
/*
 * Tokens.
 *
 * The six inks come from the approved canvas and are stated in hex because that
 * is how the print reference states them. Everything derived from them, and
 * every tint that was not in the canvas, is authored in OKLCH so the ramp stays
 * perceptually even.
 */

:root {
  /* --- Ink ---------------------------------------------------------------- */
  --paper: #f4efe2;
  --paper-2: #eae2cd;
  --paper-3: #ded9cd;
  --ink: #191713;
  --ink-2: #5c564a;
  --ink-3: oklch(56% 0.014 84);
  --rule: #d5cab2;
  --rule-soft: oklch(88% 0.022 87);
  /* Chart tracks. Deliberately quiet, and never the only carrier of a value:
     every bar in this system prints its number alongside it. */
  --track: #d5cab2;

  --red: #c1332c;
  --red-deep: #b2182b;
  --red-tint: #e5b8a8;
  --red-wash: oklch(93% 0.035 32);

  /*
   * The brand red is a fill colour. At 4.84:1 on paper it is fine for large
   * type and bars, but it drops to 4.30:1 on the receipt ground, so red *text*
   * uses a darkened cut. Same hue, same reading, one that passes everywhere:
   * 5.71:1 on paper, 5.08:1 on paper-2.
   */
  --red-text: #b02a24;

  /*
   * --red-tint reads at only 3.84:1 on the red-deep field, so kickers on a
   * field use this instead. 5.65:1 on red-deep, 4.57:1 on red.
   */
  --on-field-kicker: #f5e6df;

  --blue: #1b4f8c;
  --blue-tint: #c6cfd9;
  --blue-wash: oklch(93% 0.02 250);

  /* Roles, so a component never reaches for a raw ink. */
  --bg: var(--paper-3);
  --surface: var(--paper);
  --surface-inset: var(--paper-2);
  --text: var(--ink);
  --text-muted: var(--ink-2);
  --text-faint: var(--ink-3);
  --border: var(--ink);
  --border-soft: var(--rule);
  --accent: var(--red);
  --compare: var(--blue);

  /* Field cards invert the roles. Set --on-field on the card, not per element. */
  --on-field: var(--paper);
  --on-field-muted: oklch(94.6% 0.021 88 / 0.78);
  --on-field-faint: oklch(94.6% 0.021 88 / 0.55);

  /* --- Type --------------------------------------------------------------- */
  --font-display: Anton, 'Arial Narrow', 'Helvetica Neue Condensed', sans-serif;
  --font-body: Archivo, ui-sans-serif, system-ui, 'Helvetica Neue', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Perfect fourth, fluid. */
  --step--1: clamp(0.75rem, 0.72rem + 0.14vw, 0.82rem);
  --step-0: clamp(0.97rem, 0.93rem + 0.18vw, 1.06rem);
  --step-1: clamp(1.25rem, 1.15rem + 0.5vw, 1.55rem);
  --step-2: clamp(1.6rem, 1.35rem + 1.2vw, 2.4rem);
  --step-3: clamp(2rem, 1.5rem + 2.4vw, 3.6rem);
  --step-4: clamp(2.6rem, 1.5rem + 4.8vw, 5.4rem);
  --step-hero: clamp(4.2rem, 2rem + 11vw, 9rem);

  --label: 0.66rem;
  --label-lg: 0.74rem;

  /* --- Space -------------------------------------------------------------- */
  --gutter: clamp(1.15rem, 4vw, 4rem);
  --card-x: clamp(1.25rem, 5vw, 2.4rem);
  --measure: 34rem;
  --measure-prose: 68ch;

  /* --- Motion ------------------------------------------------------------- */
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
  --dur-rise: 500ms;
  --dur-bar: 950ms;
  --dur-count: 1100ms;
}

/*
 * Print is not theme-aware, and neither is this. The warm stock is the identity;
 * a dark variant would be a different poster. Forced-colors mode is honoured
 * instead, which is what actually helps the readers a dark theme would not.
 */

@media (forced-colors: active) {
  :root {
    --surface: Canvas;
    --surface-inset: Canvas;
    --text: CanvasText;
    --text-muted: CanvasText;
    --border: CanvasText;
    --border-soft: CanvasText;
    --accent: LinkText;
    --compare: CanvasText;
    --on-field: CanvasText;
  }
}


/* ==========================================================================
   Chrome
   ========================================================================== */

.topbar {
  background: var(--ink);
  color: var(--paper);
}

.topbar__inner {
  width: min(100%, 96rem);
  margin-inline: auto;
  padding: 0.7rem var(--gutter);
  display: flex;
  align-items: center;
  gap: 1.5rem 2rem;
  flex-wrap: wrap;
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  flex: none;
}

.topbar .mark {
  width: 1.25rem;
  height: 1.25rem;
  filter: invert(1);
}

.topbar__word {
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0.01em;
  text-transform: lowercase;
}

.topbar__word b {
  font-weight: 400;
  color: var(--red-tint);
}

.topbar__tag {
  font-family: var(--font-mono);
  font-size: var(--label);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: oklch(78% 0.02 84);
  border-left: 1px solid oklch(45% 0.01 84);
  padding-left: 0.6rem;
}

.topbar__nav {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 1.15rem;
  font-family: var(--font-mono);
  font-size: var(--label-lg);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.topbar__nav a {
  text-decoration: none;
  color: oklch(84% 0.014 84);
  padding-block: 0.55rem;
  display: inline-block;
  border-bottom: 2px solid transparent;
}

.topbar__nav a:hover {
  color: var(--paper);
  border-bottom-color: var(--red);
}

.topbar__nav a[aria-current='page'] {
  color: var(--paper);
  border-bottom-color: var(--red);
}

/* The reading rail ---------------------------------------------------------- */

.rail {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--ink);
  color: var(--paper);
}

.rail__meta {
  width: min(100%, 96rem);
  margin-inline: auto;
  padding: 0.35rem var(--gutter) 0.4rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: var(--label);
  letter-spacing: 0.14em;
  color: oklch(80% 0.02 84);
}

.rail__count b {
  color: var(--red-tint);
  font-variant-numeric: tabular-nums;
}

.rail__track {
  height: 4px;
  background: oklch(32% 0.008 79);
}

.rail__fill {
  height: 100%;
  width: 0;
  background: var(--red);
  transition: width 250ms linear;
}

/* Footer -------------------------------------------------------------------- */

.footer {
  background: var(--ink);
  color: oklch(84% 0.014 84);
  padding-block: clamp(2.5rem, 6vw, 4.5rem);
  margin-top: 0;
}

.footer__floor {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  line-height: 1.7;
  color: var(--red-tint);
  border-bottom: 1px solid oklch(35% 0.01 79);
  padding-bottom: 1.4rem;
  margin-bottom: 1.8rem;
  max-width: 60ch;
}

.footer__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 2rem 2.5rem;
}

.footer__grid .label {
  color: var(--paper);
  margin-bottom: 0.7rem;
}

.footer__grid ul {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: var(--step--1);
}

.footer__grid a {
  text-decoration-color: oklch(50% 0.01 79);
}

.footer__note {
  font-size: var(--step--1);
  line-height: 1.6;
  max-width: 38ch;
}

.footer__sig {
  margin-top: 2.2rem;
  padding-top: 1.2rem;
  border-top: 1px solid oklch(35% 0.01 79);
  font-family: var(--font-mono);
  font-size: var(--label);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: oklch(62% 0.012 79);
}

/* ==========================================================================
   The feed
   ========================================================================== */

.feed {
  width: min(100%, 40rem);
  margin-inline: auto;
  background: var(--surface);
  border-inline: 1px solid var(--rule);
}

@media (min-width: 62rem) {
  .feed {
    width: min(100%, 46rem);
  }
}

.feed .card:last-child {
  border-bottom: 0;
}

.card .kicker + .num {
  display: block;
  margin-bottom: 0.35rem;
}

.card h1,
.card h2 {
  margin-bottom: 0.7rem;
}

.card .lede {
  margin-bottom: 1.2rem;
  color: var(--text);
}

.card__floor {
  margin-top: 1.6rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-soft);
  color: var(--text-muted);
}

/* Numerals ------------------------------------------------------------------ */

.num--hero {
  font-size: var(--step-hero);
  display: block;
}

.num--large {
  font-size: var(--step-3);
  display: inline-block;
}

.num--medium {
  font-size: var(--step-2);
  display: block;
}

