/* Hallmark · genre: atmospheric · macrostructure: bespoke (continuous world home + scene pages) · theme: custom night watershed
 * nav: N9 edge-aligned bar + page-local map · footer: Ft5 statement · enrichment: live WebGL (three.js), generated stills on two pages
 * pre-emit critique: P5 H4 E4 S5 R4 V5
 */
@import url("../tokens.css");

*, *::before, *::after { box-sizing: border-box; }
html { overflow-x: clip; -webkit-text-size-adjust: 100%; scrollbar-color: var(--color-rule) var(--color-paper); }
body {
  margin: 0; overflow-x: clip; background: var(--color-paper); color: var(--color-ink);
  font: 380 var(--text-base)/1.62 var(--font-body); letter-spacing: 0.005em;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
::selection { background: var(--color-accent); color: var(--color-accent-ink); }
img, svg, canvas, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.22em; }
:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 3px; border-radius: var(--radius-sm); }
h1, h2, h3 { font-family: var(--font-display); font-weight: 650; font-style: normal; letter-spacing: var(--track-tight); line-height: 1.02; margin: 0; text-wrap: balance; overflow-wrap: anywhere; min-width: 0; }
p { margin: 0; text-wrap: pretty; }
.mono { font-family: var(--font-mono); font-size: var(--text-xs); letter-spacing: var(--track-wide); text-transform: uppercase; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.skip { position: fixed; left: var(--space-4); top: var(--space-3); z-index: 100; padding: var(--space-2) var(--space-4); background: var(--color-accent); color: var(--color-accent-ink); border-radius: var(--radius-pill); font-weight: 600; text-decoration: none; transform: translateY(-160%); transition: transform var(--dur-fast) var(--ease-out); }
.skip:focus-visible { transform: none; }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 46px; padding: 0 var(--space-5); border-radius: var(--radius-pill);
  font: 600 var(--text-sm)/1 var(--font-body); letter-spacing: 0.01em; white-space: nowrap; text-decoration: none; cursor: pointer;
  border: 1px solid transparent; transition: transform var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}
.btn--gold { background: var(--color-accent); color: var(--color-accent-ink); box-shadow: var(--edge), 0 6px 22px oklch(60% 0.14 70 / 0.28); }
.btn--ghost { background: var(--color-glass); color: var(--color-ink); border-color: var(--color-rule); }
.btn:active { transform: scale(0.97); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
@media (hover: hover) and (pointer: fine) {
  .btn--gold:hover { background: var(--color-accent-hi); box-shadow: var(--edge), 0 10px 30px oklch(65% 0.15 72 / 0.36); }
  .btn--ghost:hover { border-color: var(--color-accent); }
}
.link { color: var(--color-accent); font-weight: 550; text-decoration: none; background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: background-size var(--dur-base) var(--ease-out); }
.link:hover, .link:focus-visible { background-size: 100% 1px; }

/* ------------------------------------------------------------------ the bar */
.bar {
  position: fixed; inset: 0 0 auto 0; z-index: 50; height: 68px;
  display: flex; align-items: center; gap: var(--space-5); padding: 0 var(--gutter);
}
.bar::before { content: ""; position: absolute; inset: 0 0 -28px 0; z-index: -1; pointer-events: none;
  background: linear-gradient(to bottom, oklch(9% 0.02 240 / 0.86) 0%, oklch(10% 0.02 240 / 0.55) 60%, var(--color-scrim-0)); }
.bar::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: 0; transition: opacity var(--dur-base) var(--ease-out);
  background: oklch(9% 0.02 240 / 0.96); border-bottom: 1px solid var(--color-rule-soft); } /* no blurred shadow: its first paint can stall the WebGL frame */
.bar.is-solid::after { opacity: 1; }
.mark { display: inline-flex; align-items: center; gap: var(--space-3); text-decoration: none; color: var(--color-ink); }
.mark svg { width: 26px; height: 26px; color: var(--color-accent); flex: none; }
.mark__word { font: 700 1.02rem/1 var(--font-display); letter-spacing: 0.16em; }
.mark__sub { font: 450 var(--text-xs)/1 var(--font-body); color: var(--color-muted); letter-spacing: 0.02em; padding-left: var(--space-3); border-left: 1px solid var(--color-rule); }
.bar__nav { display: flex; gap: var(--space-5); margin-left: auto; }
.bar__nav a { font: 500 var(--text-sm)/1 var(--font-body); color: var(--color-muted-hi); text-decoration: none; padding: var(--space-2) 0; white-space: nowrap; transition: color var(--dur-fast) var(--ease-out); }
.bar__nav a:hover, .bar__nav a[aria-current="page"] { color: var(--color-ink); }
.bar__nav a[aria-current="page"] { box-shadow: inset 0 -1px 0 var(--color-accent); }
.bar .btn { min-height: 40px; padding: 0 var(--space-4); }
.bar__menu { display: none; margin-left: auto; width: 44px; height: 44px; border-radius: var(--radius-pill); border: 1px solid var(--color-rule); background: var(--color-glass); color: var(--color-ink); cursor: pointer; }
.bar__menu span { display: block; width: 16px; height: 1.5px; margin: 4px auto; background: currentColor; transition: transform var(--dur-fast) var(--ease-out), opacity var(--dur-fast); }
.bar__menu[aria-expanded="true"] span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
.bar__menu[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.bar__menu[aria-expanded="true"] span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }
#menu-sheet { position: fixed; inset: 0; z-index: 45; display: none; padding: 96px var(--gutter) var(--space-7); background: oklch(11% 0.02 240 / 0.96); }
#menu-sheet[data-open="true"] { display: flex; flex-direction: column; gap: var(--space-2); }
#menu-sheet a { font: 600 var(--text-2xl)/1.15 var(--font-display); letter-spacing: var(--track-snug); color: var(--color-ink); text-decoration: none; padding: var(--space-2) 0; }
#menu-sheet a[aria-current="page"] { color: var(--color-accent); }
#menu-sheet .btn { margin-top: var(--space-5); align-self: flex-start; font-size: var(--text-base); }
@media (max-width: 1080px) { .bar__nav, .bar > .btn { display: none; } .bar__menu { display: block; } }
@media (max-width: 520px) { .mark__sub { display: none; } }

