/* ninan.org — one stylesheet, no framework, no JavaScript.
   Inline SVG charts inherit these tokens through CSS classes.

   The look is meant to read as a reference publication rather than a web app:
   warm paper ground, a serif for display, a grotesque for anything numeric,
   and colour used only where it carries meaning. Every data colour is paired
   with a text label somewhere, because colour alone is not information. */

/* ------------------------------------------------------------------ tokens */

:root {
  /* Warm paper rather than #fff — the single cheapest thing that stops a page
     looking like an unstyled document. */
  --bg:          #fbfaf7;
  --surface:     #ffffff;
  --surface-2:   #f4f2ed;
  --ink:         #17181c;
  --ink-2:       #4a4f57;
  --ink-3:       #767b84;
  --rule:        #e4e0d8;
  --rule-2:      #efece5;

  /* Deep teal. Distinct from the default link blue, and it survives being put
     next to both series colours below. */
  --accent:      #0e6d63;
  --accent-ink:  #0a544c;
  --accent-soft: #d9ebe7;
  --accent-wash: #eef6f4;

  /* Series colours. Warm/cool rather than pink/blue: legible at a glance
     without the nursery connotation, and both clear 4.5:1 on paper. */
  --f:           #b8456a;
  --f-soft:      #f7dde5;
  --m:           #35648f;
  --m-soft:      #dbe6f0;

  --up:          #1a7048;
  --down:        #b8456a;

  --shadow-1: 0 1px 2px rgba(23, 24, 28, .05), 0 1px 1px rgba(23, 24, 28, .04);
  --shadow-2: 0 2px 4px rgba(23, 24, 28, .05), 0 8px 20px -8px rgba(23, 24, 28, .12);

  --radius:    10px;
  --radius-sm: 6px;
  --radius-lg: 16px;

  /* 4/8 rhythm. */
  --s1: .25rem; --s2: .5rem;  --s3: .75rem; --s4: 1rem;
  --s5: 1.5rem; --s6: 2rem;   --s7: 3rem;   --s8: 4rem;

  --measure: 38rem;   /* ~68 characters of body text */
  --wide:    64rem;

  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-text: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

/* Dark mode is authored, not inverted: the ground stays warm, the accent is
   lifted so it keeps its contrast, and the series colours are desaturated
   rather than brightened. */
@media (prefers-color-scheme: dark) {
  :root {
    --bg:          #131418;
    --surface:     #1a1c21;
    --surface-2:   #212429;
    --ink:         #e9eaed;
    --ink-2:       #b0b5bd;
    --ink-3:       #858b95;
    --rule:        #2e3138;
    --rule-2:      #24272d;

    --accent:      #52bfb0;
    --accent-ink:  #7bd3c6;
    --accent-soft: #1a3b38;
    --accent-wash: #171f21;

    --f:           #e08aa6;
    --f-soft:      #3a2029;
    --m:           #7aa8d4;
    --m-soft:      #1d2a37;

    --up:          #4cb583;
    --down:        #e08aa6;

    --shadow-1: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-2: 0 2px 4px rgba(0, 0, 0, .3), 0 8px 20px -8px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 17px;
  line-height: 1.65;
  font-feature-settings: "kern" 1;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* Every number in the interface is tabular, so columns line up and a changing
   value never shifts the layout around it. */
.num, td.num, th.num, .stat-value, .rank, time, .tnum {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.wrap { max-width: var(--measure); margin: 0 auto; padding: 0 var(--s5); }
.wrap-wide { max-width: var(--wide); margin: 0 auto; padding: 0 var(--s5); }
main.wrap { padding-bottom: var(--s8); }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-ink); text-decoration-thickness: 2px; }

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

.skip {
  /* Moved out of the flow rather than off to the left: a -9999px offset is
     still a box the page has to account for. */
  position: absolute; left: var(--s4); top: var(--s2);
  clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden;
  background: var(--surface); color: var(--ink);
  padding: var(--s3) var(--s4); z-index: 100;
  border-radius: var(--radius-sm); box-shadow: var(--shadow-2);
}
.skip:focus { clip-path: none; width: auto; height: auto; overflow: visible; }

/* Every icon gets a size even if no context rule matches it. An SVG with no
   width attribute and no matching rule renders at its viewBox scale, which
   is how a 14px glyph becomes a 400px one. */
.ico { width: 1em; height: 1em; flex: none; display: inline-block; vertical-align: -.125em; }

/* ------------------------------------------------------------------ chrome */

.site-head {
  border-bottom: 1px solid var(--rule);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.site-head > .wrap-wide {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: var(--s2) var(--s5);
  padding-top: var(--s3); padding-bottom: var(--s3);
}
.brand {
  font-family: var(--font-display);
  font-size: 1.2rem; font-weight: 600;
  letter-spacing: -.015em;
  text-decoration: none; color: var(--ink);
  display: inline-flex; align-items: center; gap: var(--s2);
}
.brand .mark { color: var(--accent); }
.brand b { font-weight: 700; }
.brand span { color: var(--ink-3); font-weight: 400; }

.site-head nav { display: flex; flex-wrap: wrap; gap: var(--s4); font-size: .92rem; margin-left: auto; }
.site-head nav a {
  color: var(--ink-2); text-decoration: none;
  padding: var(--s1) 0; border-bottom: 2px solid transparent;
}
.site-head nav a:hover { color: var(--accent); border-bottom-color: var(--accent); }

.crumbs { font-size: .82rem; color: var(--ink-3); padding-top: var(--s4); }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: var(--s1); margin: 0; padding: 0; }
.crumbs li + li::before { content: "/"; margin-right: var(--s1); color: var(--rule); }
/* 24px tall everywhere, not only on a touchscreen: WCAG 2.2's minimum target
   size is not conditional on the pointer, and a breadcrumb is not a link inside
   a sentence. */
.crumbs a {
  color: var(--ink-3); text-decoration: none;
  display: inline-flex; align-items: center; min-height: 26px;
}
.crumbs a:hover { color: var(--accent); text-decoration: underline; }

.site-foot {
  border-top: 1px solid var(--rule);
  margin-top: var(--s8); padding: var(--s6) 0 var(--s7);
  font-size: .86rem; color: var(--ink-3);
  background: var(--surface-2);
}
.site-foot p { margin: 0 0 var(--s3); max-width: 46rem; }
.site-foot a { color: var(--ink-2); }
.site-foot nav { display: flex; flex-wrap: wrap; gap: var(--s4); margin-top: var(--s4); }

/* -------------------------------------------------------------- typography */

h1 {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 6vw, 3.4rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -.025em;
  margin: var(--s5) 0 var(--s3);
}
h2 {
  font-family: var(--font-display);
  font-size: 1.5rem; font-weight: 600;
  line-height: 1.25; letter-spacing: -.015em;
  margin: var(--s7) 0 var(--s3);
  display: flex; align-items: baseline; gap: var(--s3);
}
h3 { font-size: 1.05rem; font-weight: 600; margin: var(--s5) 0 var(--s2); letter-spacing: -.01em; }
p { margin: 0 0 var(--s4); }

.dek {
  font-size: 1.14rem; line-height: 1.55;
  color: var(--ink-2); margin-bottom: var(--s5);
  max-width: 34rem;
}
.note, .small { color: var(--ink-3); }
.note { font-size: .88em; }
.small { font-size: .88rem; line-height: 1.6; }

/* A section icon sits in the heading, sized to the cap height and coloured
   like the rule so it labels the section without competing with it. */
h2 .ico {
  flex: none; width: 1.05rem; height: 1.05rem;
  color: var(--accent); transform: translateY(.1rem);
}

/* The page is wide enough for charts and tables, but running text is held to
   a readable measure inside it. This is the ordinary data-journalism layout:
   the figures get room, the prose does not turn into a 100-character line. */
main.wrap-wide > p,
main.wrap-wide > h1,
main.wrap-wide > h2,
main.wrap-wide > h3,
main.wrap-wide > .dek,
main.wrap-wide > .callout,
main.wrap-wide > .method-note,
main.wrap-wide > blockquote,
main.wrap-wide > ul:not(.namecards):not(.pill-row):not(.namelist):not(.alpha),
main.wrap-wide > ol:not(.namelist) { max-width: var(--measure); }

/* --------------------------------------------------------- headline facts */

.headline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
  gap: var(--s3);
  margin: var(--s5) 0 var(--s6);
}
.stat {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: var(--s4);
  box-shadow: var(--shadow-1);
  display: flex; flex-direction: column; gap: var(--s1);
}
.stat dt {
  font-size: .7rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink-3);
  display: flex; align-items: center; gap: var(--s2);
}
.stat dt .ico { width: .85rem; height: .85rem; flex: none; color: var(--accent); }
.stat dd { margin: 0; }
.stat-value {
  font-family: var(--font-display);
  font-size: 1.9rem; font-weight: 600;
  line-height: 1.05; letter-spacing: -.02em;
  display: block;
}
.stat .note { display: block; font-size: .78rem; margin-top: var(--s1); line-height: 1.35; }

