/* A Fate Made Elsewhere — Pacific editorial atlas */

:root {
  --bg: #03111c;
  --bg-deep: #010a11;
  --bg-2: #051a2a;
  --bg-card: #061f30;
  --ink: #eee6dc;
  --ink-strong: #fff9f2;
  --ink-dim: #b9c8ca;
  --ink-faint: #839a9e;
  --cyan: #4bb8b5;
  --cyan-strong: #37999b;
  --cyan-faint: #204d59;
  --coral: #e56f5b;
  --gold: #cda35e;
  --line: rgba(112, 159, 164, 0.18);
  --line-strong: rgba(112, 159, 164, 0.32);
  --grid: rgba(120, 160, 166, 0.2);
  --maxw: 82rem;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --shadow: 0 24px 70px rgba(0, 8, 14, 0.38);
}

* { box-sizing: border-box; }

html {
  background: var(--bg-deep);
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  position: relative;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 84% 18%, rgba(32, 113, 124, 0.12), transparent 30rem),
    linear-gradient(180deg, var(--bg) 0%, #041827 56%, var(--bg-deep) 100%);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.075rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.28;
  background-image:
    repeating-radial-gradient(ellipse at 12% 36%, transparent 0 28px, rgba(103, 213, 209, 0.045) 29px 30px, transparent 31px 46px),
    repeating-radial-gradient(ellipse at 92% 72%, transparent 0 38px, rgba(255, 127, 102, 0.035) 39px 40px, transparent 41px 62px);
  mask-image: linear-gradient(to bottom, #000, transparent 92%);
}

::selection { background: var(--coral); color: var(--bg-deep); }

a {
  color: var(--cyan);
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
}
a:hover, a:focus { color: var(--coral); }
strong { color: var(--ink-strong); font-weight: 700; }
.accent { color: var(--coral); }

:focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 4px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  clip: rect(0 0 0 0);
  overflow: hidden;
  white-space: nowrap;
}

.skip-link {
  position: fixed;
  left: 1.5rem;
  top: -5rem;
  z-index: 120;
  padding: 0.65rem 1rem;
  border-radius: 0 0 8px 8px;
  background: var(--coral);
  color: var(--bg-deep);
  font-family: var(--sans);
  font-weight: 700;
  text-decoration: none;
  transition: top 0.2s ease;
}
.skip-link:focus { top: 0; color: var(--bg-deep); }

/* -------------------------------------------------------------- navigation */
.topnav {
  position: fixed;
  inset: 0.85rem auto auto 50%;
  z-index: 90;
  display: flex;
  width: min(calc(100% - 2.5rem), 78rem);
  transform: translateX(-50%);
  justify-content: center;
  gap: clamp(0.2rem, 1.6vw, 1.6rem);
  padding: 0.55rem 0.75rem;
  overflow-x: auto;
  scrollbar-width: none;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(3, 20, 33, 0.78);
  box-shadow: 0 12px 36px rgba(0, 7, 12, 0.22);
  backdrop-filter: blur(14px) saturate(125%);
}
.topnav::-webkit-scrollbar { display: none; }

.topnav__btn {
  position: relative;
  min-height: 2.5rem;
  padding: 0.42rem clamp(0.75rem, 2vw, 1.4rem);
  border: 0;
  background: transparent;
  color: var(--ink-dim);
  cursor: pointer;
  font-family: var(--sans);
  font-size: 0.74rem;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: color 0.2s ease;
}
.topnav__btn::after {
  content: "";
  position: absolute;
  right: 28%;
  bottom: 0;
  left: 28%;
  height: 2px;
  transform: scaleX(0);
  background: var(--coral);
  transition: transform 0.22s ease;
}
.topnav__btn:hover, .topnav__btn:focus-visible { color: var(--ink-strong); }
.topnav__btn.is-active { color: var(--coral); }
.topnav__btn.is-active::after { transform: scaleX(1); }

/* -------------------------------------------------------------------- hero */
.hero {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(19rem, 0.82fr);
  grid-template-rows: auto auto auto auto;
  align-content: center;
  min-height: 100svh;
  padding: clamp(7.5rem, 12vw, 10rem) max(1.25rem, calc((100vw - var(--maxw)) / 2)) 4.5rem;
  text-align: left;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background: url("assets/hero-tikehau-atoll-nasa.jpg") 76% center / cover no-repeat;
  opacity: 0.7;
  mask-image: linear-gradient(90deg, transparent 4%, transparent 26%, #000 57%, #000 100%);
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(3, 20, 33, 0.99) 0%, rgba(3, 20, 33, 0.92) 32%, rgba(3, 20, 33, 0.28) 69%, rgba(3, 20, 33, 0.1) 100%),
    linear-gradient(0deg, var(--bg) 0%, transparent 22%);
}

