/* The Replay Lab: data pages. Same Broadsheet tokens, masthead and playhead rule as the front page.
   Layout: a hub of data cards on a 3-column grid, then one page per story with a block per dataset. Single light look by design. */
:root {
  --paper: #FFFFFF; --ink: #1F1F1F; --sub: #6B6B6B; --grid: #E6E6E6; --ctx: #BDBDBD;
  --red: #C70000; --blue: #1F5FA8; --tint: #F4F4F2;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Source Sans 3", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --gutter: clamp(16px, 4vw, 48px);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { background: var(--paper); }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); -webkit-text-size-adjust: 100%; }
a { color: inherit; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.page { max-width: 1280px; margin: 0 auto; padding-inline: var(--gutter); }
.note { background: var(--tint); font-size: 13px; color: var(--sub); }
.note .page { padding-block: 8px; }

/* Masthead */
.mast .page { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px 32px; padding-block: 22px 16px; }
.mast .name { margin: 0; font-family: var(--serif); font-weight: 800; font-size: clamp(40px, 6.4vw, 76px); line-height: .9; letter-spacing: -.025em; text-decoration: none; }
.mast .name span { color: var(--red); }
.mast nav { display: flex; gap: 22px; overflow-x: auto; white-space: nowrap; font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding-bottom: 4px; max-width: 100%; }
.mast nav a { text-decoration: none; padding-block: 4px; }
.mast nav a.on { box-shadow: inset 0 -2px 0 var(--red); }

/* Playhead rule and section heads */
.play { position: relative; width: 100%; height: 1px; background: var(--ink); }
.play::before { content: ""; position: absolute; left: 0; top: -2px; width: 28px; height: 5px; background: var(--red); }
.sec { display: grid; gap: 14px; margin-top: 48px; }
.sec-h { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 16px; padding-top: 12px; }
.sec-h h2 { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.sec-h p { margin: 0; font-size: 14px; color: var(--sub); }
.label { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--red); }
.meta { font-size: 13px; color: var(--sub); }
.crumb { font-size: 14px; color: var(--sub); margin-top: 20px; }
.crumb a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--ctx); }

/* Page opener */
.open { display: grid; gap: 14px; margin-top: 28px; max-width: 820px; }
.open h2 { margin: 0; font-family: var(--serif); font-weight: 700; font-size: clamp(36px, 4.6vw, 58px); line-height: 1.02; letter-spacing: -.018em; text-wrap: balance; }
.stand { margin: 0; font-family: var(--serif); font-size: 19px; line-height: 1.45; max-width: 62ch; }

/* Hub grid */
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.dcard { display: grid; gap: 10px; align-content: start; text-decoration: none; min-width: 0; }
.dcard .thumb { aspect-ratio: 4 / 3; max-width: 100%; background: var(--tint); display: grid; place-items: center; padding: 22px; position: relative; }
.dcard .thumb svg { width: 100%; height: auto; display: block; }
.dcard h3 { margin: 0; font-family: var(--serif); font-weight: 700; font-size: 22px; line-height: 1.2; }
a.dcard:hover h3 { text-decoration: underline; text-underline-offset: 4px; }
a.dcard:hover .thumb { outline: 1px solid var(--ink); }
.dcard p { margin: 0; font-size: 15px; line-height: 1.4; color: var(--sub); }
.dcard .files { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--sub); padding-top: 8px; border-top: 1px solid var(--grid); font-variant-numeric: tabular-nums; }
.dcard .files b { color: var(--ink); }
.dcard.soon .label, .dcard.soon h3 { color: var(--sub); }
.dcard.soon .thumb b { font-family: var(--serif); font-weight: 800; font-size: clamp(64px, 8vw, 104px); color: var(--ctx); letter-spacing: -.03em; line-height: 1; }

/* How we work */
.rules { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; }
.rules div { display: grid; gap: 6px; align-content: start; min-width: 0; }
.rules h3 { margin: 0; font-family: var(--serif); font-weight: 700; font-size: 19px; line-height: 1.2; }
.rules p { margin: 0; font-size: 15px; line-height: 1.45; }

/* Story data page */
.facts { display: flex; flex-wrap: wrap; gap: 8px 32px; font-size: 14px; color: var(--sub); }
.facts b { display: block; font-family: var(--serif); font-size: 32px; line-height: 1.05; color: var(--ink); font-variant-numeric: tabular-nums lining-nums; }
.used { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 24px; }
.used div { display: grid; gap: 4px; align-content: start; padding-block: 10px; border-top: 1px solid var(--grid); min-width: 0; }
.used b { font-family: var(--serif); font-size: 40px; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums lining-nums; }
.used b.r { color: var(--red); }
.used span { font-size: 15px; line-height: 1.35; }
.used a { font-size: 13px; color: var(--sub); }

