/* A tally sheet, not a dashboard. Rules divide the page; the one block of
   colour is the field of marks in the opening figure.

   Companies take successive steps of a single ink ramp, so the shade carries
   rank. The ramp is validated for the surface it sits on — light end 3.14:1 on
   paper, 2.17:1 on ink — and every mark is named and counted in the key and
   again in the table, so nothing rests on colour alone. */

:root {
  color-scheme: light dark;

  --paper:    #edefe9;
  --band:     #e4e7df;
  --ink:      #181c19;
  --ink-soft: #4e564e;
  --muted:    #878f86;
  --rule:     #cfd4c9;
  --hair:     #dde1d7;

  --ramp-1:   #0d366b;
  --ramp-2:   #1c5cab;
  --ramp-3:   #3987e5;
  --accent:   #c1521c;

  --sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --rail: 148px;
  --gap: 40px;
  --measure: 62ch;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:    #171a17;
    --band:     #1e221d;
    --ink:      #f0f2ec;
    --ink-soft: #b4bcb2;
    --muted:    #828a81;
    --rule:     #2e332c;
    --hair:     #262a25;

    --ramp-1:   #184f95;
    --ramp-2:   #3987e5;
    --ramp-3:   #9ec5f4;
    --accent:   #d96a35;
  }
}

* { box-sizing: border-box; }

/* Scrollbars stay visible. macOS hides overlay scrollbars until something
   moves, which leaves a table that scrolls sideways looking like a table that
   is simply cut off. */
html { scrollbar-gutter: stable; }

* { scrollbar-width: thin; scrollbar-color: var(--rule) var(--band); }
*::-webkit-scrollbar { width: 12px; height: 12px; }
*::-webkit-scrollbar-track { background: var(--band); }
*::-webkit-scrollbar-thumb { background: var(--rule); border: 3px solid var(--band); border-radius: 6px; }
*::-webkit-scrollbar-thumb:hover { background: var(--muted); }
*::-webkit-scrollbar-corner { background: var(--band); }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

.wrap { max-width: 1000px; margin: 0 auto; padding: 0 32px; }

a { color: inherit; text-decoration-color: var(--rule); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--accent); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 32px; top: 12px; z-index: 10; background: var(--band); padding: 8px 14px; }

/* The utility face carries every label, count and axis tick. It is what makes
   the page read as something an instrument keeps rather than something a
   marketing site shows. */
