/* ──────────────────────────────────────────────────────────────
   DRAWN APART — shared HUD chrome (v2)
   ────────────────────────────────────────────────────────────── */

:root {
  --bg: #0b0a09;
  --fg: #ece5d6;
  --muted: #8a7f6b;
  --dim: #4a4437;
  --rule: #2a261f;

  /* sodium amber — city lights from above */
  --accent: #f5a85e;
  --accent-hot: #ffc78a;
  --accent-soft: rgba(245, 168, 94, 0.45);
  --accent-faint: rgba(245, 168, 94, 0.12);

  /* cool counterfoil for basemap terrain */
  --terrain-warm: rgba(120, 90, 55, 0.22);
  --terrain-cool: rgba(70, 80, 95, 0.15);
  --terrain-ink:  rgba(245, 225, 180, 0.06);

  --font-display: "Instrument Serif", Georgia, serif;
  --font-mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --font-body: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.5;
  cursor: none;
}

/* persistent lab logo — top-right anchor */
.lab-mark-top {
  display: block;
  opacity: 0.75;
  transition: opacity 0.25s ease;
  text-decoration: none;
  pointer-events: auto;
  line-height: 0;
}
.lab-mark-top:hover { opacity: 1; }
.lab-mark-top img {
  display: block;
  height: 28px;
  width: auto;
}

/* grain — warm */
.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 9990;
  opacity: 0.07; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 0.9  0 0 0 0 0.75  0 0 0 0.6 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* corner brackets */
.corner { position: fixed; width: 28px; height: 28px; z-index: 9995; pointer-events: none; }
.corner::before, .corner::after { content: ""; position: absolute; background: var(--accent); opacity: 0.75; }
.corner.tl { top: 18px; left: 18px; }
.corner.tl::before { top: 0; left: 0; width: 18px; height: 1px; }
.corner.tl::after  { top: 0; left: 0; width: 1px; height: 18px; }
.corner.tr { top: 18px; right: 18px; }
.corner.tr::before { top: 0; right: 0; width: 18px; height: 1px; }
.corner.tr::after  { top: 0; right: 0; width: 1px; height: 18px; }
.corner.bl { bottom: 18px; left: 18px; }
.corner.bl::before { bottom: 0; left: 0; width: 18px; height: 1px; }
.corner.bl::after  { bottom: 0; left: 0; width: 1px; height: 18px; }
.corner.br { bottom: 18px; right: 18px; }
.corner.br::before { bottom: 0; right: 0; width: 18px; height: 1px; }
.corner.br::after  { bottom: 0; right: 0; width: 1px; height: 18px; }

/* ──────────────────────────────────────────────────────────────
   Cursor — surveyor's reticle
   ────────────────────────────────────────────────────────────── */

#cursor {
  position: fixed; top: 0; left: 0; width: 26px; height: 26px;
  pointer-events: none; z-index: 9999;
  transform: translate(-50%, -50%);
  mix-blend-mode: normal;
}
#cursor::before, #cursor::after { content: ""; position: absolute; background: var(--accent); opacity: 0.9; }
/* vertical line with center gap */
#cursor::before { top: 0; left: 50%; width: 1px; height: 10px; transform: translateX(-50%); }
#cursor .vbot { position: absolute; bottom: 0; left: 50%; width: 1px; height: 10px; background: var(--accent); transform: translateX(-50%); opacity: 0.9; }
/* horizontal line with center gap */
#cursor::after { top: 50%; left: 0; width: 10px; height: 1px; transform: translateY(-50%); }
#cursor .hright { position: absolute; top: 50%; right: 0; width: 10px; height: 1px; background: var(--accent); transform: translateY(-50%); opacity: 0.9; }
/* center micro square */
#cursor .dot {
  position: absolute; top: 50%; left: 50%; width: 3px; height: 3px;
  background: var(--accent); transform: translate(-50%, -50%);
}

#cursor.hot::before, #cursor.hot::after,
#cursor.hot .vbot, #cursor.hot .hright { background: var(--accent-hot); opacity: 1; }
#cursor.hot .dot { background: var(--accent-hot); box-shadow: 0 0 6px var(--accent-soft); }

/* coordinate readout trailing the cursor — hidden by default, shown only on hot */
#cursor-readout {
  position: fixed; top: 0; left: 0;
  pointer-events: none; z-index: 9998;
  transform: translate(18px, 14px);
  font-family: var(--font-mono); font-size: 9px;
  color: var(--muted); letter-spacing: 0.22em; text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s ease, color 0.2s ease;
}
#cursor-readout.hot { opacity: 1; }
#cursor-readout .tag { color: var(--dim); margin-right: 6px; }
#cursor-readout.hot { color: var(--accent-hot); }
#cursor-readout.hot .tag { color: var(--accent); }

/* top HUD bar */
.hud-top {
  position: fixed; top: 18px; left: 56px; right: 56px;
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--font-mono); font-size: 11px;
  color: var(--muted);
  z-index: 100; pointer-events: none;
}
.hud-top .brand {
  color: var(--accent);
  letter-spacing: 0.36em;
  text-transform: uppercase;
  font-weight: 500;
  font-size: 10px;
  /* reset <button> defaults so the element looks like text chrome */
  background: none;
  border: 0;
  padding: 0;
  font-family: inherit;
  cursor: none;  /* custom reticle cursor handles the affordance */
  transition: color 0.2s ease;
  /* .hud-top has pointer-events: none so wheel scrolls pass through —
     but this button needs to receive clicks. Opt back in just here. */
  pointer-events: auto;
}
.hud-top .brand:hover       { color: var(--accent-hot); }
.hud-top .brand:hover .thin { color: var(--accent); }
.hud-top .brand .thin { color: var(--dim); font-weight: 300; transition: color 0.2s ease; }
.hud-top .meta {
  display: flex; align-items: baseline; gap: 14px;
  letter-spacing: 0.04em;
  font-size: 11px;
}
.hud-top .meta .signal-label { color: var(--fg); }
.hud-top .meta .scene-counter {
  color: var(--dim);
  letter-spacing: 0.18em;
  font-size: 10px;
}
.hud-top .meta .meta-sep { color: var(--dim); }

/* bottom HUD bar */
.hud-bottom {
  position: fixed; bottom: 18px; left: 56px; right: 56px;
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted);
  z-index: 100;
}
.hud-bottom .hint { color: var(--dim); }
.hud-bottom .hint kbd {
  font-family: var(--font-mono); font-size: 9px; color: var(--accent);
  border: 1px solid var(--accent-soft); padding: 2px 5px; border-radius: 2px;
  margin: 0 2px;
}

/* NEXT / BACK buttons — shown only on narrow (touch / mobile) viewports.
   Desktop keeps the original keyboard-hint text via .hint.
   Matches the HUD aesthetic used by .strip-toggle-btn / .scene-info:
   transparent background, thin rule-colored border. */
.nav-arrows {
  display: none;   /* hidden by default (desktop); enabled in @media below */
  align-items: center; gap: 10px;
  pointer-events: auto;
}
.nav-btn {
  /* strip all native browser button chrome */
  appearance: none;
  -webkit-appearance: none;
  /* HUD-matched look */
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--rule);
  padding: 6px 12px;
  cursor: none;   /* custom reticle cursor handles hover feedback */
  transition: color 0.2s ease, border-color 0.2s ease;
}
.nav-btn:hover {
  color: var(--accent);
  border-color: var(--accent-soft);
}
.nav-btn .nav-arrow {
  font-size: 12px;
  line-height: 1;
  color: var(--accent);
  transition: transform 0.2s ease, color 0.2s ease;
}
.nav-btn:hover .nav-arrow { color: var(--accent-hot); }
.nav-btn.nav-next:hover .nav-arrow { transform: translateX(2px); }
.nav-btn.nav-back:hover .nav-arrow { transform: translateX(-2px); }