/* The lead card carries the headline number for the page. */
.stat--lead {
  background: linear-gradient(160deg, var(--accent-wash), var(--surface) 70%);
  border-color: color-mix(in srgb, var(--accent) 30%, var(--rule));
}
.stat--lead .stat-value { color: var(--accent-ink); }

/* ------------------------------------------------------------------ tables */

.table-scroll {
  overflow-x: auto;
  margin: var(--s4) 0 var(--s5);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
}
table { width: 100%; border-collapse: collapse; font-size: .94rem; }
caption {
  text-align: left; font-size: .84rem; color: var(--ink-3);
  padding: var(--s3) var(--s4) var(--s2);
  line-height: 1.5;
}
th, td { text-align: left; padding: var(--s2) var(--s4); border-bottom: 1px solid var(--rule-2); }
thead th {
  font-weight: 600; font-size: .72rem;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-3);
  border-bottom: 1px solid var(--rule);
  background: var(--surface-2);
  position: sticky; top: 0;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--accent-wash); }
td.num, th.num { text-align: right; }
td.rank-cell { color: var(--ink-3); width: 3rem; }

.up { color: var(--up); font-weight: 500; }
.down { color: var(--down); font-weight: 500; }
/* Direction is carried by an arrow as well as by colour. */
.up::before  { content: "\2191"; margin-right: .15em; }
.down::before { content: "\2193"; margin-right: .15em; }