.kicker {
  grid-column: 1;
  margin: 0 0 1.6rem;
  color: var(--cyan);
  font-family: var(--sans);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.hero h1 {
  grid-column: 1;
  max-width: none;
  margin: 0 0 1.35rem;
  color: var(--ink);
  font-size: clamp(4rem, 8.2vw, 7.8rem);
  font-weight: 400;
  letter-spacing: -0.045em;
  line-height: 0.88;
  text-wrap: balance;
}
.hero h1 em { display: block; color: var(--cyan); font-style: italic; }

.lede {
  grid-column: 1;
  max-width: 34rem;
  margin: 0 0 2.8rem;
  color: var(--ink-dim);
  font-family: var(--sans);
  font-size: clamp(1rem, 1.8vw, 1.2rem);
  line-height: 1.65;
}

.hero-stat {
  grid-column: 2;
  grid-row: 2 / span 2;
  align-self: center;
  justify-self: end;
  max-width: 25rem;
  margin: 0;
  padding: 0.8rem 0 0.8rem clamp(1.5rem, 3vw, 3rem);
  border-left: 1px solid rgba(255, 127, 102, 0.62);
}
.hero-stat .big {
  display: block;
  color: var(--coral);
  font-size: clamp(4.5rem, 9vw, 8rem);
  font-variant-numeric: tabular-nums;
  font-weight: 400;
  letter-spacing: -0.055em;
  line-height: 0.84;
}
.hero-stat-caption {
  display: block;
  max-width: 22rem;
  margin-top: 1.1rem;
  color: var(--ink-dim);
  font-family: var(--sans);
  font-size: 0.86rem;
  line-height: 1.55;
}

.scroll-cue {
  grid-column: 1;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  width: max-content;
  margin: 0;
  color: var(--ink-faint);
  font-family: var(--sans);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.scroll-cue::before {
  content: "";
  width: 1.35rem;
  height: 2.15rem;
  border: 1px solid var(--ink-faint);
  border-radius: 999px;
  background: radial-gradient(circle at 50% 28%, var(--coral) 0 2px, transparent 3px);
}
.scroll-cue::after {
  content: "";
  width: 2.75rem;
  height: 1px;
  background: linear-gradient(90deg, var(--line-strong), transparent);
}

.hero-credit {
  position: absolute;
  right: max(1.25rem, calc((100vw - var(--maxw)) / 2));
  bottom: 2rem;
  max-width: 24rem;
  margin: 0;
  color: rgba(245, 234, 223, 0.62);
  font-family: var(--sans);
  font-size: 0.68rem;
  letter-spacing: 0.02em;
  text-align: right;
}
.hero-credit a { color: rgba(182, 242, 239, 0.82); }

/* ------------------------------------------------------------- chapter heads */
.act-head {
  position: relative;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(7rem, 12vw, 11rem) 1.25rem clamp(3.5rem, 7vw, 6rem);
  border-bottom: 1px solid var(--line);
}
.act-head::after {
  content: "";
  position: absolute;
  right: 1.25rem;
  bottom: -1px;
  width: min(38vw, 27rem);
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--chapter-accent));
}
.act-head--one { --chapter-accent: var(--coral); }
.act-head--two { --chapter-accent: var(--cyan); }
.act-head--three { --chapter-accent: var(--gold); }

.act-head h2 {
  max-width: 15ch;
  margin: 0;
  color: var(--ink);
  font-size: clamp(3rem, 6.5vw, 5.8rem);
  font-weight: 400;
  letter-spacing: -0.035em;
  line-height: 0.96;
}
.act-no {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.3rem;
  color: var(--chapter-accent, var(--coral));
  font-family: var(--sans);
  font-size: 0.76rem;
  font-weight: 750;
  letter-spacing: 0.25em;
  text-transform: uppercase;
}
.act-no::after {
  content: "";
  width: 5rem;
  height: 1px;
  background: currentColor;
}
.act-sub {
  display: block;
  max-width: 43rem;
  margin-top: 1.4rem;
  color: var(--ink-dim);
  font-family: var(--sans);
  font-size: clamp(1rem, 1.7vw, 1.18rem);
  font-style: normal;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.6;
}