.dots { display: flex; gap: 10px; align-items: center; }
.dot { width: 5px; height: 5px; border-radius: 50%; background: var(--dim);
       transition: background 0.2s ease, transform 0.2s ease; }
.dot.active { background: var(--accent); transform: scale(1.3); }
.dot-label {
  font-family: var(--font-mono); font-size: 10.5px;
  color: var(--fg); margin-left: 14px; letter-spacing: 0.04em;
}
.dot-sep {
  color: var(--dim);
  margin: 0 10px;
  font-family: var(--font-mono);
  font-size: 10px;
}
.hud-bottom .scene-counter {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
}

/* stage — the persistent full-viewport container; scenes swap inside it */
.stage {
  position: relative; width: 100vw; height: 100vh; overflow: hidden;
}

/* scene — a single named section, absolutely positioned, fades in/out */
.scene {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 64px 56px;
  opacity: 0; transform: scale(1.02);
  pointer-events: none;
  transition:
    opacity 0.55s cubic-bezier(.2,.7,.25,1),
    transform 0.55s cubic-bezier(.2,.7,.25,1);
}
/* scenes with a story panel push their central content right of it */
.scene:has(> .story-text) {
  padding-left: 340px;
  padding-right: 24px;
}
.scene.active {
  opacity: 1; transform: scale(1);
  pointer-events: auto;
}

/* ──────────────────────────────────────────────────────────────
   Scene 3 — Four GCD fingerprints (2×2 cards)
   ────────────────────────────────────────────────────────────── */

.scene-title {
  font-family: var(--font-display);
  font-size: 30px;
  color: var(--fg);
  text-align: center;
  margin: 8px 0 6px;
  font-weight: 400;
  line-height: 1.1;
}

.scene-intro {
  font-family: var(--font-body);
  font-size: 14.5px;
  color: var(--muted);
  text-align: center;
  max-width: 620px;
  margin: 0 auto 14px;
  line-height: 1.6;
}
.scene-intro em { color: var(--accent); font-style: normal; }

/* short subtitle + info icon toggle */
.scene-intro-short {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--muted);
  text-align: center;
  max-width: 620px;
  margin: 0 auto 10px;
  line-height: 1.5;
}
.scene-info {
  background: none;
  border: 1px solid var(--rule);
  color: var(--muted);
  width: 20px; height: 20px;
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1;
  margin-left: 10px;
  vertical-align: middle;
  cursor: none;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.scene-info:hover,
.scene-info[aria-expanded="true"] {
  color: var(--accent-hot);
  border-color: var(--accent-hot);
}
.scene-info-panel {
  position: absolute;
  top: auto;
  left: 50%;
  transform: translateX(-50%);
  width: min(560px, 82vw);
  margin-top: 6px;
  padding: 16px 18px;
  background: rgba(8, 6, 3, 0.96);
  border: 1px solid var(--accent-soft);
  box-shadow: 0 0 24px rgba(0, 0, 0, 0.6);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.65;
  color: var(--muted);
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.scene-info-panel[data-open="true"] {
  opacity: 1;
  pointer-events: auto;
}
.scene-info-panel p { margin: 0 0 10px; }
.scene-info-panel p:last-child { margin-bottom: 0; }
.scene-info-panel b { color: var(--fg); font-weight: 500; }

.fingerprints {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  width: min(86vw, 940px);
  margin: 0 auto;
}

.fp-card {
  display: flex; flex-direction: column;
  padding: 14px 18px 16px;
  border: 1px solid var(--rule);
  background: rgba(18, 14, 10, 0.4);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.55s cubic-bezier(.2,.7,.25,1),
              transform 0.55s cubic-bezier(.2,.7,.25,1);
}
.scene.active .fp-card                  { opacity: 1; transform: translateY(0); }
.scene.active .fp-card:nth-child(1)     { transition-delay: 0.25s; }
.scene.active .fp-card:nth-child(2)     { transition-delay: 0.38s; }
.scene.active .fp-card:nth-child(3)     { transition-delay: 0.51s; }
.scene.active .fp-card:nth-child(4)     { transition-delay: 0.64s; }

.fp-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--accent);
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 4px;
}
.fp-label .num { color: var(--dim); margin-right: 10px; }

.fp-name {
  font-family: var(--font-display);
  font-size: 19px;
  color: var(--fg);
  margin: 2px 0 8px;
  line-height: 1.2;
}

.fp-diagram {
  display: flex; align-items: center; justify-content: center;
  height: 72px;
  margin: 4px 0 10px;
}
.fp-diagram svg { width: 100%; height: 100%; display: block; }

.fp-values {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: 0.14em;
  color: var(--muted);
}
.fp-value { display: flex; align-items: baseline; gap: 6px; }
.fp-value b { color: var(--accent); font-weight: 500; letter-spacing: 0.22em; }
.fp-value.right b { color: var(--accent-hot); }
.fp-value .num { color: var(--fg); font-size: 13px; letter-spacing: 0; }
/* HIGH / LOW labels replace raw numbers on the fingerprint cards —
   more readable than "35% / 79%" for a general audience. */
.fp-value .num.lo { color: var(--muted);      font-size: 11px; letter-spacing: 0.22em; }
.fp-value .num.hi { color: var(--accent-hot); font-size: 11px; letter-spacing: 0.22em; }
.fp-bar {
  flex: 1; height: 1px;
  background: linear-gradient(90deg, var(--accent-soft), var(--accent-hot));
}

.fp-desc {
  font-family: var(--font-body);
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.55;
  margin-top: 10px;
}

/* ──────────────────────────────────────────────────────────────
   Scene 4 — The wave (temporal GCD adoption)
   ────────────────────────────────────────────────────────────── */

.wave-wrap {
  position: relative;
  width: min(86vw, 880px);
  margin: 10px auto 0;
}
.wave-chart {
  width: 100%;
  height: 320px;
  display: block;
}
.wave-chart .axis-line { stroke: var(--rule); stroke-width: 1; }
.wave-chart .axis-text {
  fill: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
}
.wave-chart .grid-line { stroke: var(--rule); stroke-width: 0.6; stroke-dasharray: 2 4; opacity: 0.5; }

.wave-chart .wave-area {
  fill: var(--accent); opacity: 0;
  transition: opacity 0.8s ease 2.0s;
}
.scene.active .wave-chart .wave-area { opacity: 0.08; }

.wave-chart .wave-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1500;
  stroke-dashoffset: 1500;
  transition: stroke-dashoffset 2.2s cubic-bezier(.25,.65,.3,1) 0.4s;
}
.scene.active .wave-chart .wave-line { stroke-dashoffset: 0; }