.eyebrow, .key, .tick, .rail, .meta, td, th, .stamp, .count {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.eyebrow, .rail, .stamp {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---- Masthead ---- */

.masthead { border-bottom: 1px solid var(--rule); background: var(--band); }
.masthead .wrap { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; padding-top: 14px; padding-bottom: 14px; }
.wordmark { font-family: var(--mono); font-size: 13px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; text-decoration: none; }
.section-of { margin: 0; font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }

/* The stats section's own tabs. The app around them does not exist yet, so the
   masthead names this section rather than linking to siblings that would 404. */
.tabs { border-bottom: 1px solid var(--rule); background: var(--band); }
.tabs .wrap { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.tabs .wrap::-webkit-scrollbar { display: none; }
.tabs a {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--ink-soft); text-decoration: none;
  padding: 12px 16px; white-space: nowrap; border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs a:first-child { padding-left: 0; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current] { color: var(--ink); border-bottom-color: var(--accent); }

/* ---- Page head on the breakdown tabs ---- */

.page-head { padding: 34px 0 0; }
.page-head h1 { font-size: 1.5rem; margin-bottom: 4px; }
.page-head p { font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; color: var(--muted); margin: 0; max-width: none; }

/* ---- The opening figure ---- */

.opening { padding: 52px 0 40px; border-bottom: 1px solid var(--rule); }

/* Colour set here, not inherited: the generic paragraph rule below is muted
   and would otherwise grey out the one number the page exists to show. */
.figure-value {
  margin: 8px 0 10px;
  color: var(--ink);
  font-size: clamp(4rem, 13vw, 7rem);
  font-weight: 700;
  line-height: 0.8;
  letter-spacing: -0.045em;
  font-variant-numeric: proportional-nums;
}
.figure-meta { margin: 0 0 24px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.figure-meta em { font-style: normal; color: var(--accent); }

.opening-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }

/* Range picker — plain links, so the range is in the URL and the CDN can cache
   each one. */
.ranges { display: flex; gap: 2px; }
.ranges a {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted); text-decoration: none;
  padding: 5px 10px; border: 1px solid var(--hair);
}
.ranges a:hover { color: var(--ink); border-color: var(--rule); }
.ranges a[aria-current] { color: var(--paper); background: var(--ink); border-color: var(--ink); }

.market { margin-top: 22px; }
.market .tick { text-anchor: start; }
.grid.zero { stroke: var(--baseline); }
.axis-note { font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 8px 0 0; }

.figure-meta em.up { color: var(--good); }
.figure-meta em.down { color: var(--accent); }
.step-0 { --step: var(--ramp-2); }

/* ---- Ruled sections: label in the rail, content beside it ---- */

.row { display: grid; grid-template-columns: var(--rail) 1fr; gap: var(--gap); padding: 40px 0; border-bottom: 1px solid var(--rule); }
/* A grid track is min-width:auto by default, so a wide table would push the
   track — and the whole page — past the viewport instead of scrolling itself. */
.row > *, .colophon .wrap > * { min-width: 0; }
.row > .rail { padding-top: 3px; }
.rail b { display: block; font-weight: 400; color: var(--ink); }
.rail a { color: var(--muted); text-decoration-color: var(--rule); }
.rail a:hover { color: var(--ink); }
.body > :first-child { margin-top: 0; }
.body > :last-child { margin-bottom: 0; }

h1, h2 { font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; margin: 0 0 10px; }
h1 { font-size: 2rem; }
h2 { font-size: 1.15rem; }

p { margin: 0 0 12px; color: var(--ink-soft); max-width: var(--measure); }
p strong { color: var(--ink); }

/* ---- Counts strip ---- */

.counts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1px; background: var(--hair); border: 1px solid var(--hair); }
.counts div { background: var(--paper); padding: 14px 16px; }
.counts dt { font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.counts dd { margin: 0; font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }
.counts dd small { display: block; font-family: var(--mono); font-size: 10px; font-weight: 400; letter-spacing: 0.06em; color: var(--muted); margin-top: 4px; text-transform: uppercase; }

/* ---- Charts ---- */

.plot { display: block; width: 100%; height: auto; margin: 4px 0 0; overflow: visible; }
.grid { stroke: var(--hair); stroke-width: 1; }
.baseline { stroke: var(--rule); stroke-width: 1; }
.tick { fill: var(--muted); font-size: 10px; letter-spacing: 0.06em; }
.mark { fill: var(--ramp-2); }
.mark.alt { fill: var(--accent); }
.line { fill: none; stroke: var(--ramp-2); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.area { fill: var(--ramp-3); opacity: 0.14; }
.end-dot { fill: var(--ramp-2); stroke: var(--paper); stroke-width: 2; }
.end-label { fill: var(--ink); font-family: var(--mono); font-size: 11px; }
.mark:hover { fill: var(--accent); }

.median { stroke: var(--accent); stroke-width: 1.5; }
.median-label { fill: var(--accent); font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em; }

.legend { display: flex; gap: 18px; list-style: none; margin: 0 0 6px; padding: 0; font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft); }
.legend li { display: flex; align-items: center; gap: 6px; }
.legend .chip { width: 8px; height: 8px; }
.legend .chip.one { background: var(--ramp-2); }
.legend .chip.two { background: var(--accent); }

/* ---- The waiting state: a line, not an empty frame ---- */

.awaiting { border-left: 2px solid var(--accent); padding: 2px 0 2px 16px; }
.awaiting .stamp { color: var(--accent); display: block; margin-bottom: 6px; }

/* ---- Tables ---- */

table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { padding: 9px 12px 9px 0; text-align: left; border-bottom: 1px solid var(--hair); }
thead th { font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 400; }
tbody th { font-weight: 400; color: var(--ink); font-family: var(--mono); }
td { color: var(--ink-soft); }
td.n, th.n { text-align: right; padding-right: 0; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
.bar { width: 34%; }
.bar svg { display: block; width: 100%; height: 6px; }
.bar rect { fill: var(--step); }

.ledger { margin-top: 10px; }
.ledger summary { font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); cursor: pointer; padding: 8px 0; }
.ledger summary:hover { color: var(--ink); }
.ledger .scroll { max-height: 380px; overflow-y: auto; border-top: 1px solid var(--hair); }
.scroll { overflow-x: auto; }
.scroll table { min-width: 340px; }

/* ---- Prose ---- */

.prose { max-width: var(--measure); }
.prose h2 { margin-top: 32px; }
.prose dt { font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink); margin-top: 14px; }
.prose dd { margin: 2px 0 0; color: var(--ink-soft); }
.lede { font-size: 1.05rem; color: var(--ink); }

/* ---- Colophon ---- */

.colophon { background: var(--band); border-top: 1px solid var(--rule); margin-top: 0; padding: 26px 0 44px; }
.colophon .wrap { display: block; }
.colophon p { font-size: 12px; margin: 0; font-family: var(--mono); letter-spacing: 0.06em; color: var(--muted); }
.colophon .note { color: var(--ink); }

code { font-family: var(--mono); font-size: 0.9em; }

@media (max-width: 720px) {
  .wrap { padding: 0 20px; }
  .row, .colophon .wrap { grid-template-columns: 1fr; gap: 14px; }
  .row { padding: 28px 0; }
  .opening { padding: 36px 0 32px; }
  .opening-head { align-items: flex-start; }
  .bar { display: none; }
  .counts { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: no-preference) {
  .mark, .masthead nav a, a { transition: fill 120ms ease, color 120ms ease, text-decoration-color 120ms ease; }
}