.eyebrow {
  margin: 0 0 0.8rem;
  color: var(--coral);
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

/* ------------------------------------------------------------------ scrolly */
.scrolly {
  --chapter-accent: var(--coral);
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 1.25rem;
}
#act1 { --chapter-accent: var(--coral); }
#act2 { --chapter-accent: var(--cyan); }
#act3 { --chapter-accent: var(--gold); }

.sticky-wrap {
  display: grid;
  grid-template-columns: minmax(18rem, 4.5fr) minmax(0, 7.5fr);
  gap: clamp(2.25rem, 5vw, 5rem);
  align-items: start;
}

.graphic {
  position: sticky;
  top: 0;
  display: flex;
  height: 100svh;
  margin: 0;
  padding: 6.7rem 0 2rem;
  flex-direction: column;
  justify-content: center;
}

.graphic::before,
.graphic::after {
  content: "";
  position: absolute;
  z-index: 2;
  width: 1.2rem;
  height: 1.2rem;
  pointer-events: none;
}
.graphic::before {
  top: calc(6.7rem + 4.05rem);
  left: 0;
  border-top: 1px solid var(--chapter-accent);
  border-left: 1px solid var(--chapter-accent);
}
.graphic::after {
  right: 0;
  bottom: calc(2rem + 3.2rem);
  border-right: 1px solid var(--chapter-accent);
  border-bottom: 1px solid var(--chapter-accent);
}

.chart-title {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 0.9rem 1rem 0.85rem;
  border: 1px solid var(--line-strong);
  border-bottom: 0;
  background: rgba(6, 30, 48, 0.82);
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(1.15rem, 2vw, 1.5rem);
  font-weight: 500;
  letter-spacing: -0.015em;
}

.chart-meta {
  display: flex;
  min-height: 1.7rem;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0 0.15rem 0.55rem;
  color: var(--ink-faint);
  font-family: var(--sans);
  font-size: 0.69rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  line-height: 1.3;
  text-transform: uppercase;
}
.chart-progress { color: var(--chapter-accent); white-space: nowrap; }
.chart-hint { margin-left: auto; text-align: right; }
.chart-selection {
  color: var(--ink);
  letter-spacing: 0.035em;
  text-align: right;
  text-transform: none;
}
.chart-selection[hidden] { display: none; }

.chart-host {
  width: 100%;
  height: min(62svh, 35rem);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background:
    linear-gradient(rgba(75, 184, 181, 0.012) 1px, transparent 1px),
    linear-gradient(90deg, rgba(75, 184, 181, 0.012) 1px, transparent 1px),
    rgba(4, 22, 35, 0.97);
  background-size: 28px 28px;
  box-shadow: var(--shadow);
}
.chart-host svg { display: block; }

.chart-note {
  min-height: 2.2em;
  margin: 0;
  padding: 0.7rem 1rem;
  border: 1px solid var(--line-strong);
  border-top: 0;
  background: rgba(3, 18, 29, 0.86);
  color: var(--ink-dim);
  font-family: var(--sans);
  font-size: 0.84rem;
  line-height: 1.5;
}

@keyframes evidence-title-reveal {
  0% { opacity: 0.35; transform: translateY(0.35rem); }
  100% { opacity: 1; transform: translateY(0); }
}
@keyframes evidence-progress-pulse {
  0%, 100% { opacity: 1; }
  40% { opacity: 0.38; }
}
@keyframes evidence-border-pulse {
  0% { border-color: var(--line-strong); }
  45% { border-color: color-mix(in srgb, var(--chapter-accent) 68%, transparent); }
  100% { border-color: var(--line-strong); }
}
.graphic.is-transitioning .chart-title,
.graphic.is-transitioning .chart-note {
  animation: evidence-title-reveal 0.62s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.graphic.is-transitioning .chart-note { animation-delay: 0.08s; }
.graphic.is-transitioning .chart-progress {
  animation: evidence-progress-pulse 0.72s ease-out;
}
.graphic.is-transitioning .chart-host {
  animation: evidence-border-pulse 0.72s ease-out;
}

.steps {
  position: relative;
  z-index: 2;
  padding: 11svh 0 20svh;
  counter-reset: story-step;
}
.steps::before {
  content: "";
  position: absolute;
  top: 11svh;
  bottom: 20svh;
  left: 1.15rem;
  width: 1px;
  background: linear-gradient(var(--line-strong), var(--line), transparent);
}

.step {
  position: relative;
  display: flex;
  min-height: 72svh;
  padding: 2rem 1rem 2rem 3.4rem;
  flex-direction: column;
  justify-content: center;
  border-radius: 0 12px 12px 0;
  opacity: 0.42;
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.step::before {
  counter-increment: story-step;
  content: "0" counter(story-step);
  position: absolute;
  top: 50%;
  left: 0;
  display: grid;
  width: 2.3rem;
  height: 2.3rem;
  transform: translateY(-50%);
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--bg);
  color: var(--ink-faint);
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.08em;
}
.step::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 2.85rem;
  width: 2px;
  height: 0;
  transform: translateY(-50%);
  background: var(--chapter-accent);
  transition: height 0.35s ease;
}
.step.active {
  transform: translateX(0.35rem);
  background: linear-gradient(90deg, color-mix(in srgb, var(--chapter-accent) 10%, transparent), transparent 78%);
  opacity: 1;
}
.step.active::before {
  border-color: var(--chapter-accent);
  background: var(--chapter-accent);
  color: var(--bg-deep);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--chapter-accent) 12%, transparent);
}
.step.active::after { height: 7.5rem; }

