/* Story page in the planner's drawing style: dark sheets, one bone sheet for results, a heat orange end block. */

:root {
  color-scheme: dark;
  /* Same values as style.css. That file also sets a fixed app layout on body, so it is not linked here. */
  --paper: #0e0f12;
  --ink: #ebe9e2;
  --ink-2: #a8a69e;
  --ink-3: #6e6d67;
  --hair: #64656b;
  --heat: #ff6a3d;
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Consolas, monospace;
  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --pad: 48px;
  --cols: 6;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 17px/1.55 var(--sans); -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
a { color: inherit; }
a:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
::selection { background: var(--heat); color: var(--paper); }

/* Sheets. Each section sets its own colours so the theme flips at the hairline between them. */
.s { position: relative; isolation: isolate; padding: 120px var(--pad); background: var(--bg); color: var(--fg); border-top: 1px solid var(--line); }
.s-dark { --bg: var(--paper); --fg: var(--ink); --fg2: var(--ink-2); --line: var(--hair); --grid: rgba(235, 233, 226, 0.07); --mark: var(--heat); }
.s-sheet { --bg: var(--ink); --fg: var(--paper); --fg2: #4a4944; --line: #a9a79f; --grid: rgba(14, 15, 18, 0.08); --mark: var(--paper); }
.s-heat { --bg: var(--heat); --fg: var(--paper); --fg2: var(--paper); --line: var(--paper); --grid: rgba(14, 15, 18, 0.12); --mark: var(--paper); }
/* The one texture: survey columns, with a closing line on the right edge. */
.s::before {
  content: ""; position: absolute; inset: 0 var(--pad); z-index: -1; pointer-events: none;
  background: repeating-linear-gradient(90deg, var(--grid) 0 1px, transparent 1px calc(100% / var(--cols)));
  border-right: 1px solid var(--grid);
}

.eyebrow { display: flex; gap: 14px; align-items: baseline; margin: 0 0 40px; font: 500 11px/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg2); }
.eyebrow b { font-weight: 500; color: var(--mark); }

h1, h2, h3 { margin: 0; font-weight: 400; }
h2 { font: 600 clamp(48px, 7.4vw, 120px)/0.88 var(--display); text-transform: uppercase; letter-spacing: -0.005em; }
h2 .l { font: 300 0.5em/1.15 var(--sans); text-transform: none; letter-spacing: -0.02em; color: var(--fg2); }
h3 { font: 500 13px/1.3 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; }
.body { max-width: 52ch; margin: 0; color: var(--fg2); text-wrap: pretty; }

/* Dimension line: a hairline with end ticks and a label in the gap, as on a drawing. */
.ruler-dim { display: flex; align-items: center; gap: 12px; font: 500 11px/1.3 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg2); }
.ruler-dim i { flex: 1; height: 9px; border-left: 1px solid currentColor; position: relative; }
.ruler-dim i::after { content: ""; position: absolute; left: 0; right: 0; top: 4px; border-top: 1px solid currentColor; }
.ruler-dim i:last-child { border-left: 0; border-right: 1px solid currentColor; }

/* Pill */
.pill {
  position: fixed; top: 20px; right: 20px; z-index: 50; padding: 12px 18px; border-radius: 999px;
  background: var(--heat); color: var(--paper); text-decoration: none;
  font: 500 12px/1 var(--mono); letter-spacing: 0.06em; text-transform: uppercase;
  transition: background 200ms, color 200ms;
}
.pill:hover { background: var(--ink); }
.pill.flip { background: var(--paper); color: var(--ink); }
.pill.flip:hover { background: var(--ink); color: var(--paper); }

