:root {
  --bg: #05070d;
  --ink: #e9ecf1;
  --muted: #98a2b3;
  --accent: #ffd166;
  --red: #e63946;
  --blue: #4cc9f0;
  --panel: rgba(8, 12, 22, 0.78);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.6 Georgia, 'Iowan Old Style', 'Palatino Linotype', serif;
}
h1, h2, h3, nav, .kicker, .legend { font-family: system-ui, -apple-system, 'Segoe UI', sans-serif; }
a { color: var(--accent); }

/* fixed 3D stage behind everything */
#stage { position: fixed; inset: 0; z-index: 0; }
#stage canvas { width: 100% !important; height: 100% !important; display: block; }

/* scrolling story column */
main { position: relative; z-index: 1; pointer-events: none; }
main > * { pointer-events: auto; }
header.hero {
  min-height: 100vh; display: flex; flex-direction: column; justify-content: flex-end;
  padding: 8vh 6vw; max-width: 900px;
  background: linear-gradient(180deg, transparent 30%, rgba(5, 7, 13, 0.85) 90%);
}
.kicker { text-transform: uppercase; letter-spacing: 0.25em; font-size: 0.75rem; color: var(--accent); }
h1 { font-size: clamp(2.4rem, 6vw, 5rem); line-height: 1; margin: 0.3em 0; text-wrap: balance; }
.hero p { font-size: 1.2rem; color: var(--muted); max-width: 60ch; }

.step {
  max-width: 460px; margin: 60vh 6vw 60vh auto; padding: 1.4rem 1.6rem;
  background: var(--panel); backdrop-filter: blur(8px); border-left: 3px solid transparent;
  border-radius: 6px; opacity: 0.45; transition: opacity 0.4s, border-color 0.4s;
}
.step.active { opacity: 1; border-left-color: var(--accent); }
.step h2 { margin: 0 0 0.5rem; font-size: 1.25rem; }
.step p { margin: 0.5rem 0; }
.step blockquote { margin: 0.8rem 0; padding-left: 0.9rem; border-left: 2px solid var(--muted); color: var(--muted); font-style: italic; }
.step .legend { font-size: 0.8rem; color: var(--muted); margin-top: 0.8rem; }
.dot { display: inline-block; width: 0.7em; height: 0.7em; border-radius: 50%; margin-right: 0.3em; vertical-align: -0.05em; }

footer.chapter-nav {
  display: flex; justify-content: space-between; gap: 1rem; padding: 3rem 6vw 5rem;
  background: linear-gradient(0deg, var(--bg) 60%, transparent);
  font-family: system-ui, sans-serif;
}
nav.top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 2; display: flex; gap: 1.5rem;
  padding: 0.8rem 6vw; font-size: 0.85rem; background: linear-gradient(180deg, rgba(5,7,13,.8), transparent);
}
nav.top a { text-decoration: none; color: var(--muted); }
nav.top a:hover { color: var(--accent); }

/* index page */
.grid { background: linear-gradient(180deg, transparent, var(--bg) 25%); display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; padding: 2rem 6vw 6rem; }
.card {
  display: block; padding: 1.2rem 1.4rem; background: var(--panel); border-radius: 8px;
  text-decoration: none; color: var(--ink); border: 1px solid rgba(255,255,255,.06); transition: transform .2s, border-color .2s;
}
.card:hover { transform: translateY(-3px); border-color: var(--accent); }
.card .num { font-family: system-ui, sans-serif; color: var(--accent); font-size: 0.8rem; letter-spacing: .15em; }
.card h3 { margin: 0.3rem 0 0.4rem; font-size: 1.15rem; }
.card p { margin: 0; color: var(--muted); font-size: 0.95rem; }

@media (max-width: 720px) {
  .step { max-width: none; margin: 50vh 4vw; }
  header.hero { padding: 6vh 5vw; }
}

/* button-driven story (body.stepped is set by steps() in pitch.js) */
body.stepped { overflow: hidden; height: 100vh; }
body.stepped header.hero { position: fixed; inset: 0; min-height: 0; justify-content: flex-end; padding-bottom: 14vh; }
body.stepped header.hero[hidden] { display: none; }
body.stepped .step { display: none; position: fixed; right: 6vw; top: 50%; transform: translateY(-50%); margin: 0; max-height: 72vh; overflow-y: auto; opacity: 1; }
body.stepped .step.active { display: block; animation: stepin 0.45s ease; }
@keyframes stepin { from { opacity: 0; transform: translateY(-50%) translateX(24px); } to { opacity: 1; transform: translateY(-50%); } }
body.stepped footer.chapter-nav { display: none; }
.stepbar {
  position: fixed; left: 50%; bottom: 2rem; transform: translateX(-50%); z-index: 3;
  display: flex; align-items: center; gap: 0.8rem; padding: 0.5rem 0.6rem;
  background: var(--panel); backdrop-filter: blur(8px); border: 1px solid rgba(255,255,255,.08); border-radius: 999px;
  font: 600 0.9rem system-ui, -apple-system, 'Segoe UI', sans-serif;
}
.stepbar button, .stepbar a {
  appearance: none; border: 0; cursor: pointer; padding: 0.55rem 1.1rem; border-radius: 999px; text-decoration: none;
  background: rgba(255,255,255,.08); color: var(--ink); font: inherit; transition: background .2s;
}
.stepbar a.next { background: var(--accent); color: #111; }
.stepbar button:hover, .stepbar a:hover { background: rgba(255,255,255,.18); }
.stepbar a.next:hover { background: #ffe08a; }
.stepbar button:disabled { opacity: 0.35; cursor: default; }
.stepbar .count { color: var(--muted); min-width: 3.5em; text-align: center; font-variant-numeric: tabular-nums; }
.stepbar .count:empty { display: none; }
@media (max-width: 720px) {
  body.stepped .step { left: 4vw; right: 4vw; top: auto; bottom: 6rem; transform: none; max-height: 48vh; max-width: none; }
  @keyframes stepin { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
  body.stepped header.hero { padding-bottom: 7rem; }
}

.disclaimer { padding: 1rem 6vw 4rem; background: var(--bg); max-width: none; color: var(--muted); font-size: 0.85rem; line-height: 1.6; font-family: system-ui, -apple-system, 'Segoe UI', sans-serif; }
.disclaimer em { color: var(--ink); }
.disclaimer p { max-width: 90ch; margin: 0; }