.num__affix {
  font-size: 0.42em;
  letter-spacing: 0;
  vertical-align: baseline;
}

.num--medium .num__affix,
.num--large .num__affix {
  font-size: 0.5em;
}

/* The paired comparison on card 2 ------------------------------------------- */

.pair {
  display: grid;
  grid-template-columns: 4.5rem 4.5rem minmax(0, 1fr);
  gap: 1.4rem;
  align-items: end;
  min-height: 17rem;
  margin-bottom: 1.3rem;
}

.pair__col {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 100%;
}

.pair__col .num {
  font-size: clamp(1.6rem, 6vw, 2.3rem);
  margin-bottom: 0.5rem;
}

.pair__num--accent {
  color: var(--red-tint);
}

.pair__track {
  flex: 1;
  min-height: 8rem;
  display: flex;
  align-items: flex-end;
  background: color-mix(in oklch, black 14%, transparent);
}

.pair__bar {
  width: 100%;
  background: var(--on-field);
}

.pair__bar--accent {
  background: var(--red);
}

.pair__col .label {
  margin-top: 0.6rem;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.pair__aside {
  padding-bottom: 2.1rem;
  font-size: var(--step-0);
  line-height: 1.5;
  color: var(--text);
}

@media (max-width: 32rem) {
  .pair {
    grid-template-columns: 4rem 4rem;
    min-height: 14rem;
  }
  .pair__aside {
    grid-column: 1 / -1;
    padding-bottom: 0;
  }
}

/* Rent slider --------------------------------------------------------------- */

.rent {
  border: 1.5px solid var(--border);
  background: var(--surface-inset);
  padding: 1rem 1rem 1.15rem;
  margin-block: 1.3rem;
}

.rent label {
  display: block;
  margin-bottom: 0.7rem;
}

.rent input[type='range'] {
  width: 100%;
  height: 44px;
  accent-color: var(--red);
}

.rent__out {
  margin-top: 0.6rem;
  font-size: var(--step-0);
  line-height: 1.45;
}

/* Postal gate --------------------------------------------------------------- */

.postal label {
  display: block;
  margin-bottom: 0.6rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
}

.postal__row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
}

.postal input {
  flex: 1;
  min-width: 0;
  padding: 0.8rem 0.75rem;
  border: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
}

.postal input[aria-invalid='true'] {
  box-shadow: inset 0 0 0 2px var(--red-deep);
}

.postal__out {
  min-height: 2.6em;
  color: var(--text-muted);
}

.postal__note {
  margin-top: 1.1rem;
  color: var(--text-muted);
}

.reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.2rem;
}

/* Section index on the last card -------------------------------------------- */

.sections {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-block: 1.4rem;
  border-top: 1px solid var(--border-soft);
}

.sections__item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.15rem 1rem;
  padding: 0.95rem 0;
  border-bottom: 1px solid var(--border-soft);
  text-decoration: none;
  transition: padding-inline-start 180ms var(--ease-out), background 180ms var(--ease-out);
}

.sections__item:hover {
  background: var(--surface-inset);
  padding-inline-start: 0.6rem;
}

.sections__title {
  grid-column: 1;
  grid-row: 1;
  font-family: var(--font-display);
  font-size: var(--step-1);
  text-transform: uppercase;
  line-height: 1.1;
}

.sections__count {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
  color: var(--red-text);
}

.sections__blurb {
  grid-column: 1 / -1;
  grid-row: 2;
  font-size: var(--step--1);
  line-height: 1.5;
  color: var(--text-muted);
}

/* ==========================================================================
   Section pages
   ========================================================================== */

.sectionhead {
  background: var(--surface);
  border-bottom: 2px solid var(--border);
  padding-block: clamp(2.5rem, 7vw, 5rem) clamp(2rem, 5vw, 3.5rem);
}

.sectionhead h1 {
  font-size: var(--step-4);
  margin-block: 0.2rem 1rem;
  max-width: 16ch;
}

.sectionhead__lede {
  font-size: var(--step-1);
  line-height: 1.4;
  max-width: 48ch;
}

.sectionhead__stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 1.5rem 2rem;
  margin-top: clamp(2rem, 4vw, 3rem);
  padding-top: 1.6rem;
  border-top: 2px solid var(--border);
}

.sectionhead__stats dt {
  color: var(--text-muted);
  margin-bottom: 0.45rem;
}

.sectionhead__stats dd {
  margin: 0;
}

.band {
  background: var(--surface);
  border-bottom: 2px solid var(--border);
  padding-block: clamp(2.2rem, 5.5vw, 4rem);
}

.band--field {
  border-bottom: 0;
}

.band__head {
  margin-bottom: clamp(1.2rem, 3vw, 2rem);
}

.band__head h2 {
  max-width: 18ch;
}

.band__lede {
  margin-top: 0.8rem;
  max-width: 56ch;
  font-size: var(--step-0);
  line-height: 1.55;
  color: var(--text-muted);
}

.band--field .band__lede {
  color: var(--text-muted);
}

.callout {
  border: 1.5px solid var(--border);
  padding: 1.1rem 1.2rem;
  margin-block: 1.4rem;
  max-width: 62ch;
  font-size: var(--step-0);
  line-height: 1.6;
}

.callout--accent {
  border-color: var(--red);
  background: var(--red-wash);
}

.callout--onfield {
  background: color-mix(in oklch, black 20%, transparent);
  border-color: color-mix(in oklch, var(--on-field) 40%, transparent);
}

.split-cols {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 2rem;
  align-items: center;
}