/* ------------------------------------------------------------------ the stage (all scene pages) */
.stage { position: fixed; inset: 0; z-index: 0; background: var(--color-paper); }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity 600ms var(--ease-out); }
.gl-ready .stage canvas[data-ready="true"] { opacity: 1; }
.stage .poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: opacity 700ms var(--ease-out); }
.gl-ready .stage .poster { opacity: 0; }
.still-film { position: absolute; inset: 0; display: none; }
.still-film img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 500ms var(--ease-out); }
.still-film img.on { opacity: 1; }
.no-gl .still-film { display: block; }
.no-gl .stage canvas, .no-gl .stage .poster { display: none; }
@media (prefers-reduced-motion: reduce) { .still-film img { transition: opacity 150ms linear; } }

/* ------------------------------------------------------------------ home: copy over the world */
.page-home #spacer { width: 1px; }
.copy { position: fixed; inset: 0; z-index: 20; pointer-events: none; }
.wp { position: absolute; visibility: hidden; opacity: 0; will-change: opacity, transform; max-width: min(36rem, calc(100vw - 2 * var(--gutter))); }
.wp.is-live { pointer-events: auto; }
.wp::before { content: ""; position: absolute; z-index: -1; inset: -18% -22% -22% -26%; pointer-events: none;
  background: radial-gradient(closest-side, oklch(9% 0.02 240 / 0.66), oklch(9% 0.02 240 / 0.35) 55%, oklch(9% 0.02 240 / 0) 100%); }
.wp h1 { font-size: var(--text-display); max-width: 13ch; }
.wp h2 { font-size: var(--text-3xl); max-width: 14ch; }
.wp p { color: var(--color-muted); font-size: var(--text-lg); line-height: 1.55; margin-top: var(--space-4); max-width: 34ch; }
.wp .ctas { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-6); }
.wp--lead { left: var(--gutter); bottom: clamp(7.5rem, 16vh, 11rem); }
.wp--trail { right: var(--gutter); bottom: clamp(7.5rem, 18vh, 12rem); text-align: left; }
.wp--hero { left: var(--gutter); bottom: clamp(6rem, 13vh, 9.5rem); max-width: min(46rem, calc(100vw - 2 * var(--gutter))); }
.wp--hero p { max-width: 40ch; }
.wp--top { left: var(--gutter); top: clamp(6.5rem, 15vh, 9rem); }
.quote { margin: 0 0 var(--space-5); padding: var(--space-4) var(--space-5); border-radius: var(--radius-md); background: var(--color-glass); border: 1px solid var(--color-rule-soft); box-shadow: var(--e1), var(--edge); max-width: 30rem; }
.quote blockquote { margin: 0; font: 520 var(--text-xl)/1.3 var(--font-display); letter-spacing: var(--track-snug); color: var(--color-ink); }
.quote figcaption { margin-top: var(--space-3); font-size: var(--text-sm); color: var(--color-muted); }
.quote figcaption b { color: var(--color-accent); font-weight: 600; }
.wp .hint, .hint { display: flex; align-items: center; gap: var(--space-3); margin-top: var(--space-5); font-size: var(--text-sm); color: var(--color-ink); }
.wp--finale { left: var(--gutter); bottom: clamp(7rem, 15vh, 10rem); max-width: min(34rem, calc(100vw - 2 * var(--gutter))); }
.wp--finale::before { inset: -22% -30% -40% -40%; background: radial-gradient(closest-side, oklch(8% 0.02 240 / 0.86), oklch(8% 0.02 240 / 0.5) 60%, oklch(8% 0.02 240 / 0)); }
.wp--finale h2 { max-width: 9ch; font-size: var(--text-display); }
.wp--finale p { max-width: 36ch; }
.colophon { margin-top: var(--space-7); display: inline-flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); padding: var(--space-2) var(--space-4); border-radius: var(--radius-md); background: oklch(9% 0.02 240 / 0.72); font-size: var(--text-sm); color: var(--color-muted); }
.colophon a { color: var(--color-ink); text-decoration: none; }
.colophon span { flex-basis: 100%; font: 500 var(--text-xs)/1.4 var(--font-mono); letter-spacing: var(--track-wide); text-transform: uppercase; color: var(--color-muted); }
.colophon a:hover { color: var(--color-ink); }

/* persistent trace control once the atlas has formed */
.trace-dock { position: fixed; right: var(--gutter); bottom: var(--space-6); z-index: 30; display: flex; align-items: center; gap: var(--space-3);
  opacity: 0; visibility: hidden; transition: opacity var(--dur-slow) var(--ease-out), visibility 0s linear var(--dur-slow); }
.can-trace .trace-dock { opacity: 1; visibility: visible; transition: opacity var(--dur-slow) var(--ease-out); }
.trace-dock span { font-size: var(--text-sm); color: var(--color-muted); text-shadow: 0 1px 8px oklch(9% 0.02 240); }
@media (max-width: 760px) { .trace-dock span { display: none; } }
.trace-card { position: fixed; left: 0; top: 0; z-index: 40; width: min(22rem, calc(100vw - 32px)); padding: var(--space-4) var(--space-5); pointer-events: none;
  border-radius: var(--radius-md); background: var(--color-glass); border: 1px solid oklch(83% 0.145 78 / 0.35); box-shadow: var(--e2), var(--edge); }