.set { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 20px 40px; align-items: start; }
.set .about { display: grid; gap: 12px; min-width: 0; }
.set h3 { margin: 0; font-family: var(--serif); font-weight: 700; font-size: 28px; line-height: 1.15; text-wrap: balance; }
.set .about > p { margin: 0; font-size: 16px; line-height: 1.5; }
.set dl { margin: 0; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 14px; font-size: 14px; line-height: 1.4; }
.set dt { font-weight: 700; }
.set dd { margin: 0; color: var(--ink); }
.set dd .flag { color: var(--red); font-weight: 700; }
.set .look { display: grid; gap: 10px; min-width: 0; }
.fig { background: var(--tint); padding: 18px; display: grid; gap: 6px; }
.fig .ft { margin: 0; font-family: var(--serif); font-weight: 700; font-size: 18px; line-height: 1.25; }
.fig svg { width: 100%; height: auto; display: block; }
.fig .bobo { height: 180px; width: auto; justify-self: start; }

.tbl { overflow-x: auto; border-top: 1px solid var(--ink); }
table { border-collapse: collapse; width: 100%; font-size: 14px; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 7px 12px 7px 0; border-bottom: 1px solid var(--grid); white-space: nowrap; }
th { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--sub); }
td.n, th.n { text-align: right; }
tr.hl td { color: var(--red); font-weight: 600; }
.tcap { font-size: 13px; color: var(--sub); margin: 0; }

.get { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.get button { font: inherit; font-weight: 700; font-size: 14px; letter-spacing: .03em; padding: 9px 16px; border: 0; background: var(--red); color: #FFFFFF; cursor: pointer; }
.get .dl { font-weight: 700; font-size: 14px; letter-spacing: .03em; padding: 9px 16px; background: var(--red); color: #FFFFFF; text-decoration: none; }
.get button.ghost { background: var(--paper); color: var(--ink); border: 1px solid var(--ink); }
.get .file { font-family: var(--mono); font-size: 13px; color: var(--sub); }
.get .ok { font-size: 13px; color: var(--sub); min-height: 1.2em; }
details { font-size: 14px; }
details summary { cursor: pointer; font-weight: 700; padding-block: 4px; }
details pre { margin: 8px 0 0; padding: 12px; background: var(--tint); font-family: var(--mono); font-size: 12px; line-height: 1.5; overflow-x: auto; max-height: 280px; }

.check { margin: 0; padding: 0; list-style: none; display: grid; gap: 0; }
.check li { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 16px; padding-block: 10px; border-top: 1px solid var(--grid); font-size: 15px; line-height: 1.45; }
.check li span { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--sub); padding-top: 2px; }
.check li span.r { color: var(--red); }

.use { background: var(--tint); margin-top: 52px; }
.use .page { padding-block: 4px 36px; }
.use .cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.use .cols div { background: var(--paper); padding: 20px; display: grid; gap: 8px; align-content: start; }
.use h3 { margin: 0; font-family: var(--serif); font-weight: 700; font-size: 20px; line-height: 1.2; }
.use p { margin: 0; font-size: 15px; line-height: 1.45; }
.foot-site .page { padding-block: 40px 32px; font-size: 13px; color: var(--sub); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }

@media (max-width: 900px) {
  .grid, .use .cols, .used { grid-template-columns: 1fr; }
  .rules { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .set { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .rules { grid-template-columns: 1fr; }
  .check li { grid-template-columns: 1fr; gap: 2px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

/* Data hub: a plain reference list, one row per story */
.ledger { display: grid; border-bottom: 1px solid var(--grid); }
.ds-row { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 5fr) minmax(0, 3fr); gap: 16px 32px; padding-block: 20px; border-top: 1px solid var(--grid); }
.ds-row:first-child { border-top: 0; }
.ds-story { display: grid; gap: 6px; align-content: start; }
.ds-story h3 { margin: 0; font-family: var(--serif); font-weight: 700; font-size: 22px; line-height: 1.2; }
.ds-story p { margin: 0; font-size: 14px; color: var(--sub); }
.ds-story p a, .ds-src a, .ds-files li div a { color: var(--ink); }
.ds-row h4 { margin: 0 0 8px; font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--sub); }
.ds-row ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.ds-files li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: start; }
.ds-files li div { display: grid; font-size: 15px; line-height: 1.3; }
.ds-files li span { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; color: var(--sub); overflow-wrap: anywhere; }
.ds-files .csv { font-size: 12px; font-weight: 700; letter-spacing: .06em; color: #fff; background: var(--red); text-decoration: none; padding: 3px 8px; margin-top: 1px; }
.ds-files .csv:hover { background: var(--ink); }
.ds-src li { font-size: 14px; line-height: 1.4; }
@media (max-width: 860px) { .ds-row { grid-template-columns: 1fr; } }
