/* Fonts are bundled in fonts/ (OFL licensed, from Fontsource), so the page makes no outside font requests. */
@font-face { font-family: 'Newsreader'; src: url('fonts/newsreader-latin-opsz-normal.woff2') format('woff2'); font-weight: 200 800; font-style: normal; font-display: swap; }
@font-face { font-family: 'Newsreader'; src: url('fonts/newsreader-latin-opsz-italic.woff2') format('woff2'); font-weight: 200 800; font-style: italic; font-display: swap; }
@font-face { font-family: 'IBM Plex Sans'; src: url('fonts/ibm-plex-sans-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'IBM Plex Sans'; src: url('fonts/ibm-plex-sans-latin-400-italic.woff2') format('woff2'); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: 'IBM Plex Sans'; src: url('fonts/ibm-plex-sans-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'IBM Plex Sans'; src: url('fonts/ibm-plex-sans-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url('fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url('fonts/ibm-plex-mono-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url('fonts/ibm-plex-mono-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }

/* Drift — a night sea with lantern light.
   Amber = people on the move. Coral = forced flight and danger. Sea-glass = arrival and home.
   Region colors (the eight UN SDG regions) live in data.js and are validated on the --bg surface.
   Page structure follows Stage and Herd. */
:root {
  color-scheme: dark;
  --bg: #0e1a2b;
  --bg-2: #122135;
  --raise: #172a42;
  --line: #22354f;
  --line-2: #33496a;
  --land: #1a2d47;
  --ink: #f1ece0;
  --ink-2: #b9c0cc;
  --muted: #8592a6;
  --amber: #f2a84b;
  --amber-ink: #f6bd70;
  --coral: #ef6f5e;
  --coral-ink: #f48a7b;
  --glass: #5cc4b4;
  --display: 'Newsreader', Georgia, serif;
  --sans: 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', monospace;
  --header: 60px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: var(--header); background: var(--bg); }
body {
  margin: 0; color: var(--ink); font: 16px/1.6 var(--sans); background: var(--bg);
  /* faint swell lines, like a nautical chart */
  background-image: radial-gradient(1200px 600px at 70% -10%, #1b3354 0%, transparent 60%);
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }
::selection { background: #f2a84b55; }
.page-wrap { max-width: 1240px; margin: 0 auto; padding: 0 48px; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }
b { font-weight: 600; color: var(--ink); }
em.amber, .amber { color: var(--amber); }
em.coral, .coral { color: var(--coral); }
em.glass, .glass { color: var(--glass); }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 20; height: var(--header); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.header-inner { height: 100%; display: flex; align-items: center; gap: 24px; }
.brand { display: flex; align-items: center; gap: 10px; font: 500 28px/1 var(--display); font-style: italic; text-decoration: none; letter-spacing: -0.4px; }
.brand-mark { width: 26px; height: 18px; flex: none; }
.story-nav { display: flex; gap: 24px; margin-left: 24px; margin-right: auto; }
.story-nav a, .story-nav .soon { font: 500 14px var(--sans); color: var(--ink-2); text-decoration: none; padding: 6px 0; border-bottom: 2px solid transparent; white-space: nowrap; }
.story-nav a:hover { color: var(--ink); border-bottom-color: var(--amber); }
.story-nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--amber); }
.story-nav .soon { color: var(--muted); cursor: default; }
.story-nav .soon sup { font: 500 8.5px var(--mono); letter-spacing: 0.8px; text-transform: uppercase; margin-left: 3px; }
.lab-link { font-size: 13px; color: var(--muted); text-decoration: none; white-space: nowrap; }
.lab-link:hover { color: var(--ink); }
.read-progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; }
.read-progress span { display: block; height: 100%; width: 0; background: var(--amber); }

/* ---------- Front page ---------- */
.front { padding-bottom: 24px; }
.edition-bar { display: flex; justify-content: space-between; gap: 8px 20px; flex-wrap: wrap; margin-top: 0; padding: 9px 0; border-bottom: 1px solid var(--line-2); font: 500 10.5px var(--mono); letter-spacing: 1.4px; text-transform: uppercase; color: var(--ink-2); }
.fp-kicker { display: flex; align-items: center; gap: 10px; font: 600 11px var(--mono); letter-spacing: 1.6px; text-transform: uppercase; color: var(--amber-ink); margin: 0 0 12px; }
.fp-kicker.coral { color: var(--coral-ink); }
.fp-kicker.glass { color: var(--glass); }
.fp-kicker::before { content: ''; width: 18px; height: 2px; background: currentColor; }
.fp-deck { font-size: 18px; line-height: 1.6; color: var(--ink-2); margin: 0 0 16px; }
.side-head { font: 500 clamp(34px, 3.6vw, 50px)/1.04 var(--display); letter-spacing: -0.8px; margin: 0 0 14px; }
.side-head a, .lead-head a { text-decoration: none; }
.side-head em, .lead-head em { font-style: italic; font-weight: 400; color: var(--amber); }
.side-head em.coral { color: var(--coral); }
.side-head em.glass { color: var(--glass); }
.source-line { font-size: 11px; line-height: 1.5; color: var(--muted); margin: 10px 0 0; max-width: 820px; }
.source-line a { color: inherit; text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 2px; }
.chart-title { font: 600 10.5px var(--mono); letter-spacing: 1.3px; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }

/* Lead: the flow map, full bleed under the headline */
.front-lead { position: relative; padding: 0 0 30px; border-bottom: 1px solid var(--line-2); }
/* The map runs edge to edge (up to 1640px) and the headline and deck sit on top of it. */
.hero { position: relative; }
/* Headline and deck sit together over the map's lower left; the counter sits lower, at the right. */
.lead-overlay { position: absolute; z-index: 2; bottom: 26%; left: calc(min(50vw, 820px) - min(50vw, 620px) + 48px); max-width: 600px; pointer-events: none; text-shadow: 0 0 22px var(--bg), 0 0 8px var(--bg), 0 0 3px var(--bg); }
.lead-overlay a { pointer-events: auto; }
.lead-overlay .lead-head { margin-bottom: 0; }
.lead-deck { max-width: 430px; margin: 2px 0 0; font-size: 17px; }
.lead-text a, .lead-text button { pointer-events: auto; }
.lead-head { font: 400 clamp(56px, 7.2vw, 104px)/0.94 var(--display); letter-spacing: -2.5px; margin: 8px 0 20px; }
.lead-head em { color: var(--amber); }
.front-lead .lead-figure { width: auto; margin: 0 calc(50% - min(50vw, 820px)); position: relative; z-index: 1; }
.front-lead .tour-row, .front-lead .year-scrub, .front-lead .region-key, .front-lead .source-line, .front-lead .table-view { margin-left: calc(min(50vw, 820px) - min(50vw, 620px) + 48px); margin-right: calc(min(50vw, 820px) - min(50vw, 620px) + 48px); }
.flowmap { position: relative; width: 100%; aspect-ratio: 1.9 / 1; }
.hero .flowmap .counter { right: calc(min(50vw, 820px) - min(50vw, 620px) + 48px); bottom: 14%; }
.flowmap canvas, .flowmap svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.flowmap .counter { position: absolute; right: 2%; bottom: 6%; text-align: right; pointer-events: none; }
.flowmap .counter-num { display: block; font: 400 clamp(40px, 5vw, 72px)/1 var(--display); letter-spacing: -1.5px; color: var(--ink); font-variant-numeric: lining-nums tabular-nums; }
.flowmap .counter-sub { font: 500 11px var(--mono); letter-spacing: 1.2px; text-transform: uppercase; color: var(--ink-2); }
.year-scrub { display: flex; align-items: center; gap: 14px; margin: 6px 0 0; flex-wrap: wrap; }
.year-scrub .ticks { display: flex; gap: 4px; flex-wrap: wrap; }
.year-scrub .ticks button { border: 1px solid var(--line-2); background: var(--bg-2); color: var(--ink-2); border-radius: 16px; padding: 4px 11px; font: 500 12.5px var(--mono); }
.year-scrub .ticks button:hover { color: var(--ink); border-color: var(--ink-2); }
.year-scrub .ticks button[aria-pressed="true"] { background: var(--amber); border-color: var(--amber); color: #1a1206; }
.region-key { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--ink-2); margin-top: 10px; }
.region-key span { display: inline-flex; align-items: center; gap: 6px; }
.region-key i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

.cta { display: inline-flex; align-items: center; gap: 10px; margin-top: 18px; padding: 11px 22px; background: var(--amber); color: #1a1206; border-radius: 26px; font: 600 14px var(--sans); text-decoration: none; transition: transform .2s, background .2s; border: 0; }
.cta:hover { background: #ffc477; }
.cta span { transition: transform .2s; }
.cta:hover span { transform: translateX(4px); }
.cta.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line-2); }
.cta.ghost:hover { border-color: var(--ink); background: transparent; }
.soon-tag { display: inline-flex; align-items: center; gap: 8px; margin-top: 16px; font: 600 10.5px var(--mono); letter-spacing: 1.4px; text-transform: uppercase; color: var(--muted); border: 1px dashed var(--line-2); border-radius: 20px; padding: 7px 14px; }
.pill { border: 1.5px solid var(--line-2); background: transparent; border-radius: 20px; padding: 5px 14px; font: 500 13px var(--sans); color: var(--ink-2); }
.pill:hover { color: var(--ink); border-color: var(--ink-2); }
.seg { display: inline-flex; border: 1.5px solid var(--line-2); border-radius: 22px; padding: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; border-radius: 18px; padding: 5px 13px; font: 500 13px var(--sans); color: var(--ink-2); }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.graphic { margin: 0; width: 100%; min-width: 0; }
.graphic-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 0 0 12px; }

/* Stat band */
.stat-band { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border-bottom: 1px solid var(--line-2); margin: 0; }
.stat-band > div { padding: 22px 18px 24px; border-left: 1px solid var(--line); }
.stat-band > div:first-child { border-left: 0; padding-left: 0; }
.stat-band dt { font: 600 10px/1.3 var(--mono); letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line-2); }
.stat-band dd { margin: 0; }
.stat-num { display: block; font: 400 46px/1 var(--display); letter-spacing: -1.2px; font-variant-numeric: lining-nums tabular-nums; }
.stat-num.amber { color: var(--amber); }
.stat-num.coral { color: var(--coral); }
.stat-num.glass { color: var(--glass); }
.stat-num small { font-size: 0.5em; letter-spacing: 0; margin-left: 2px; }
.stat-note { display: block; font-size: 12.5px; color: var(--ink-2); margin-top: 6px; line-height: 1.4; }