/* A bar drawn inside a table cell, for magnitude at a glance. */
.bar-cell { position: relative; }
.bar-cell .bar-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--accent-soft);
  border-radius: 0 2px 2px 0;
  z-index: 0;
}
.bar-cell > span { position: relative; z-index: 1; }

/* ------------------------------------------------------------------ charts */

.chart {
  margin: var(--s5) 0;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: var(--s4) var(--s4) var(--s3);
  box-shadow: var(--shadow-1);
}
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart figcaption {
  font-size: .82rem; color: var(--ink-3);
  margin-top: var(--s3); padding-top: var(--s3);
  border-top: 1px solid var(--rule-2);
  line-height: 1.5;
}

.chart .line {
  fill: none; stroke: var(--accent); stroke-width: 2.25;
  stroke-linejoin: round; stroke-linecap: round;
}
.chart .area  { fill: url(#areaGrad); stroke: none; }
.chart .area-line { fill: none; stroke: var(--accent); stroke-width: 1.75; stroke-linejoin: round; }
.chart .grad-a { stop-color: var(--accent); stop-opacity: .28; }
.chart .grad-b { stop-color: var(--accent); stop-opacity: .02; }
.chart .dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2.5; }
.chart .grid { stroke: var(--rule); stroke-width: 1; }
.chart .grid-soft { stroke: var(--rule-2); stroke-width: 1; }
.chart .ax { fill: var(--ink-3); font-size: 11px; font-family: var(--font-text); font-variant-numeric: tabular-nums; }
.chart .peak-line { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 3 3; opacity: .55; }
.chart .peak-dot { fill: var(--surface); stroke: var(--ink-2); stroke-width: 2; }

/* Callouts drawn on the chart itself: direct labelling beats a legend when
   there are only one or two things to name. */
.chart .lbl {
  font-family: var(--font-text); font-size: 11.5px; font-weight: 600;
  fill: var(--ink-2); font-variant-numeric: tabular-nums;
}
.chart .lbl-accent { fill: var(--accent-ink); }
.chart .lbl-box { fill: var(--surface); stroke: var(--rule); rx: 4; }

.chart .bar-f { fill: var(--f); }
.chart .bar-m { fill: var(--m); }
.chart .bl { font-family: var(--font-text); font-size: 12px; font-weight: 600; }

/* ---------------------------------------------------------------- tile map */

/* A tile-grid cartogram: one square per state in roughly its geographic
   position. Chosen over a true outline map because at this size the shape of
   Rhode Island carries no information, and 50 equal squares compare cleanly. */
.tilemap { margin: var(--s5) 0; }
.tilemap svg { width: 100%; height: auto; display: block; }
.tilemap .tile { stroke: var(--bg); stroke-width: 2; rx: 3; }
.tilemap .tile-0 { fill: var(--surface-2); }
.tilemap .tile-1 { fill: color-mix(in srgb, var(--accent) 18%, var(--surface)); }
.tilemap .tile-2 { fill: color-mix(in srgb, var(--accent) 36%, var(--surface)); }
.tilemap .tile-3 { fill: color-mix(in srgb, var(--accent) 58%, var(--surface)); }
.tilemap .tile-4 { fill: color-mix(in srgb, var(--accent) 80%, var(--surface)); }
.tilemap .tile-5 { fill: var(--accent); }
.tilemap .tl { font-family: var(--font-text); font-size: 9.5px; font-weight: 600; fill: var(--ink-2); }
.tilemap .tl-on { fill: #fff; }
.tilemap .tl-0 { fill: var(--ink-3); }

.tilemap figcaption {
  font-size: .82rem; color: var(--ink-3);
  margin-top: var(--s3); padding-top: var(--s3);
  border-top: 1px solid var(--rule-2);
  line-height: 1.5; max-width: var(--measure);
}

.legend {
  display: flex; align-items: center; gap: var(--s2);
  font-size: .78rem; color: var(--ink-3);
  margin-top: var(--s3); flex-wrap: wrap;
}
.legend .swatches { display: flex; gap: 2px; }
.legend i {
  width: 1.6rem; height: .55rem; border-radius: 2px; display: block;
}

/* -------------------------------------------------------------- name lists */

.namelist {
  list-style: none; padding: 0;
  margin: var(--s4) 0 var(--s5);
  display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: var(--s2);
}
.namelist li { font-size: .95rem; }
.namelist .rank { color: var(--ink-3); font-size: .8rem; margin-left: .3em; }

/* Similar names read better as cards than as a bare list: the rank is a fact
   about each one, not a footnote. */
.namecards {
  list-style: none; padding: 0; margin: var(--s4) 0 var(--s5);
  display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
  gap: var(--s2);
}
.namecards a {
  display: flex; flex-direction: column; gap: 1px;
  padding: var(--s3) var(--s3);
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--radius-sm); text-decoration: none;
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.namecards a:hover {
  border-color: var(--accent); box-shadow: var(--shadow-1);
  transform: translateY(-1px);
}
.namecards .n { font-weight: 600; color: var(--ink); font-size: .97rem; }
.namecards .r { font-size: .76rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.pill-row { display: flex; flex-wrap: wrap; gap: var(--s2); margin: var(--s4) 0 var(--s5); padding: 0; list-style: none; }
.pill-row a {
  display: inline-flex; align-items: center; gap: var(--s2);
  padding: var(--s2) var(--s4);
  border: 1px solid var(--rule); border-radius: 999px;
  font-size: .89rem; text-decoration: none; color: var(--ink-2);
  background: var(--surface);
  transition: border-color .15s ease, color .15s ease;
}
.pill-row a:hover { border-color: var(--accent); color: var(--accent); }
.pill-row .ico { width: .9rem; height: .9rem; flex: none; opacity: .7; }

/* ------------------------------------------------------------------- misc */

.callout {
  border-left: 3px solid var(--accent);
  background: var(--accent-wash);
  padding: var(--s4) var(--s5);
  margin: var(--s5) 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: .95rem;
}
.callout p:last-child { margin-bottom: 0; }
.callout strong { color: var(--accent-ink); }

/* Not display:flex. The body of a note is a run of text nodes and inline links,
   and every one of those becomes its own flex item — so the sentence laid out
   as an unwrappable row and pushed the page sideways on a narrow screen. As a
   block it is what it looks like: a paragraph with an icon beside it. */
.method-note {
  position: relative; display: block;
  font-size: .88rem; color: var(--ink-3); line-height: 1.55;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: var(--s3) var(--s4);
  padding-left: calc(var(--s4) + 1rem + var(--s3));
  margin: var(--s3) 0 var(--s5);
}
.method-note .ico {
  position: absolute; left: var(--s4); top: calc(var(--s3) + .2rem);
  width: 1rem; height: 1rem; color: var(--ink-3);
}
.method-note p { margin: 0; }

.attrib { font-size: .8rem; color: var(--ink-3); margin-top: var(--s2); }

/* Height is reserved at every breakpoint. A fluid unit that lands late and
   shoves the page down is a Core Web Vitals failure, and it is the jump that
   annoys people rather than the advertisement itself. */
.ad-slot {
  display: block;
  margin: var(--s7) 0;
  padding-top: var(--s2);
  border-top: 1px solid var(--rule-2);
  contain: layout;
}
.ad-slot .ad-label {
  display: block;
  font-size: .66rem; letter-spacing: .09em; text-transform: uppercase;
  color: var(--ink-3); opacity: .75;
  margin-bottom: var(--s2);
}
.ad-slot .adsbygoogle { display: block; width: 100%; }

/* Mobile first: a shorter reservation, because a 300px block on a phone is
   most of the screen. */
.ad-primary .adsbygoogle { min-height: 250px; }
.ad-deep    .adsbygoogle { min-height: 250px; }

@media (min-width: 48rem) {
  .ad-primary .adsbygoogle { min-height: 280px; }
  .ad-deep    .adsbygoogle { min-height: 280px; }
}

/* Never let a unit be the last thing before the footer with no separation,
   and never sit flush against a figure. */
.chart + .ad-slot, .tilemap + .ad-slot, .table-scroll + .ad-slot { margin-top: var(--s8); }

.pager {
  display: flex; gap: var(--s3); flex-wrap: wrap;
  margin: var(--s6) 0 var(--s5); font-size: .92rem;
}
.pager a {
  display: inline-flex; align-items: center; gap: var(--s2);
  padding: var(--s2) var(--s4); min-height: 44px;
  border: 1px solid var(--rule); border-radius: var(--radius-sm);
  text-decoration: none; color: var(--ink-2); background: var(--surface);
}
.pager a:hover { border-color: var(--accent); color: var(--accent); }

.alpha { display: flex; flex-wrap: wrap; gap: var(--s1); margin: var(--s4) 0 var(--s5); padding: 0; list-style: none; }
.alpha a {
  display: inline-block; min-width: 2.1rem; text-align: center;
  padding: var(--s1) var(--s2);
  border: 1px solid var(--rule); border-radius: var(--radius-sm);
  text-decoration: none; color: var(--ink-2); background: var(--surface);
  font-size: .9rem; font-weight: 500;
}
.alpha a:hover { border-color: var(--accent); color: var(--accent); }
.alpha .on a { background: var(--accent); color: #fff; border-color: var(--accent); }

.cols2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 0 var(--s6); }

.api-link code {
  background: var(--surface-2); padding: .12rem .4rem;
  border-radius: 4px; font-size: .9em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* Ordered lists used as leaderboards. */
ol.namelist { counter-reset: rankcount; }

@media (max-width: 34rem) {
  body { font-size: 16px; }
  .wrap, .wrap-wide { padding: 0 var(--s4); }
  .stat-value { font-size: 1.6rem; }
  .headline { grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr)); gap: var(--s2); }
  h2 { font-size: 1.3rem; }
  th, td { padding: var(--s2) var(--s3); }
}

@media print {
  .site-head, .ad-slot, .pager { display: none; }
  body { background: #fff; }
  .chart, .table-scroll { break-inside: avoid; }
}

/* ------------------------------------------------------------------- hero */

.hero { margin: var(--s6) 0 var(--s7); }
.hero h1 { max-width: 18ch; }
.hero .dek { font-size: 1.2rem; max-width: 40rem; }

/* ------------------------------------------------------------ leaderboard */

/* A ranked list where the bar carries the magnitude, so the eye gets the
   shape of the distribution without reading a single number. */
.leaderboard { list-style: none; margin: var(--s3) 0 var(--s5); padding: 0; }
.leaderboard li {
  display: grid;
  grid-template-columns: 1.6rem minmax(5rem, auto) 1fr auto;
  align-items: center; gap: var(--s3);
  padding: var(--s2) 0;
  border-bottom: 1px solid var(--rule-2);
  font-size: .95rem;
}
.leaderboard li:last-child { border-bottom: 0; }
.lb-rank { color: var(--ink-3); font-size: .82rem; font-variant-numeric: tabular-nums; }
.lb-name a { text-decoration: none; font-weight: 500; }
.lb-name a:hover { text-decoration: underline; }
.lb-bar { height: .45rem; background: var(--rule-2); border-radius: 999px; overflow: hidden; min-width: 2rem; }
.lb-bar i { display: block; height: 100%; background: var(--accent); opacity: .55; border-radius: 999px; }
.lb-num { color: var(--ink-3); font-size: .84rem; }

/* -------------------------------------------------------------- storylist */

.storylist { list-style: none; padding: 0; margin: var(--s4) 0 var(--s5); }
.storylist li {
  padding: var(--s3) 0;
  border-bottom: 1px solid var(--rule-2);
}
.storylist li:last-child { border-bottom: 0; }
.storylist a { font-weight: 600; text-decoration: none; }
.storylist a:hover { text-decoration: underline; }
.storylist .note { display: block; margin-top: 2px; font-size: .88rem; }

/* ----------------------------------------------------------------- search */

/* Rendered hidden and revealed by assets/search.js, so a reader without
   JavaScript never sees a control that would do nothing. The A–Z index below
   is the fallback, and it is a real one. */
.searchbox {
  position: relative;
  display: flex; gap: var(--s2);
  margin: var(--s5) 0 var(--s6);
  max-width: 30rem;
}
.searchbox input[type=search] {
  flex: 1; min-width: 0;
  padding: var(--s3) var(--s4);
  font: inherit; font-size: 1rem;
  border: 1px solid var(--rule); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
}
.searchbox input[type=search]:focus { border-color: var(--accent); }
.searchbox button {
  padding: var(--s3) var(--s5);
  font: inherit; font-size: .95rem; font-weight: 500;
  border: 0; border-radius: var(--radius-sm);
  background: var(--accent); color: #fff; cursor: pointer;
}
.searchbox button:hover { background: var(--accent-ink); }

.search-results {
  position: absolute; top: calc(100% + var(--s2)); left: 0; right: 0;
  z-index: 30; margin: 0; padding: var(--s1); list-style: none;
  background: var(--surface);
  border: 1px solid var(--rule); border-radius: var(--radius);
  box-shadow: var(--shadow-2);
  max-height: 22rem; overflow-y: auto;
}
.search-results a {
  display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3);
  padding: var(--s2) var(--s3);
  border-radius: var(--radius-sm);
  text-decoration: none; color: var(--ink);
}
.search-results li.on a,
.search-results a:hover { background: var(--accent-wash); }
.search-results .sr-name { font-weight: 500; }
.search-results .sr-meta { font-size: .8rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ----------------------------------------------------------------- finder */

.finder {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: var(--s5);
  margin: var(--s5) 0;
  box-shadow: var(--shadow-1);
}
.finder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: var(--s4);
}
.finder .field { display: flex; flex-direction: column; gap: var(--s1); min-width: 0; }
.finder label { font-size: .78rem; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--ink-3); }
.finder select {
  font: inherit; font-size: .95rem;
  padding: var(--s2) var(--s3);
  /* 44px minimum touch target, per the interaction checklist. */
  min-height: 44px;
  border: 1px solid var(--rule); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
  max-width: 100%;
}
.finder select:focus { border-color: var(--accent); }

.finder .field-check {
  flex-direction: row; align-items: center; gap: var(--s3);
  min-height: 44px;
}
.finder .field-check input { width: 1.5rem; height: 1.5rem; accent-color: var(--accent); flex: none; }
.finder .field-check label { text-transform: none; letter-spacing: 0; font-size: .92rem;
  font-weight: 400; color: var(--ink-2); }

.finder-actions {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s4); margin-top: var(--s4);
  padding-top: var(--s4); border-top: 1px solid var(--rule-2);
  flex-wrap: wrap;
}
.finder-count { font-size: .9rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.btn-quiet {
  font: inherit; font-size: .9rem;
  padding: var(--s2) var(--s4); min-height: 44px;
  border: 1px solid var(--rule); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink-2); cursor: pointer;
}
.btn-quiet:hover { border-color: var(--accent); color: var(--accent); }