.step h3 {
  margin: 0 0 1rem;
  color: var(--ink);
  font-size: clamp(1.75rem, 3vw, 2.45rem);
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.05;
}
.step p {
  max-width: 34rem;
  margin: 0 0 1rem;
  color: var(--ink-dim);
}
.step p strong { color: var(--ink); }
.step .aside {
  margin-top: 0.65rem;
  padding: 0.8rem 0 0.8rem 1rem;
  border-left: 1px solid var(--chapter-accent);
  color: var(--ink-faint);
  font-family: var(--sans);
  font-size: 0.86rem;
  line-height: 1.55;
}

/* --------------------------------------------------------------- interlude */
.interlude {
  position: relative;
  scroll-margin-top: 4.5rem;
  overflow: hidden;
  padding: clamp(6rem, 10vw, 9rem) 1.25rem;
  border-block: 1px solid var(--line);
  background: #051a2a;
}
.interlude::before {
  content: "";
  position: absolute;
  inset: -30% auto auto -12%;
  width: 42rem;
  height: 42rem;
  border: 1px solid rgba(103, 213, 209, 0.1);
  border-radius: 48% 52% 45% 55%;
  box-shadow: 0 0 0 3rem rgba(103, 213, 209, 0.025), 0 0 0 7rem rgba(103, 213, 209, 0.018);
  transform: rotate(18deg);
}
.interlude-inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(17rem, 0.72fr) minmax(0, 1.28fr);
  max-width: var(--maxw);
  margin: 0 auto;
  gap: 1rem clamp(2.5rem, 6vw, 5.5rem);
  align-items: start;
}
.interlude h2 {
  grid-column: 1;
  margin: 0 0 1rem;
  color: var(--ink);
  font-size: clamp(2.8rem, 5.5vw, 5rem);
  font-weight: 400;
  letter-spacing: -0.04em;
  line-height: 0.98;
}
.interlude p {
  grid-column: 1;
  margin: 0;
  color: var(--ink-dim);
}
.method-fig {
  grid-column: 2;
  grid-row: 1 / span 3;
  margin: 0;
  padding: clamp(1.25rem, 3vw, 2.2rem);
  border: 1px solid var(--line-strong);
  background: rgba(8, 38, 58, 0.72);
  box-shadow: var(--shadow);
}
.method-fig--heatmap {
  padding: clamp(1rem, 2vw, 1.4rem);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 42%),
    rgba(8, 38, 58, 0.78);
}
.method-heatmap {
  display: block;
  width: 100%;
  max-height: min(49svh, 32rem);
  object-fit: contain;
  border: 1px solid rgba(238, 230, 220, 0.16);
  background: #f8f6f2;
  filter: saturate(0.92) contrast(0.98) brightness(0.94);
}
.method-evidence-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 1rem;
  gap: 0.75rem;
}
.method-fig--heatmap .method-stage {
  display: block;
  min-height: 9.5rem;
  padding: 0.9rem;
  border: 1px solid var(--line);
  background: rgba(3, 18, 29, 0.58);
}
.method-fig--heatmap .method-stage > span,
.method-fig--heatmap .method-stage strong,
.method-fig--heatmap .method-stage small {
  display: block;
}
.method-fig--heatmap .method-stage > span { margin-bottom: 0.5rem; }
.method-fig--heatmap .method-stage strong {
  margin-bottom: 0.55rem;
  font-size: clamp(1rem, 1.45vw, 1.3rem);
}
.method-fig--heatmap .method-stage--result strong {
  font-size: clamp(1.6rem, 3vw, 2.75rem);
}
.method-stage {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--line);
  gap: 0.3rem 1rem;
}
.method-stage > span {
  grid-row: 1 / span 2;
  color: var(--cyan);
  font-family: var(--sans);
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}
.method-stage strong {
  font-size: clamp(1.2rem, 2.4vw, 2rem);
  font-weight: 500;
  line-height: 1.15;
}
.method-stage small,
.method-fig figcaption {
  color: var(--ink-faint);
  font-family: var(--sans);
  font-size: 0.76rem;
}
.method-stage--result strong { color: var(--coral); font-size: clamp(2.4rem, 5vw, 4.8rem); }
.method-fig figcaption { margin-top: 1rem; text-align: right; }
.interlude .method-caveat {
  margin-top: 1.2rem;
  padding-left: 1rem;
  border-left: 1px solid var(--coral);
  color: var(--ink-faint);
  font-family: var(--sans);
  font-size: 0.86rem;
}