.trace-card[hidden] { display: none; }
.trace-card__fact { font: 520 var(--text-lg)/1.35 var(--font-display); letter-spacing: var(--track-snug); }
.trace-card__meta { margin-top: var(--space-2); font-size: var(--text-sm); color: var(--color-muted); }
.trace-card__tag { margin-top: var(--space-3); font: 500 var(--text-xs)/1 var(--font-mono); letter-spacing: var(--track-wide); text-transform: uppercase; color: var(--color-accent); }

/* labels anchored to 3D points */
.labels { position: fixed; inset: 0; z-index: 15; pointer-events: none; }
.tag { position: absolute; left: 0; top: 0; translate: -50% -100%; opacity: 0; white-space: nowrap; transition: opacity var(--dur-base) var(--ease-out); }
.tag--cluster { font: 500 var(--text-xs)/1 var(--font-mono); letter-spacing: var(--track-wide); text-transform: uppercase; color: var(--color-ink); padding: 5px 8px; border-radius: var(--radius-sm); background: oklch(10% 0.02 240 / 0.92); }
.tag--q, .tag--a, .tag--h { white-space: normal; width: max-content; max-width: 17rem; padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--color-glass); border: 1px solid var(--color-rule-soft); font-size: var(--text-sm); line-height: 1.4; box-shadow: var(--e1); }
.tag b { display: block; margin-bottom: 4px; font: 500 var(--text-xs)/1 var(--font-mono); letter-spacing: var(--track-wide); text-transform: uppercase; }
.tag--q b { color: oklch(84% 0.11 215); }
.tag--a { border-color: oklch(83% 0.145 78 / 0.45); }
.tag--a b { color: var(--color-accent); }
.tag--h b { color: var(--color-ink); }

/* ------------------------------------------------------------------ the flight map */
.map { position: fixed; right: var(--gutter); top: 92px; z-index: 30; width: 116px; }
.map__frame { position: relative; aspect-ratio: 200 / 220; }
.map svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.map__river { fill: none; stroke: oklch(55% 0.04 225); stroke-linecap: round; stroke-linejoin: round; opacity: 0.5; transition: stroke var(--dur-slow) var(--ease-out), opacity var(--dur-slow); }
.map__river.o4 { stroke-width: 1.6; } .map__river.o3 { stroke-width: 1.1; } .map__river.o2 { stroke-width: 0.8; } .map__river.o1 { stroke-width: 0.6; }
.map__river.is-lit { stroke: var(--color-accent); opacity: 0.95; }
.map__lake { fill: oklch(28% 0.04 235); stroke: oklch(55% 0.04 225); stroke-width: 0.6; }
.map__pt { position: absolute; width: 26px; height: 26px; margin: -13px 0 0 -13px; padding: 0; border: 0; background: transparent; cursor: pointer; border-radius: 50%; }
.map__pt::after { content: ""; position: absolute; inset: 9px; border-radius: 50%; border: 1.5px solid var(--color-muted); background: var(--color-paper); transition: transform var(--dur-fast) var(--ease-out), border-color var(--dur-fast); }
.map__pt[aria-current="step"]::after { border-color: var(--color-accent); background: var(--color-accent); }
.map__pt:hover::after, .map__pt:focus-visible::after { transform: scale(1.35); border-color: var(--color-accent); }
.map__tip { position: absolute; right: 100%; top: 50%; translate: -6px -50%; white-space: nowrap; font-size: var(--text-xs); padding: 4px 8px; border-radius: var(--radius-sm); background: var(--color-glass); color: var(--color-ink); opacity: 0; pointer-events: none; transition: opacity var(--dur-fast) var(--ease-out); }
.map__pt:hover .map__tip, .map__pt:focus-visible .map__tip { opacity: 1; }
.map__bead { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--color-accent-hi); box-shadow: 0 0 0 3px oklch(83% 0.145 78 / 0.25), 0 0 14px oklch(83% 0.145 78 / 0.8); pointer-events: none; }
.map__bead.is-high { box-shadow: 0 0 0 6px oklch(83% 0.145 78 / 0.15), 0 0 20px oklch(83% 0.145 78 / 0.9); }
.map__name { text-align: right; margin-top: var(--space-2); font: 500 var(--text-xs)/1.2 var(--font-mono); letter-spacing: var(--track-wide); text-transform: uppercase; color: var(--color-ink); }
.map__progress { margin-top: var(--space-2); height: 2px; background: var(--color-rule-soft); border-radius: 2px; overflow: hidden; }
.map__progress i { display: block; height: 100%; width: 100%; background: var(--color-accent); transform-origin: left; transform: scaleX(var(--trip, 0)); }
@media (max-width: 760px) {
  .map { width: 84px; left: auto; right: var(--gutter); top: 80px; bottom: auto; }
  .map__name, .map__progress { display: none; }
  .map__tip { display: none; }
  .map__pt { width: 22px; height: 22px; margin: -11px 0 0 -11px; }
  .map__pt::after { inset: 7px; }
}