/* Hero: the line and the pitch on the left, the planner map on the right, three numbers along the bottom. */
.hero { min-height: 100svh; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; padding-top: 28px; padding-bottom: 40px; border-top: 0; }
.top { display: flex; gap: 40px; align-items: baseline; padding-right: 220px; }
.top .eyebrow { margin: 0; }
.mark { font: 600 15px/1 var(--mono); letter-spacing: -0.02em; }
.hero-main { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); align-items: stretch; }
.hero-copy { grid-column: 1 / 4; display: flex; flex-direction: column; justify-content: center; padding-right: 48px; }
.hero-d { margin: 0; font: 600 clamp(56px, 5.7vw, 96px)/0.86 var(--display); text-transform: uppercase; letter-spacing: -0.005em; }
.hero-d span { font: 300 0.5em/1.15 var(--sans); text-transform: none; color: var(--ink-2); letter-spacing: -0.02em; }
.hero-text { margin-top: 48px; }
.hero h1 { max-width: 34ch; font: 400 clamp(22px, 2vw, 30px)/1.25 var(--sans); letter-spacing: -0.015em; text-wrap: balance; }
.hero-sub { margin: 16px 0 0; color: var(--ink-2); text-wrap: pretty; min-height: 1lh; }
/* While loading, the empty line keeps its space so the buttons do not jump when the text arrives. */
html:not(.loading) .hero-sub:empty { display: none; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.btn {
  padding: 12px 18px; border: 1px solid var(--ink); border-radius: 999px; color: var(--ink); text-decoration: none;
  font: 500 12px/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase;
  transition: background 200ms, border-color 200ms, color 200ms;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn-solid { background: var(--heat); border-color: var(--heat); color: var(--paper); }
.btn-solid:hover { border-color: var(--ink); }
.hero-shot { grid-column: 4 / 7; margin: 0; }
.hero-shot a { display: block; overflow: hidden; border: 1px solid var(--line); }
.hero-shot img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; }
.meta { margin: 12px 0 0; font: 500 11px/1.6 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); min-height: 1lh; }
.hero-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; }
/* Hidden keeps its space so the hero does not jump when the numbers arrive. */
.hero-strip[hidden] { visibility: hidden; }
/* --rule lets the motion script draw the top rule in without scaling the text under it. */
.hero-strip > div { --rule: 1; position: relative; display: flex; flex-direction: column; padding: 14px 24px 0 0; }
.hero-strip > div::before { content: ""; position: absolute; top: 0; left: 0; right: 24px; border-top: 1px solid var(--fg); transform: scaleX(var(--rule)); transform-origin: left; }
.hero-strip dd { order: -1; margin: 0; }
.hs-n { font: 300 clamp(36px, 3.6vw, 56px)/1 var(--display); letter-spacing: -0.01em; font-variant-numeric: tabular-nums; min-height: 1em; }
.hs-n small { font: 500 0.26em/1 var(--mono); letter-spacing: 0; margin-left: 0.3em; color: var(--fg2); }
#hs-ban { color: var(--heat); }
.hero-strip dt { margin-top: 8px; font: 500 11px/1.4 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; max-width: 26ch; }
/* The sub line and the numbers come from runs.json, so keep their space blank until it arrives. */
.loading .hero-sub, .loading .hero-strip { visibility: hidden; }

/* Smooth scroll base rules, from the Lenis docs. */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }

.progress { position: fixed; top: 0; left: 0; right: 0; z-index: 60; height: 2px; pointer-events: none; }
.progress i { display: block; height: 100%; background: var(--heat); transform: scaleX(0); transform-origin: left; }
.progress.flip i { background: var(--paper); }

/* Problem */
.split { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); margin-top: 72px; align-items: end; row-gap: 56px; }
.split .body { grid-column: 1 / 3; padding-right: 24px; }
.ruler { grid-column: 4 / 7; margin: 0; }
.ruler-dim { margin-left: 50%; width: 16.667%; min-width: 0; flex-direction: column; gap: 10px; align-items: stretch; text-align: center; }
.ruler-dim span { white-space: nowrap; align-self: center; }
.ruler-dim i { display: none; }
.ruler-dim::after { content: ""; height: 9px; border: 1px solid currentColor; border-bottom: 0; }
.ruler-bar {
  position: relative; height: 56px; margin-top: 8px; border: 1px solid var(--line);
  background: repeating-linear-gradient(90deg, var(--line) 0 1px, transparent 1px calc(100% / 15));
}
.ruler-bar .ban {
  position: absolute; top: 0; bottom: 0; left: 50%; width: 16.667%; background: var(--ink);
}
.ruler-ticks { position: relative; height: 14px; margin-top: 10px; font-size: 11px; color: var(--fg2); }
/* Labels sit on 3-hour ticks of a 15-hour bar, so 20 percent apart. */
.ruler-ticks span { position: absolute; transform: translateX(-50%); }
.ruler-ticks span:nth-child(2) { left: 20%; }
.ruler-ticks span:nth-child(3) { left: 40%; }
.ruler-ticks span:nth-child(4) { left: 60%; }
.ruler-ticks span:nth-child(5) { left: 80%; }
.ruler-ticks span:first-child { left: 0; transform: none; }
.ruler-ticks span:last-child { right: 0; transform: none; }