.wave-chart .wave-dot {
  fill: var(--accent-hot); stroke: var(--bg); stroke-width: 1;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.scene.active .wave-chart .wave-dot.trough { opacity: 1; transition-delay: 1.4s; }
.scene.active .wave-chart .wave-dot.peak   { opacity: 1; transition-delay: 2.2s; }
.scene.active .wave-chart .wave-dot.recent { opacity: 1; transition-delay: 2.8s; }

.wave-chart .wave-dot.peak {
  filter: drop-shadow(0 0 6px var(--accent-soft));
}

.wave-anno { opacity: 0; transition: opacity 0.6s ease; }
.scene.active .wave-anno.trough { opacity: 1; transition-delay: 1.5s; }
.scene.active .wave-anno.peak   { opacity: 1; transition-delay: 2.3s; }
.scene.active .wave-anno.recent { opacity: 1; transition-delay: 2.9s; }

.wave-anno .tick-line { stroke: var(--accent-soft); stroke-width: 0.6; stroke-dasharray: 1.5 2; }
.wave-anno .anno-year {
  fill: var(--accent-hot);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  font-weight: 500;
}
.wave-anno .anno-tag {
  fill: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

/* Hover guide inside the wave chart */
.wave-chart .wave-hover-rule {
  stroke: var(--accent-soft);
  stroke-width: 0.7;
  stroke-dasharray: 2 3;
  opacity: 0.65;
}
.wave-chart .wave-hover-dot {
  fill: var(--accent-hot);
  stroke: var(--bg);
  stroke-width: 1.2;
}
#wave-capture { cursor: crosshair; }

/* Floating tooltip keyed to the hover dot */
.wave-tooltip {
  position: absolute;
  left: 0; top: 0;
  pointer-events: none;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  background: rgba(11, 10, 9, 0.92);
  border: 1px solid var(--accent-soft);
  padding: 5px 9px;
  white-space: nowrap;
  transform: translate(-50%, calc(-100% - 10px));
  z-index: 3;
  display: none;
  gap: 10px;
  align-items: baseline;
}
.wave-tooltip.visible { display: inline-flex; }
.wave-tooltip .wt-year { color: var(--fg); font-weight: 500; }
.wave-tooltip .wt-val  { color: var(--accent-hot); }
.wave-tooltip .wt-count {
  color: var(--muted); font-size: 9px; letter-spacing: 0.12em;
  border-left: 1px solid var(--rule); padding-left: 10px; margin-left: 2px;
}

.wave-beats {
  display: flex; justify-content: space-between;
  max-width: min(86vw, 880px);
  margin: 18px auto 0;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--muted);
  gap: 24px;
}
.wave-beats span { color: var(--muted); }
.wave-beats b { color: var(--accent); font-weight: 500; display: block; margin-bottom: 4px; }
.wave-beats .beat {
  opacity: 0;
  transition: opacity 0.6s ease;
  flex: 1;
  text-align: center;
}
.scene.active .wave-beats .beat:nth-child(1) { opacity: 1; transition-delay: 3.2s; }
.scene.active .wave-beats .beat:nth-child(2) { opacity: 1; transition-delay: 3.4s; }
.scene.active .wave-beats .beat:nth-child(3) { opacity: 1; transition-delay: 3.6s; }

/* ──────────────────────────────────────────────────────────────
   Scene 5 — Counterfactual slider
   ────────────────────────────────────────────────────────────── */

.ctf-panels {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 28px;
  width: min(90vw, 1080px);
  margin: 14px auto 0;
}

.ctf-panel {
  display: flex; flex-direction: column;
  align-items: stretch;
  padding: 14px 16px 14px;
  border: 1px solid var(--rule);
  background: rgba(18, 14, 10, 0.35);
}

.ctf-panel-title {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 2px;
}
.ctf-panel-unit {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 10px;
}

.ctf-chart {
  width: 100%; height: 140px;
  display: block;
  margin-bottom: 12px;
}
.ctf-chart .ctf-axis { stroke: var(--rule); stroke-width: 0.8; }
.ctf-chart .ctf-axis-text {
  fill: var(--muted); font-family: var(--font-mono); font-size: 9.5px;
  letter-spacing: 0.16em;
}

/* "Distance from downtown (km)" label under each chart */
.ctf-axis-label {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--muted);
  margin: -4px 0 12px;
}
.ctf-axis-label span { color: var(--accent); }

/* Shaded band between high and low — the "explained by design" area.
   Two-stage reveal on scene entry (see JS playCtfReveal):
     Beat 1 (0.1-0.6s): both curves fade in together — the full picture
       with the gap between them visible as empty space.
     Beat 2 (0.9-2.7s): amber band expands + counters tick up — the
       answer to "what is that gap?" fills itself in. */
.ctf-band {
  fill: var(--accent-hot);
  fill-opacity: 0;
  stroke: none;
  transition: fill-opacity 0.3s ease 0.9s;
}
#scene-04.active .ctf-band { fill-opacity: 0.2; }

.ctf-line-low {
  fill: none; stroke: var(--muted); stroke-width: 1.3; stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0; transition: opacity 0.5s ease 0.1s;
}
.ctf-line-high {
  fill: none; stroke: var(--accent-hot); stroke-width: 2; stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0; transition: opacity 0.5s ease 0.1s;
}
#scene-04.active .ctf-line-low,
#scene-04.active .ctf-line-high { opacity: 1; }

.ctf-readout {
  display: flex;
  padding-top: 10px;
  border-top: 1px solid var(--rule);
  gap: 14px;
}
.ctf-pct-slot {
  flex: 1;
  display: flex; align-items: baseline;
  gap: 2px;
}
.ctf-pct-slot + .ctf-pct-slot { border-left: 1px solid var(--rule); padding-left: 12px; }
.ctf-pct-slot .ctf-pct-note { margin-left: 6px; }

/* Primary (design) — the story beat; hot amber, large display type */
.ctf-pct-slot.primary .ctf-pct        { color: var(--accent-hot); font-size: 32px; }
.ctf-pct-slot.primary .ctf-pct-symbol { color: var(--accent);     font-size: 22px; }
.ctf-pct-slot.primary .ctf-pct-note   { color: var(--accent); }

/* Secondary (distance) — the other share, de-emphasized. Starts hidden
   so it only appears after the design band + counter have finished
   (JS fades it in during Stage B of playCtfReveal). */
.ctf-pct-slot.secondary                 { opacity: 0; transition: opacity 0.3s ease; }
.ctf-pct-slot.secondary .ctf-pct        { color: var(--muted); font-size: 22px; }
.ctf-pct-slot.secondary .ctf-pct-symbol { color: var(--muted); font-size: 16px; }
.ctf-pct-slot.secondary .ctf-pct-note   { color: var(--muted); }

.ctf-pct {
  font-family: var(--font-display);
  line-height: 1;
}
.ctf-pct-symbol {
  font-family: var(--font-display);
  line-height: 1;
}
.ctf-pct-note {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  align-self: baseline;
}

.ctf-legend {
  display: flex; justify-content: center;
  gap: 24px;
  margin: 18px auto 0;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
}
.ctf-legend-item { display: flex; align-items: center; gap: 8px; }
.ctf-legend-swatch {
  display: inline-block; width: 18px; height: 2px;
}
.ctf-legend-swatch.high { background: var(--accent-hot); }
.ctf-legend-swatch.low  { background: var(--muted); }
.ctf-legend-swatch.band {
  height: 9px;
  background: var(--accent-hot);
  opacity: 0.3;
}

/* ──────────────────────────────────────────────────────────────
   Scene 6 — City signatures (GCD × outcome per city)
   ────────────────────────────────────────────────────────────── */

.signatures {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 18px;
  width: min(92vw, 1100px);
  margin: 10px auto 0;
}

.sig-card {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}

.sig-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  background: rgba(14, 10, 6, 0.4);
  border: 1px solid var(--rule);
  overflow: visible;
}
.sig-frame svg { width: 100%; height: 100%; display: block; }

.sig-name {
  font-family: var(--font-display);
  font-size: 17px;
  color: var(--fg);
  line-height: 1.1;
}
.sig-stat {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}
.sig-stat b { color: var(--accent); font-weight: 500; }

/* outcome toggle above strip plot */
.strip-toggle {
  display: flex; align-items: center; justify-content: center;
  gap: 4px;
  margin: 0 auto 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.strip-toggle .label {
  color: var(--dim);
  margin-right: 14px;
}
.strip-toggle-btn {
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--muted);
  padding: 6px 14px;
  cursor: none;
  font-family: inherit;
  font-size: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.strip-toggle-btn:hover {
  color: var(--accent);
  border-color: var(--accent-soft);
}
.strip-toggle-btn.active {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
}

/* color-scale legend under toggle */
.strip-color-legend {
  display: flex; align-items: center; gap: 14px; justify-content: center;
  margin: 0 auto 10px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--muted);
}
.strip-color-legend-bar {
  display: inline-block;
  width: 220px; height: 5px;
  background: linear-gradient(90deg,
    rgb(70,110,150)  0%,
    rgb(35,32,28)   50%,
    rgb(255,210,130) 100%);
}
.strip-color-legend b {
  color: var(--accent);
  font-weight: 500;
}
/* Small-caps caption to the right of the gradient bar clarifying that
   the color scale is relative to each city's typical neighborhood,
   not to some absolute threshold. */