.fr-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: var(--s3); margin: var(--s5) 0;
}
.fr-card {
  display: flex; flex-direction: column; gap: var(--s1);
  padding: var(--s3) var(--s4);
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--radius-sm); text-decoration: none;
  transition: border-color .15s ease, transform .15s ease;
}
.fr-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.fr-name { font-weight: 600; font-size: 1.02rem; color: var(--ink); }
.fr-meta { font-size: .78rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.fr-tags { display: flex; flex-wrap: wrap; gap: var(--s1); margin-top: var(--s1); }
.fr-tag {
  font-size: .68rem; padding: 1px var(--s2);
  border-radius: 999px; background: var(--surface-2); color: var(--ink-3);
  white-space: nowrap;
}
.fr-up   { background: color-mix(in srgb, var(--up) 14%, var(--surface)); color: var(--up); }
.fr-down { background: color-mix(in srgb, var(--down) 14%, var(--surface)); color: var(--down); }

.deflist { margin: var(--s4) 0 var(--s5); max-width: var(--measure); }
.deflist dt { font-weight: 600; margin-top: var(--s4); }
.deflist dd { margin: var(--s1) 0 0; color: var(--ink-2); font-size: .95rem; }

/* On a phone the nav wraps to two rows, and a sticky two-row header eats a
   sixth of the screen on every scroll of a long data page. The header stays
   put below the breakpoint; there is a skip link and the pages are not so deep
   that navigation needs to follow you down them. */
@media (max-width: 47.99rem) {
  .site-head { position: static; backdrop-filter: none; }
  .site-head nav { margin-left: 0; gap: var(--s3) var(--s4); font-size: .88rem; }
  .finder { padding: var(--s4); }
  .finder-grid { gap: var(--s3); }
  /* A full-width unit on a phone should not be taller than the answer above
     it; the reserved height stays modest and the label keeps it honest. */
  .ad-slot { margin: var(--s6) 0; }
}

/* ------------------------------------------------------- your-cohort block */

.cohort {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3);
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--radius); padding: var(--s4);
  margin: var(--s4) 0;
}
.cohort label { font-size: .95rem; color: var(--ink-2); }
.cohort input {
  font: inherit; font-size: 1.05rem; width: 7rem; min-height: 44px;
  padding: var(--s2) var(--s3); text-align: center;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--rule); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
}
.cohort input:focus { border-color: var(--accent); }
.cohort button {
  font: inherit; font-size: .95rem; font-weight: 500;
  padding: var(--s2) var(--s5); min-height: 44px;
  border: 0; border-radius: var(--radius-sm);
  background: var(--accent); color: #fff; cursor: pointer;
}
.cohort button:hover { background: var(--accent-ink); }
.cohort-out:not(:empty) { margin: var(--s4) 0 var(--s5); }
.cohort-cards { margin-top: 0; }