@media (max-width: 48rem) {
  .split-cols {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Charts
   ========================================================================== */

.rank__rows,
.split__rows {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.rank__row.is-highlight .chart__row {
  color: var(--red-text);
}

[data-field] .rank__row.is-highlight .chart__row {
  color: var(--on-field);
}

.rank__note {
  margin-top: 0.3rem;
  font-family: var(--font-mono);
  font-size: var(--label);
  color: var(--text-muted);
  line-height: 1.5;
}

.split__row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.split__track {
  height: 0.6rem;
  background: var(--track);
}

.split__bar {
  height: 100%;
}

.split__bar--l {
  background: var(--red);
}

.split__bar--r {
  background: var(--blue);
}

.split__note {
  margin-top: 0.3rem;
  font-family: var(--font-mono);
  font-size: var(--label);
  color: var(--text-muted);
}

[data-field] .split__bar--l {
  background: var(--on-field);
}

[data-field] .split__bar--r {
  background: color-mix(in oklch, var(--on-field) 35%, transparent);
}

.split__l {
  color: var(--red-text);
}

[data-field] .split__l {
  color: var(--on-field);
}

/* Flow ---------------------------------------------------------------------- */

.flow__bar {
  display: flex;
  gap: 2px;
}

.flow__part {
  flex-basis: 0;
  min-width: 0;
}

.flow__part--paper {
  background: var(--paper);
}
.flow__part--ink {
  background: var(--ink);
}
.flow__part--accent {
  background: var(--red);
}
.flow__part--compare {
  background: var(--blue);
}

[data-field='ink'] .flow__part--ink {
  background: oklch(45% 0.012 79);
}

/*
 * Brand blue is 2.2:1 against the ink field — a segment nobody can find. The
 * tint clears 11:1 there. Same reasoning as the ink override above: on a field
 * a tone is chosen for separation from that field, not for brand consistency.
 */
[data-field='ink'] .flow__part--compare {
  background: var(--blue-tint);
}

.flow__keys {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem 2rem;
  margin-top: 0.85rem;
}

.flow__key {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.15rem 0.5rem;
  align-items: center;
  font-family: var(--font-mono);
  font-size: var(--label-lg);
}

.flow__swatch {
  width: 0.8rem;
  height: 0.8rem;
  grid-row: 1 / span 2;
}

.flow__key b {
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: var(--label);
}

.flow__key em {
  font-style: normal;
  color: var(--text-muted);
  font-size: var(--label);
}

/* Marimekko ----------------------------------------------------------------- */

.mekko__grid {
  display: flex;
  gap: 3px;
  align-items: stretch;
  overflow: hidden;
}

.mekko__col {
  flex-basis: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.mekko__stack {
  display: flex;
  flex-direction: column;
  height: 15rem;
}

.mekko__seg {
  background: var(--tone);
  flex-basis: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.mekko__seg-label {
  font-family: var(--font-mono);
  font-size: var(--label);
  color: color-mix(in oklch, black 72%, white);
  mix-blend-mode: luminosity;
}

.mekko__label {
  margin-top: 0.5rem;
  font-family: var(--font-mono);
  font-size: var(--label);
  letter-spacing: 0.04em;
  line-height: 1.35;
}

.mekko__label em {
  display: block;
  font-style: normal;
  color: var(--text-muted);
}

/* Unit dots ----------------------------------------------------------------- */

.dots__grid {
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  gap: 4px;
  margin-bottom: 0.75rem;
}

.dots__dot {
  aspect-ratio: 1;
  background: color-mix(in oklch, var(--on-field) 62%, transparent);
  border-radius: 1px;
}

.dots__grid--round .dots__dot {
  border-radius: 50%;
}

.dots__dot.is-hot {
  background: var(--on-field);
}

.dots__key {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: color-mix(in oklch, currentColor 62%, transparent);
}

.dots__key.is-hot {
  background: currentColor;
}

/* Zone grid ----------------------------------------------------------------- */

.zones__grid {
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  gap: 5px;
  max-width: 44rem;
}

.zones__tile {
  aspect-ratio: 1;
  padding: 0.45rem 0.4rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

.zones__key {
  font-family: var(--font-mono);
  font-size: var(--label);
  font-weight: 600;
  opacity: 0.85;
}

.zones__val {
  font-family: var(--font-display);
  font-size: clamp(0.95rem, 2.6vw, 1.35rem);
  line-height: 1;
}

.zones__sub {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legend--ramp {
  align-items: center;
}

.legend__ramp {
  width: 7rem;
  height: 0.7rem;
  background: linear-gradient(to right, #c1332c, #d76a55, #e7a894, #c6cfd9, #7d9dba, #1b4f8c);
}

/* Treemap ------------------------------------------------------------------- */

.treemap__box {
  position: relative;
  width: 100%;
}

.treemap__cell {
  position: absolute;
  padding: 0.4rem 0.5rem;
  overflow: hidden;
  outline: 1px solid var(--surface);
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  container-type: size;
}

/* The aggregate block is a bookkeeping cell, not a category. Outlined, never filled. */
.treemap__cell--tail {
  outline: 1.5px dashed var(--rule);
  outline-offset: -3px;
}

.treemap__value {
  font-family: var(--font-display);
  font-size: 1.15rem;
  line-height: 1;
}

.treemap__label {
  font-family: var(--font-mono);
  font-size: var(--label);
  letter-spacing: 0.04em;
  line-height: 1.25;
}

/*
 * When a cell runs out of room the label goes first and the number stays: a
 * number without a label is recoverable from the list below, a label without a
 * number is not recoverable from anywhere.
 */
@container (max-height: 3.4rem) {
  .treemap__label {
    display: none;
  }
}

@container (max-width: 4rem) {
  .treemap__label {
    display: none;
  }
}

@container (max-height: 1.7rem) {
  .treemap__value {
    display: none;
  }
}

/* The full category list, for everything the treemap cannot label. */
.catlist {
  columns: 3 14rem;
  column-gap: 2.5rem;
  margin-top: 1.6rem;
  padding-top: 1.2rem;
  border-top: 2px solid var(--border);
}

.catlist__item {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  break-inside: avoid;
  padding: 0.28rem 0;
  border-bottom: 1px solid var(--border-soft);
  font-family: var(--font-mono);
  font-size: var(--step--1);
}

.catlist__item b {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

/* SVG chart text ------------------------------------------------------------ */

/*
 * SVG charts are drawn in a 340-unit box, which is a phone column. Left to
 * scale with a full-width section they reach three times that and their 9px
 * axis type arrives at 32px. The cap keeps the drawn size near the designed
 * size; a chart that genuinely wants the room asks for it with --chart-max.
 */
.chart svg {
  width: 100%;
  max-width: var(--chart-max, 32rem);
  height: auto;
  overflow: visible;
}

.chart--wide {
  --chart-max: 46rem;
}

.slope__label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.04em;
  fill: var(--text);
}

.slope__label--muted {
  fill: var(--text-muted);
}

.slope__value {
  font-family: var(--font-mono);
  font-size: 9px;
  fill: var(--text-muted);
}

.dumbbell__key {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  border: 1.5px solid var(--text-faint);
  background: var(--surface);
}

.dumbbell__key.is-solid {
  background: var(--blue);
  border-color: var(--blue);
}

/* Sparklines ---------------------------------------------------------------- */

.sparks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 0.6rem 2rem;
  margin-block: 1.4rem;
}

.spark {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.1rem 0.8rem;
  padding-block: 0.5rem;
  border-top: 1px solid var(--border-soft);
}

.spark__label {
  font-family: var(--font-mono);
  font-size: var(--label-lg);
  letter-spacing: 0.04em;
}

.spark__svg {
  grid-row: 1 / span 2;
  grid-column: 2;
  width: 5.5rem;
}

.spark__ends {
  font-family: var(--font-mono);
  font-size: var(--label);
  color: var(--text-muted);
}

/* Timeline ------------------------------------------------------------------ */

.timeline__strip {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.timeline__col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.timeline__barwrap {
  width: 100%;
  height: 8rem;
  display: flex;
  align-items: flex-end;
  background: var(--track);
}

.timeline__bar {
  width: 100%;
  background: var(--red);
}

.timeline__value {
  font-family: var(--font-display);
  font-size: 1.1rem;
  line-height: 1;
}

.timeline__label {
  font-family: var(--font-mono);
  font-size: var(--label);
  color: var(--text-muted);
}

/* Histogram ----------------------------------------------------------------- */

.histogram__bars {
  display: flex;
  gap: 3px;
  align-items: flex-end;
}

.histogram__col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}

.histogram__barwrap {
  width: 100%;
  height: 9rem;
  display: flex;
  align-items: flex-end;
  border-bottom: 1px solid var(--border-soft);
}

.histogram__bar {
  width: 100%;
  background: var(--blue);
}

.histogram__count,
.histogram__label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.2;
}

/* Thinned bin labels leave some columns a line shorter, which would stagger
   the counts along the top. Reserve the line whether or not it is printed. */
.histogram__label {
  min-height: 1.2em;
}

/* Funnel -------------------------------------------------------------------- */

.funnel__steps {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  counter-reset: step;
}

.funnel__bar {
  height: 2.2rem;
  background: var(--blue);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-inline: 0.5rem;
  min-width: 3.5rem;
}

.funnel__step:last-child .funnel__bar {
  background: var(--red);
}

.funnel__pct {
  font-family: var(--font-mono);
  font-size: var(--label);
  font-weight: 600;
  color: var(--paper);
}

.funnel__lost {
  margin-top: 0.35rem;
  font-family: var(--font-mono);
  font-size: var(--label);
  color: var(--text-muted);
}

/* Radial arc ---------------------------------------------------------------- */

.arc {
  position: relative;
  display: grid;
  place-items: center;
  text-align: center;
}

.arc__svg {
  width: min(100%, 11rem);
}

.arc__center {
  position: absolute;
  inset-block-start: 50%;
  transform: translateY(-70%);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  pointer-events: none;
}

.arc__value {
  font-family: var(--font-display);
  font-size: 1.9rem;
  line-height: 1;
}

.arc__sub {
  font-family: var(--font-mono);
  font-size: var(--label);
  color: var(--text-muted);
}

/* ==========================================================================
   Data tables
   ========================================================================== */

.datatable__controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem 1.4rem;
  align-items: flex-end;
  margin-bottom: 1rem;
}

.datatable__field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 10rem;
}

.datatable__field--end {
  margin-inline-start: auto;
  flex-direction: row;
  align-items: center;
  gap: 0.9rem;
}

.datatable input[type='search'],
.datatable select {
  min-height: 44px;
  padding: 0.4rem 0.6rem;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: var(--step--1);
  border-radius: 2px;
}

.table-wrap {
  max-height: 34rem;
  overflow: auto;
}

/*
 * These tables run to thousands of rows. Every row stays in the markup, because
 * the markup is the record; `content-visibility` lets the browser skip layout
 * and paint for the rows nobody is looking at.
 */
tbody tr {
  content-visibility: auto;
  contain-intrinsic-size: auto 2.1rem;
}

th.is-sortable {
  cursor: pointer;
  user-select: none;
  padding-inline-end: 1.4rem;
  position: sticky;
}

th.is-sortable::after {
  content: '↕';
  position: absolute;
  inset-inline-end: 0.45rem;
  opacity: 0.35;
}

th[aria-sort='ascending']::after {
  content: '↑';
  opacity: 1;
  color: var(--red);
}

th[aria-sort='descending']::after {
  content: '↓';
  opacity: 1;
  color: var(--red);
}

td a {
  color: var(--blue);
}

/* ==========================================================================
   Method page
   ========================================================================== */

.rules {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr));
  gap: 1.6rem 2.5rem;
}

.rules__item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  align-items: start;
  border-top: 2px solid var(--border);
  padding-top: 0.9rem;
}

.rules__n {
  font-size: 1.7rem;
  color: var(--red-text);
}

.rules__item h3 {
  font-size: var(--step-1);
  margin-bottom: 0.4rem;
}

.rules__item p {
  font-size: var(--step--1);
  line-height: 1.6;
  color: var(--text-muted);
}

.sources {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
  gap: 1.5rem 2.5rem;
}

.sources__item {
  border-top: 2px solid var(--border);
  padding-top: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.sources__item h3 {
  font-size: var(--step-1);
  margin-bottom: 0.2rem;
}

.sources__item .label {
  color: var(--red-text);
}

.sources__meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 0.9rem;
  font-family: var(--font-mono);
  font-size: var(--label);
}

.sources__meta dt {
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sources__meta dd {
  margin: 0;
}

.sources__caveat {
  font-size: var(--step--1);
  line-height: 1.6;
  color: var(--text-muted);
}

.sources__caveat b {
  color: var(--text);
}


/* --------------------------------------------------------------------------
 * Bars on a colour field
 *
 * Red cannot mean "this is the row that needs help" on a red card: it vanishes.
 * Inside a field the emphasis flips to weight instead of hue, so the marked row
 * is the solid one and the rest step back.
 * -------------------------------------------------------------------------- */

[data-field] .chart__bar {
  background: color-mix(in oklch, var(--on-field) 58%, transparent);
}

[data-field] .chart__bar--accent {
  background: var(--on-field);
}

[data-field='red'] .chart__track,
[data-field='red-deep'] .chart__track {
  background: color-mix(in oklch, black 26%, transparent);
}

/*
 * Four fills that still named a brand colour directly, and therefore vanished
 * the first time their chart was put on a field of that colour: a blue
 * histogram bar on the blue field is invisible, and it renders at full height
 * while showing nothing. Same rule as the bars above — on a field the tone is
 * chosen for separation from that field, not for brand consistency.
 */
[data-field] .histogram__bar,
[data-field] .funnel__bar {
  background: color-mix(in oklch, var(--on-field) 72%, transparent);
}

[data-field] .funnel__step:last-child .funnel__bar,
[data-field] .timeline__bar {
  background: var(--on-field);
}

[data-field] .dumbbell__key.is-solid {
  background: var(--on-field);
  border-color: var(--on-field);
}

/* Marimekko labels ---------------------------------------------------------- */

.mekko__col {
  /* No minimum: column width is the encoding, and padding the two smallest
     offices out to a readable size would misstate how few races they hold.
     Their labels move to the key underneath instead. */
  container-type: inline-size;
}

@container (max-width: 4.6rem) {
  .mekko__label {
    display: none;
  }
}

.mekko__label {
  overflow-wrap: anywhere;
  hyphens: none;
}

.mekko__seg-label {
  font-family: var(--font-mono);
  font-size: var(--label);
  mix-blend-mode: normal;
}

.mekko__seg--light .mekko__seg-label {
  color: var(--ink);
}

.mekko__seg--dark .mekko__seg-label {
  color: var(--paper);
}

/* A segment too short for a number just carries its title attribute. */
@container (max-height: 1.6rem) {
  .mekko__seg-label {
    display: none;
  }
}

.mekko__seg {
  container-type: size;
}


/* The rent scale: where the average sits, and where the reader put themselves. */
.rent__scale {
  position: relative;
  height: 1.9rem;
  margin-top: 0.2rem;
}

.rent__tick {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  font-family: var(--font-mono);
  font-size: var(--label);
  color: var(--text-muted);
  white-space: nowrap;
}

.rent__tick i {
  width: 1px;
  height: 0.45rem;
  background: var(--text-muted);
}

.rent__marker {
  position: absolute;
  top: 0;
  inset-inline-start: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 0.45rem;
  background: var(--red);
}


/* Kickers on a colour field need their own tint; the paper red-tint is too
   close in luminance to the red-deep ground. */
[data-field] .kicker {
  color: var(--on-field-kicker);
}


/* Every office named, including the columns too narrow to carry a label. */
.mekko__key {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1.4rem;
  margin-top: 0.9rem;
  font-family: var(--font-mono);
  font-size: var(--label);
  color: var(--text-muted);
}

.mekko__key b {
  color: var(--text);
  font-weight: 600;
}

/* Calculator ---------------------------------------------------------------- */

.calculator {
  background: var(--surface-inset);
  padding: 1.4rem;
  margin-block: 1.5rem;
}

[data-field='ink'] .calculator {
  background: oklch(25% 0.01 79);
}

.calculator label {
  display: block;
  margin-bottom: 0.8rem;
  font-family: var(--font-mono);
  font-size: var(--label-lg);
  color: var(--text-muted);
}

[data-field='ink'] .calculator label {
  color: var(--on-field-muted);
}

.calculator__controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
}

.calculator__controls input[type='range'] {
  flex: 1;
  min-width: 12rem;
}

.calculator__count {
  font-size: 0.95rem;
  color: var(--text);
  white-space: nowrap;
}

[data-field='ink'] .calculator__count {
  color: var(--on-field);
}

.calculator__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.calculator__card {
  background: var(--surface);
  padding: 1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  border: 1px solid var(--border-soft);
}

[data-field='ink'] .calculator__card {
  background: oklch(19% 0.008 79);
  border: 1px solid oklch(35% 0.01 79);
}

.calculator__card--accent {
  border: 1px solid var(--blue);
  background: color-mix(in oklch, var(--blue) 8%, var(--surface));
}

[data-field='ink'] .calculator__card--accent {
  border: 1px solid var(--paper);
  background: oklch(22% 0.01 79);
}

.calculator__lede {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text);
}

