:root {
  --bg: #140a24;
  --bg2: #1d1033;
  --fg: #f6efff;
  --muted: #d0c3e8;
  --panel: #21123b;
  --line: #4a3578;
  --purple: #b98cff;
  --orange: #ff8a1f;
  --orange-fg: #1a0b00;
  --green: #7dff8f;
  --stone: #8a8499;
  --warn: #ffd24a;
  --code-bg: #0d0618;
  --ctl: #8a74c2;
  --on-purple: #1a0b33;
  --orange-hover: #ffa04d;
  color-scheme: dark light;
}

/* Light theme, chosen by the visitor's system setting. Every pair is checked
   by tests/a11y.test.js (4.5:1 for text, 3:1 for control borders). */
@media (prefers-color-scheme: light) {
  :root {
    --bg: #faf7ff;
    --bg2: #f0e9fb;
    --fg: #1d1230;
    --muted: #4a3d63;
    --panel: #ffffff;
    --line: #c9bce3;
    --purple: #5a2fb0;
    --orange: #a64500;
    --orange-fg: #ffffff;
    --green: #0b6b22;
    --stone: #5c566b;
    --warn: #7a4f00;
    --code-bg: #f1ebfa;
    --ctl: #6f5f93;
    --on-purple: #ffffff;
    --orange-hover: #8f3b00;
  }
  body { background: var(--bg); }
  .button { box-shadow: 0 0 0 3px rgba(166,69,0,0.2); }
  .moon { box-shadow: 0 0 40px rgba(166,69,0,0.35); }
  .hero h1 { text-shadow: none; }
  .alive-word { text-shadow: none; }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(ellipse at 80% -10%, rgba(185,140,255,0.25), transparent 55%),
    radial-gradient(ellipse at 10% 110%, rgba(255,138,31,0.16), transparent 55%),
    var(--bg);
  color: var(--fg);
  font: 17px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: 0 16px 56px;
}
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; background: var(--panel); padding: 8px 12px; z-index: 10; }
header.top, header.hero, main, footer, .rip-line { max-width: 1000px; margin: 0 auto; }

/* examples page header */
header.top h1 { font-size: 2.4rem; letter-spacing: 0.04em; margin: 32px 0 8px; color: var(--orange); }