.chart-age .age-bar { fill: var(--accent); opacity: .42; }
.chart-age .age-you { stroke: var(--accent-ink); stroke-width: 2; }

/* ------------------------------------------------------ notable-people faces */

.face-cell { width: 48px; padding-right: 0; }
.face {
  display: block; width: 48px; height: 48px;
  border-radius: 50%; object-fit: cover;
  /* P18 is often a full-length photograph, so bias the crop upward. */
  object-position: 50% 22%;
  background: var(--surface-2);
}
.face-none {
  display: grid; place-items: center;
  font-family: var(--font-display); font-size: 1.15rem;
  color: var(--ink-3); background: var(--surface-2);
}
.credits { margin: calc(var(--s3) * -1) 0 var(--s5); font-size: .85rem; }
.credits summary {
  cursor: pointer; color: var(--ink-2);
  padding: var(--s2) 0; min-height: 32px;
}
.credits ul { margin: var(--s2) 0 0; padding-left: var(--s4); color: var(--ink-3); }
.credits li { margin-bottom: var(--s1); line-height: 1.5; }

@media (max-width: 47.99rem) {
  .face-cell, .face, .face-none { width: 36px; }
  .face, .face-none { height: 36px; }
}

/* Tile-map legend swatches. Static colours, so they live here rather than in a
   style attribute on every chart. */