/* ---------------------------------------------------------- judge-ready recap */
.recap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(6rem, 10vw, 10rem) 1.25rem;
}
.recap h2 {
  max-width: 46rem;
  margin: 0 0 clamp(2.8rem, 6vw, 5rem);
  color: var(--ink);
  font-size: clamp(2.8rem, 6vw, 5.6rem);
  font-weight: 400;
  letter-spacing: -0.045em;
  line-height: 0.98;
}
.recap dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  border-block: 1px solid var(--line-strong);
}
.recap dl > div { padding: 2rem clamp(1rem, 3vw, 2.4rem) 2.2rem 0; }
.recap dl > div + div { padding-left: clamp(1rem, 3vw, 2.4rem); border-left: 1px solid var(--line); }
.recap dt {
  color: var(--coral);
  font-family: var(--sans);
  font-size: clamp(2.9rem, 6vw, 5.7rem);
  font-weight: 750;
  letter-spacing: -0.07em;
  line-height: 1;
}
.recap dd { margin: 0.9rem 0; color: var(--ink); font-size: 1.1rem; line-height: 1.35; }
.recap small { color: var(--ink-faint); font-family: var(--sans); font-size: 0.74rem; line-height: 1.45; }

/* ----------------------------------------------------------------- closing */
.closing {
  position: relative;
  display: grid;
  min-height: 84svh;
  padding: clamp(7rem, 12vw, 12rem) 1.25rem;
  place-content: center;
  overflow: hidden;
  text-align: left;
}
.closing::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent, rgba(103, 213, 209, 0.08) 48%, transparent),
    repeating-radial-gradient(ellipse at 5% 70%, transparent 0 22px, rgba(103, 213, 209, 0.09) 23px 24px, transparent 25px 38px);
  mask-image: linear-gradient(90deg, #000, transparent 70%);
}
.closing-q,
.closing-a { position: relative; width: min(100%, 62rem); }
.closing-q {
  margin: 0 0 2.5rem;
  color: var(--ink);
  font-size: clamp(2.35rem, 5.2vw, 4.8rem);
  letter-spacing: -0.04em;
  line-height: 1.08;
}
.closing-q em { color: var(--coral); font-style: italic; }
.closing-a {
  max-width: 44rem;
  margin: 0;
  padding-left: 1.25rem;
  border-left: 2px solid var(--coral);
  color: var(--ink-dim);
  font-family: var(--sans);
  font-size: clamp(1rem, 1.7vw, 1.18rem);
}