[data-field='ink'] .calculator__lede {
  color: var(--on-field);
}

/* Filter ribbon ------------------------------------------------------------- */

.filter-ribbon {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-block: 1rem 1.4rem;
}

.filter-ribbon .chip {
  font-size: var(--label-lg);
}

/* ==========================================================================
   Satirical Civic Social Feed & Infographic Items
   ========================================================================== */

.post-social-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-bottom: 0.85rem;
  margin-bottom: 1.1rem;
  border-bottom: 1px solid var(--border-soft);
}

[data-field] .post-social-header {
  border-bottom-color: color-mix(in oklch, var(--on-field) 20%, transparent);
}

.post-social-header__avatar {
  flex-shrink: 0;
  width: 2.2rem;
  height: 2.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-inset);
  border: 1px solid var(--border-soft);
}

[data-field] .post-social-header__avatar {
  background: color-mix(in oklch, var(--on-field) 15%, transparent);
  border-color: color-mix(in oklch, var(--on-field) 30%, transparent);
}

.post-social-header__meta {
  flex: 1;
  min-width: 0;
}

.post-social-header__author {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  line-height: 1.2;
}

.post-social-header__name {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}

[data-field] .post-social-header__name {
  color: var(--on-field);
}

.post-social-header__verified {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  background: var(--blue);
  color: var(--paper);
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 50%;
}

.post-social-header__handle {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

[data-field] .post-social-header__handle {
  color: var(--on-field-muted);
}

.post-social-header__subline {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

[data-field] .post-social-header__subline {
  color: var(--on-field-muted);
}

.algo-pill {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--surface-inset);
  color: var(--red-text);
  border: 1px solid var(--border-soft);
}

.algo-pill--onfield {
  background: color-mix(in oklch, var(--on-field) 15%, transparent);
  color: var(--on-field);
  border-color: color-mix(in oklch, var(--on-field) 30%, transparent);
}

/* Satirical Engagement Footer */

.post-social-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1rem;
  margin-top: 1.2rem;
  border-top: 1px solid var(--border-soft);
  flex-wrap: wrap;
}

[data-field] .post-social-footer {
  border-top-color: color-mix(in oklch, var(--on-field) 20%, transparent);
}