.sw-0 { background: var(--surface-2); }
.sw-1 { background: color-mix(in srgb, var(--accent) 18%, var(--surface)); }
.sw-2 { background: color-mix(in srgb, var(--accent) 36%, var(--surface)); }
.sw-3 { background: color-mix(in srgb, var(--accent) 58%, var(--surface)); }
.sw-4 { background: color-mix(in srgb, var(--accent) 80%, var(--surface)); }
.sw-5 { background: var(--accent); }

/* The reader's own age marker, revealed by cohort.js once a year is entered.
   Not the hidden attribute: that is HTML's, and this is inside an SVG. */
.age-you-marker { display: none; }

/* ------------------------------------------------ touch targets on handsets */

/* WCAG 2.2 asks for 44×44 on controls and 24×24 on everything else that is not
   a link inside running text. On a phone the header, footer and breadcrumb
   links were 33px and 16px tall, so they get the height here rather than the
   text getting bigger. */
@media (pointer: coarse), (max-width: 47.99rem) {
  .site-head nav a,
  .site-foot nav a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
  .crumbs ol { gap: var(--s2); row-gap: 0; }
  .credits summary { min-height: 44px; display: flex; align-items: center; }
}

/* The finder's submit control. It inherited nothing and rendered as a 21px-tall
   bare button; it is the primary action on that page. */
.finder-actions button[type="submit"] {
  font: inherit; font-size: .95rem; font-weight: 500;
  padding: var(--s2) var(--s5); min-height: 44px;
  border: 0; border-radius: var(--radius-sm);
  background: var(--accent); color: #fff; cursor: pointer;
}
.finder-actions button[type="submit"]:hover { background: var(--accent-ink); }