/* hero */
.hero { display: grid; grid-template-columns: 1.3fr 1fr; gap: 24px; align-items: center; padding: 36px 0 8px; }
.kicker { color: var(--green); font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; font-size: 0.85rem; margin: 0 0 4px; }
.hero h1 { font-size: clamp(3.2rem, 11vw, 6.4rem); line-height: 1; margin: 0 0 12px; letter-spacing: 0.02em; color: var(--orange); text-shadow: 0 0 28px rgba(255,138,31,0.45), 0 4px 0 #6a2a00; }
.tagline { font-size: clamp(1.3rem, 3.4vw, 1.9rem); font-weight: 800; line-height: 1.25; margin: 0 0 14px; color: var(--fg); }
.lead { font-size: 1.08rem; color: var(--muted); max-width: 62ch; }
.cta { margin: 20px 0 0; }
.button {
  display: inline-block; min-height: 48px; line-height: 48px; padding: 0 28px; border-radius: 8px;
  background: var(--orange); color: var(--orange-fg); font-weight: 800; font-size: 1.1rem; text-decoration: none;
  box-shadow: 0 0 0 3px rgba(255,138,31,0.25), 0 8px 24px rgba(255,138,31,0.3);
}
.button:hover { background: var(--orange-hover); }

/* tombstone scene, pure CSS */
.graveyard { position: relative; height: 340px; }
.moon { position: absolute; top: 4px; right: 18px; width: 84px; height: 84px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffc27a, var(--orange)); box-shadow: 0 0 60px rgba(255,138,31,0.55); }
.bat { position: absolute; width: 42px; fill: #0a0414; }
.b1 { top: 30px; right: 130px; animation: flap 3s ease-in-out infinite; }
.b2 { top: 78px; right: 190px; width: 30px; animation: flap 2.4s ease-in-out infinite 0.5s; }
@keyframes flap { 0%, 100% { transform: translateY(0) scaleY(1); } 50% { transform: translateY(-8px) scaleY(0.7); } }
.ground { position: absolute; left: -6%; right: -6%; bottom: 0; height: 56px; background: linear-gradient(#2a1748, #0f0720); border-radius: 50% 50% 0 0 / 100% 100% 0 0; }
.stone {
  position: absolute; left: 50%; bottom: 30px; width: 190px; height: 250px; margin-left: -95px;
  border-radius: 95px 95px 6px 6px; border: 4px solid #5d5870;
  background: linear-gradient(160deg, #c4bfd4, #9a95ae);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
  color: #1b1626; animation: stone-glow 9s ease-in-out infinite;
}
.stone .cross { position: relative; width: 34px; height: 44px; }
.stone .cross::before, .stone .cross::after { content: ""; position: absolute; background: #3b3550; border-radius: 2px; }
.stone .cross::before { left: 14px; top: 0; width: 6px; height: 44px; }
.stone .cross::after { left: 4px; top: 10px; width: 26px; height: 6px; }
.stone .rip, .stone .alive { font-weight: 900; font-size: 2rem; letter-spacing: 0.08em; }
.stone .alive { position: absolute; top: 110px; left: 0; right: 0; opacity: 0; color: #052a0c; }
.stone .rip { animation: rip-fade 9s ease-in-out infinite; }
.stone .alive { animation: alive-fade 9s ease-in-out infinite; }
.stone .epitaph { font-size: 0.85rem; font-weight: 700; margin-top: 4px; }
.stone .crack { position: absolute; top: 14%; left: 80%; width: 4px; height: 0; background: var(--green); box-shadow: 0 0 10px var(--green); transform: rotate(8deg); animation: crack-grow 9s ease-in-out infinite; }
@keyframes rip-fade { 0%, 45% { opacity: 1; } 55%, 92% { opacity: 0; } 100% { opacity: 1; } }
@keyframes alive-fade { 0%, 50% { opacity: 0; } 60%, 90% { opacity: 1; } 100% { opacity: 0; } }
@keyframes crack-grow { 0%, 40% { height: 0; opacity: 0; } 52% { height: 62%; opacity: 1; } 90% { height: 62%; opacity: 1; } 100% { height: 0; opacity: 0; } }
@keyframes stone-glow {
  0%, 45% { box-shadow: 0 0 0 rgba(125,255,143,0); filter: none; }
  58%, 90% { box-shadow: 0 0 60px 6px rgba(125,255,143,0.75), 0 0 120px rgba(185,140,255,0.5); }
  100% { box-shadow: 0 0 0 rgba(125,255,143,0); }
}
.rip-line { text-align: center; font-size: clamp(1.3rem, 4vw, 2rem); font-weight: 900; letter-spacing: 0.04em; margin-top: 4px; margin-bottom: 8px; }
.dead-word { color: var(--stone); text-decoration: line-through; text-decoration-color: var(--purple); }
.arrow { color: var(--orange); margin: 0 0.3em; }
.alive-word { color: var(--green); text-shadow: 0 0 18px rgba(125,255,143,0.5); }

h2 { font-size: 1.45rem; margin: 0 0 12px; color: var(--purple); }
h3 { color: var(--fg); }
section { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 22px; margin: 22px 0; }
.privacy { border-left: 8px solid var(--green); }
.privacy strong { color: var(--green); }
.coffin { border-top: 8px solid var(--orange); }
.how { border-top: 8px solid var(--purple); }
.yard { border-top: 8px solid var(--stone); }
.key { border-top: 8px solid var(--green); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 12px 0; }
label { font-weight: 700; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
textarea, select {
  width: 100%;
  background: var(--code-bg);
  color: var(--fg);
  border: 2px solid var(--ctl);
  border-radius: 8px;
  padding: 10px;
  font: 14px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
select { width: auto; font-family: inherit; min-height: 44px; }
button {
  min-height: 44px;
  padding: 0 22px;
  border-radius: 8px;
  border: 2px solid var(--orange);
  background: var(--orange);
  color: var(--orange-fg);
  font: 800 1.05rem system-ui, sans-serif;
  cursor: pointer;
}
button:hover { filter: brightness(1.1); }
button.ghost { background: transparent; color: var(--fg); border-color: var(--ctl); font-weight: 600; }
button.chip { background: transparent; color: var(--purple); border-color: var(--purple); font-weight: 700; border-radius: 999px; }
button.chip:hover { background: rgba(185,140,255,0.16); }
button:focus-visible, a:focus-visible, textarea:focus-visible, select:focus-visible, #result:focus-visible { outline: 3px solid var(--warn); outline-offset: 2px; }
a { color: var(--orange); }
.small, .try { color: var(--muted); font-size: 0.92rem; }
.summary { font-weight: 700; font-size: 1.1rem; }
pre {
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  overflow-x: auto;
  font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre;
  margin: 8px 0;
}
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92em; }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; display: block; overflow-x: auto; }
th, td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
th { background: var(--code-bg); }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 0; }
.tabs button { min-height: 44px; }
.tabs button[aria-selected="true"] { background: var(--orange); color: var(--orange-fg); border-color: var(--orange); }
.tabs button[aria-selected="false"] { background: transparent; color: var(--fg); border-color: var(--ctl); }

/* how it works */
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.steps li { display: flex; gap: 14px; align-items: flex-start; }
.steps h3 { margin: 0 0 2px; }
.steps p { margin: 0; color: var(--muted); }
.n { flex: none; width: 44px; height: 44px; border-radius: 50%; background: var(--purple); color: var(--on-purple); font-weight: 900; font-size: 1.3rem; display: flex; align-items: center; justify-content: center; }

/* graveyard list */
.yard-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.yard-list li { background: var(--code-bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }
.yard-list .nm { font-weight: 800; display: block; }
.badge { display: inline-block; font-weight: 800; font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; padding: 1px 8px; border-radius: 3px; border: 2px solid var(--stone); color: var(--muted); margin-right: 6px; }
.badge.scheduled { border-color: var(--warn); color: var(--warn); }
.badge.moved { border-color: var(--purple); color: var(--purple); }

/* tombstone result cards */
.card { position: relative; overflow: hidden; border: 2px solid var(--line); border-radius: 14px 14px 6px 6px; padding: 16px 16px 16px 20px; margin: 14px 0; background: var(--code-bg); }
.card h3 { margin: 0 0 4px; font-size: 1.15rem; }
.card .stamp { display: inline-block; font-weight: 900; letter-spacing: 0.1em; text-transform: uppercase; font-size: 0.85rem; padding: 2px 10px; border: 2px solid var(--stone); color: var(--muted); border-radius: 3px; margin-bottom: 6px; }
.card.alive { border-color: var(--green); }
.card.alive .stamp { border-color: var(--green); color: var(--green); }
.card.buried .stamp { border-color: var(--warn); color: var(--warn); }
.card .beam { position: absolute; left: 0; right: 0; bottom: -100%; height: 100%; background: linear-gradient(to top, rgba(125,255,143,0.4), transparent); opacity: 0; pointer-events: none; }
.card.rise .beam { animation: rise 1.8s ease-out 1; }
@keyframes rise { 0% { bottom: -100%; opacity: 0.9; } 100% { bottom: 100%; opacity: 0; } }

/* graveyard page list */
.g-list { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.g-card { background: var(--code-bg); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; }
.g-card .nm { font-weight: 800; display: block; margin-bottom: 4px; }
.g-card .g-summary { font-size: 0.92rem; color: var(--muted); margin: 6px 0 8px; }
.g-card .g-flag { font-size: 0.88rem; color: var(--warn); margin: 8px 0 0; }

footer { color: var(--muted); font-size: 0.92rem; border-top: 1px solid var(--line); margin-top: 32px; padding-top: 16px; }
.disclaimer { font-weight: 700; }
.copy { margin: 0 0 8px; min-height: 44px; }
.notes li { margin: 4px 0; }

@media (max-width: 760px) {
  /* the decorative ground strip is wider than its box; without this the whole page scrolls sideways at 360 px */
  .hero { grid-template-columns: 1fr; overflow-x: clip; }
  .graveyard { height: 300px; }
}
@media (max-width: 480px) {
  body { font-size: 16px; }
  section { padding: 14px; }
  .button { display: block; text-align: center; }
}

@media (max-width: 360px) {
  body { padding: 0 10px 40px; }
  .yard-list { grid-template-columns: 1fr; }
  .g-list { grid-template-columns: 1fr; }
  pre { font-size: 12px; }
  table { font-size: 0.82rem; }
}

/* reduced motion: no animation at all; the stone shows the resurrected state */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .stone, .stone .rip, .stone .alive, .stone .crack, .bat, .card.rise .beam { animation: none !important; }
  .stone { box-shadow: 0 0 40px 4px rgba(125,255,143,0.6); }
  .stone .rip { opacity: 0; }
  .stone .alive { opacity: 1; }
  .stone .crack { height: 62%; opacity: 1; }
  * { transition: none !important; }
}

/* Dead-API pages (/dead/<id>/). Colours come from the variables above only. */
.dead-notice { background: var(--code-bg); border: 1px solid var(--line); border-left: 6px solid var(--warn); border-radius: 8px; padding: 4px 16px 8px; margin: 16px 0; }
.dead-unverified { border-left-color: var(--orange); }
.dead-flag, .dead-warning { color: var(--warn); }
.dead-label { font-weight: 700; margin: 14px 0 4px; }
.dead-facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; }
.dead-facts dt { font-weight: 700; }
.dead-facts dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 480px) { .dead-facts { grid-template-columns: 1fr; } .dead-facts dd { margin-bottom: 6px; } }
main details { border: 1px solid var(--line); border-radius: 8px; padding: 6px 14px; margin: 12px 0; }
main summary { cursor: pointer; font-weight: 700; padding: 8px 0; overflow-wrap: anywhere; }
.dead-fields { margin: 10px 0 16px; }
.dead-output { margin: 12px 0; }
.dead-output pre { max-height: 24rem; overflow: auto; }
.g-card .g-more { margin: 8px 0 0; font-size: 0.92rem; }
main :not(pre) > code { overflow-wrap: anywhere; }
header.top h1 { overflow-wrap: anywhere; }
.nf-list { columns: 2 260px; padding-left: 1.2em; }
.signup { font-weight: 700; }
/* Video mode: hidden until the names are replaced (public/video-gate.js, public/video-mode.js). */
html.video-pending body { visibility: hidden; }
