:root {
  --hud: #151412e8;
  --hud-line: #ffffff24;
  --stage-glow: #e9b44c;
  --agency: #9fb3c8;
  --debt: #ff3d8a;
  --bar-h: 56px;
  --z-bar: 45;
  --motion-fast: 160ms;
  --motion-scene: 420ms cubic-bezier(.32,.72,0,1);
}

.nb { white-space: nowrap; }
html { scroll-behavior: smooth; }
main section[id] { scroll-margin-top: var(--bar-h); }

/* header lives only at the page top; the chapter bar is the persistent chrome */
.hdr { position: absolute; }

/* ---------- hero: copy left / stage right, headline first on mobile ---------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  padding: 84px 0 40px;
}

.hero .title { padding-top: 0; }
.hero__head { padding-bottom: 8px; }
.hero__head h1 {
  font-size: clamp(46px, 9.6vw, 104px);
  line-height: .98;
  letter-spacing: -.025em;
  text-wrap: balance;
}

.hero .stage {
  height: min(46vh, 420px);
  margin: 12px 0 20px;
}

.hero__body .lead { max-width: 34em; }

@media (min-width: 64rem) {
  .hero {
    grid-template-columns: minmax(0, 7fr) minmax(0, 6fr);
    grid-template-rows: auto 1fr;
    align-items: start;
    column-gap: 24px;
    max-width: 1240px;
    margin: 0 auto;
    padding: 96px clamp(24px, 3vw, 48px) 48px;
    min-height: 100dvh;
  }

  .hero .col { max-width: none; margin: 0; padding: 0; }
  .hero__head { grid-column: 1; grid-row: 1; }
  .hero__body { grid-column: 1; grid-row: 2; }
  .hero .stage {
    grid-column: 2;
    grid-row: 1 / 3;
    position: sticky;
    top: 0;
    height: min(88vh, 800px);
    margin: 0;
  }
}

/* ---------- chapter bar (in-flow, sticky, <= 56px) ---------- */
.reader-bar {
  position: sticky;
  top: 0;
  z-index: var(--z-bar);
  color: var(--cream);
  background: var(--hud);
  border-top: 1px solid var(--hud-line);
  border-bottom: 1px solid var(--hud-line);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.reader-bar__in {
  display: flex;
  align-items: center;
  gap: 8px;
  height: calc(var(--bar-h) - 2px);
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 16px;
}

.reader-bar a,
.reader-bar button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--silver);
  text-decoration: none;
  font: 600 12px var(--sans);
  letter-spacing: .02em;
  cursor: pointer;
  transition: color var(--motion-fast) ease, border-color var(--motion-fast) ease, background var(--motion-fast) ease;
}

.reader-bar__now {
  flex: 1 1 auto;
  min-width: 0;
  gap: 8px;
  color: var(--spot);
  font: 500 12px var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.reader-bar__chapters { display: none; gap: 4px; }
.reader-bar__chapters a { padding: 0 12px; border-bottom: 2px solid transparent; }
.reader-bar__chapters a:hover { color: var(--cream); }
.reader-bar__chapters a[aria-current="true"] { color: var(--spot); border-bottom-color: var(--spot); }

.reader-bar button {
  padding: 0 14px;
  border: 1px solid var(--hud-line);
  border-radius: 999px;
  background: #ffffff08;
}

.reader-bar button:hover,
.reader-bar button[aria-pressed="true"] {
  color: var(--stage-glow);
  border-color: var(--stage-glow);
  background: #e9b44c1a;
}

.reader-bar a:focus-visible,
.reader-bar button:focus-visible,
.argument-node:focus-visible {
  outline: 2px solid var(--spot);
  outline-offset: 3px;
}

.reader-bar__pct {
  min-width: 4ch;
  color: var(--silver);
  font: 500 12px var(--mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.reader-bar__rail { height: 2px; overflow: hidden; background: var(--hud-line); }
.reader-bar__rail i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--spot), var(--debt));
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform var(--motion-fast) linear;
}

@media (min-width: 40rem) {
  .reader-bar__chapters { display: flex; }
  .reader-bar__in { gap: 16px; padding: 0 24px; }
}

/* ---------- argument map: three chapter doors on a lit floor ---------- */
#argument-map {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 32px 0 16px;
  padding: clamp(20px, 4vw, 40px) clamp(20px, 4vw, 40px) clamp(28px, 5vw, 56px);
  overflow: hidden;
  border: 1px solid var(--hud-line);
  border-radius: 24px;
  background:
    radial-gradient(ellipse at 50% 100%, #e9b44c2e, transparent 60%),
    linear-gradient(180deg, var(--stage-2), var(--stage));
  perspective: 1000px;
}