/* ------------------------------------------------------------------ footer */
.site-footer {
  display: grid;
  grid-template-columns: minmax(15rem, 1.2fr) minmax(15rem, 1fr) minmax(13rem, 0.8fr);
  padding: clamp(4rem, 8vw, 7rem) max(1.25rem, calc((100vw - var(--maxw)) / 2));
  gap: 1.5rem clamp(2rem, 5vw, 4rem);
  border-top: 1px solid var(--line-strong);
  background: var(--bg-deep);
  color: var(--ink-dim);
  font-family: var(--sans);
  font-size: 0.9rem;
}
.site-footer h2 {
  grid-column: 1 / -1;
  max-width: none;
  margin: 0 0 1.2rem;
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(2.2rem, 4vw, 3.6rem);
  font-weight: 400;
  letter-spacing: -0.03em;
}
.sources,
.method-note,
.colophon {
  max-width: none;
  margin: 0;
}
.footer-block { min-width: 0; }
.footer-block h3 {
  margin: 0 0 1rem;
  color: var(--cyan);
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.sources { padding: 0 0 0 1.15rem; }
.sources li { margin-bottom: 1rem; padding-left: 0.2rem; }
.sources code {
  padding: 0.12em 0.35em;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--bg-2);
  color: var(--cyan);
  font-size: 0.8em;
}
.method-note {
  padding-left: 1.2rem;
  border-left: 1px solid var(--line);
  color: var(--ink-dim);
}
.colophon {
  padding-left: 1.2rem;
  border-left: 1px solid var(--line);
  color: var(--ink-dim);
}

/* ------------------------------------------------------------------- charts */
.graphic text { font-family: var(--sans); }
.axis text { fill: var(--ink-dim); font-size: 12px; }
.axis line, .axis path { stroke: var(--grid); }
.gridline { stroke: var(--grid); }
.anno-text { fill: var(--ink); font-size: 12px; }
.anno-dim { fill: var(--ink-faint); font-size: 11px; }
.anno-line { stroke: var(--ink-faint); stroke-width: 1; }

.viz-tooltip {
  position: fixed;
  z-index: 150;
  max-width: min(19rem, calc(100vw - 2rem));
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--line-strong);
  background: rgba(2, 13, 22, 0.96);
  box-shadow: 0 14px 36px rgba(0, 5, 9, 0.45);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.82rem;
  line-height: 1.4;
  pointer-events: none;
}
.viz-tooltip[hidden] { display: none; }

/* --------------------------------------------------------------- responsive */
@media (max-width: 1060px) {
  .hero {
    grid-template-columns: minmax(0, 1fr) minmax(16rem, 0.62fr);
  }
  .hero h1 { font-size: clamp(3.7rem, 8vw, 6rem); }
  .sticky-wrap { gap: 2.25rem; }
}