.strip-color-legend-note {
  font-size: 8.5px;
  letter-spacing: 0.2em;
  color: var(--dim);
  text-transform: none;
  margin-left: 4px;
  font-style: italic;
}

/* hover tooltip for strip plot */
.strip-tooltip {
  position: fixed;
  top: 0; left: 0;
  pointer-events: none;
  z-index: 9997;
  padding: 10px 14px;
  background: rgba(8, 6, 3, 0.94);
  border: 1px solid var(--accent-soft);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.55;
  color: var(--fg);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.strip-tooltip.visible { opacity: 1; }
.strip-tooltip .t-city {
  display: block;
  color: var(--accent-hot);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 9px;
  margin-bottom: 6px;
}
.strip-tooltip .t-gcd {
  display: block;
  color: var(--muted);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 8.5px;
  margin-bottom: 6px;
}
.strip-tooltip .t-gcd b {
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 0;
  font-weight: 400;
  margin-left: 4px;
}
.strip-tooltip .t-row {
  display: block;
  color: var(--dim);
  letter-spacing: 0.16em;
  font-size: 9px;
  text-transform: uppercase;
}
.strip-tooltip .t-row b {
  color: var(--fg);
  font-weight: 400;
  letter-spacing: 0;
  font-family: var(--font-display);
  font-size: 11px;
  margin: 0 3px 0 6px;
}

/* strip plot — one row per city, GCD as x-axis, each neighborhood a colored tick */
.strip-wrap {
  position: relative;
  width: min(90vw, 860px);
  margin: 6px auto 0;
}
.strip-chart {
  width: 100%; height: auto; display: block;
  position: relative; z-index: 2;
}
.strip-canvas {
  position: absolute; inset: 0;
  pointer-events: none; z-index: 1;
  width: 100%; height: 100%;
  opacity: 0;
  transition: opacity 0.6s ease 0.25s;
}
.scene.active .strip-canvas { opacity: 1; }

.strip-row-line {
  stroke: var(--rule); stroke-width: 0.4; opacity: 0.35;
}
.strip-grid-line {
  stroke: var(--rule); stroke-width: 0.4; stroke-dasharray: 2 4; opacity: 0.35;
}
.strip-axis-text {
  fill: var(--muted); font-family: var(--font-mono); font-size: 9px;
  letter-spacing: 0.22em; text-transform: uppercase;
}
.strip-axis-head {
  fill: var(--dim); font-family: var(--font-mono); font-size: 8.5px;
  letter-spacing: 0.3em; text-transform: uppercase;
}
.strip-city-name {
  fill: var(--fg); font-family: var(--font-display); font-size: 12.5px;
}
.strip-city-stat {
  fill: var(--accent); font-family: var(--font-mono); font-size: 9.5px;
  letter-spacing: 0.12em;
}

/* one big ternary plot showing all cities at once (kept for reference) */
.tern-wrap {
  width: min(82vw, 620px);
  margin: 6px auto 0;
  position: relative;
}
.tern-chart { width: 100%; height: auto; display: block; position: relative; z-index: 2; }
.tern-canvas {
  position: absolute; inset: 0;
  pointer-events: none; z-index: 1;
  width: 100%; height: 100%;
  opacity: 0;
  transition: opacity 0.6s ease 0.2s;
}
.scene.active .tern-canvas { opacity: 0.85; }

.tern-frame  { fill: none; stroke: var(--rule); stroke-width: 0.8; stroke-dasharray: 3 4; opacity: 0.8; }
.tern-grid   { fill: none; stroke: var(--rule); stroke-width: 0.3; opacity: 0.45; }
.tern-center {
  fill: var(--dim); opacity: 0.6;
}
.tern-center-label {
  fill: var(--dim);
  font-family: var(--font-mono); font-size: 8px;
  letter-spacing: 0.26em; text-transform: uppercase;
}

.tern-vertex-label {
  fill: var(--fg);
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.28em; text-transform: uppercase;
}
.tern-vertex-sub {
  fill: var(--muted);
  font-family: var(--font-mono); font-size: 8.5px;
  letter-spacing: 0.2em;
}

/* neighborhood scatter (background cloud) */
.tern-nbr {
  fill-opacity: 0.45;
  stroke: none;
}
.tern-nbr-low  { fill: var(--dim); }
.tern-nbr-mid  { fill: var(--accent); fill-opacity: 0.55; }
.tern-nbr-high { fill: var(--accent-hot); fill-opacity: 0.7; }

/* city dot + label */
.tern-city-dot {
  fill: var(--accent-hot);
  stroke: var(--bg);
  stroke-width: 1.5;
  filter: drop-shadow(0 0 4px var(--accent-soft));
  opacity: 0;
  transition: opacity 0.6s ease 0.3s;
}
.scene.active .tern-city-dot { opacity: 1; }

.tern-city-tick { stroke: var(--accent-soft); stroke-width: 0.6; opacity: 0; transition: opacity 0.5s ease 0.8s; }
.scene.active .tern-city-tick { opacity: 1; }

.tern-city-label {
  fill: var(--fg);
  font-family: var(--font-display);
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.5s ease 0.85s;
}
.scene.active .tern-city-label { opacity: 1; }

.tern-city-stat {
  fill: var(--muted);
  font-family: var(--font-mono); font-size: 8.5px;
  letter-spacing: 0.18em;
  opacity: 0;
  transition: opacity 0.5s ease 0.95s;
}
.scene.active .tern-city-stat { opacity: 1; }

.tern-note {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--dim);
  text-align: center;
  margin-top: 10px;
}
.tern-note b { color: var(--muted); font-weight: 400; }

/* triangle-radar signature: 3 vertices = 3 outcomes, pulled outward by effect size */
.sig-tri-ref   { fill: none; stroke: var(--rule); stroke-width: 0.6; stroke-dasharray: 2 3; opacity: 0.7; }
.sig-tri-axis  { stroke: var(--rule); stroke-width: 0.4; opacity: 0.5; }
.sig-tri-fill  {
  fill: var(--accent-soft); stroke: var(--accent-hot);
  stroke-width: 1.5; stroke-linejoin: round;
  opacity: 0;
  transform: scale(0.2); transform-origin: 0 0;
  transition: opacity 0.7s cubic-bezier(.25,.65,.25,1),
              transform 0.7s cubic-bezier(.25,.65,.25,1);
}
.scene.active .sig-tri-fill { opacity: 1; transform: scale(1); }
.scene.active .sig-card:nth-child(1) .sig-tri-fill { transition-delay: 0.20s; }
.scene.active .sig-card:nth-child(2) .sig-tri-fill { transition-delay: 0.34s; }
.scene.active .sig-card:nth-child(3) .sig-tri-fill { transition-delay: 0.48s; }
.scene.active .sig-card:nth-child(4) .sig-tri-fill { transition-delay: 0.62s; }
.scene.active .sig-card:nth-child(5) .sig-tri-fill { transition-delay: 0.76s; }

.sig-tri-vertex { fill: var(--accent-hot); filter: drop-shadow(0 0 3px var(--accent-soft)); }

.sig-tri-label {
  fill: var(--muted);
  font-family: var(--font-mono); font-size: 8.5px;
  letter-spacing: 0.22em; text-transform: uppercase;
}
.sig-tri-value {
  fill: var(--accent-hot);
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.14em; font-weight: 500;
}

/* center pip */
.sig-core { fill: var(--muted); opacity: 0.8; }

/* effect readout below each signature */
.sig-effect {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--accent-hot);
  margin-top: 2px;
}
.sig-effect .label {
  color: var(--muted);
  letter-spacing: 0.2em;
}