/* home on phones: copy recomposed, not shrunk */
@media (max-width: 760px) {
  .wp, .wp--hero, .wp--lead, .wp--trail, .wp--top { left: var(--gutter); right: var(--gutter); max-width: none; bottom: calc(var(--space-8) + env(safe-area-inset-bottom)); top: auto; }
  .wp--finale { left: var(--gutter); right: var(--gutter); max-width: none; bottom: var(--space-6); }
  .wp--finale h2 { max-width: none; }
  .wp h2 { font-size: var(--text-2xl); }
  .wp--finale h2 { font-size: var(--text-3xl); }
  .wp p { font-size: var(--text-base); }
  .wp::before { inset: -30% -12% -12% -12%; }
  .quote blockquote { font-size: var(--text-lg); }
  .trace-dock { right: var(--gutter); bottom: var(--space-4); }
}
@media (max-height: 560px) and (min-width: 761px) {
  .wp h1 { font-size: var(--text-3xl); }
  .wp h2 { font-size: var(--text-2xl); }
}

/* ================================================================== inner pages */
.scene { position: relative; height: calc(var(--span, 5) * 100svh); }
.scene__frame { position: sticky; top: 0; height: 100svh; overflow: hidden; }
.scene__frame .stage { position: absolute; }
.scene__copy { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.cap { position: absolute; left: var(--gutter); bottom: clamp(4.5rem, 12vh, 8rem); max-width: min(30rem, calc(100vw - 2 * var(--gutter))); visibility: hidden; opacity: 0; }
.cap::before { content: ""; position: absolute; z-index: -1; inset: -24% -30% -26% -34%; pointer-events: none;
  background: radial-gradient(closest-side, oklch(9% 0.02 240 / 0.74), oklch(9% 0.02 240 / 0.4) 55%, oklch(9% 0.02 240 / 0)); }
.cap h1 { font-size: var(--text-display); max-width: 12ch; }
.cap h2 { font-size: var(--text-3xl); }
.cap p { margin-top: var(--space-4); color: var(--color-muted); font-size: var(--text-lg); max-width: 34ch; }
.cap--hero { bottom: clamp(5rem, 14vh, 9rem); max-width: min(40rem, calc(100vw - 2 * var(--gutter))); }
.cap__kicker { color: var(--color-accent-hi); margin: 0 0 var(--space-4) !important; font-size: var(--text-xs) !important; }
.cap--right { left: auto; right: var(--gutter); }
.scene__note { position: absolute; right: var(--gutter); bottom: var(--space-5); z-index: 5; color: var(--color-muted); opacity: 0.8; font-size: 0.6875rem; }
.no-gl .scene__frame .poster { display: block; opacity: 1; }
@media (max-width: 760px) {
  .cap, .cap--hero, .cap--right { left: var(--gutter); right: var(--gutter); max-width: none; bottom: calc(var(--space-7) + env(safe-area-inset-bottom)); }
  .cap h1 { font-size: var(--text-3xl); }
  .cap h2 { font-size: var(--text-2xl); }
  .cap p { font-size: var(--text-base); }
  .cap::before { inset: -30% -12% -16% -12%; }
  .scene__note { left: var(--gutter); right: auto; top: 78px; bottom: auto; }
}

.flow { position: relative; z-index: 2; background: var(--color-paper); }
.sect { padding: var(--space-10) var(--gutter) var(--space-9); max-width: 1280px; margin: 0 auto; }
.sect__head { max-width: 44rem; margin-bottom: var(--space-7); }
.sect__head h2 { font-size: var(--text-3xl); }
.sect__head p { margin-top: var(--space-4); color: var(--color-muted); font-size: var(--text-lg); max-width: 52ch; }
[data-reveal] { opacity: 0; transform: translateY(14px); transition: opacity 700ms var(--ease-out), transform 700ms var(--ease-out); }
[data-reveal].is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { [data-reveal] { transform: none; transition: opacity 150ms linear; } }
@media (max-width: 760px) { .sect { padding: var(--space-8) var(--gutter) var(--space-7); } .sect__head h2 { font-size: var(--text-2xl); } }

/* fact anatomy */
.anatomy { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: var(--space-7); align-items: center; }
.anatomy__card { position: relative; padding: var(--space-5); border-radius: var(--radius-md); background: var(--color-paper-2); border: 1px solid var(--color-rule-soft); box-shadow: var(--e2), var(--edge); display: grid; gap: 2px; }
.anatomy__field { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: var(--space-4); align-items: baseline; width: 100%; text-align: left; padding: var(--space-3) var(--space-4); border: 0; border-radius: var(--radius-sm); background: transparent; color: inherit; font: inherit; cursor: pointer; transition: background-color var(--dur-fast) var(--ease-out); }
.anatomy__field[aria-pressed="true"] { background: var(--color-paper-3); box-shadow: inset 2px 0 0 var(--color-accent); }
@media (hover: hover) and (pointer: fine) { .anatomy__field:hover { background: var(--color-paper-3); } }
.anatomy__label { font: 500 var(--text-xs)/1.4 var(--font-mono); letter-spacing: var(--track-wide); text-transform: uppercase; color: var(--color-muted); }
.anatomy__value { font-size: var(--text-base); color: var(--color-ink); }
.anatomy__field--fact .anatomy__value { font: 560 var(--text-xl)/1.3 var(--font-display); letter-spacing: var(--track-snug); }
.anatomy__value--ok { color: var(--color-accent); }
.anatomy__sample { position: absolute; right: var(--space-5); top: calc(-1 * var(--space-5)); color: var(--color-accent); font-size: 0.6875rem; padding: 4px 8px; border-radius: var(--radius-sm); background: var(--color-paper); border: 1px solid var(--color-rule-soft); }
.anatomy__note { font: 500 var(--text-xl)/1.4 var(--font-display); letter-spacing: var(--track-snug); color: var(--color-ink); max-width: 26ch; min-height: 6em; }
@media (max-width: 900px) { .anatomy { grid-template-columns: minmax(0, 1fr); } .anatomy__note { min-height: 0; } .anatomy__field { grid-template-columns: minmax(0, 1fr); gap: var(--space-1); } }

/* ledger list */
.ledger { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--space-8); }
.ledger li { display: grid; gap: var(--space-2); padding: var(--space-5) 0; border-top: var(--rule); }
.ledger b { font: 600 var(--text-xl)/1.2 var(--font-display); letter-spacing: var(--track-snug); }
.ledger span { color: var(--color-muted); max-width: 46ch; }
@media (max-width: 760px) { .ledger { grid-template-columns: minmax(0, 1fr); } }