@media (max-width: 820px) {
  body { font-size: 1rem; }
  html { scroll-padding-top: 4.25rem; }

  .topnav {
    inset: 0.45rem 0.45rem auto;
    width: auto;
    transform: none;
    justify-content: flex-start;
    border-radius: 11px;
  }
  .topnav__btn {
    min-height: 2.7rem;
    padding-inline: 0.8rem;
    font-size: 0.68rem;
  }

  .hero {
    display: flex;
    min-height: 100svh;
    padding: 7.2rem 1.25rem 4.5rem;
    flex-direction: column;
    justify-content: flex-end;
  }
  .hero::before {
    opacity: 0.62;
    background-position: 62% 22%;
    mask-image: linear-gradient(180deg, #000 0%, #000 32%, transparent 76%);
  }
  .hero::after {
    background: linear-gradient(0deg, var(--bg) 12%, rgba(3, 20, 33, 0.48) 62%, rgba(3, 20, 33, 0.1) 100%);
  }
  .kicker { margin-bottom: 1rem; }
  .hero h1 {
    max-width: none;
    margin-bottom: 1rem;
    font-size: clamp(3.2rem, 14vw, 5.5rem);
  }
  .lede { max-width: 34rem; margin-bottom: 1.65rem; }
  .hero-stat {
    align-self: stretch;
    max-width: none;
    margin: 0 0 1.8rem;
    padding: 1rem 0 0;
    border-top: 1px solid rgba(255, 127, 102, 0.5);
    border-left: 0;
  }
  .hero-stat .big { font-size: clamp(3.6rem, 20vw, 5.6rem); }
  .hero-stat-caption { max-width: 24rem; margin-top: 0.7rem; }
  .hero-credit {
    right: 1.25rem;
    bottom: 1rem;
    left: 1.25rem;
    max-width: none;
    font-size: 0.61rem;
    text-align: right;
  }
  .scroll-cue { margin-bottom: 1.6rem; }

  .act-head { padding: 6.5rem 1.25rem 3.5rem; }
  .act-head h2 { font-size: clamp(2.8rem, 13vw, 4.3rem); }

  .sticky-wrap {
    display: flex;
    flex-direction: column;
    gap: 0;
  }
  .graphic {
    top: 0;
    z-index: 3;
    order: -1;
    align-self: stretch;
    height: auto;
    padding: 4.3rem 0 0.55rem;
    background: var(--bg);
  }
  .graphic::before { top: calc(4.3rem + 4.35rem); }
  .graphic::after { bottom: calc(0.55rem + 3.1rem); }
  .chart-meta { padding-inline: 0.15rem; font-size: 0.62rem; }
  .chart-title { font-size: 1rem; }
  .chart-host { height: 49svh; min-height: 21rem; }
  .chart-note { min-height: 0; font-size: 0.78rem; }

  .steps { padding: 5svh 0 12svh; }
  .steps::before { top: 5svh; bottom: 12svh; }
  .step {
    min-height: 0;
    margin: 0 0 43svh;
    padding: 1.7rem 1.1rem 1.7rem 3.65rem;
    border: 1px solid var(--line);
    background: rgba(8, 38, 58, 0.92);
    box-shadow: 0 16px 44px rgba(0, 7, 12, 0.28);
    opacity: 1;
  }
  .step:last-child { margin-bottom: 8svh; }
  .step::before { left: 0.8rem; }
  .step::after { left: 3.05rem; }
  .step.active {
    transform: none;
    border-color: color-mix(in srgb, var(--chapter-accent) 70%, transparent);
    background: color-mix(in srgb, var(--chapter-accent) 9%, rgba(8, 38, 58, 0.96));
    box-shadow: 0 18px 48px color-mix(in srgb, var(--chapter-accent) 15%, rgba(0, 7, 12, 0.38));
  }
  .step h3 { font-size: 1.45rem; }

  .interlude { padding: 5.5rem 1.25rem; }
  .interlude-inner { display: block; }
  .interlude h2 { font-size: clamp(2.8rem, 12vw, 4rem); }
  .interlude p { margin-bottom: 2rem; }
  .method-fig { margin: 0; }
  .method-stage { grid-template-columns: 6.4rem minmax(0, 1fr); }
  .method-evidence-strip { grid-template-columns: 1fr; }
  .method-fig--heatmap .method-stage { min-height: 0; }
  .method-heatmap { max-height: none; }

  .recap dl { display: block; }
  .recap dl > div { padding: 1.8rem 0; }
  .recap dl > div + div { padding-left: 0; border-top: 1px solid var(--line); border-left: 0; }

  .closing { min-height: 76svh; padding: 7rem 1.25rem; }
  .closing-q { font-size: clamp(2.15rem, 10vw, 3.6rem); }

  .site-footer {
    display: block;
    padding: 4.5rem 1.25rem;
  }
  .site-footer h2 { margin-bottom: 2rem; }
  .sources,
  .method-note,
  .colophon { margin-bottom: 2.2rem; }
  .method-note,
  .colophon { padding-left: 1rem; }
}

@media (max-width: 480px) {
  .topnav__btn { padding-inline: 0.5rem; }
  .hero { padding-inline: 1rem; }
  .kicker { font-size: 0.65rem; letter-spacing: 0.18em; }
  .lede { font-size: 0.96rem; }
  .hero-credit { right: 1rem; left: 1rem; }
  .scrolly { padding-inline: 0.8rem; }
  .chart-host { min-height: 19rem; }
  .chart-note { padding-inline: 0.75rem; }
  .method-stage { display: block; }
  .method-stage > * { display: block; margin-bottom: 0.35rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .topnav__btn,
  .topnav__btn::after,
  .step,
  .step::after { transition: none; }
  .graphic * { transition: none !important; }
  .graphic.is-transitioning .chart-title,
  .graphic.is-transitioning .chart-note,
  .graphic.is-transitioning .chart-progress,
  .graphic.is-transitioning .chart-host { animation: none !important; }
}

@media print {
  .topnav, .scroll-cue { display: none; }
  body { background: #fff; color: #111; }
  .hero, .act-head, .interlude, .closing, .site-footer { break-inside: avoid; }
}