#argument-map::before {
  position: absolute;
  inset: auto 6% 22%;
  height: 1px;
  content: "";
  background: linear-gradient(90deg, transparent, var(--spot) 30%, var(--debt) 70%, transparent);
  opacity: .55;
}

.argument-map__key {
  grid-column: 1 / -1;
  margin: 0 0 8px;
  color: var(--silver);
  font: 600 11px var(--mono);
  letter-spacing: .16em;
  text-transform: uppercase;
}

.argument-node {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 176px;
  padding: 20px;
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--hud-line);
  border-radius: 16px;
  background: linear-gradient(160deg, #ffffff0a, transparent 40%), var(--stage-2);
  box-shadow: 0 32px 48px -28px #000d, inset 0 1px #ffffff14;
  transform-style: preserve-3d;
  transition: transform var(--motion-scene), border-color var(--motion-fast) ease, box-shadow var(--motion-scene);
}

.argument-node:nth-of-type(1) { transform: translateZ(16px) rotateY(6deg); }
.argument-node:nth-of-type(2) { transform: translateY(28px) translateZ(56px); }
.argument-node:nth-of-type(3) { transform: translateY(8px) translateZ(24px) rotateY(-6deg); }

.argument-node small {
  margin-bottom: 12px;
  color: var(--silver);
  font: 500 11px var(--mono);
  letter-spacing: .06em;
}

.argument-node strong {
  color: var(--cream);
  font: 600 clamp(30px, 4vw, 48px) var(--serif);
  line-height: 1;
  letter-spacing: -.02em;
}

.argument-node span {
  margin: 12px 0 20px;
  font-size: 13px;
  line-height: 1.55;
}

.argument-node em {
  margin-top: auto;
  color: var(--spot);
  font: 600 11px var(--mono);
  font-style: normal;
  letter-spacing: .1em;
}

.argument-node em::after { content: " \2192"; }

.argument-node:hover { border-color: var(--spot-2); box-shadow: 0 40px 56px -28px #000e, inset 0 1px #ffffff20; }
.argument-node:nth-of-type(1):hover { transform: translateY(-6px) translateZ(16px) rotateY(6deg); }
.argument-node:nth-of-type(2):hover { transform: translateY(22px) translateZ(56px); }
.argument-node:nth-of-type(3):hover { transform: translateY(2px) translateZ(24px) rotateY(-6deg); }

.argument-node[aria-current="true"],
.argument-node[data-active="true"] {
  border-color: var(--stage-glow);
  background: linear-gradient(160deg, #e9b44c24, transparent 60%), var(--stage-2);
}

.argument-node[aria-current="true"] small,
.argument-node[data-active="true"] small { color: var(--spot); }

/* ---------- quiet mode: same dark identity, stages off, nothing hidden ---------- */
.reader-mode #gl { opacity: 0; }
.reader-mode .hero .stage { display: none; }
.reader-mode .hero { min-height: 0; }
.reader-mode .fig { border-color: var(--ring-d); }
.reader-mode .argument-node,
.reader-mode .argument-node:nth-of-type(n) { transform: none; }

@media (max-width: 640px) {
  .reader-bar__in { height: 52px; padding: 0 12px; }
  .reader-bar__chapters { display: none; }
  .reader-bar__now { font-size: 11px; }
  .reader-bar button { min-height: 38px; padding: 0 10px; }
  .reader-bar__pct { min-width: 3ch; }
  #argument-map { grid-template-columns: 1fr; gap: 12px; padding: 20px 20px 28px; border-radius: 18px; perspective: none; }
  #argument-map::before { inset: 20% auto 20% 8px; width: 1px; height: auto; background: linear-gradient(180deg, transparent, var(--spot) 30%, var(--debt) 70%, transparent); }
  .argument-node { min-height: 0; padding: 16px 18px 18px 22px; }
  .argument-node:nth-of-type(n) { transform: none; }
  .argument-node:nth-of-type(2) { margin-left: 12%; }
  .argument-node:nth-of-type(3) { margin-left: 6%; }
  .argument-node strong { font-size: 28px; }
  .argument-node span { margin-bottom: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reader-bar a, .reader-bar button, .reader-bar__rail i, .argument-node { transition: none; }
  .argument-node:nth-of-type(n):hover { transform: none; }
  .argument-node:nth-of-type(n) { transform: none; }
  .hero .stage,
  .fig {
    background:
      radial-gradient(ellipse at 50% 18%, #e9b44c38, transparent 42%),
      linear-gradient(180deg, #1a1917, #0f0f0e);
  }
}