.post-social-footer__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.post-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border-soft);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease;
}

.post-action-btn:hover {
  background: var(--surface-inset);
}

.post-action-btn[aria-pressed='true'] {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.post-action-btn--onfield {
  background: color-mix(in oklch, var(--on-field) 10%, transparent);
  border-color: color-mix(in oklch, var(--on-field) 30%, transparent);
  color: var(--on-field);
}

.post-action-btn--onfield:hover {
  background: color-mix(in oklch, var(--on-field) 20%, transparent);
}

.post-action-btn--onfield[aria-pressed='true'] {
  background: var(--on-field);
  color: var(--field-bg, var(--ink));
}

.signal-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.signal-tag--onfield {
  color: var(--on-field-muted);
}

.signal-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--blue);
  display: inline-block;
}

/* AntV Graphic Container & Fallback */

.antv-graphic-wrap {
  margin: 1.2rem 0;
}

.antv-graphic-title {
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.8rem;
}

.antv-step-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.antv-step-item {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  padding: 0.75rem 1rem;
  background: var(--surface-inset);
  border: 1px solid var(--border-soft);
}

[data-field] .antv-step-item {
  background: color-mix(in oklch, var(--on-field) 10%, transparent);
  border-color: color-mix(in oklch, var(--on-field) 25%, transparent);
}

.antv-step-num {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--red-text);
}

[data-field] .antv-step-num {
  color: var(--on-field);
}

.antv-step-content {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.antv-step-label {
  font-size: 0.95rem;
  font-weight: 700;
}

.antv-step-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
}

[data-field] .antv-step-desc {
  color: var(--on-field-muted);
}

.antv-canvas-mount {
  display: none;
}

/* Pudding.cool Scrollytelling Stories */

.scrolly-story {
  margin-block: 1.2rem;
}

.scrolly-story__title {
  font-family: var(--font-body);
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.scrolly-story__track {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13.5rem, 1fr));
  gap: 1rem;
}

.scrolly-step {
  background: var(--surface);
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.scrolly-step--highlight {
  border-color: var(--blue);
  background: color-mix(in oklch, var(--blue) 5%, var(--surface));
}

[data-field] .scrolly-step {
  background: color-mix(in oklch, var(--on-field) 12%, transparent);
  border-color: color-mix(in oklch, var(--on-field) 25%, transparent);
}

[data-field] .scrolly-step--highlight {
  background: color-mix(in oklch, var(--on-field) 22%, transparent);
  border-color: var(--on-field);
}

.scrolly-step__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

[data-field] .scrolly-step__header {
  color: var(--on-field-muted);
}

.scrolly-step__badge {
  text-transform: uppercase;
  font-weight: 700;
}

.scrolly-step__metric {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.scrolly-step__label {
  font-size: 0.85rem;
  font-weight: 600;
}

.scrolly-step__bar-track {
  height: 6px;
  background: var(--border-soft);
  width: 100%;
  overflow: hidden;
}

[data-field] .scrolly-step__bar-track {
  background: color-mix(in oklch, var(--on-field) 20%, transparent);
}

.scrolly-step__bar-fill {
  height: 100%;
  background: var(--ink);
}

.scrolly-step__bar-fill--accent {
  background: var(--red);
}

[data-field] .scrolly-step__bar-fill {
  background: var(--on-field);
}

.scrolly-step__explanation {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--text-muted);
}

[data-field] .scrolly-step__explanation {
  color: var(--on-field-muted);
}


/* ===========================================================================
 * Uncertainty family
 *
 * Five forms whose subject is a missing number rather than a present one.
 * Withheld quantities always carry a diagonal hatch as well as a colour, so
 * they survive greyscale printing, colour-vision deficiency and forced colours.
 * =========================================================================== */

/*
 * One hatch definition, used by every "this is withheld" mark in the system.
 * 45° so it never lines up with a bar edge and reads as a border.
 */
.matrix__cell--hatch,
.legend__swatch--hatch,
.columns__bar--withheld {
  background-image: repeating-linear-gradient(
    45deg,
    transparent 0 3px,
    color-mix(in oklch, var(--paper) 70%, transparent) 3px 5px
  );
}

/* RangeBar ------------------------------------------------------------------ */

/*
 * The 2px gaps are the separation. Three segments of a certainty ramp sit
 * adjacent, and adjacent fills of similar lightness merge; a gap showing the
 * track behind them means each segment only has to separate from one known
 * ground rather than from whatever happens to be next to it.
 */
.range__track {
  display: flex;
  gap: 2px;
  height: 2.6rem;
  background: var(--surface-inset);
  border: 1px solid var(--border-soft);
  overflow: hidden;
}

.range__seg {
  height: 100%;
  min-width: 1px;
  transition: width var(--dur-bar) var(--ease-out);
}

/* Known, at-least, at-most: solid, hatched, outlined. Three certainties. */
.range__seg--counted {
  background: var(--ink);
}

.range__seg--atleast {
  background: var(--red);
  background-image: repeating-linear-gradient(
    45deg,
    transparent 0 3px,
    color-mix(in oklch, var(--paper) 68%, transparent) 3px 5px
  );
}

.range__seg--atmost {
  background: color-mix(in oklch, var(--red) 22%, var(--paper-2));
  background-image: repeating-linear-gradient(
    45deg,
    transparent 0 5px,
    color-mix(in oklch, var(--red) 45%, transparent) 5px 6px
  );
}

[data-field] .range__track {
  background: color-mix(in oklch, var(--ink) 28%, transparent);
  border-color: color-mix(in oklch, var(--on-field) 35%, transparent);
}

[data-field] .range__seg--counted {
  background: var(--on-field);
}

/* On a field the ramp runs paper → tint → wash, monotone and hatched. */
[data-field] .range__seg--atleast {
  background: var(--red-tint);
  background-image: repeating-linear-gradient(
    45deg,
    transparent 0 3px,
    color-mix(in oklch, var(--ink) 55%, transparent) 3px 5px
  );
}

[data-field] .range__seg--atmost {
  background: color-mix(in oklch, var(--on-field) 18%, transparent);
  background-image: repeating-linear-gradient(
    45deg,
    transparent 0 5px,
    color-mix(in oklch, var(--on-field) 60%, transparent) 5px 6px
  );
}

/*
 * Running totals sit under the boundary they name, not at the ends of the
 * track. Each mark is as wide as its own segment and right-aligns, so the
 * number lands exactly where that segment stops.
 */
.range__marks {
  display: flex;
  gap: 2px;
  margin-top: 0.35rem;
}

.range__mark {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 0;
}

.range__mark-tick {
  width: 2px;
  height: 0.5rem;
  background: var(--text-muted);
}

[data-field] .range__mark-tick {
  background: var(--on-field-muted);
}

.range__mark-value {
  font-family: var(--font-mono);
  font-size: var(--label-lg);
  font-weight: 600;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  transform: translateX(50%);
  margin-top: 0.2rem;
  white-space: nowrap;
}

/* The last mark would run off the right edge; pull it back inside. */
.range__mark:last-child .range__mark-value {
  transform: none;
}

/*
 * A narrow segment is narrower than the number naming it, so on a phone the
 * boundary figures collide. They are dropped there rather than shrunk, because
 * the key underneath already carries every running total in words.
 */
@media (max-width: 34rem) {
  .range__marks {
    display: none;
  }
}

.range__key {
  list-style: none;
  margin: 1.6rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}

.range__key li {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  max-width: 46ch;
}

.range__key b,
.range__running {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.92em;
}

.range__running {
  color: var(--text-muted);
}

[data-field] .range__running {
  color: var(--on-field-muted);
}

.range__swatch {
  flex: none;
  width: 0.9rem;
  height: 0.9rem;
  translate: 0 0.1rem;
  border: 1px solid color-mix(in oklch, var(--ink) 25%, transparent);
}

[data-field] .range__swatch {
  border-color: color-mix(in oklch, var(--on-field) 40%, transparent);
}

.range__unit {
  margin-top: 1rem;
  font-family: var(--font-mono);
  font-size: var(--label);
  letter-spacing: 0.06em;
  color: var(--text-muted);
  text-transform: uppercase;
}

[data-field] .range__unit {
  color: var(--on-field-muted);
}

/* StateMatrix --------------------------------------------------------------- */

.matrix__scroll {
  overflow-x: auto;
  padding-bottom: 0.4rem;
}

.matrix__grid {
  display: grid;
  grid-template-columns: minmax(9.5rem, 15rem) repeat(var(--cols), minmax(1.4rem, 1fr));
  gap: 2px;
  min-width: 20rem;
  align-items: stretch;
}

.matrix__corner,
.matrix__col {
  font-size: var(--label);
  color: var(--text-muted);
  padding-bottom: 0.35rem;
  align-self: end;
}

.matrix__col {
  text-align: center;
}

[data-field] .matrix__corner,
[data-field] .matrix__col {
  color: var(--on-field-muted);
}

.matrix__rowlabel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  line-height: 1.25;
  padding-right: 0.5rem;
  min-height: 1.5rem;
}