/* What it is: two paragraphs side by side on wide screens, stacked by the phone rules. */
@media (min-width: 901px) {
  .what .split { align-items: start; }
  .what .split .body + .body { grid-column: 4 / 7; padding: 0; }
}

/* How it works */
.how-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); margin-top: 72px; align-items: start; }
.steps, .uses { list-style: none; margin: 0; padding: 0; }
.steps { grid-column: 1 / 4; padding-right: 48px; }
.steps li, .uses li { border-top: 1px solid var(--line); padding: 28px 0 40px; display: grid; grid-template-columns: 72px minmax(0, 1fr); column-gap: 8px; }
.steps p, .uses p { grid-column: 2; margin: 12px 0 0; color: var(--fg2); max-width: 46ch; }
.idx { grid-row: span 2; font: 300 44px/0.8 var(--display); color: var(--fg); }
/* Reading guide. The motion script adds these classes on wide screens only. */
.steps.live li { opacity: 0.35; transition: opacity 0.3s; }
.steps.live li.on { opacity: 1; }
.fig { grid-column: 4 / 7; margin: 0; position: sticky; top: 80px; }
.fig .eyebrow { margin-bottom: 14px; }
.fig iframe { display: block; width: 100%; height: 700px; border: 1px solid var(--line); background: #08090a; }
.fig-note { margin: 12px 0 0; font-size: 14px; color: var(--fg2); }

/* Results, the bone sheet */
.pair { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); margin: 72px 0 88px; align-items: end; }
.pair > div { grid-column: span 2; padding-right: 24px; }
.pair > .body { grid-column: 5 / 7; }
.pair-n { display: block; font: 300 clamp(96px, 12vw, 200px)/0.8 var(--display); letter-spacing: -0.02em; }
.pair > div:first-child .pair-n { color: var(--fg2); }
.pair-n small { font: 500 0.14em/1 var(--mono); letter-spacing: 0; margin-left: 0.15em; color: var(--fg2); }
.pair-lab { display: block; margin-top: 18px; padding-top: 10px; border-top: 1px solid var(--fg); font: 500 11px/1.4 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; max-width: 26ch; }
.runs { width: 100%; border-collapse: collapse; font-size: 15px; }
.runs th { text-align: left; vertical-align: bottom; padding: 0 16px 14px 0; font: 500 11px/1.35 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg2); border-bottom: 1px solid var(--fg); }
.runs td { padding: 18px 16px 18px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.runs td.n { white-space: nowrap; font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 14px; }
.runs tbody tr { position: relative; transition: background 150ms; }
.runs tbody tr:hover { background: rgba(14, 15, 18, 0.05); }
.runs td a { text-decoration: none; font-weight: 500; white-space: nowrap; }
/* The city link covers the whole row, so the row is one target. */
.runs td a::after { content: ""; position: absolute; inset: 0; }
.runs td a::before { content: "\2197\00a0"; font-family: var(--mono); }
.note { margin: 24px 0 0; max-width: 64ch; font-size: 14px; color: var(--fg2); }

/* Who, and the three plans in What we tested */
.uses { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 72px; }
.tested .body { margin-top: 48px; }
.tested .note { margin-top: 40px; }
/* Cards in a row share one height, so keep each card's text packed at the top. */
.uses li { padding-right: 32px; align-content: start; }

/* Sources */
.src-list { list-style: none; margin: 72px 0 40px; padding: 0; max-width: 820px; counter-reset: src; }
.src-list li { display: flex; justify-content: space-between; gap: 24px; padding: 16px 0; border-top: 1px solid var(--line); counter-increment: src; }
.src-list li:last-child { border-bottom: 1px solid var(--line); }
.src-list li::before { content: counter(src, decimal-leading-zero); font: 500 11px/1.6 var(--mono); color: var(--fg2); width: 48px; flex: none; }
.src-list .who { flex: 1; }
.src-list .yr { font: 500 14px/1.4 var(--mono); color: var(--fg2); }
.sources .body a { color: var(--fg); }

/* End block */
.end { padding-bottom: 0; overflow: hidden; }
.voice { margin: 0; font: 600 clamp(40px, 5.6vw, 88px)/0.92 var(--display); text-transform: uppercase; max-width: 12ch; }
.end-links { display: flex; flex-wrap: wrap; gap: 12px 40px; margin-top: 40px; font: 500 12px/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; }
.end-links a { text-decoration: none; border-bottom: 1px solid currentColor; padding-bottom: 6px; }
.word { margin: 64px calc(var(--pad) * -1) 0; font: 600 49.5vw/0.74 var(--display); letter-spacing: -0.035em; text-align: center; white-space: nowrap; transform: translateY(0.03em); }

/* Phone */
@media (max-width: 900px) {
  :root { --pad: 16px; --cols: 2; }
  body { font-size: 16px; }
  .s { padding-top: 80px; padding-bottom: 80px; }
  .hero { gap: 32px; padding-top: 22px; padding-bottom: 40px; }
  .top { flex-direction: column; gap: 14px; padding-right: 0; }
  .pill { top: 14px; right: 14px; padding: 10px 14px; }
  .hero-main, .split, .how-grid { grid-template-columns: minmax(0, 1fr); }
  .hero-main { row-gap: 40px; }
  .hero-copy, .hero-shot, .split .body, .ruler, .steps, .fig { grid-column: 1; padding: 0; }
  .hero-text { margin-top: 28px; }
  /* Both lines wrap to two on a phone, so reserve two. */
  .hero-sub, .meta { min-height: 2lh; }
  /* Three cells side by side would squeeze the labels to a word per line, so they stack. */
  .hero-strip { grid-template-columns: minmax(0, 1fr); row-gap: 20px; }
  .hero-strip > div { padding-right: 0; }
  .hero-strip > div::before { right: 0; }
  .pair { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; }
  .pair > div { grid-column: auto; padding: 0; }
  .pair > .body { grid-column: 1 / -1; }
  .split, .how-grid, .pair { margin-top: 48px; row-gap: 40px; }
  /* The label is wider than the ban band, so it hangs left from the band's right end. */
  .ruler-dim span { align-self: flex-end; width: 400%; flex: none; white-space: normal; text-align: right; }
  .steps li, .uses li { grid-template-columns: 52px minmax(0, 1fr); }
  .idx { font-size: 34px; }
  .fig { position: static; }
  .fig iframe { height: 490px; }
  .pair { margin-bottom: 56px; }
  .uses { grid-template-columns: minmax(0, 1fr); margin-top: 48px; }
  .src-list { margin-top: 48px; }
  .src-list li { flex-wrap: wrap; gap: 4px 0; }
  .src-list .yr { margin-left: 48px; }
  /* Seven columns do not fit a phone, so each row becomes a labelled card. */
  .runs thead { display: none; }
  .runs, .runs tbody, .runs tr, .runs td { display: block; }
  .runs tbody tr { padding: 20px 0; border-top: 1px solid var(--fg); }
  .runs td { display: flex; justify-content: space-between; gap: 16px; border: 0; padding: 4px 0; text-align: right; }
  .runs td::before { content: attr(data-label); font: 500 11px/1.4 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg2); text-align: left; max-width: 55%; }
  .runs td:first-child { font-size: 20px; }
  .runs td:last-child { display: block; text-align: left; padding-top: 12px; }
  .runs td:last-child::before { display: block; margin-bottom: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .pill, .btn, .runs tbody tr { transition: none; }
  .progress { display: none; }
}