/* legend strip */
.sig-legend {
  display: flex; justify-content: center; gap: 36px;
  margin: 22px auto 0;
  font-family: var(--font-mono);
  font-size: 9.5px; letter-spacing: 0.24em;
  text-transform: uppercase; color: var(--muted);
  width: min(92vw, 820px);
}
.sig-legend-item { display: flex; align-items: center; gap: 10px; }
.sig-legend-gradient {
  display: inline-block; width: 80px; height: 3px;
  background: linear-gradient(90deg, var(--dim) 0%, var(--accent) 55%, var(--accent-hot) 100%);
}
.sig-legend-lenbar {
  display: inline-block; width: 22px; height: 2px; background: var(--accent);
}
.sig-legend-lenbar.long { width: 44px; }

/* ──────────────────────────────────────────────────────────────
   Scene 6 — About the paper (final slide, academic-style page)
   ────────────────────────────────────────────────────────────── */

.about {
  width: min(86vw, 760px);
  margin: 0 auto;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.paper-title {
  font-family: var(--font-display);
  font-size: 34px;
  color: var(--fg);
  line-height: 1.2;
  margin: 0 0 10px;
  font-weight: 400;
  letter-spacing: 0.005em;
}

.paper-authors {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 22px;
}

.paper-heading {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  margin: 0 0 10px;
}

.paper-abstract {
  font-family: var(--font-body);
  font-size: 14.5px;
  line-height: 1.75;
  color: var(--fg);
  margin: 0 0 20px;
  text-align: justify;
}

.paper-citation {
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.65;
  color: var(--muted);
  padding-top: 14px;
  border-top: 1px solid var(--rule);
  margin-bottom: 14px;
}
.paper-citation em { color: var(--fg); font-style: italic; }

.paper-read-more {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.paper-read-more em {
  color: var(--fg);
  font-style: normal;
  font-weight: 500;
}

.paper-links {
  display: flex; gap: 10px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.paper-links a {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  text-decoration: none;
  padding: 7px 14px;
  border: 1px solid var(--accent-soft);
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.paper-links a:hover {
  color: var(--accent-hot);
  border-color: var(--accent-hot);
  background: rgba(245, 168, 94, 0.08);
}

.paper-lab {
  display: flex; align-items: center; gap: 18px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 18px;
  border-top: 1px solid var(--rule);
}
.paper-lab-logo {
  height: 28px;
  width: auto;
  display: block;
}
.paper-lab strong { color: var(--accent); font-weight: 500; }

@media (max-width: 780px) {
  /* Scene 6 About page: more readable sizing at phone widths. */
  .about           { width: 92vw; }
  .paper-title     { font-size: 22px; line-height: 1.25; }
  .paper-abstract  { text-align: left; font-size: 14px; line-height: 1.7; }
  .paper-citation  { font-size: 12.5px; line-height: 1.55; }
  .paper-read-more { font-size: 9.5px; }
  .paper-links     { gap: 8px; }
  .paper-links a   { padding: 5px 10px; font-size: 9.5px; }
  .paper-lab       { gap: 12px; font-size: 9px; }
}

/* ──────────────────────────────────────────────────────────────
   Scene 7 — Coda (closing line + credits) [legacy — unused]
   ────────────────────────────────────────────────────────────── */

.coda {
  display: flex; flex-direction: column; align-items: center;
  gap: 34px;
  max-width: 780px;
  text-align: center;
}
.coda-line {
  font-family: var(--font-display);
  font-size: 42px;
  color: var(--fg);
  line-height: 1.3;
  letter-spacing: 0.005em;
}
.coda-footer {
  display: flex; align-items: center; gap: 18px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}
.coda-footer a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-soft);
  padding-bottom: 2px;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.coda-footer a:hover {
  color: var(--accent-hot);
  border-color: var(--accent-hot);
}
.coda-footer .coda-sep { color: var(--dim); }
.coda-credit {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
}

@media (max-width: 780px) {
  .coda-line { font-size: 28px; }
  .coda { gap: 24px; }
}

/* ──────────────────────────────────────────────────────────────
   Scene 6 — Closer line + footer (preserved)
   ────────────────────────────────────────────────────────────── */

.closer-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 42px;
  width: min(86vw, 920px);
  margin: 0 auto;
  align-items: start;
}

.closer-example {
  display: flex; flex-direction: column;
}
.closer-example .example-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
.closer-example .example-name {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--fg);
  margin-bottom: 12px;
  line-height: 1.15;
}
.example-panel {
  position: relative;
  aspect-ratio: 1 / 1;
  width: 100%;
  background: #070605;
  overflow: hidden;
}
.example-panel .basemap {
  position: absolute; inset: 0; pointer-events: none;
  opacity: 0.28;
  background:
    radial-gradient(ellipse at 30% 30%, var(--terrain-warm), transparent 55%),
    radial-gradient(ellipse at 70% 70%, var(--terrain-cool), transparent 60%);
}
.example-panel .basemap::before {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(var(--terrain-ink) 0.6px, transparent 0.7px);
  background-size: 6px 6px;
  opacity: 0.7;
}
.example-panel svg.streets {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
}
/* reuse road weight classes (.primary etc.) from .twin */
.example-panel svg.streets .primary     { fill: none; stroke: var(--accent-hot); stroke-width: 2.2; stroke-linecap: round; }
.example-panel svg.streets .secondary   { fill: none; stroke: var(--accent);     stroke-width: 1.6; stroke-linecap: round; }
.example-panel svg.streets .tertiary    { fill: none; stroke: var(--accent);     stroke-width: 1.2; stroke-linecap: round; opacity: 0.9; }
.example-panel svg.streets .residential { fill: none; stroke: var(--accent);     stroke-width: 0.85; stroke-linecap: round; opacity: 0.75; }
.example-panel svg.streets .service     { fill: none; stroke: var(--accent);     stroke-width: 0.55; stroke-linecap: round; opacity: 0.5; }

.example-panel .twin-chrome { position: absolute; inset: 0; pointer-events: none; }
.example-desc {
  font-family: var(--font-body);
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.55;
  margin-top: 12px;
}

.policy-list {
  display: flex; flex-direction: column; gap: 14px;
  padding-top: 22px;
}
.policy-card {
  padding: 14px 18px;
  border-left: 1px solid var(--accent-soft);
  background: rgba(18, 14, 10, 0.35);
  opacity: 0; transform: translateX(12px);
  transition: opacity 0.55s cubic-bezier(.2,.7,.25,1),
              transform 0.55s cubic-bezier(.2,.7,.25,1);
}
.scene.active .policy-card                  { opacity: 1; transform: translateX(0); }
.scene.active .policy-card:nth-child(1)     { transition-delay: 0.30s; }
.scene.active .policy-card:nth-child(2)     { transition-delay: 0.42s; }
.scene.active .policy-card:nth-child(3)     { transition-delay: 0.54s; }

.policy-where {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
.policy-what {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--fg);
  line-height: 1.5;
}

.closer-line {
  margin: 32px auto 0;
  text-align: center;
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--fg);
  max-width: 640px;
  line-height: 1.35;
  opacity: 0;
  transition: opacity 0.6s ease 0.7s;
}
.scene.active .closer-line { opacity: 1; }

.closer-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
  margin-top: 18px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0;
  transition: opacity 0.6s ease 0.85s;
}
.scene.active .closer-footer { opacity: 1; }
.closer-footer a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-soft);
  padding-bottom: 2px;
  transition: color 0.2s, border-color 0.2s;
}
.closer-footer a:hover {
  color: var(--accent-hot);
  border-color: var(--accent-hot);
}
.closer-footer .sep-dot { color: var(--dim); }