.matrix__rowlabel > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.matrix__note {
  flex: none;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

[data-field] .matrix__note {
  color: var(--on-field-muted);
}

.matrix__cell {
  min-height: 1.5rem;
  border: 1px solid color-mix(in oklch, var(--ink) 12%, transparent);
}

.matrix__axis {
  margin-top: 0.6rem;
  color: var(--text-muted);
}

[data-field] .matrix__axis {
  color: var(--on-field-muted);
}

.legend__swatch {
  display: inline-block;
  width: 0.85rem;
  height: 0.85rem;
  flex: none;
  border: 1px solid color-mix(in oklch, var(--ink) 25%, transparent);
}

/* ColumnSeries -------------------------------------------------------------- */

/*
 * Bars are absolutely positioned inside their slot rather than stacked with
 * flexbox. A percentage height on a flex item does not resolve against a flex
 * container's cross size, so the flex version silently collapsed every column
 * to its 1px minimum; against a positioned containing block with a definite
 * height it resolves correctly.
 */
.columns__plot {
  display: flex;
  align-items: stretch;
  gap: 2px;
  height: var(--h, 190px);
  border-bottom: 2px solid var(--border);
  padding-top: 1.7rem;
  margin-bottom: 1.8rem;
}

[data-field] .columns__plot {
  border-bottom-color: var(--on-field);
}

.columns__slot {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
}

.columns__bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--ink);
  transition: height var(--dur-bar) var(--ease-out);
  min-height: 1px;
}

[data-field] .columns__bar {
  background: var(--on-field);
}

/* The withheld floor stacks on top of the counted bar, at its own base. */
.columns__bar--withheld {
  bottom: var(--base, 0%);
  background: var(--red);
}

[data-field='red'] .columns__bar--withheld,
[data-field='red-deep'] .columns__bar--withheld {
  background: var(--on-field-kicker);
}

.columns__tick {
  position: absolute;
  bottom: -1.45rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.6rem;
  color: var(--text-muted);
  white-space: nowrap;
}

[data-field] .columns__tick {
  color: var(--on-field-muted);
}

/* The callout sits directly above its own column, not at the top of the plot. */
.columns__annotate {
  position: absolute;
  bottom: calc(var(--base, 0%) + 0.45rem);
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--red-text);
  white-space: nowrap;
  z-index: 1;
}

[data-field] .columns__annotate {
  color: var(--on-field);
}

/* LorenzCurve --------------------------------------------------------------- */

.lorenz__area {
  fill: color-mix(in oklch, var(--red) 16%, transparent);
  stroke: none;
}

[data-field] .lorenz__area {
  fill: color-mix(in oklch, var(--on-field) 22%, transparent);
}

.lorenz__even {
  stroke: var(--text-muted);
  stroke-width: 1.5;
  stroke-dasharray: 4 4;
}

.lorenz__curve {
  fill: none;
  stroke: var(--red);
  stroke-width: 2.5;
  stroke-linejoin: round;
  transition: stroke-dashoffset var(--dur-bar) var(--ease-out);
}

.lorenz__mark {
  stroke: var(--ink);
  stroke-width: 1.5;
  stroke-dasharray: 2 3;
}

.lorenz__dot {
  fill: var(--ink);
}

[data-field] .lorenz__even {
  stroke: var(--on-field-faint);
}

[data-field] .lorenz__curve,
[data-field] .lorenz__mark {
  stroke: var(--on-field);
}

[data-field] .lorenz__dot {
  fill: var(--on-field);
}

.lorenz__read {
  margin-top: 0.9rem;
  max-width: 40ch;
}

.legend__line {
  width: 1.4rem;
  height: 0;
  flex: none;
  border-top: 2px solid var(--red);
}

.legend__line--even {
  border-top-style: dashed;
  border-top-color: var(--text-muted);
}

[data-field] .legend__line {
  border-top-color: var(--on-field);
}

/* LeakFunnel ---------------------------------------------------------------- */

.leak__steps {
  list-style: none;
  margin: 0;
  padding: 0;
}

.leak__step + .leak__step {
  margin-top: 1.15rem;
}

.leak__track {
  background: var(--track);
  height: 1.05rem;
}

[data-field] .leak__track {
  background: color-mix(in oklch, var(--on-field) 22%, transparent);
}

.leak__bar {
  height: 100%;
  background: var(--ink);
  transition: width var(--dur-bar) var(--ease-out);
}

[data-field] .leak__bar {
  background: var(--on-field);
}

.leak__loss {
  margin-top: 0.4rem;
  padding-left: 1.1rem;
  border-left: 2px solid var(--border-soft);
}

[data-field] .leak__loss {
  border-left-color: color-mix(in oklch, var(--on-field) 35%, transparent);
}

.leak__track--loss {
  height: 0.55rem;
  background: transparent;
}

.leak__bar--loss {
  background: var(--red);
}

[data-field='red'] .leak__bar--loss,
[data-field='red-deep'] .leak__bar--loss {
  background: var(--on-field-kicker);
}