.refuse { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-6) var(--space-8); }
.refuse p { color: var(--color-muted); font-size: var(--text-lg); max-width: 40ch; }
.refuse b { display: block; color: var(--color-ink); font: 600 var(--text-xl)/1.25 var(--font-display); letter-spacing: var(--track-snug); margin-bottom: var(--space-2); }
@media (max-width: 760px) { .refuse { grid-template-columns: minmax(0, 1fr); } }

.band { padding: var(--space-10) var(--gutter); text-align: center; background: radial-gradient(60% 120% at 50% 100%, oklch(30% 0.06 70 / 0.35), transparent 70%), var(--color-paper); border-top: var(--rule); }
.band h2 { font-size: var(--text-3xl); max-width: 18ch; margin: 0 auto; }
.band__ctas { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-3); margin-top: var(--space-6); }

.foot { position: relative; z-index: 2; background: var(--color-paper); padding: var(--space-9) var(--gutter) var(--space-6); border-top: var(--rule); }
.foot__line { font: 650 var(--text-display)/1 var(--font-display); letter-spacing: var(--track-tight); max-width: 14ch; }
.foot__row { margin-top: var(--space-8); display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-4) var(--space-6); font-size: var(--text-sm); color: var(--color-muted); }
.foot__row nav { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); }
.foot__row a { color: var(--color-muted); text-decoration: none; }
.foot__row a:hover { color: var(--color-ink); }

/* ================================================================== atlas: the live surface */
.page-atlas .scene__frame { cursor: grab; }
.page-atlas .labels { position: absolute; }
.surface { position: absolute; z-index: 10; left: var(--gutter); top: 84px; bottom: 64px; width: min(22rem, 34vw); display: flex; flex-direction: column; gap: var(--space-4);
  padding: var(--space-5); border-radius: var(--radius-md); background: oklch(13% 0.022 240 / 0.9); border: 1px solid var(--color-rule-soft); box-shadow: var(--e2), var(--edge); overflow: auto; cursor: auto; overscroll-behavior: contain; }
.surface__kicker { color: var(--color-accent); }
.surface h1 { font-size: var(--text-xl); letter-spacing: var(--track-snug); margin-top: var(--space-2); }
.surface__note { margin-top: var(--space-2); font-size: var(--text-sm); color: var(--color-muted); }
.surface__tabs { display: flex; flex-wrap: wrap; gap: var(--space-1); padding: 3px; border-radius: var(--radius-md); background: var(--color-paper); border: 1px solid var(--color-rule-soft); }
.surface__tabs [role="tab"] { flex: 1 1 auto; min-height: 34px; padding: 0 var(--space-3); border: 0; border-radius: 9px; background: transparent; color: var(--color-muted); font: 500 var(--text-sm)/1 var(--font-body); white-space: nowrap; cursor: pointer; transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast); }
.surface__tabs [role="tab"][aria-selected="true"] { background: var(--color-paper-3); color: var(--color-ink); box-shadow: inset 0 -2px 0 var(--color-accent); }
.surface__tabs [role="tab"]:hover { color: var(--color-ink); }
.panel__hint { font-size: var(--text-sm); color: var(--color-muted); }
.panel__metric { margin-top: var(--space-4); font: 520 var(--text-lg)/1.35 var(--font-display); }
.panel__metric b { color: var(--color-accent); font-size: var(--text-2xl); font-variant-numeric: tabular-nums; margin-right: 4px; }
.panel__sub { margin-top: var(--space-2); font-size: var(--text-sm); color: var(--color-muted); }
.legend { list-style: none; margin: var(--space-3) 0 0; padding: 0; display: grid; gap: 2px; }
.legend li { display: grid; grid-template-columns: 14px 1fr auto; align-items: center; gap: var(--space-3); font-size: var(--text-sm); padding: 5px 0; }
.legend b { font-variant-numeric: tabular-nums; color: var(--color-muted); font-weight: 500; }
.sw { width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px var(--color-paper); }
.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); }
.chip { min-height: 34px; padding: 0 var(--space-3); border-radius: var(--radius-pill); border: 1px solid var(--color-rule); background: transparent; color: var(--color-ink); font: 500 var(--text-sm)/1 var(--font-body); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--color-accent); color: var(--color-accent-ink); border-color: transparent; }
.list { list-style: none; margin: var(--space-3) 0 0; padding: 0; display: grid; gap: 2px; }
.list button, .steps button { width: 100%; display: grid; grid-template-columns: auto 1fr; gap: 2px var(--space-3); text-align: left; padding: var(--space-2) var(--space-3); border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--color-ink); font: 400 var(--text-sm)/1.4 var(--font-body); cursor: pointer; }
.list button:hover, .steps button:hover { background: var(--color-paper-3); }
.list button small { grid-column: 2; color: var(--color-muted); font-size: var(--text-xs); }
.list--tight button { grid-template-columns: 1fr; }
.dot { width: 14px; height: 14px; margin-top: 3px; border-radius: 50%; display: grid; place-items: center; font: 700 9px/1 var(--font-mono); }
.dot--gap { border: 1.5px solid var(--color-alert); }
.dot--review { background: oklch(80% 0.15 75); color: var(--color-accent-ink); }
.steps { margin: var(--space-3) 0 0; padding-left: 1.4rem; display: grid; gap: 2px; }
.steps li::marker { font: 600 var(--text-xs) var(--font-mono); color: var(--color-accent); }
.steps button { grid-template-columns: 1fr; }
.ramp { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--space-3); margin-top: var(--space-3); font-size: var(--text-xs); color: var(--color-muted); }
.ramp i { height: 8px; border-radius: 4px; background: linear-gradient(90deg, oklch(83% 0.145 78), oklch(32% 0.06 60)); }
.surface__search input { width: 100%; min-height: 42px; padding: 0 var(--space-4); border-radius: var(--radius-pill); border: 1px solid var(--color-rule); background: var(--color-paper); color: var(--color-ink); font: inherit; font-size: var(--text-sm); }
.surface__search input::placeholder { color: oklch(66% 0.02 230); }
.surface__detail { border-top: var(--rule); padding-top: var(--space-4); }
.st { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: var(--radius-sm); font: 500 var(--text-xs)/1.2 var(--font-mono); letter-spacing: 0.04em; text-transform: uppercase; }
.st--ok { color: var(--color-accent); background: oklch(83% 0.145 78 / 0.12); }
.st--review { color: oklch(86% 0.13 80); background: oklch(80% 0.15 75 / 0.16); }
.st--gap { color: var(--color-alert); background: oklch(74% 0.14 32 / 0.14); }
.detail__text { margin-top: var(--space-3); font: 540 var(--text-lg)/1.35 var(--font-display); letter-spacing: var(--track-snug); }
.detail__meta { margin: var(--space-3) 0 0; display: grid; gap: var(--space-2); }
.detail__meta div { display: grid; grid-template-columns: 7.5rem 1fr; gap: var(--space-3); font-size: var(--text-sm); }
.detail__meta dt { color: var(--color-muted); }
.detail__meta dd { margin: 0; }
.detail__rel { margin-top: var(--space-4); font: 500 var(--text-xs)/1 var(--font-mono); letter-spacing: var(--track-wide); text-transform: uppercase; color: var(--color-muted); }
.surface-tools { position: absolute; z-index: 10; right: var(--gutter); top: 84px; display: flex; gap: var(--space-2); }
.tool { min-width: 40px; height: 40px; padding: 0 var(--space-3); border-radius: var(--radius-pill); border: 1px solid var(--color-rule); background: var(--color-glass); color: var(--color-ink); font: 500 var(--text-base)/1 var(--font-body); cursor: pointer; }
.tool--wide { font-size: var(--text-sm); }
.tool:hover { border-color: var(--color-accent); }
.statusbar { position: absolute; z-index: 10; left: 0; right: 0; bottom: 0; min-height: 48px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-6); padding: var(--space-2) var(--gutter);
  background: oklch(11% 0.02 240 / 0.9); border-top: 1px solid var(--color-rule-soft); font-size: var(--text-sm); color: var(--color-muted); }