.fp-line-a   { stroke: var(--accent);     stroke-width: 1.5; opacity: 0.55; fill: none; stroke-linecap: round; }
.fp-line-b   { stroke: var(--accent-hot); stroke-width: 1.8; fill: none; stroke-linecap: round; }
.fp-shape-a  { stroke: var(--accent);     stroke-width: 1.5; opacity: 0.55; fill: none; }
.fp-shape-b  { stroke: var(--accent-hot); stroke-width: 1.8; fill: none; }
.fp-bulb-b   { fill: var(--accent-hot); }
.fp-diagram-label {
  font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.26em;
  fill: var(--accent); opacity: 0.6;
}
.fp-diagram-label.hot { fill: var(--accent-hot); opacity: 1; }

/* ──────────────────────────────────────────────────────────────
   Story panel — left-center narrator text per scene
   ────────────────────────────────────────────────────────────── */

.story-text {
  position: absolute;
  left: 42px;
  top: 50%;
  width: min(22vw, 260px);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.7;
  color: var(--fg);
  padding: 14px 18px;
  background: rgba(8, 6, 4, 0.88);
  border-left: 1px solid var(--accent-soft);
  opacity: 0;
  transform: translate(-10px, -50%);
  transition: opacity 0.55s ease 0.35s, transform 0.55s ease 0.35s;
  z-index: 10;
  pointer-events: auto;
}
.scene.active .story-text {
  opacity: 1;
  transform: translate(0, -50%);
}
.story-text p { margin: 0; }
.story-text em {
  color: var(--accent);
  font-style: normal;
  font-weight: 500;
}
.story-text b {
  color: var(--fg);
  font-weight: 500;
}
.story-text .chapter {
  display: block;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

/* scene 1 sub-phase indicator (shown only on scene 1) */
.scene1-progress {
  display: flex; align-items: center; gap: 6px;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--rule);
}
.scene1-progress .step {
  width: 5px; height: 5px;
  background: var(--dim);
  border-radius: 50%;
  transition: background 0.3s ease, transform 0.3s ease;
}
.scene1-progress .step.active {
  background: var(--accent-hot);
  transform: scale(1.3);
}
/* Scroll cue — its own row under the step dots so it reads as an
   affordance, not chrome. Bobs down on a gentle beat; fades once the
   reader has scrolled even once. Also fades on the final phase. */
.story-text .scroll-cue {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--accent);
  transition: opacity 0.5s ease;
}
.story-text .scroll-cue .cue-arrow {
  font-size: 14px;
  color: var(--accent-hot);
  transform-origin: center;
}
/* Desktop cue (↓ scroll) bobs vertically; mobile cue (▸ next) bobs
   sideways. Visibility is swapped in the mobile @media block below. */
.story-text .scroll-cue .cue-mobile  { display: none; }
.story-text .scroll-cue .cue-arrow.cue-desktop {
  animation: cue-bob-down 1.6s ease-in-out infinite;
}
.story-text .scroll-cue .cue-arrow.cue-mobile {
  animation: cue-bob-right 1.6s ease-in-out infinite;
}
@keyframes cue-bob-down {
  0%, 100% { transform: translateY(0);   opacity: 0.55; }
  50%      { transform: translateY(5px); opacity: 1;    }
}
@keyframes cue-bob-right {
  0%, 100% { transform: translateX(0);   opacity: 0.55; }
  50%      { transform: translateX(5px); opacity: 1;    }
}
/* Fade after the reader has demonstrated they know how to advance. */
body.has-scrolled .story-text .scroll-cue,
#scene-01.at-final-phase .story-text .scroll-cue {
  opacity: 0.3;
}
body.has-scrolled .story-text .scroll-cue .cue-arrow,
#scene-01.at-final-phase .story-text .scroll-cue .cue-arrow {
  animation: none;
}

/* phase-c twin spread-apart animation on entry */
.phase-c .twins .twin {
  transition: transform 0.75s cubic-bezier(.3,.7,.25,1) 0.1s;
}
.phase-c .twins .twin:first-child { transform: translateX(80px); }
.phase-c .twins .twin:last-child  { transform: translateX(-80px); }
.phase-c.visible .twins .twin { transform: translateX(0); }

@media (max-width: 1100px) {
  .story-text {
    position: static;
    width: auto;
    max-width: 640px;
    margin: 0 auto 20px;
    transform: none;
  }
  .scene.active .story-text { transform: none; }
  /* The desktop rule pads scenes with a 340 px left gutter to reserve
     room for the absolutely-positioned .story-text. Once story-text
     goes static (above), that gutter just wastes space. */
  .scene:has(> .story-text) { padding-left: 24px; padding-right: 24px; }
}

/* placeholder "stub" for incomplete scenes */
.stub {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  text-align: center; max-width: 680px;
}
.stub-number {
  font-family: var(--font-display);
  font-size: 200px; line-height: 1;
  color: var(--accent); opacity: 0.85;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}
.stub-title {
  font-family: var(--font-display);
  font-size: 36px; color: var(--fg);
}
.stub-body {
  font-family: var(--font-mono);
  font-size: 12px; letter-spacing: 0.04em;
  color: var(--muted); line-height: 1.9;
  max-width: 480px;
}
.stub-note {
  font-family: var(--font-mono);
  font-size: 9px; letter-spacing: 0.32em;
  text-transform: uppercase; color: var(--dim);
  margin-top: 14px;
}

/* ──────────────────────────────────────────────────────────────
   Macro opener — three-phase zoom: US → Phoenix → two panels
   ────────────────────────────────────────────────────────────── */

.macro-phase {
  position: absolute;
  inset: 64px 56px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  pointer-events: none;
  opacity: 0;
  will-change: opacity, transform;
}

/* Phases are now driven by scroll via JS classes ('.visible' / '.exited'),
   not auto-played. Each transition applies a zoom-morph so the visual
   perception is "diving into" the next level. */
.macro-phase {
  opacity: 0;
  transform: scale(0.9);
  transform-origin: 50% 50%;
  transition:
    opacity   0.7s cubic-bezier(.3,.7,.25,1),
    transform 0.9s cubic-bezier(.3,.7,.25,1);
}
/* phase A exits TOWARD the Phoenix dot, so it feels like we're zooming into it */
.macro-phase.phase-a           { transform-origin: 22% 48%; transform: scale(0.96); }
.macro-phase.phase-a.visible   { opacity: 1; transform: scale(1); }
.macro-phase.phase-a.exited    { opacity: 0; transform: scale(5.5); }

.macro-phase.phase-b           { transform: scale(0.25); }
.macro-phase.phase-b.visible   { opacity: 1; transform: scale(1); }
.macro-phase.phase-b.exited    { opacity: 0; transform: scale(3.2); }

.phase-c {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 100%;
  opacity: 0;
  transform: scale(1.18);
  transition:
    opacity   0.7s cubic-bezier(.3,.7,.25,1),
    transform 0.9s cubic-bezier(.3,.7,.25,1);
  will-change: opacity, transform;
}
.phase-c.visible { opacity: 1; transform: scale(1); }

/* Phase captions */
.macro-caption {
  position: relative;
  margin-top: 26px;
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.36em; text-transform: uppercase; color: var(--muted);
}
.macro-caption b { color: var(--accent); font-weight: 500; }

/* Phase A — US constellation */
.us-wrap {
  position: relative;
  width: min(86vw, 1100px);
  aspect-ratio: 2 / 1;
  pointer-events: auto;      /* receive mousemove to update coord readout */
}
.us-wrap svg { width: 100%; height: 100%; display: block; }
.us-dot       { fill: var(--accent); opacity: 0.42; }
.us-dot.major { fill: var(--accent); opacity: 0.8; }
.us-dot.phx   { fill: var(--accent-hot); opacity: 1; animation: phx-pulse 1.6s ease-in-out infinite; }
@keyframes phx-pulse {
  0%, 100% { opacity: 0.55; r: 3; }
  50%      { opacity: 1;    r: 4.4; }
}
.us-phx-halo {
  fill: none; stroke: var(--accent-hot); stroke-width: 1; opacity: 0.7;
  /* same 1.6s period as the dot + scroll cue — halo ripples out in time
     with the dot's expansion, not on its own clock. */
  animation: phx-halo 1.6s ease-out infinite;
}
@keyframes phx-halo {
  0%   { opacity: 0.9; r: 3; }
  100% { opacity: 0;   r: 24; }
}
/* non-blinking city labels — dark halo keeps them legible over dots */
.us-city-label {
  fill: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.1em;
  opacity: 0.95;
  text-anchor: end;
  stroke: var(--bg);
  stroke-width: 2.5;
  paint-order: stroke;
  stroke-linejoin: round;
}