.leak__loss-note {
  margin-top: 0.3rem;
  font-family: var(--font-mono);
  font-size: var(--label);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.leak__loss-note b {
  color: var(--red-text);
}

[data-field] .leak__loss-note {
  color: var(--on-field-muted);
}

[data-field] .leak__loss-note b {
  color: var(--on-field);
}

.leak__unit {
  margin-top: 1rem;
  color: var(--text-muted);
}

[data-field] .leak__unit {
  color: var(--on-field-muted);
}

/* RatioScale ---------------------------------------------------------------- */

.chart.ratio {
  display: grid;
  gap: 1.4rem;
}

.ratio__head {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 0.7rem;
}

.ratio__head .num {
  display: inline-block;
}

.ratio__units {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  align-items: center;
}

.ratio__unit {
  width: 0.62rem;
  height: 0.62rem;
  flex: none;
  background: var(--ink);
}

/* Red is the side that needs help: here that is the side there is almost none of. */
.ratio__unit--scarce {
  background: var(--red);
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

[data-field] .ratio__unit {
  background: var(--on-field-faint);
}

[data-field] .ratio__unit--scarce {
  background: var(--on-field);
  outline-color: var(--on-field);
}

.ratio__more {
  color: var(--text-muted);
}

.ratio__read {
  max-width: 42ch;
}

/* On a field the ratio's two rows need the same separation the rules give. */
[data-field] .ratio__read,
[data-field] .lorenz__read {
  color: var(--on-field-muted);
}

/* Quote list and name list ---------------------------------------------------
 *
 * Two plain editorial forms the chart components do not cover: verbatim
 * excerpts from a dataset, and a list short enough to name in full. Both exist
 * so a page can print the actual rows behind a count instead of asking the
 * reader to take the count on faith.
 */

.quotelist {
  list-style: none;
  margin: 1.6rem 0 0;
  padding: 0;
  display: grid;
  gap: 1.15rem;
}

.quotelist__item {
  border-left: 3px solid var(--red);
  padding-left: 1rem;
}

[data-field] .quotelist__item {
  border-left-color: var(--on-field);
}

.quotelist__text {
  max-width: 58ch;
  margin: 0;
}

.quotelist__meta {
  margin-top: 0.4rem;
  color: var(--text-muted);
}

[data-field] .quotelist__meta {
  color: var(--on-field-muted);
}

.namelist {
  list-style: none;
  margin: 1.4rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
  max-width: 58ch;
}

.namelist li {
  padding-left: 1rem;
  border-left: 2px solid var(--border-soft);
  font-size: var(--step-0);
}

.namelist b {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

[data-field] .namelist li {
  border-left-color: color-mix(in oklch, var(--on-field) 40%, transparent);
}


/* ==========================================================================
   Research atlas and visual essays
   ========================================================================== */

.research-pipeline {
  margin-block: 1.5rem;
  border: 1.5px solid var(--border);
  background: var(--surface-inset);
  padding: clamp(0.8rem, 2vw, 1.4rem);
}

.research-pipeline img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 31rem;
  object-fit: contain;
  background: white;
}

.pipeline-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
  counter-reset: pipeline;
}

.pipeline-list li {
  counter-increment: pipeline;
  border-top: 3px solid var(--red);
  padding-top: 0.65rem;
  font-size: var(--step--1);
  line-height: 1.5;
}

.pipeline-list li::before {
  content: '0' counter(pipeline);
  display: block;
  margin-bottom: 0.25rem;
  color: var(--red-text);
  font-family: var(--font-mono);
  font-size: var(--label);
}

.chart-note {
  margin-top: 1rem;
  color: var(--text-muted);
  font-size: var(--step--1);
}

.essay-card {
  display: grid;
  gap: 0.9rem;
  border: 2px solid currentColor;
  padding: clamp(1.2rem, 3vw, 2rem);
  text-decoration: none;
  color: inherit;
  background: color-mix(in oklch, var(--on-field) 9%, transparent);
}

.essay-card:hover,
.essay-card:focus-visible {
  background: color-mix(in oklch, var(--on-field) 16%, transparent);
}

.essay-card__eyebrow,
.essay-card > span:last-child,
.button-link {
  font-family: var(--font-mono);
  font-size: var(--label-lg);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.essay-card strong {
  max-width: 22ch;
  font-family: var(--font-display);
  font-size: var(--step-3);
  font-weight: 400;
  line-height: 1.05;
  text-transform: uppercase;
}

.button-link {
  display: inline-block;
  border: 2px solid var(--border);
  padding: 0.75rem 1rem;
  text-decoration: none;
}

.turnout-scrolly {
  background: var(--surface);
  border-bottom: 2px solid var(--border);
}

.turnout-scrolly__layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(19rem, 0.75fr);
  gap: clamp(1.5rem, 5vw, 5rem);
  align-items: start;
  padding-block: clamp(2rem, 5vw, 4rem);
}

.turnout-scrolly__graphic {
  margin: 0;
  border: 1.5px solid var(--border);
  background: var(--paper);
  padding: 0.7rem;
}

.js .turnout-scrolly__graphic {
  position: sticky;
  top: 4.25rem;
  z-index: 3;
}

.turnout-persistent {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.story-axis {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
  transition: opacity 420ms ease;
}

.story-axis line {
  stroke: currentColor;
  stroke-width: 1;
}

.story-axis text {
  fill: currentColor;
}

.story-axis--cohort,
.story-axis--turnout {
  opacity: 0;
}

.turnout-mark {
  transform: translate(var(--door-x), var(--turnout-y));
  transform-origin: 0 0;
  color: var(--blue);
  transition: transform 700ms var(--ease-out), opacity 350ms ease;
}

.turnout-mark circle {
  fill: currentColor;
  stroke: var(--paper);
  stroke-width: 2;
}

.turnout-mark.is-low {
  color: var(--red);
}

.turnout-mark.is-high {
  color: var(--blue);
}

.turnout-mark--comparison {
  color: var(--text-muted);
  opacity: 0.52;
}

.turnout-mark__label {
  fill: var(--ink);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  opacity: 1;
  transition: opacity 260ms ease;
}

.turnout-scrolly__graphic figcaption {
  min-height: 3em;
  border-top: 1px solid var(--border-soft);
  padding-top: 0.7rem;
  color: var(--text-muted);
  font-size: var(--step--1);
  line-height: 1.45;
}

.turnout-scrolly__steps {
  display: grid;
  gap: 20vh;
  padding-block: 10vh 32vh;
}

.turnout-step {
  border-left: 4px solid var(--border-soft);
  padding: 1.2rem 0 1.2rem 1.2rem;
  opacity: 1;
  transition: opacity 240ms ease, border-color 240ms ease, background 240ms ease;
}

.js .turnout-step {
  opacity: 0.38;
}

.turnout-step[aria-current='step'] {
  border-color: var(--red);
  background: var(--red-wash);
  opacity: 1;
}

.turnout-step h2 {
  margin-block: 0.35rem 0.7rem;
  font-size: var(--step-2);
}

.turnout-step p:last-child {
  line-height: 1.65;
}

.js [data-active-step='0'] [data-zone-dot],
.js [data-active-step='1'] [data-zone-dot] {
  transform: translate(var(--cohort-x), 190px);
}

.js [data-active-step='2'] [data-zone-dot] {
  transform: translate(var(--turnout-x), 190px);
}

.js [data-active-step='3'] [data-zone-dot],
.js [data-active-step='4'] [data-zone-dot],
.js [data-active-step='4'] [data-comparison-dot] {
  transform: translate(var(--door-x), var(--turnout-y));
}

.js [data-active-step='0'] .story-axis--cohort,
.js [data-active-step='1'] .story-axis--cohort,
.js [data-active-step='2'] .story-axis--turnout,
.js [data-active-step='3'] .story-axis--scatter,
.js [data-active-step='4'] .story-axis--scatter {
  opacity: 1;
}

.js [data-active-step='0'] .story-axis--scatter,
.js [data-active-step='1'] .story-axis--scatter,
.js [data-active-step='2'] .story-axis--scatter {
  opacity: 0;
}

.js [data-active-step='1'] [data-zone-dot]:not(.is-low):not(.is-high) {
  opacity: 0.13;
}

.js [data-active-step='0'] .turnout-mark__label,
.js [data-active-step='3'] .turnout-mark__label,
.js [data-active-step='4'] .turnout-mark__label {
  opacity: 0;
}

.js [data-active-step='0'] [data-comparison-dot],
.js [data-active-step='1'] [data-comparison-dot],
.js [data-active-step='2'] [data-comparison-dot],
.js [data-active-step='3'] [data-comparison-dot] {
  opacity: 0;
}

.argument-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.2rem;
}

.argument-grid article {
  border-top: 3px solid var(--border);
  padding-top: 0.9rem;
}

.argument-grid article:last-child {
  border-color: var(--red);
}

.argument-grid h3 {
  margin-block: 0.3rem 0.55rem;
  font-size: var(--step-1);
}

.argument-grid p:last-child {
  color: var(--text-muted);
  line-height: 1.55;
}

@media (max-width: 56rem) {
  .pipeline-list,
  .argument-grid {
    grid-template-columns: 1fr 1fr;
  }

  .turnout-scrolly__layout {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .js .turnout-scrolly__graphic {
    top: 0;
  }

  .turnout-scrolly__steps {
    gap: 55vh;
    padding-block: 55vh 25vh;
  }

  .turnout-step {
    background: color-mix(in oklch, var(--paper) 95%, transparent);
    box-shadow: 0 0 0 1px var(--border-soft);
    padding: 1rem;
  }
}

@media (max-width: 36rem) {
  .pipeline-list,
  .argument-grid {
    grid-template-columns: 1fr;
  }

  .turnout-scrolly__graphic {
    padding: 0.35rem;
  }

  .turnout-scrolly__graphic figcaption {
    font-size: var(--label-lg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .turnout-mark,
  .story-axis,
  .turnout-step,
  .turnout-mark__label {
    transition: none !important;
  }
}

.turnout-mark:focus {
  outline: none;
}

.turnout-mark:focus circle {
  stroke: var(--ink);
  stroke-width: 4;
}

.turnout-mark-readout {
  min-height: 3.2em;
  margin-top: 0.65rem;
  border-left: 3px solid var(--red);
  padding-left: 0.75rem;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--label-lg);
  line-height: 1.5;
}


/* --- Reset ---------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* The sticky feed rail must not cover an anchored heading. */
  scroll-padding-top: 5.5rem;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.55;
  font-synthesis-weight: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

img,
svg {
  display: block;
  max-width: 100%;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

/* --- Type ----------------------------------------------------------------- */

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  line-height: 1.04;
  text-wrap: balance;
}

h1 {
  font-size: var(--step-3);
}
h2 {
  font-size: var(--step-2);
}
h3 {
  font-size: var(--step-1);
}

p {
  text-wrap: pretty;
}

a {
  color: currentColor;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-thickness: 2px;
}

strong {
  font-weight: 600;
}

/* The label voice: every machine-produced fact wears mono. */
.label {
  font-family: var(--font-mono);
  font-size: var(--label);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1.3;
}

.kicker {
  font-family: var(--font-mono);
  font-size: var(--label);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--red-text);
  margin-bottom: 0.5rem;
}

.mono {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  line-height: 1.55;
}

.num {
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 0.84;
}

.lede {
  font-size: var(--step-1);
  line-height: 1.35;
  max-width: 28ch;
}

.prose {
  max-width: var(--measure-prose);
}

.prose p + p {
  margin-top: 0.85em;
}

/* --- Focus ---------------------------------------------------------------- */

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

[data-field] :focus-visible {
  outline-color: var(--on-field);
}

.skip {
  position: absolute;
  left: 0.5rem;
  top: -4rem;
  z-index: 100;
  background: var(--ink);
  color: var(--paper);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0.75rem 1.1rem;
  font-family: var(--font-mono);
  font-size: var(--label-lg);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: top 160ms var(--ease-out);
}

.skip:focus {
  top: 0.5rem;
}

/* --- Layout --------------------------------------------------------------- */

.shell {
  width: min(100%, 78rem);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.shell--wide {
  width: min(100%, 96rem);
}

.stack > * + * {
  margin-top: var(--flow, 1rem);
}

/* --- Cards ---------------------------------------------------------------- */

/*
 * A card is paper or a field, never both. `.card` is paper; `[data-field]`
 * flips the whole colour role set at once so nothing inside has to know.
 */

.card {
  background: var(--surface);
  color: var(--text);
  padding: 2.1rem var(--card-x);
  border-bottom: 2px solid var(--border);
}

.card--dense {
  padding: 1.9rem var(--card-x);
}

.card--tall {
  padding: 2.75rem var(--card-x) 2.4rem;
}

[data-field] {
  color: var(--on-field);
  border-bottom: 0;
  --text: var(--on-field);
  --text-muted: var(--on-field-muted);
  --text-faint: var(--on-field-faint);
  --border: var(--on-field);
  --border-soft: color-mix(in oklch, var(--on-field) 34%, transparent);
  --surface-inset: color-mix(in oklch, black 22%, transparent);
  --accent: var(--on-field);
}

[data-field='blue'] {
  background: var(--blue);
}
[data-field='red'] {
  background: var(--red);
}
[data-field='red-deep'] {
  background: var(--red-deep);
}
[data-field='ink'] {
  background: var(--ink);
  --text-muted: oklch(84% 0.014 84);
}

[data-field] .kicker {
  color: var(--on-field-muted);
  letter-spacing: 0.18em;
}

[data-field='ink'] .kicker,
[data-field='red-deep'] .kicker {
  color: var(--red-tint);
}

/* --- The misregistration ---------------------------------------------------
 * A red ghost of the hero numeral, four pixels off. It is the one piece of pure
 * decoration in the system and it earns its place: it is what makes the page
 * read as printed rather than rendered.
 */

.hero-num {
  position: relative;
  font-size: var(--step-hero);
}

.hero-num__ghost {
  position: absolute;
  inset: 4px auto auto 4px;
  color: var(--red);
  opacity: 0.55;
  pointer-events: none;
}

[data-field] .hero-num__ghost {
  color: color-mix(in oklch, black 30%, transparent);
  opacity: 1;
}

[data-misregister='off'] .hero-num__ghost {
  display: none;
}

@media (forced-colors: active) {
  .hero-num__ghost {
    display: none;
  }
}

.hero-num__ink {
  position: relative;
  display: block;
}

/* --- Buttons and chips ----------------------------------------------------- */

.chip {
  font-family: var(--font-mono);
  font-size: var(--label);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  min-height: 44px;
  padding-inline: 0.95rem;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: transparent;
  color: currentColor;
  border: 1.5px solid var(--border);
  border-radius: 2px;
  cursor: pointer;
  text-decoration: none;
  transition: background 140ms var(--ease-out), color 140ms var(--ease-out);
}

.chip:hover {
  background: var(--text);
  color: var(--surface);
}

[data-field] .chip:hover {
  background: var(--on-field);
  color: var(--ink);
}

.chip--solid {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.chip--solid:hover {
  background: var(--red);
  border-color: var(--red);
  color: var(--paper);
}

.chip--quiet {
  border-color: color-mix(in oklch, currentColor 34%, transparent);
}

.chip[aria-pressed='true'] {
  background: var(--text);
  color: var(--surface);
}

/* --- Receipts -------------------------------------------------------------- */

.receipt {
  margin-top: 0.85rem;
}

.receipt > summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 44px;
  padding-inline: 0.95rem;
  border: 1.5px solid var(--border);
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: var(--label);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 140ms var(--ease-out), color 140ms var(--ease-out);
}

.receipt > summary::-webkit-details-marker {
  display: none;
}

.receipt > summary:hover {
  background: var(--text);
  color: var(--surface);
}

[data-field] .receipt > summary:hover {
  background: var(--on-field);
  color: var(--ink);
}

.receipt__dot {
  width: 0.55em;
  height: 0.55em;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  transition: background 140ms var(--ease-out);
}

.receipt[open] .receipt__dot {
  background: var(--red);
  border-color: var(--red);
}

.receipt__body {
  margin-top: 0.75rem;
  padding: 0.85rem 0.95rem;
  background: var(--surface-inset);
  font-family: var(--font-mono);
  font-size: var(--step--1);
  line-height: 1.6;
}

.receipt__body dl {
  display: grid;
  grid-template-columns: minmax(6.5rem, auto) 1fr;
  gap: 0.3rem 0.9rem;
  margin-bottom: 0.7rem;
}

.receipt__body dt {
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: var(--label);
  padding-top: 0.15em;
}

.receipt__caveat {
  border-top: 1px solid var(--border-soft);
  padding-top: 0.7rem;
}

/* --- Charts, shared -------------------------------------------------------- */

.chart {
  margin-block: 1.2rem;
}

.chart figcaption,
.chart__note {
  font-family: var(--font-mono);
  font-size: var(--label);
  letter-spacing: 0.06em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 0.7rem;
}

.chart__row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-family: var(--font-mono);
  font-size: var(--label-lg);
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-bottom: 0.3rem;
}

.chart__track {
  background: var(--track);
  height: 0.85rem;
}

.chart__bar {
  height: 100%;
  background: var(--text);
}

.chart__bar--accent {
  background: var(--red);
}

.chart__bar--compare {
  background: var(--blue);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.1rem;
  font-family: var(--font-mono);
  font-size: var(--label);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 0.75rem;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.legend i {
  width: 0.75rem;
  height: 0.75rem;
  flex: none;
}

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

.table-wrap {
  overflow-x: auto;
  margin-block: 1.2rem;
  border-block: 1px solid var(--border-soft);
}

table {
  border-collapse: collapse;
  width: 100%;
  font-family: var(--font-mono);
  font-size: var(--step--1);
}

th,
td {
  text-align: left;
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
}

thead th {
  border-bottom: 2px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: var(--label);
  position: sticky;
  top: 0;
  background: var(--surface);
}

td.num-cell,
th.num-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

tbody tr:hover {
  background: var(--surface-inset);
}

/* --- Utility --------------------------------------------------------------- */

.vh {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.rule {
  border: 0;
  border-top: 2px solid var(--border);
}

.rule--soft {
  border-top-color: var(--border-soft);
}

/* --- Motion ----------------------------------------------------------------
 * The contract: charts render finished in the HTML. The reveal engine sets the
 * starting state on hydrate and then plays it once. With JS off, nothing here
 * applies and every number is already on screen.
 */

[data-anim] {
  transition-timing-function: var(--ease-out);
}

.js [data-anim='rise']:not([data-played]) {
  opacity: 0;
  transform: translateY(12px);
}

[data-anim='rise'] {
  transition: opacity var(--dur-rise) ease, transform var(--dur-rise) var(--ease-out);
}

[data-anim='bar'] {
  transition: width var(--dur-bar) var(--ease-out), height var(--dur-bar) var(--ease-out),
    flex-grow var(--dur-bar) var(--ease-out);
}

[data-anim='draw'] {
  transition: stroke-dashoffset var(--dur-bar) var(--ease-out);
}

[data-anim='tile'] {
  transition: opacity 400ms ease, transform 400ms var(--ease-out);
}

.js [data-anim='tile']:not([data-played]) {
  opacity: 0;
  transform: scale(0.9);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .js [data-anim]:not([data-played]) {
    opacity: 1;
    transform: none;
  }
}