.statusbar b { color: var(--color-ink); font-variant-numeric: tabular-nums; font-weight: 600; }
.statusbar i { font-style: normal; opacity: 0.5; margin: 0 4px; }
.statusbar__tour { display: inline-flex; align-items: center; gap: var(--space-3); color: var(--color-ink); }
.tour-dots { display: inline-flex; gap: 4px; }
.tour-dots i { width: 6px; height: 6px; margin: 0; border-radius: 50%; background: var(--color-rule); opacity: 1; }
.tour-dots i.on { background: var(--color-accent); }
.tag--topic { font: 500 var(--text-xs)/1 var(--font-mono); letter-spacing: var(--track-wide); text-transform: uppercase; color: var(--color-ink); padding: 5px 8px 5px 18px; border-radius: var(--radius-sm); background: oklch(10% 0.02 240 / 0.92); translate: -50% calc(-100% - 14px); }
.tag--topic::before { content: ""; position: absolute; left: 7px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--c); }
.tag--step { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: var(--color-accent); color: var(--color-accent-ink); font: 700 11px/1 var(--font-mono); translate: -50% calc(-100% - 10px); }
.hover-tip { position: fixed; left: 0; top: 0; z-index: 60; max-width: 280px; padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--color-glass); border: 1px solid var(--color-rule-soft); box-shadow: var(--e1); font-size: var(--text-sm); pointer-events: none; }
.hover-tip b { display: block; margin-bottom: 4px; font: 500 var(--text-xs)/1 var(--font-mono); letter-spacing: var(--track-wide); text-transform: uppercase; color: var(--color-accent); }
.hover-tip[hidden] { display: none; }
@media (max-width: 900px) {
  .surface { top: auto; bottom: 0; left: 0; right: 0; width: auto; max-height: 46svh; border-radius: var(--radius-md) var(--radius-md) 0 0; padding: var(--space-4) var(--gutter) calc(var(--space-6) + 48px); }
  .surface__head .surface__note, .surface h1 { display: none; }
  .surface__tabs { flex-wrap: nowrap; overflow-x: auto; }
  .statusbar__stats { display: none; }
  .surface-tools { top: 80px; }
}