.us-phx-label {
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.26em;
  fill: var(--accent-hot); text-transform: uppercase;
  font-weight: 500;
  animation: phx-label-blink 1.7s ease-in-out infinite;
}
@keyframes phx-label-blink {
  0%, 100% { opacity: 1;    }
  50%      { opacity: 0.35; }
}

/* Phase B — Phoenix ring */
.phx-wrap { position: relative; width: min(76vh, 740px); aspect-ratio: 1 / 1; }
.phx-wrap svg { width: 100%; height: 100%; display: block; }
.phx-ring {
  fill: none; stroke: var(--accent-soft); stroke-width: 1; stroke-dasharray: 4 5;
}
.phx-dot       { fill: var(--accent); opacity: 0.38; }
.phx-dot.major { fill: var(--accent); opacity: 0.75; }
.phx-downtown-dot { fill: var(--accent-hot); }
.phx-cross        { stroke: var(--accent-hot); stroke-width: 1; }
.phx-pin-ring {
  fill: none; stroke: var(--accent-hot); stroke-width: 1.2;
}
.phx-pin-dot { fill: var(--accent-hot); }
.phx-pin-label {
  font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.2em;
  fill: var(--accent-hot); text-transform: uppercase; font-weight: 500;
}
.phx-center-label {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.3em;
  fill: var(--fg); text-transform: uppercase;
}
.phx-ring-label {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.3em;
  fill: var(--muted); text-transform: uppercase;
}

/* eyebrow */
.eyebrow {
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.36em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 18px;
}
.eyebrow .sep { color: var(--dim); margin: 0 12px; }

/* ──────────────────────────────────────────────────────────────
   Twin tethers — city pin + two equal cords drawn to each panel
   ────────────────────────────────────────────────────────────── */

.tether-apex {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  margin-bottom: 2px;
}
.tether-apex .pin-cross {
  width: 22px; height: 22px;
  display: block;
  overflow: visible;
}
.tether-apex .pin-cross line {
  stroke: var(--accent-hot);
  stroke-width: 1;
  stroke-linecap: round;
  opacity: 0.9;
}
.tether-apex .pin-cross-dot {
  fill: var(--accent-hot);
  animation: pin-pulse 3.2s ease-in-out infinite;
}
.tether-apex .pin-label {
  font-family: var(--font-mono); font-size: 9px;
  letter-spacing: 0.34em; color: var(--muted);
  text-transform: uppercase;
}

.tether-svg {
  display: block;
  width: min(88vw, 1080px);
  height: 52px;
  margin: 0 auto 10px;
  overflow: visible;
}
.tether-svg line {
  stroke: var(--accent-soft);
  stroke-width: 1;
  fill: none;
  stroke-dasharray: 600;
  stroke-dashoffset: 600;
  animation: draw-tether 1.5s cubic-bezier(.2,.7,.25,1) 0.35s forwards;
}

@keyframes draw-tether {
  to { stroke-dashoffset: 0; }
}
@keyframes pin-pulse {
  0%, 100% { opacity: 0.65; }
  50%      { opacity: 1;    }
}

/* ──────────────────────────────────────────────────────────────
   Twin panels
   ────────────────────────────────────────────────────────────── */

.twins {
  display: grid; grid-template-columns: 1fr 1fr; gap: 48px;
  width: min(88vw, 1080px); margin: 0 auto;
}

.twin { position: relative; aspect-ratio: 1 / 1; background: #070605; overflow: hidden; }

/* basemap — warm muted terrain, visible by default, fades on hover */
.twin .basemap {
  position: absolute; inset: 0; pointer-events: none;
  opacity: 0.85; transition: opacity 0.5s ease;
  background:
    radial-gradient(ellipse at 25% 30%, var(--terrain-warm), transparent 55%),
    radial-gradient(ellipse at 75% 70%, var(--terrain-cool), transparent 60%),
    radial-gradient(ellipse at 55% 80%, var(--terrain-warm), transparent 50%);
}
/* dotted base texture — faint graph paper / satellite pixel vibe */
.twin .basemap::before {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(var(--terrain-ink) 0.6px, transparent 0.7px);
  background-size: 6px 6px;
  opacity: 0.7;
}
/* contour-like lines */
.twin .basemap::after {
  content: ""; position: absolute; inset: 0;
  background-image:
    repeating-radial-gradient(ellipse at 50% 50%, transparent 0 26px, var(--terrain-ink) 26px 27px);
  opacity: 0.7;
}
.twin:hover .basemap { opacity: 0.18; }

/* street network overlay (SVG) */
.twin svg.streets {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  opacity: 0.38; transition: opacity 0.45s ease;
}
.twin:hover svg.streets { opacity: 1; }

/* OSM-weighted road classes — thicker = higher rank */
.twin svg.streets .primary    { fill: none; stroke: var(--accent-hot); stroke-width: 2.2; stroke-linecap: round; }
.twin svg.streets .secondary  { fill: none; stroke: var(--accent);     stroke-width: 1.6; stroke-linecap: round; }
.twin svg.streets .tertiary   { fill: none; stroke: var(--accent);     stroke-width: 1.2; stroke-linecap: round; opacity: 0.9; }
.twin svg.streets .residential{ fill: none; stroke: var(--accent);     stroke-width: 0.85; stroke-linecap: round; opacity: 0.75; }
.twin svg.streets .service    { fill: none; stroke: var(--accent);     stroke-width: 0.55; stroke-linecap: round; opacity: 0.5; }
.twin svg.streets .cul        { fill: none; stroke: var(--accent);     stroke-width: 0.9; stroke-linecap: round; opacity: 0.85; }
.twin svg.streets .cul-head   { fill: var(--accent); opacity: 0.55; }

/* panel chrome */
.twin-chrome { position: absolute; inset: 0; pointer-events: none; }
.twin-tick { position: absolute; width: 10px; height: 10px; }
.twin-tick::before, .twin-tick::after { content: ""; position: absolute; background: var(--accent); opacity: 0.7; }
.twin-tick.tl { top: 6px; left: 6px; }
.twin-tick.tl::before { top: 0; left: 0; width: 8px; height: 1px; }
.twin-tick.tl::after  { top: 0; left: 0; width: 1px; height: 8px; }
.twin-tick.tr { top: 6px; right: 6px; }
.twin-tick.tr::before { top: 0; right: 0; width: 8px; height: 1px; }
.twin-tick.tr::after  { top: 0; right: 0; width: 1px; height: 8px; }
.twin-tick.bl { bottom: 6px; left: 6px; }
.twin-tick.bl::before { bottom: 0; left: 0; width: 8px; height: 1px; }
.twin-tick.bl::after  { bottom: 0; left: 0; width: 1px; height: 8px; }
.twin-tick.br { bottom: 6px; right: 6px; }
.twin-tick.br::before { bottom: 0; right: 0; width: 8px; height: 1px; }
.twin-tick.br::after  { bottom: 0; right: 0; width: 1px; height: 8px; }

.twin-label {
  position: absolute;
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted);
}
.twin-label.tl { top: 14px; left: 20px; }
.twin-label.tr { top: 14px; right: 20px; }
.twin-label.bl { bottom: 14px; left: 20px; }
.twin-label.br { bottom: 14px; right: 20px; color: var(--dim); }
.twin-label b { color: var(--accent); font-weight: 500; }