/* Front sections */
.front-wide { display: grid; grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.5fr); gap: 48px; padding: 44px 0; border-bottom: 1px solid var(--line-2); align-items: center; }
.front-wide.flip { grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.8fr); }
.front-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-bottom: 1px solid var(--line-2); }
.front-grid > * { padding: 40px 40px 42px; min-width: 0; }
.front-grid > :first-child { padding-left: 0; }
.front-grid > :last-child { padding-right: 0; }
.front-grid > * + * { border-left: 1px solid var(--line-2); }
.front-grid.third { grid-template-columns: repeat(3, minmax(0, 1fr)); border-bottom: 0; }
.front-grid.third > * { padding-top: 34px; }
.rule-head { font: 600 11px var(--mono); letter-spacing: 1.4px; text-transform: uppercase; margin: 0 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--ink-2); color: var(--ink); }
.updates, .coming { list-style: none; padding: 0; margin: 0; }
.updates li, .coming li { display: grid; gap: 3px; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.updates li:last-child, .coming li:last-child { border-bottom: 0; }
.updates time { font: 11px var(--mono); color: var(--muted); letter-spacing: 0.6px; text-transform: uppercase; }
.updates p { font-size: 14px; margin: 0; color: var(--ink-2); }
.coming b { font: 500 20px var(--display); }
.coming span { font-size: 14px; color: var(--ink-2); }
.front-about p { font-size: 14px; color: var(--ink-2); margin: 0 0 12px; }
.front-about code { font: 12.5px var(--mono); color: var(--ink); }
.lead-grid > *, .front-wide > *, .front-grid > * { min-width: 0; }

/* ---------- Charts ---------- */
.chart-wrap { position: relative; width: 100%; }
.chart-wrap svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-wrap .grid { stroke: var(--line); }
.chart-wrap .axis-lab { font: 11px var(--sans); fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart-wrap .label { font: 500 12px var(--sans); fill: var(--ink); paint-order: stroke; stroke: var(--bg); stroke-width: 4px; stroke-linejoin: round; }
.chart-wrap .label.light { font-weight: 400; fill: var(--ink-2); }
.chart-wrap .val { font: 500 12px var(--sans); fill: var(--ink-2); font-variant-numeric: tabular-nums; }
.chart-wrap .serif { font-family: var(--display); }

.tooltip { position: absolute; pointer-events: none; min-width: 170px; max-width: 280px; background: var(--ink); color: var(--bg); border-radius: 8px; box-shadow: 0 12px 30px #00000066; padding: 10px 13px; font-size: 12.5px; z-index: 10; }
.tooltip h3 { font: 500 17px/1.2 var(--display); margin: 0 0 4px; display: flex; align-items: center; }
.tooltip .sub { color: #4b5566; margin: 0 0 6px; }
.tooltip dl { display: grid; grid-template-columns: auto auto; gap: 2px 16px; margin: 0; font-variant-numeric: tabular-nums; }
.tooltip dt { color: #4b5566; }
.tooltip dd { margin: 0; text-align: right; font-weight: 600; }
.tooltip .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; flex: none; }

/* Chord */
.chord .arc-lab { font: 500 12px var(--sans); fill: var(--ink); }
.chord .arc-val { font: 11px var(--mono); fill: var(--muted); }
.chord .arc-lab, .chord .arc-val { paint-order: stroke; stroke: var(--bg); stroke-width: 4px; stroke-linejoin: round; }
.chord .ribbon { mix-blend-mode: screen; transition: opacity .2s; }
.chord .group-arc { stroke: var(--bg); stroke-width: 2; }
.chord .center-num { font: 400 40px var(--display); fill: var(--ink); }
.chord .center-sub { font: 500 11px var(--mono); letter-spacing: 1px; fill: var(--ink-2); text-transform: uppercase; }

/* Isotype: 1 in 70 */
.iso70 svg { width: 100%; height: auto; display: block; }
.iso-caption { display: flex; gap: 16px; align-items: baseline; margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--ink-2); }
.iso-caption .stat-num { font-size: 40px; }

/* Crossing mini map */
.dotmap { position: relative; width: 100%; aspect-ratio: 2 / 1.02; }
.dotmap canvas, .dotmap svg { position: absolute; inset: 0; width: 100%; height: 100%; }

/* Data tables */
.table-view { margin-top: 8px; font-size: 12px; color: var(--muted); }
.table-view summary { cursor: pointer; }
.table-view summary:hover { color: var(--ink); }
.table-view .scroll { max-height: 280px; overflow: auto; margin-top: 8px; border: 1px solid var(--line); background: var(--bg-2); }
.table-view table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.table-view th, .table-view td { text-align: right; padding: 4px 10px; border-bottom: 1px solid var(--line); color: var(--ink-2); font-weight: 400; }
.table-view th:first-child, .table-view td:first-child { text-align: left; }
.table-view thead th { position: sticky; top: 0; background: var(--raise); color: var(--ink); }

/* Footer */
.site-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; border-top: 1px solid var(--ink-2); margin-top: 40px; padding-top: 24px; padding-bottom: 60px; font-size: 13px; color: var(--muted); }
.site-footer a { text-decoration: none; }
.site-footer a:hover { color: var(--ink); }
.footer-brand { font: italic 500 22px var(--display); color: var(--ink); }
.footer-updated { margin-right: auto; }
.load-failed main::before { content: 'Could not load the data. Serve this folder over http (python3 -m http.server).'; display: block; padding: 40px 0; color: var(--coral); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .stat-band { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat-band > div:nth-child(4) { border-left: 0; padding-left: 0; }
  .stat-band > div:nth-child(n+4) { border-top: 1px solid var(--line); }
}
@media (max-width: 1000px) {
  .story-nav { gap: 16px; margin-left: 12px; }
  .lab-link { display: none; }
  .front-wide, .front-wide.flip { grid-template-columns: 1fr; gap: 24px; }
  .front-wide.flip > :first-child { order: 2; }
  .hero { display: flex; flex-direction: column; }
  .lead-overlay { position: static; order: 1; max-width: none; margin: 0 22px 14px 18px; padding-top: 18px; text-shadow: none; }
  .lead-deck { margin-top: 24px; }
  .hero #front-flow { order: 3; }
  .front-lead .tour-row, .front-lead .year-scrub, .front-lead .region-key, .front-lead .source-line, .front-lead .table-view { margin-left: 18px; margin-right: 22px; }
  .hero .flowmap .counter { right: 22px; bottom: calc(var(--map-gap, 0px) + 4px); }
}
@media (max-width: 900px) {
  :root { --header: 56px; }
  .page-wrap { padding: 0 22px 0 18px; }
  .front-grid, .front-grid.third { grid-template-columns: 1fr; }
  .front-grid > * { padding: 30px 0; }
  .front-grid > * + * { border-left: 0; border-top: 1px solid var(--line-2); }
}
@media (max-width: 560px) {
  .brand { font-size: 24px; }
  .lead-head { letter-spacing: -1.5px; }
  .stat-band { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-band > div { border-left: 0; padding-left: 0; }
  .stat-band > div:nth-child(even) { border-left: 1px solid var(--line); padding-left: 16px; }
  .stat-band > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .stat-num { font-size: 36px; }
  .flowmap { aspect-ratio: 1.6 / 1; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .cta, .cta span { transition: none; }
}

/* ---- Header menu: a hamburger on phones (same behavior as Herd) ---- */
.menu-btn, .nav-lab { display: none; }
@media (max-width: 760px) {
  .header-inner { justify-content: space-between; }
  .menu-btn { display: inline-flex; flex-direction: column; justify-content: center; gap: 5px; width: 40px; height: 40px; margin-right: -8px; padding: 0 9px; background: none; border: 0; cursor: pointer; color: var(--ink); }
  .menu-btn span { display: block; height: 2px; border-radius: 2px; background: currentColor; transition: transform .25s, opacity .2s; }
  .menu-open .menu-btn span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .menu-open .menu-btn span:nth-child(2) { opacity: 0; }
  .menu-open .menu-btn span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .story-nav { position: absolute; left: 0; right: 0; top: 100%; margin: 0; padding: 6px 18px 14px; display: flex; flex-direction: column; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--line); box-shadow: 0 14px 28px -18px #000;
    visibility: hidden; opacity: 0; transform: translateY(-6px); transition: opacity .2s, transform .2s, visibility 0s .2s; }
  .menu-open .story-nav { visibility: visible; opacity: 1; transform: none; transition: opacity .2s, transform .2s; }
  .story-nav a, .story-nav .soon { display: flex; align-items: baseline; padding: 14px 2px; border-bottom: 1px solid var(--line); font: 500 17px var(--sans); }
  .story-nav a[aria-current] { color: var(--ink); border-bottom-color: var(--line); box-shadow: inset 3px 0 0 var(--amber); padding-left: 12px; }
  .story-nav .soon sup { display: inline; margin-left: 8px; font-size: 10px; vertical-align: baseline; }
  .story-nav .nav-lab { display: flex; border-bottom: 0; font-size: 14px; color: var(--muted); }
}
@media (max-width: 560px) {
  .chord .arc-val { display: none; }
  .chord .arc-lab { font-size: 24px; }
}

/* =====================================================================
   Story pages (structure from Stage and Herd: opening, chapters, scrolly steps, rail)
   ===================================================================== */
.rail { position: fixed; right: 26px; top: 50%; transform: translateY(-50%); z-index: 30; display: flex; flex-direction: column; align-items: flex-end; }
.rail a { position: relative; display: flex; align-items: center; justify-content: flex-end; padding: 6px 0 6px 14px; text-decoration: none; }
.rail i { display: block; width: 14px; height: 2px; border-radius: 2px; background: var(--line-2); transition: width .25s, background .25s; }
.rail a:hover i { background: var(--ink-2); width: 18px; }
.rail a[aria-current="true"] i { width: 30px; height: 3px; background: var(--amber); }
.rail-label { position: absolute; right: calc(100% + 4px); white-space: nowrap; font-size: 12px; color: var(--bg); background: var(--ink); border-radius: 12px; padding: 3px 10px; opacity: 0; transform: translateX(6px); transition: opacity .18s, transform .18s; pointer-events: none; }
.rail a:hover .rail-label, .rail a:focus-visible .rail-label { opacity: 1; transform: none; }

.opening { min-height: calc(90vh - var(--header)); display: flex; flex-direction: column; justify-content: center; padding-top: 48px; padding-bottom: 48px; border-bottom: 1px solid var(--line-2); position: relative; }
.eyebrow { display: flex; align-items: center; gap: 10px; font: 600 11px var(--mono); letter-spacing: 1.6px; text-transform: uppercase; color: var(--ink-2); margin: 0; }
.eyebrow .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); }
.eyebrow.coral .dot { background: var(--coral); }
.opening h1 { font: 400 clamp(54px, 7.6vw, 112px)/0.95 var(--display); letter-spacing: -2.5px; margin: 22px 0 26px; max-width: 1040px; }
.opening h1 em { color: var(--amber); font-style: italic; }
.opening h1 em.coral { color: var(--coral); }
.lede { font-size: 20px; line-height: 1.6; color: var(--ink-2); max-width: 680px; margin: 0; }
.opening-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin: 40px 0 0; max-width: 960px; border-top: 1px solid var(--ink-2); }
.opening-stats div { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; color: var(--ink-2); line-height: 1.4; padding: 16px 18px 0 0; }
.opening-stats div + div { padding-left: 18px; border-left: 1px solid var(--line); }
.big-num { font: 400 52px/1 var(--display); color: var(--ink); letter-spacing: -1.2px; font-variant-numeric: lining-nums tabular-nums; }
.big-num.amber { color: var(--amber); }
.big-num.coral { color: var(--coral); }
.toc { list-style: none; padding: 0; margin: 40px 0 0; display: flex; flex-wrap: wrap; gap: 8px 10px; max-width: 960px; }
.toc a { display: inline-flex; gap: 8px; align-items: baseline; text-decoration: none; border: 1px solid var(--line-2); background: var(--bg-2); border-radius: 20px; padding: 7px 15px; font: 500 14px var(--sans); color: var(--ink); }
.toc a span { font: 11px var(--mono); color: var(--muted); }
.toc a:hover { border-color: var(--ink-2); }
.story-updated { font-size: 12px; color: var(--muted); margin: 20px 0 0; }

.chapter { padding-top: 88px; }
.chapter-head { padding-bottom: 8px; }
.chapter-number { font: 600 11px var(--mono); letter-spacing: 1.6px; text-transform: uppercase; color: var(--amber-ink); margin: 0; }
.chapter-number.coral { color: var(--coral-ink); }
.chapter-head h2 { font: 400 clamp(40px, 5vw, 64px)/1.02 var(--display); letter-spacing: -1.2px; margin: 10px 0 14px; }
.chapter-head h2 em { color: var(--amber); font-style: italic; }
.chapter-head h2 em.coral { color: var(--coral); }
.chapter-head > p:last-child { font-size: 18px; color: var(--ink-2); max-width: 700px; margin: 0; }

.scrolly { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 0 56px; position: relative; }
.scrolly .sticky { grid-column: 2; grid-row: 1; position: sticky; top: var(--header); height: calc(100vh - var(--header)); display: flex; align-items: center; }
.scrolly .steps { grid-column: 1; grid-row: 1; padding: 30vh 0 40vh; }
.step { min-height: 80vh; display: flex; align-items: center; }
.step:first-child { min-height: 50vh; }
.step-card { background: var(--bg-2); border: 1px solid var(--line); border-left: 3px solid var(--line-2); padding: 22px 24px; opacity: 0.35; transition: opacity .35s, border-color .35s, box-shadow .35s; }
.step.is-active .step-card { opacity: 1; border-left-color: var(--amber); box-shadow: 0 16px 40px #00000055; }
.coral-steps .step.is-active .step-card { border-left-color: var(--coral); }
.step-card p { margin: 0 0 11px; font-size: 16px; line-height: 1.65; color: var(--ink-2); }
.step-card p:last-child { margin-bottom: 0; }
.step-kicker { font: 600 10.5px/1.2 var(--mono) !important; letter-spacing: 1.4px; text-transform: uppercase; color: var(--amber-ink) !important; margin-bottom: 10px !important; }
.coral-steps .step-kicker { color: var(--coral-ink) !important; }
.step-head { font: 500 28px/1.1 var(--display); letter-spacing: -0.4px; margin: 0 0 12px; color: var(--ink); }
.hint { font-size: 13px !important; color: var(--muted) !important; }

.prose-chart { display: grid; grid-template-columns: minmax(260px, 360px) minmax(0, 1fr); gap: 56px; align-items: start; padding-top: 40px; padding-bottom: 32px; }
.prose p { font-size: 17px; line-height: 1.7; margin: 0 0 14px; color: var(--ink-2); }
.prose p.muted { font-size: 14px; color: var(--muted); }
.wide-chart { padding-top: 32px; }

.next-story { padding-top: 96px; }
.next-card { display: grid; gap: 10px; text-decoration: none; border: 1px solid var(--line-2); padding: 30px 34px; background: var(--bg-2); transition: border-color .2s; }
.next-card:hover { border-color: var(--amber); }
.next-kicker { font: 600 11px var(--mono); letter-spacing: 1.4px; text-transform: uppercase; color: var(--amber-ink); }
.next-title { font: 400 clamp(32px, 4vw, 50px)/1.04 var(--display); letter-spacing: -0.8px; }
.next-text { font-size: 16px; color: var(--ink-2); max-width: 660px; }
.next-back { font-size: 13px; margin: 16px 0 0; }
.next-back a { color: var(--ink-2); text-decoration: none; }
.methods { padding-top: 88px; padding-bottom: 24px; }
.methods h2 { font: 400 36px/1.1 var(--display); margin: 0 0 22px; }
.methods-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; }
.methods h3 { font: 600 11px var(--mono); letter-spacing: 1.4px; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.methods p, .methods li { font-size: 14.5px; line-height: 1.7; color: var(--ink-2); }
.methods ul { padding-left: 18px; margin: 0 0 14px; }
.methods a { color: var(--ink); }

/* Story chart pieces */
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12.5px; color: var(--ink-2); margin: 0 0 10px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.legend i.dot { border-radius: 50%; }
.legend i.ring { background: transparent !important; border: 2px solid var(--ink-2); border-radius: 50%; width: 11px; height: 11px; }
.area .series-lab { font: 500 12.5px var(--sans); }
.area .series-val { font: 11.5px var(--mono); fill: var(--ink-2); }
.area .cross { stroke: var(--ink-2); stroke-dasharray: 2 3; }
.area .year-note { font: 500 11px var(--mono); fill: var(--ink-2); letter-spacing: .5px; }
.stream .stream-lab { font: 500 12px var(--sans); fill: var(--ink); pointer-events: none; paint-order: stroke; stroke: #0e1a2bcc; stroke-width: 3px; stroke-linejoin: round; }
.dumbbell .row-lab { font: 500 12.5px var(--sans); fill: var(--ink-2); }
.dumbbell .row-lab.on { fill: var(--ink); }
.dumbbell .stem { stroke: var(--line-2); stroke-width: 2; }
.explore-bar { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: center; margin-bottom: 18px; }
.pick { display: inline-flex; align-items: center; gap: 8px; font: 600 10.5px var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: 1.2px; }
.pick select { appearance: none; border: 1px solid var(--line-2); background: var(--bg-2); border-radius: 18px; padding: 6px 32px 6px 14px; font: 500 15px var(--sans); color: var(--ink); text-transform: none; letter-spacing: 0;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
.explore-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 36px; }
.explore-grid h3 { font: 500 22px/1.2 var(--display); margin: 0 0 4px; }
.explore-grid .sub { font-size: 13px; color: var(--muted); margin: 0 0 12px; }
.explore-stat { font: 400 40px/1 var(--display); letter-spacing: -1px; margin: 0 0 4px; }
.split-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border-top: 1px solid var(--ink-2); margin: 18px 0; }
.split-stats > div { padding: 12px 14px 0 0; font-size: 13px; color: var(--ink-2); }
.split-stats > div + div { padding-left: 14px; border-left: 1px solid var(--line); }
.split-stats .stat-num { font-size: 40px; }

@media (max-width: 1100px) { .rail { display: none; } }
@media (max-width: 900px) {
  .scrolly { display: block; }
  .scrolly .sticky { height: auto; top: var(--header); padding: 8px 0 6px; background: var(--bg); z-index: 2; align-items: flex-start; }
  .scrolly .steps { position: relative; z-index: 3; padding: 30vh 0 30vh; }
  .step, .step:first-child { min-height: 75vh; align-items: flex-end; }
  .step-card { opacity: 0; transition: opacity .3s; padding: 16px 18px; }
  .step.is-active .step-card { opacity: 0.97; }
  .prose-chart, .methods-grid, .explore-grid { grid-template-columns: 1fr; gap: 24px; }
  .opening-stats { grid-template-columns: 1fr; }
  .opening-stats div + div { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); }
}

/* The Crossing and America */
.zoomdots { aspect-ratio: auto; height: min(74vh, 640px); background: transparent; }
.multiples { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px 36px; margin-top: 28px; }
.multiple h3 { font: 500 21px/1.2 var(--display); margin: 0 0 2px; }
.multiple .sub { font-size: 12.5px; color: var(--muted); margin: 0 0 8px; }
.eyebrow.glass .dot { background: var(--glass); }
.opening h1 em.glass, .chapter-head h2 em.glass { color: var(--glass); }
.chapter-number.glass { color: var(--glass); }
.glass-steps .step.is-active .step-card { border-left-color: var(--glass); }
.glass-steps .step-kicker { color: var(--glass) !important; }
.glass-steps .read-progress span, .glass-steps .rail a[aria-current="true"] i { background: var(--glass); }
.coral-steps .read-progress span, .coral-steps .rail a[aria-current="true"] i { background: var(--coral); }
@media (max-width: 900px) { .multiples { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .multiples { grid-template-columns: 1fr; } }

.iso-key { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 13px; color: var(--ink-2); margin: 8px 0 0; }
.iso-key span { display: inline-flex; align-items: center; gap: 7px; }
.iso-key i { width: 10px; height: 10px; border-radius: 50%; background: var(--line-2); display: inline-block; }
.iso-key i.me { background: var(--coral); }

/* The cover's story tour */
.tour-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; margin-top: calc(8px - var(--map-gap, 0px)); position: relative; z-index: 3; }
.tour-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tour-chips button { position: relative; overflow: hidden; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--ink-2); border-radius: 16px; padding: 5px 13px; font: 500 13px var(--sans); }
.tour-chips button:hover { color: var(--ink); border-color: var(--ink-2); }
.tour-chips button[aria-pressed="true"] { color: var(--bg); background: var(--ink); border-color: var(--ink); }
/* a thin bar fills along the active chip while the tour waits on it */
.tour-chips button::after { content: ''; position: absolute; left: 0; bottom: 0; height: 2px; width: 0; background: var(--amber); }
.tour-chips.running button[aria-pressed="true"]::after { animation: tour-fill var(--tour-ms, 7000ms) linear forwards; }
.tour-chips.running.paused button[aria-pressed="true"]::after { animation-play-state: paused; }
@keyframes tour-fill { to { width: 100%; } }
.front-lead .year-scrub { margin-top: 10px; }
@media (prefers-reduced-motion: reduce) { .tour-chips button::after { display: none; } }