/* table view */
.table-tools { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-4); font-size: var(--text-sm); color: var(--color-muted); }
.table-tools select { margin-left: var(--space-2); min-height: 40px; padding: 0 var(--space-3); border-radius: var(--radius-sm); border: 1px solid var(--color-rule); background: var(--color-paper-2); color: var(--color-ink); font: inherit; }
.table-wrap { overflow-x: auto; border: 1px solid var(--color-rule-soft); border-radius: var(--radius-md); max-height: 34rem; }
.facts { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.facts th { position: sticky; top: 0; text-align: left; padding: var(--space-3) var(--space-4); background: var(--color-paper-2); font: 500 var(--text-xs)/1 var(--font-mono); letter-spacing: var(--track-wide); text-transform: uppercase; color: var(--color-muted); }
.facts td { padding: var(--space-3) var(--space-4); border-top: 1px solid var(--color-rule-soft); vertical-align: top; }
.facts td:first-child { min-width: 22rem; color: var(--color-ink); }
.facts td:not(:first-child) { color: var(--color-muted); white-space: nowrap; }
.facts em { font-style: normal; color: var(--color-alert); }

/* ================================================================== fluency */
.page-fluency .labels { position: absolute; }
.daydial { position: absolute; z-index: 6; right: var(--gutter); top: 96px; display: grid; justify-items: end; gap: 2px; text-align: right; }
.daydial b { font: 650 clamp(3rem, 2rem + 4vw, 5.6rem)/0.9 var(--font-display); letter-spacing: var(--track-tight); font-variant-numeric: tabular-nums; color: var(--color-accent); }
.daydial .mono { color: var(--color-muted); }
.tag--axis { font: 500 var(--text-xs)/1 var(--font-mono); letter-spacing: var(--track-wide); text-transform: uppercase; color: var(--color-muted); translate: -50% 0; }
.tag--topicaxis { color: var(--color-ink); translate: 0 -50%; padding-left: 14px; }
.tag--topicaxis::before { content: ""; position: absolute; left: 0; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: var(--c); }
.facts--num td { text-align: right; font-variant-numeric: tabular-nums; color: var(--color-ink) !important; }
.facts--num th[scope="row"] { position: static; background: none; text-align: left; font: 400 var(--text-sm)/1.3 var(--font-body); letter-spacing: 0; text-transform: none; color: var(--color-ink); display: flex; gap: var(--space-3); align-items: center; padding: var(--space-3) var(--space-4); border-top: 1px solid var(--color-rule-soft); }
.facts--num thead th:not(:first-child) { text-align: right; }
@media (max-width: 760px) { .daydial { top: 76px; } .daydial b { font-size: 2.6rem; } }

/* ================================================================== with BOISE AI */
.stations { position: absolute; inset: 0; z-index: 6; pointer-events: none; }
.station { position: absolute; left: 0; top: 0; width: min(19rem, calc(100vw - 32px)); padding: var(--space-4) var(--space-5); border-radius: var(--radius-md); background: oklch(12% 0.022 240 / 0.86); border: 1px solid var(--color-rule-soft); box-shadow: var(--e2), var(--edge); visibility: hidden; opacity: 0; pointer-events: auto; transition: opacity var(--dur-base) var(--ease-out); }
.station .mono { color: var(--color-accent); font-size: 0.6875rem; }
.station h2 { font-size: var(--text-xl); margin-top: var(--space-2); }
.station p:not(.mono) { margin-top: var(--space-2); font-size: var(--text-sm); color: var(--color-muted); }
.station .link { display: inline-block; margin-top: var(--space-3); font-size: var(--text-sm); }
@media (max-width: 760px) { .station { left: var(--gutter) !important; transform: none !important; top: auto !important; bottom: calc(var(--space-7) + env(safe-area-inset-bottom)); width: auto; right: var(--gutter); } }
.duo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-6); }
.duo__col { padding: var(--space-6); border-radius: var(--radius-md); background: var(--color-paper-2); border: 1px solid var(--color-rule-soft); box-shadow: var(--edge); }
.duo__name { display: flex; align-items: center; gap: var(--space-3); font: 650 var(--text-2xl)/1 var(--font-display); letter-spacing: var(--track-snug); }
.duo__mark { width: 12px; height: 12px; border-radius: 50%; }
.duo__mark--gold { background: var(--color-accent); }
.duo__mark--cyan { background: var(--color-partner); }
.duo ul { margin: var(--space-5) 0 var(--space-4); padding-left: 1.1rem; display: grid; gap: var(--space-3); color: var(--color-muted); }
.duo li::marker { color: var(--color-rule); }
@media (max-width: 760px) { .duo { grid-template-columns: minmax(0, 1fr); } }