/* ambient mobility traces — particles flow along invisible motion paths */
.twin .traces {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  opacity: 1;
}
.twin .traces .trace {
  fill: none;
  stroke: none;    /* paths are invisible; used only as motion tracks */
}
.twin .traces .particle {
  fill: var(--accent-hot);
  filter: drop-shadow(0 0 2.5px var(--accent-soft));
  pointer-events: none;
}
.twin .traces .particle-trail {
  fill: var(--accent-hot);
  pointer-events: none;
}

/* bearing arrow inside twin */
.twin-bearing {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 9.5px;
  color: var(--muted); letter-spacing: 0.24em; text-transform: uppercase;
}
.twin-bearing .arrow { color: var(--accent); }

/* caption */
.twins-caption {
  margin-top: 36px; text-align: center; max-width: 820px;
  font-family: var(--font-display); font-size: 34px;
  color: var(--fg); line-height: 1.3; letter-spacing: 0.005em;
}
.twins-subcaption {
  margin-top: 18px; font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.28em; text-transform: uppercase; color: var(--dim);
}
.twins-subcaption .hover-cue { color: var(--accent); }

@media (max-width: 780px) {
  /* Scene 1 Phase C: keep twins SIDE-BY-SIDE on mobile. The "same
     distance, different design" narrative is inherently parallel —
     stacking them hides the comparison. Smaller is fine. */
  .twins { grid-template-columns: 1fr 1fr; gap: 10px; width: 92vw; }
  .twins-caption { font-size: 20px; }
  /* macro-phase inset: top pushed down to 200 px so the absolutely-
     positioned phase diagram (US map / Phoenix ring / twin panels)
     clears the static-flow story-text that renders above it on mobile.
     Sides match scene padding; bottom leaves clearance for the fixed
     HUD chrome. */
  .macro-phase { inset: 200px 18px 96px 18px; }
  .hud-top, .hud-bottom { left: 20px; right: 20px; }
  .corner { display: none; }
  .locator .arm .line { width: 28px; }

  /* Scene 2 fingerprint cards: 2x2 on desktop → single column on phone.
     Tighten each card so the four cards fit with less scroll. */
  .fingerprints { grid-template-columns: 1fr; gap: 12px; width: 92vw; }
  .fp-card     { padding: 10px 14px 12px; }
  .fp-name     { font-size: 16px; margin: 2px 0 6px; }
  .fp-diagram  { height: 52px; margin: 2px 0 6px; }
  .fp-values   { padding: 8px 0; gap: 10px; }
  .fp-desc     { font-size: 13px;   margin-top: 7px; line-height: 1.45; }

  /* Scene 4 counterfactual panels: 3-across → stacked vertically.
     Tighter internal padding + counter sizing so three panels fit
     with less scrolling. */
  .ctf-panels   { grid-template-columns: 1fr; gap: 14px; width: 92vw; }
  .ctf-panel    { padding: 10px 12px; }
  .ctf-chart    { height: 110px; margin-bottom: 8px; }
  .ctf-axis-label { font-size: 8.5px; margin: -2px 0 6px; }
  .ctf-readout  { padding-top: 8px; gap: 10px; }
  .ctf-pct-slot.primary   .ctf-pct        { font-size: 26px; }
  .ctf-pct-slot.primary   .ctf-pct-symbol { font-size: 18px; }
  .ctf-pct-slot.secondary .ctf-pct        { font-size: 16px; }
  .ctf-pct-slot.secondary .ctf-pct-symbol { font-size: 12px; }
  .ctf-pct-slot .ctf-pct-note { font-size: 8px; }
  .ctf-legend { flex-wrap: wrap; gap: 8px 14px; font-size: 8.5px; margin-top: 14px; }

  /* Scene titles scale down for narrow screens */
  .scene-title { font-size: 26px; line-height: 1.15; padding: 0 12px; }

  /* Scene 3 adoption curve: tighter, since SVG viewBox is 800x280
     (2.85:1 aspect) — a fixed 320 px tall box on mobile left
     ~180 px of dead whitespace above/below the curve. */
  .wave-wrap  { width: 92vw; }
  .wave-chart { height: 200px; }
  .wave-beats { max-width: 92vw; gap: 10px; font-size: 9px; letter-spacing: 0.18em; }
  .wave-beats b { font-size: 11px; margin-bottom: 2px; }

  /* Scene 5 strip plot. The canvas/SVG viewBox is 900x470 so at 92 vw
     it scales to roughly 345x180 — cramped, but a full JS rewrite to
     change the layout would be heavier than the visual benefit. Focus
     here: keep the chrome (toggle, legend, info-panel, intro) usable. */
  .strip-toggle { font-size: 9px; flex-wrap: wrap; gap: 2px; }
  .strip-toggle-btn { padding: 5px 9px; }
  .strip-color-legend { flex-wrap: wrap; gap: 6px 12px; font-size: 8.5px; }
  .strip-color-legend-bar { width: 140px; }
  .strip-color-legend-note { font-size: 8px; }
  .scene-intro-short { font-size: 12.5px; padding: 0 12px; }
  .scene-info-panel { width: 92vw; font-size: 13px; padding: 12px; }

  /* HUD chrome — tighten for small screens */
  .hud-top { font-size: 9px; }
  .hud-bottom { bottom: 12px; flex-wrap: wrap; gap: 8px; }
  .dot-label { display: none; }            /* too long at narrow widths */
  .dot-sep { display: none; }
  .hud-bottom .dots { flex: 0 0 auto; }

  /* Allow scenes to scroll their own content on phones. Without this,
     anything taller than the viewport gets center-clipped (stuck in the
     middle, top + bottom invisible). `safe center` tells flex to fall
     back to top-alignment when content overflows, so scrolling starts
     from the top instead of the middle. */
  .scene {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    justify-content: safe center;
    /* top padding = clearance for HUD top (18 px bottom + ~24 px tall);
       bottom padding = clearance for HUD bottom (can wrap to 2 rows
       with dots + nav buttons on narrow screens) — extra breathing so
       content doesn't scroll-collide with the fixed chrome. */
    padding: 56px 18px 96px;
  }
  .scene:has(> .story-text) { padding-left: 18px; padding-right: 18px; }

  /* Swap desktop keyboard-hint for tap-friendly nav buttons */
  .hint { display: none; }
  .nav-arrows { display: inline-flex; }
  .nav-btn { padding: 6px 10px; font-size: 9.5px; letter-spacing: 0.22em; gap: 6px; }
  .nav-btn .nav-arrow { font-size: 12px; }

  /* Scene 1 cue: swap "scroll to zoom ↓" (desktop) for "next to zoom ▸"
     (mobile), since there's no scroll on touch. */
  .story-text .scroll-cue { font-size: 10px; }
  .story-text .scroll-cue .cue-desktop { display: none; }
  .story-text .scroll-cue .cue-mobile  { display: inline; }

  /* About page abstract — already in another block, keep consistent */
  .paper-heading { font-size: 11px; }

  /* Scene 1 zoom phases: clamp widths so the SVGs never overflow the
     narrow viewport. phx-wrap was sized by 76vh which is larger than
     86vw on portrait phones. */
  .us-wrap  { width: min(92vw, 1100px); }
  .phx-wrap { width: min(86vw, 76vh, 740px); }
}

/* Touch devices (no hover): hide the custom crosshair cursor + its
   coordinate readout, since they follow mousemove which touch doesn't
   fire. Desktop browsers in tablet mode get the system cursor back. */
@media (hover: none) {
  #cursor, #cursor-readout { display: none !important; }
  /* Restore normal cursor on interactive elements */
  .nav-btn, .dot, .brand, .scene-info, .strip-toggle-btn,
  .fp-card, .ctf-panel { cursor: pointer; }
}