/* ================================================================== start */
.cap__touch { margin-top: var(--space-5) !important; font: 500 var(--text-xs)/1 var(--font-mono) !important; letter-spacing: var(--track-wide); text-transform: uppercase; color: var(--color-accent) !important; }
@media (hover: none) { .cap__touch { display: none; } }
.formgrid { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.3fr); gap: var(--space-8); align-items: start; }
.formgrid__intro h2 { font-size: var(--text-3xl); }
.howto { margin: var(--space-6) 0 0; padding-left: 1.3rem; display: grid; gap: var(--space-4); color: var(--color-muted); }
.howto b { color: var(--color-ink); font-weight: 600; }
.howto li::marker { font: 600 var(--text-sm) var(--font-mono); color: var(--color-accent); }
.preview-note { margin-top: var(--space-6); padding: var(--space-4); border-radius: var(--radius-md); border: 1px dashed var(--color-rule); font-size: var(--text-sm); color: var(--color-muted); }
.preview-note b { color: var(--color-ink); }
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-5); padding: var(--space-6); border-radius: var(--radius-md); background: var(--color-paper-2); border: 1px solid var(--color-rule-soft); box-shadow: var(--e1), var(--edge); }
.field { display: grid; gap: var(--space-2); min-width: 0; margin: 0; padding: 0; border: 0; }
.field--wide { grid-column: 1 / -1; }
.field label, .field legend { font-size: var(--text-sm); font-weight: 500; color: var(--color-ink); padding: 0; }
.field label span { margin-left: var(--space-2); font: 500 var(--text-xs)/1 var(--font-mono); letter-spacing: var(--track-wide); text-transform: uppercase; color: var(--color-accent); }
.field input, .field select, .field textarea { width: 100%; min-height: 46px; padding: var(--space-3) var(--space-4); border-radius: var(--radius-sm); border: 1px solid var(--color-rule); background: var(--color-paper); color: var(--color-ink); font: inherit; font-size: var(--text-base); transition: border-color var(--dur-fast) var(--ease-out); }
.field textarea { resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: oklch(64% 0.02 230); }
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--color-muted); }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible { border-color: var(--color-accent); outline-offset: 1px; }
.field [aria-invalid="true"] { border-color: var(--color-alert); }
.checks { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-2); }
.checks label { position: relative; cursor: pointer; }
.checks input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.checks span { display: inline-flex; align-items: center; min-height: 40px; padding: 0 var(--space-4); border-radius: var(--radius-pill); border: 1px solid var(--color-rule); font-size: var(--text-sm); transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast); }
.checks input:checked + span { background: var(--color-accent); color: var(--color-accent-ink); border-color: transparent; }
.checks input:focus-visible + span { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.checks label:hover span { border-color: var(--color-muted); }
.form__submit { justify-items: start; }
.form__result { grid-column: 1 / -1; padding: var(--space-5); border-radius: var(--radius-md); background: var(--color-paper); border: 1px solid var(--color-rule-soft); }
.form__result[data-state="error"] { border-color: var(--color-alert); }
.form__result pre { margin: var(--space-4) 0; padding: var(--space-4); border-radius: var(--radius-sm); background: var(--color-paper-3); font: 400 var(--text-sm)/1.6 var(--font-mono); white-space: pre-wrap; color: var(--color-ink); }
.form__after { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-5); }
.faq { display: grid; gap: 0; max-width: 52rem; }
.faq details { border-top: var(--rule); }
.faq details:last-child { border-bottom: var(--rule); }
.faq summary { cursor: pointer; padding: var(--space-5) 0; font: 600 var(--text-xl)/1.25 var(--font-display); letter-spacing: var(--track-snug); list-style: none; display: flex; justify-content: space-between; gap: var(--space-4); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font: 400 var(--text-xl)/1 var(--font-mono); color: var(--color-accent); transition: transform var(--dur-base) var(--ease-out); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { padding: 0 0 var(--space-5); color: var(--color-muted); max-width: 60ch; }
@media (max-width: 900px) { .formgrid { grid-template-columns: minmax(0, 1fr); gap: var(--space-6); } .form { grid-template-columns: minmax(0, 1fr); padding: var(--space-5); } }

.no-gl .station { left: var(--gutter); top: auto; bottom: clamp(4.5rem, 12vh, 8rem); width: min(26rem, calc(100vw - 2 * var(--gutter))); transform: none !important; }

/* pass 1 */
@media (max-width: 760px) { .at-close .trace-dock { opacity: 0; visibility: hidden; } }
@media (max-width: 900px) {
  .surface { height: 42svh; max-height: none; padding-bottom: var(--space-6); }
  .statusbar { bottom: 42svh; min-height: 0; padding: var(--space-2) var(--gutter); background: transparent; border: 0; }
  .statusbar__tour { font-size: var(--text-xs); text-shadow: 0 1px 6px oklch(9% 0.02 240); }
}
@media (max-width: 760px) { .tag--topicaxis { display: none; } }

/* pass 1: full-width copy on phones sits on a band, not a radial (the radial thins out at the edges) */
@media (max-width: 760px) {
  .wp::before, .cap::before, .wp--finale::before { inset: -95% calc(-1 * var(--gutter)) -40vh calc(-1 * var(--gutter)); background: linear-gradient(to top, oklch(8% 0.02 240 / 0.92) 0%, oklch(8% 0.02 240 / 0.8) 62%, oklch(8% 0.02 240 / 0) 100%); }
  .scene__note { padding: 4px 8px; border-radius: var(--radius-sm); background: oklch(9% 0.02 240 / 0.8); }
}
.cap .cap__kicker { color: var(--color-accent-hi); }

/* pass 2: the panel says when there is more below */
.surface::after { content: ""; position: sticky; bottom: calc(-1 * var(--space-5)); flex: none; height: 44px; margin: 0 calc(-1 * var(--space-5)) calc(-1 * var(--space-5)); background: linear-gradient(oklch(13% 0.022 240 / 0), oklch(13% 0.022 240 / 0.97) 85%); pointer-events: none; }
@media (max-width: 760px) { .surface::after { bottom: calc(-1 * var(--space-6)); margin: 0 calc(-1 * var(--gutter)) calc(-1 * var(--space-6)); } }
/* pass 2: the leg name sits over the open sky at top-right, so it carries its own backing */
@media (min-width: 761px) { .map__name { display: table; margin-left: auto; padding: 2px 6px; border-radius: var(--radius-sm); background: oklch(9% 0.02 240 / 0.72); } }

/* ---- vignettes: glowing figures in the flow (src/core/vignettes.js) ---- */
.vig { position: relative; display: block; margin: 0; pointer-events: none; }
.vig > .vig__cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity 900ms var(--ease-out); }
.vig.is-lit > .vig__cv { opacity: 1; }
.no-vig .vig, .vig--empty { display: none; }
.vig--foot { height: clamp(96px, 9vw, 150px); margin: var(--space-5) calc(-1 * var(--gutter)) 0; }
.foot__line + .vig--foot + .foot__row { margin-top: var(--space-5); }
