/* Global Burden of Suffering — shared styles.
   Colour roles follow the validated reference palette (see docs/design.md). */

:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f2f1ed;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #6f6d68;
  --axis-ink: #737169;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --border-strong: rgba(11, 11, 11, 0.18);
  --link: #1c5cab;
  --focus: #2a78d6;
  --nav-accent: #087c75;

  /* Group identity (categorical slots 1–3; "other" is de-emphasis gray) */
  --g-farmed: #2a78d6;
  --g-caught: #eb6834;
  --g-wild: #1baf7a;
  --g-other: #a3a199;

  /* Pain intensity (ordinal, validated --ordinal): darker = more intense, in both colour schemes */
  --pain-1: #eda26a;
  --pain-2: #cd6c00;
  --pain-3: #a82e00;
  --pain-4: #6e0013;

  --good: #006300;
  --warn-bg: #fdf3dc;
  --warn-ink: #6b4a00;

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Source Serif 4", "Source Serif Pro", Georgia, "Times New Roman", serif;

  --radius: 8px;
  --gutter: 16px;
  --max: 1160px;
  --prose: 70ch;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #232321;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --muted: #a3a199;
    --axis-ink: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --border-strong: rgba(255, 255, 255, 0.18);
    --link: #86b6ef;
    --focus: #6da7ec;
    --nav-accent: #78d9c9;
    --g-farmed: #3987e5;
    --g-caught: #d95926;
    --g-wild: #199e70;
    --g-other: #6f6e69;
    --pain-1: #ffd5ac;
    --pain-2: #f99900;
    --pain-3: #e04736;
    --pain-4: #9e1812;
    --good: #0ca30c;
    --warn-bg: #3a2f12;
    --warn-ink: #f3d58a;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #232321;
  --ink: #f0efec;
  --ink-2: #c3c2b7;
  --muted: #a3a199;
  --axis-ink: #898781;
  --grid: #2c2c2a;
  --axis: #383835;
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.18);
  --link: #86b6ef;
  --focus: #6da7ec;
  --nav-accent: #78d9c9;
  --g-farmed: #3987e5;
  --g-caught: #d95926;
  --g-wild: #199e70;
  --g-other: #6f6e69;
  --pain-1: #ffd5ac;
  --pain-2: #f99900;
  --pain-3: #e04736;
  --pain-4: #9e1812;
  --good: #0ca30c;
  --warn-bg: #3a2f12;
  --warn-ink: #f3d58a;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  /* 1rem, not 16px, so a larger browser font size enlarges the body text with the headings (fix round 5, reader-11);
     the same 16px at the default size. */
  font: 1rem/1.55 var(--font-sans);
  overflow-x: hidden;
}
a { color: var(--link); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h1, h2 { font-family: var(--font-serif); font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 4.5vw, 3rem); }
h2 { font-size: clamp(1.45rem, 3vw, 1.9rem); }
h3 { font-size: 1.05rem; font-weight: 650; }
p { margin: 0 0 1em; }
/* A word or address longer than the line ("countries_history.json", an e-mail address, "Entrepreneurship’s" at 200% text
   on a 320px phone) breaks rather than pushing the page sideways; where every word fits, nothing changes (UX pass, SPEC §9
   item 6). */
main p, main li, main dd, main dt, main summary, main h1, main h2, main h3 { overflow-wrap: break-word; }
small, .small { font-size: 0.875rem; }
/* hidden="until-found" is excluded: a tab panel hidden that way stays searchable by find-in-page (common.js showPanel;
   the owner's answer of 2026-11-09, G), which display: none would defeat. */
[hidden]:not([hidden="until-found" i]) { display: none !important; }
.muted { color: var(--muted); }
.ink-2 { color: var(--ink-2); }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; margin: -1px;
}
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 100; }
.skip-link:focus { left: 8px; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.prose { max-width: var(--prose); }
.prose p, .prose li { color: var(--ink-2); }
.prose strong { color: var(--ink); }

/* ---------- Header ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.site-header .wrap { display: flex; align-items: center; gap: 12px; min-height: 66px; max-width: 1360px; flex-wrap: wrap; }
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-decoration: none; color: var(--ink); }
.brand-name { font: 700 1.3rem/1.12 var(--font-serif); letter-spacing: -.025em; }
.brand-tag { font-size: .75rem; line-height: 1.2; color: var(--muted); }
.header-end { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; align-items: center; justify-content: flex-end; min-width: 0; }
.site-nav { display: flex; gap: 2px; flex-wrap: wrap; align-items: center; }
.site-nav a, .nav-sources-toggle {
  display: inline-flex; align-items: center; min-height: 44px; padding: 6px 9px; border: 0; background: none;
  color: var(--ink-2); text-decoration: none; font: 500 .9rem/1.35 var(--font-sans); cursor: pointer;
}
.site-nav :is(a, button):hover { color: var(--nav-accent); }
.site-nav a[aria-current], .nav-sources:has(a[aria-current]) > .nav-sources-toggle {
  color: var(--ink); font-weight: 700; box-shadow: inset 0 -2px var(--nav-accent);
}
.nav-sources, .nav-sources-links { display: contents; }
.nav-sources-toggle::after {
  content: ""; width: 6px; height: 6px; margin: -3px 2px 0 8px;
  border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg);
}
.menu-ready:not(.menu-compact) .nav-sources { position: relative; display: block; }
.menu-ready:not(.menu-compact) .nav-sources-links {
  display: none; position: absolute; right: 0; top: 100%; z-index: 1; width: max-content;
  padding: 4px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 4px;
  box-shadow: 0 5px 14px rgb(0 0 0 / 10%);
}
.menu-ready:not(.menu-compact) .nav-sources-toggle[aria-expanded="true"] + .nav-sources-links { display: grid; }
.nav-sources-links a { padding-inline: 12px; }
.menu-compact .nav-sources-toggle { display: none; }
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 44px; min-height: 44px;
  border: 0; background: transparent; color: var(--ink-2); border-radius: 4px; cursor: pointer; font: inherit;
}
.menu-ready .theme-toggle::before {
  content: ""; display: block; width: 16px; height: 16px; border: 1.5px solid currentColor; border-radius: 50%;
  background: linear-gradient(90deg, currentColor 50%, transparent 50%);
}
.menu-ready:not(.menu-compact) .theme-name { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }
.theme-toggle:hover { color: var(--ink); background: var(--surface-2); }
@media (min-width: 761px) and (max-width: 960px) {
  .site-header .wrap { gap: 8px; }
  .site-header:not(.menu-compact) .brand { flex: 1 1 9rem; max-width: 16rem; }
  .site-nav a, .nav-sources-toggle { padding-inline: 5px; }
}
/* Above 760px the header is sticky: a link to an anchor (methodology.html#no-estimate), and anything scrolled into
   view, lands below it rather than under it (S16). The header is 61px tall on one line and 90px where the nav wraps
   (below about 1080px with the site's fonts), so the narrower widths keep room for two lines. */
/* With large text the header is taller (144px at 200%): its measured height (--header-h, common.js initTheme) then sets
   the padding, so a link still lands below it (UX fix round 2, desktop-2). */
@media (min-width: 761px) { html { scroll-padding-top: max(104px, calc(var(--header-h, 0px) + 15px)); } }
@media (min-width: 1200px) { html { scroll-padding-top: max(76px, calc(var(--header-h, 0px) + 15px)); } }
/* A short screen, where the sticky header alone would cover more than a quarter of it (a phone held sideways with large
   text: 203px of 390 at 200%): it scrolls away with the page, as at 760px and below, on every page (common.js
   initTheme; UX polish round 2, reader-12), and a link lands at the top, with no header to clear. */
html.header-scrolls .site-header { position: static; }
@media (min-width: 761px) { html.header-scrolls { scroll-padding-top: auto; } }
/* A sticky header is always on the screen, but it lies inside that padding, so Chrome scrolled the page each time the
   keyboard moved the focus onto one of its controls (about 460px a Tab through the full header; with the compact Menu
   open while scrolled down, each Tab through its links moved the page under it and the reader lost their place: fix
   round 1 of the owner's answers of 2026-11-09, B, reader-1). While a control of the sticky header has the keyboard's
   focus, the page keeps no room for it, so moving the focus there never scrolls; leaving it for the page restores the
   room before the next control is scrolled into view. Only for keyboard focus (:focus-visible), so a click on the theme
   button leaves links to a place landing below the header. The methodology's page bar needs no such rule and keeps its
   room, so its "↑ Contents" lands the contents below it: the bar is fixed, not sticky, and the browser does not scroll
   the page to show a fixed box (measured in Chrome, Firefox and WebKit; GBS-4, guarded by compact_menu.mjs). Where
   :has() is not supported, as before. */
@media (min-width: 761px) {
  html:not(.header-scrolls):not(.bar-alone):has(.site-header :focus-visible) { scroll-padding-top: 0; }
}
/* At 760px and below (UX pass, SPEC §2): a grid, the brand and the theme button on the first row, the nav on the second
   (.header-end's box is dropped, so the nav and the button are the grid's items). The brand's column can shrink
   (minmax(0, 1fr)), so a long label ("Light mode") or a fallback font wraps the brand rather than letting the button
   overlap it; nothing is positioned absolutely. At most 92px tall at 375-414px. The brand breaks only between words
   (fix round 1, reader-6); where its longest word ("Suffering") and the button cannot share the first row (large text
   on a narrow screen: the container query below, in rem so it follows the text size), the button takes a row of its
   own under the nav, as before the UX pass, which is also its place in the focus order.
   Known: with the button on the first row, keyboard focus reaches it after the nav's links (its place in the page, and
   on wider screens where it follows "Data"); see docs/design.md, "Header" (fix round 1, a11y-4). */
@media (max-width: 760px) {
  .site-header { position: static; container: site-header / inline-size; }
  .site-header .wrap {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "brand theme" "nav nav";
    align-items: center; gap: 2px 12px; min-height: 0; padding-top: 8px; padding-bottom: 4px;
  }
  .header-end { display: contents; }
  .site-header .brand { grid-area: brand; min-width: 0; }
  .site-header .brand-name { overflow-wrap: normal; min-width: 0; }
  .site-header .theme-toggle { grid-area: theme; justify-self: end; }
  .site-nav { grid-area: nav; margin-left: 0; width: 100%; gap: 0; }
  .site-nav a { padding: 6px 8px; font-size: 0.9rem; }
}
/* Five links on one line down to 320px (fix round 1, reader-6). */
@media (max-width: 374px) { .site-nav a { padding: 6px 4px; } }
@container site-header (max-width: calc(10rem + 64px)) {
  .site-header .wrap { grid-template-columns: minmax(0, 1fr); grid-template-areas: "brand" "nav" "theme"; }
  .site-header .theme-toggle { justify-self: start; margin: 2px 0 4px; }
}

/* Owner-approved compact phone menu (2026-11-03). initHeaderMenu enhances the
   existing navigation; the rules above remain its usable no-JavaScript fallback.
   .menu-compact (common.js initHeaderMenu): at 760px and below, and, since the owner's answer of 2026-11-09 (B), on any
   wider screen where the desktop navigation and theme icon do not fit on one line (large text), measured, not by a
   breakpoint. The full brand and its scope sit beside Menu; open,
   the six links in two columns (one where large text needs the room) and the theme control below. Above 760px it stays
   sticky (html.header-scrolls still sends it away on a short screen); an open menu then scrolls inside the screen's
   height below the closed header, so its last control can always be reached. */
.menu-toggle {
  border: 1px solid var(--border-strong); background: transparent; color: var(--ink-2);
  border-radius: 4px; min-width: 58px; min-height: 44px; padding: 8px 12px;
  font: inherit; font-size: .9rem; cursor: pointer;
}
.menu-toggle:hover { color: var(--ink); background: var(--surface-2); }
.site-header.menu-compact { container: site-header / inline-size; }
.site-header.menu-compact .wrap {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "brand toggle" "menu menu";
  align-items: center; gap: 0 12px; min-height: 64px; padding-top: 9px; padding-bottom: 9px;
}
.menu-compact .brand { grid-area: brand; min-width: 0; }
.menu-compact .brand-name { overflow-wrap: normal; min-width: 0; font-size: 1.19rem; }
.menu-compact .menu-toggle { grid-area: toggle; justify-self: end; }
.menu-compact .header-end {
  grid-area: menu; display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start;
  gap: 0; width: 100%; margin: 0; padding-top: 12px;
  /* One column: .header-end's wrap (the full header's) would put the theme control in a second column to the right of
     the links once the open menu is capped at the window's height (below), off the screen (1024×500 at 300% text; fix
     round 1 of the owner's answers of 2026-11-09). */
  flex-wrap: nowrap;
}
/* Neither the links nor the theme control shrinks to fit a capped menu (the control's min-height would let it). */
.menu-compact .header-end > * { flex-shrink: 0; }
.menu-compact .site-nav {
  grid-area: auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 8px; width: 100%; margin-left: 0; padding: 8px 0; border-top: 1px solid var(--border);
}
.menu-compact .site-nav a { display: flex; align-items: center; min-height: 44px; padding: 8px 10px; font-size: 1rem; }
.menu-compact .site-nav a[aria-current] {
  box-shadow: none; text-decoration: underline 2px var(--nav-accent); text-underline-offset: .35em;
}
.menu-compact .theme-toggle {
  grid-area: auto; align-self: flex-start; min-height: 44px; margin: 0; padding: 8px 10px;
  font-size: 1rem; text-align: left;
}
@media (min-width: 761px) {
  html:not(.header-scrolls) .site-header.menu-compact .header-end {
    max-height: calc(100vh - var(--menu-closed-h, 0px)); max-height: calc(100dvh - var(--menu-closed-h, 0px));
    overflow-y: auto; overscroll-behavior: contain;
    /* A scrolling box clips what lies outside it: 4px of room on each side and below, taken back by the margins, so a
       focus ring (2px, 2px out) is drawn whole around a link at its edge and the theme control (fix round 1 of the
       owner's answers of 2026-11-09); the links and the control stay where they were. */
    width: calc(100% + 8px); margin-inline: -4px; padding-inline: 4px; padding-bottom: 4px; margin-bottom: -4px;
  }
  /* A control scrolled into view inside it (the keyboard's focus) comes with room for its ring above and below. */
  html:not(.header-scrolls) .site-header.menu-compact .header-end :is(a, button) { scroll-margin-block: 8px; }
}
/* Rem-based thresholds also respond to the browser's enlarged-text setting. */
@container site-header (max-width: 22rem) {
  .menu-compact .site-nav { grid-template-columns: minmax(0, 1fr); }
}
@container site-header (max-width: calc(10rem + 112px)) {
  .site-header.menu-compact .wrap { grid-template-columns: minmax(0, 1fr); grid-template-areas: "brand" "toggle" "menu"; row-gap: 8px; }
  .menu-compact .menu-toggle { justify-self: start; }
  .menu-compact .header-end { padding-top: 4px; }
}

/* ---------- Page sections ---------- */
main { padding-bottom: 64px; }
.hero { padding: 48px 0 28px; }
.hero .eyebrow { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 10px; }
/* Below 600px the eyebrow ("Animal suffering, measured openly") is hidden from view but kept for screen readers: the
   .visually-hidden rules, not display: none (UX pass, SPEC §2). */
@media (max-width: 600px) {
  .hero .eyebrow {
    position: absolute !important; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; margin: -1px;
  }
}
/* A word too long for the line (“concentrated?” at 320px with 200% text) breaks rather than pushing the page sideways;
   at other sizes, where every word fits, nothing changes (ux-7). */
.hero h1 { max-width: 22ch; overflow-wrap: break-word; }
.hero .lede { font-size: 1.15rem; color: var(--ink-2); max-width: 62ch; margin-top: 14px; }
.section { padding: 36px 0 8px; }
.section > .wrap > h2, .section-head h2 { margin-bottom: 8px; }
.section-head { margin-bottom: 18px; }
.section-head p { color: var(--ink-2); max-width: var(--prose); margin: 0; }
.page-head { padding: 40px 0 20px; }
.page-head p { color: var(--ink-2); max-width: var(--prose); margin-top: 12px; font-size: 1.05rem; }
/* contact.html: the address, larger than the text around it also on phones (beats .page-head.compact p); the short page
   fills the window so its footer sits at the bottom. */
.page-head.compact .contact-email { color: var(--ink); font-size: 1.2rem; overflow-wrap: anywhere; }
body.contact-page { min-height: 100vh; display: flex; flex-direction: column; }
body.contact-page main { flex: 1 0 auto; }

/* ---------- Stat tiles ---------- */
/* A query container, so a tile's wild count can be sized to fit its tile (.has-about). Not the tiles themselves: a
   container's layout containment would cut them off the subgrid that lines their values up. */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, max(8em, calc(25% - 9px))), 1fr)); gap: 12px; margin: 24px 0 8px; container-type: inline-size; }
/* Two tiles a row, or one when two would leave a tile under 8em of text wide: at 200% text on a phone, where a value
   ("1.5 trillion", "960,000") no longer fits half the row and pushed the page sideways (UX pass, SPEC §9 item 6). At the
   default text size every width keeps its two columns (8em is 128px; half a 320px phone's row is 138px). */
@media (max-width: 860px) { .kpis { grid-template-columns: repeat(auto-fill, minmax(min(100%, max(8em, calc(50% - 7px))), 1fr)); } }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px 16px; min-width: 0;
  /* One column no wider than the tile: a long word ("Entrepreneurship’s") at a large text size breaks inside the tile
     (with .kpi-label and .kpi-note below) instead of widening it past its border (round 6, reader-1). */
  display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto 1fr; align-content: start;
}
/* Label, value and note rows are shared by the tiles side by side (subgrid), so the values line up at any width,
   however many lines a label takes. Without subgrid, two lines are reserved for every label. */
@supports (grid-template-rows: subgrid) { .kpi { grid-row: span 3; grid-template-rows: subgrid; row-gap: 0; } }
@supports not (grid-template-rows: subgrid) { .kpi-label { min-height: 2.7em; } }
.kpi-label { font-size: 0.85rem; color: var(--ink-2); line-height: 1.35; overflow-wrap: anywhere; }
/* A value too long for its tile ("35 quintillion") breaks before the scale word, which continues on a smaller line.
   The Atlas sets the scale word smaller itself (.kpi-scale) and keeps the value on one line. */
.kpi-value { font-size: 1.05rem; font-weight: 650; line-height: 1.2; margin: 2px 0 2px; letter-spacing: -0.01em; min-width: 0; }
.kpi-value::first-line, .kpi-value.has-scale { font-size: clamp(1.5rem, 3.4vw, 2.1rem); }
.kpi-value.has-scale { white-space: nowrap; }
/* A wild count ("about 7 quadrillion") stays on one line, "about" with its number, as the other tiles' values do (fix
   round 2, reader-13): its size is capped by its tile's width, so it never breaks after "about" on a phone nor inside a
   word at 200% text (reader-6). The whole value is about 6.25 times its size wide; a tile's text is 50cqi − 40px wide
   in two columns (gap 12px, padding and border 34px) and 25cqi − 43px in four, so the caps below leave a little room.
   Where the tile is wide enough (most widths) the cap is above the size set here, and the value matches its neighbours. */
.kpi-value.has-about { white-space: nowrap; font-size: min(clamp(1.5rem, 3.4vw, 2.1rem), calc(7.8cqi - 6.5px)); }
@media (min-width: 861px) { .kpi-value.has-about { font-size: min(clamp(1.5rem, 3.4vw, 2.1rem), calc(3.9cqi - 7px)); } }
.kpi-value.has-about::first-line { font-size: inherit; }
/* One tile a row (the container under 16em of its own text): a tile's text is 100cqi − 34px wide, so the values' caps
   below follow it. A value's second line ("sextillion" under "about 5") is about six times its size wide. */
@container (max-width: 16em) {
  .kpi-value { font-size: min(1.05rem, calc(16.6cqi - 5.7px)); }
  .kpi-value::first-line, .kpi-value.has-scale:not(.has-about) { font-size: min(clamp(1.5rem, 3.4vw, 2.1rem), calc(22.7cqi - 7.7px)); }
  .kpi-value.has-scale:not(.has-about)::first-line { font-size: inherit; }
  .kpi-value.has-about { font-size: min(clamp(1.5rem, 3.4vw, 2.1rem), calc(15.6cqi - 6px)); }
}
.kpi-scale { font-size: 0.62em; font-weight: 600; letter-spacing: 0; }
.kpi-note { font-size: 0.8rem; color: var(--muted); overflow-wrap: anywhere; }
.hero-figure { font-size: clamp(3rem, 8vw, 4.6rem); font-weight: 700; letter-spacing: -0.02em; line-height: 1; }
.hero-figure-row { display: flex; flex-direction: column; gap: 10px; margin-top: 26px; }
.hero-figure-caption { color: var(--ink-2); max-width: 64ch; overflow-wrap: break-word; }
/* Two headline blocks (SPEC §3.1): "Caused by humans" and "In the wild", side by side from 900px, stacked (human first)
   below; the figures shrink to share the row. The wild block has a 3px rule in the wild colour. */
.hero-figure-row.two-blocks { display: grid; grid-template-columns: minmax(0, 1fr); gap: 26px; }
@media (min-width: 900px) { .hero-figure-row.two-blocks { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 36px; } }
.hero-figure-row.two-blocks .hero-figure { font-size: clamp(2.4rem, 6vw, 3.3rem); overflow-wrap: anywhere; hyphens: auto; }
.hero-figure-row.two-blocks .hero-figure-caption { margin-top: 10px; }
.hero-block { min-width: 0; }
.hero-block .hb-eyebrow { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 8px; }
.hero-block.is-wild { border-left: 3px solid var(--g-wild); padding-left: 14px; }
.hero-block .hero-links { margin-top: 8px; }
.hero-figure .hf-sci { font-size: 0.45em; font-weight: 650; letter-spacing: 0; color: var(--ink-2); white-space: nowrap; }
/* "Sources for the human-caused estimate" and "How this was built" under the headline; "Sources for these counts" under the tiles.
   Small, but each at least 24px tall to tap. */
.hero-links { display: flex; flex-wrap: wrap; gap: 0 18px; margin: 6px 0 0; font-size: 0.9rem; }
/* At least 24px tall, and taller when a link wraps at 200% text, so wrapped links never overlap (reader-6). */
.hero-links a, .hero-links .btn-link { display: inline-block; min-height: 24px; line-height: 1.35; padding: 2px 0; box-sizing: border-box; }
.hero-sources-label { font-size: 0.85rem; font-weight: 600; color: var(--ink-2); margin: 12px 0 6px; }
.hero-sources-label:first-child { margin-top: 0; }
/* The Atlas, led by its charts (UX pass, docs/handoff/ux/SPEC.md §3): the lede's first two sentences in view and the
   rest in "More about this atlas"; each headline figure with one line, the rest of its caption in a disclosure; the
   counts and "Killed every second" in a disclosure, open from 1024px. */
.hero .lede { margin-bottom: 4px; }
#lede-more .lede-rest { margin: 0 0 4px; }
.hero-figure-caption + details.hero-more { margin-top: 6px; }
details.hero-more > .more-body > .hero-figure-caption { margin: 0 0 8px; }
details.hero-more > .more-body > .hero-links { margin: 0 0 4px; }
#hero-counts { margin: 18px 0 0; }
#hero-counts > .more-body > .kpis { margin-top: 6px; }
/* On a phone the ranked chart's card starts within two screens (SPEC §8): less space around the headline and above
   "Where is the suffering?". Not in an embed, which keeps its own 8px (.embed .section), so an embedded figure sits
   where it did before the UX pass (SPEC §9 item 16). */
@media (max-width: 600px) {
  .hero { padding: 26px 0 6px; }
  .hero-figure-row { margin-top: 18px; }
  #hero-counts { margin-top: 10px; }
  html:not(.embed) #explore { padding-top: 22px; }
  #explore .section-head { margin-bottom: 6px; }
}

/* ---------- Figure card ---------- */
.figure {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  margin: 0 0 24px; min-width: 0;
}
.figure-head { padding: 18px 20px 6px; }
.figure-title { font-size: 1.15rem; font-weight: 650; margin: 0; }
/* A figure title that is an h2 (a species page's "Where the SADs come from", before the page's first h2) looks like the
   others: the sans face, not the h2's serif (UX pass fix round 1, a11y-3). */
h2.figure-title { font-family: inherit; letter-spacing: normal; }
.figure-subtitle { color: var(--ink-2); font-size: 0.95rem; margin: 4px 0 0; max-width: 80ch; }
/* A note on the view under the subtitle, inside the figure so that embeds and exported images carry it too (the map's
   "your own figure" and "Left out of this view" line, V9). */
.figure-head .map-excluded { margin: 6px 0 0; max-width: 80ch; }
.figure-body { padding: 4px 20px 12px; min-width: 0; }
.figure-foot {
  border-top: 1px solid var(--border); padding: 10px 20px 12px; font-size: 0.82rem; color: var(--muted);
  display: flex; gap: 12px; justify-content: space-between; flex-wrap: wrap;
}
@media (max-width: 600px) {
  .figure-head { padding: 14px 14px 4px; }
  .figure-body { padding: 4px 12px 10px; }
  .figure-foot { padding: 10px 14px 12px; }
}

/* Tabs (Chart | Table | Sources | Download) */
.tabs { display: flex; gap: 2px; padding: 0 20px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab {
  border: 0; background: transparent; color: var(--ink-2); font: inherit; font-size: 0.9rem;
  padding: 9px 12px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); font-weight: 600; }
.tabpanel[hidden]:not([hidden="until-found" i]) { display: none; }
/* A tab panel hidden until found (the browser's own style draws it as nothing: content-visibility: hidden) takes no
   room, as display: none did: no margin, padding, border or minimum height. Never display: none, contents or inline,
   which would stop find-in-page from searching it (the owner's answer of 2026-11-09, G). No gap either: WebKit (Safari)
   kept a hidden grid's gap between its rows, so on a phone each Key insight not shown was drawn as an empty strip 16px
   tall, three of them under the one shown (GBS-3, tests/engines/engines.mjs); Chrome and Firefox drew them as nothing. */
.tabpanel[hidden="until-found" i] { margin: 0 !important; padding: 0 !important; border: 0 !important; min-height: 0 !important; gap: 0 !important; }
@media (max-width: 600px) { .tabs { padding: 0 8px; } }

/* ---------- Controls ---------- */
.controls { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: flex-end; padding: 10px 0 6px; }
.control { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.control-label { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 7px; overflow: hidden; flex-wrap: wrap; }
.seg button {
  border: 0; background: transparent; color: var(--ink-2); font: inherit; font-size: 0.88rem;
  padding: 6px 11px; cursor: pointer; border-right: 1px solid var(--border);
}
.seg button:last-child { border-right: 0; }
/* The control clips its buttons to its rounded box, which cut a focus ring drawn outside a button to a 2px line on one
   side (and none on an end button's outer side): the ring is drawn inside the button, at its edge, with a band of the
   page's colour inside it, so it stands out on a pressed button too, whose background is the text colour (UX polish
   round 1, a11y-6). Whatever the control's width, its buttons wrapping to two rows or not. */
.seg button:focus-visible { outline-offset: -2px; border-radius: 0; box-shadow: inset 0 0 0 4px var(--surface); }
.seg button:hover { background: var(--surface-2); color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--surface); }
select, input[type="search"], input[type="number"] {
  font: inherit; font-size: 0.9rem; color: var(--ink); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: 7px; padding: 6px 9px; max-width: 100%;
}
input[type="number"] { width: 6.5em; padding: 4px 6px; font-variant-numeric: tabular-nums; }
.check { display: inline-flex; gap: 7px; align-items: center; font-size: 0.9rem; color: var(--ink-2); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--border-strong);
  background: transparent; color: var(--ink-2); border-radius: 999px; padding: 4px 11px 4px 9px;
  font: inherit; font-size: 0.86rem; cursor: pointer;
  /* No wider than its row: with very large text on a phone a word wider than the row ("invertebrates") breaks inside
     the chip instead of pushing it past the screen's edge (GBS-2). At the default size every chip is as before. */
  max-width: 100%; overflow-wrap: anywhere;
}
.chip:hover { background: var(--surface-2); color: var(--ink); }
.chip[aria-pressed="false"] { color: var(--muted); border-style: dashed; }
.chip[aria-pressed="false"] .swatch { background: transparent !important; box-shadow: inset 0 0 0 1.5px var(--axis-ink); }
.chip[aria-pressed="true"] { color: var(--ink); border-color: var(--ink-2); }
.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.btn {
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink); border-radius: 7px;
  padding: 6px 12px; font: inherit; font-size: 0.88rem; cursor: pointer; text-decoration: none; display: inline-flex; gap: 6px; align-items: center;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.btn-primary:hover { background: var(--ink-2); }
.btn-link { border: 0; background: none; color: var(--link); padding: 0; font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Charts ---------- */
.chart { position: relative; width: 100%; min-width: 0; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-family: var(--font-sans); }
.axis text, .tick text { fill: var(--axis-ink); font-size: 11px; font-variant-numeric: tabular-nums; }
.axis .domain { stroke: var(--axis); }
.axis .tick line { stroke: var(--grid); }
.gridline { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.baseline { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.bar-label { fill: var(--ink); font-size: 12.5px; }
.bar-value { fill: var(--ink-2); font-size: 11.5px; font-variant-numeric: tabular-nums; }
/* A value drawn over its interval band (no room beside it): a halo in the row's background keeps it readable. */
.bar-value.halo { stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; paint-order: stroke; }
.row:hover .bar-value.halo { stroke: var(--surface-2); }
.whisker { stroke: var(--ink-2); stroke-width: 1.25; opacity: 0.7; }
.mark-hit { fill: transparent; cursor: pointer; }
.mark-hit:hover + .mark, .mark.is-hover { filter: brightness(1.12); }
.row-hit:focus-visible { outline: none; }
.row-hit:focus-visible rect.row-bg { stroke: var(--focus); stroke-width: 2px; }
.row-bg { fill: transparent; }
.row:hover .row-bg { fill: var(--surface-2); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.85rem; color: var(--ink-2); margin: 4px 0 8px; }
/* No wider than the key, and a word wider than the key's line breaks inside it: with very large text on a phone the
   Squares tab's "Two shades of a colour: neighbouring groups …" ran past the key's box ("neighbouring" at 320px with
   300% text; GBS-2 review fix). At the default size every key is as before. */
.legend-item { display: inline-flex; gap: 6px; align-items: center; max-width: 100%; overflow-wrap: anywhere; }
/* The ranked chart's key while its 90% intervals are worked out ("90% interval: computing…"; assets/js/intervals.js): a
   word wider than the key's line breaks inside it (300% text on a 320px phone), never past the key (perf fix round 4). */
.legend-pending { min-width: 0; overflow-wrap: anywhere; }
/* A key's marker keeps its size when its label wraps at phone width (X10): never squeezed into an oval. */
.legend-item > [aria-hidden="true"], .legend-item > svg { flex: none; }
.chart-note { font-size: 0.85rem; color: var(--ink-2); margin: 6px 0 4px; }
/* A word longer than the callout's line breaks inside it rather than run past it and the page's edge (as source lists
   and chart notes do): the species pages' "Why this site gives no estimate" note, whose "Entrepreneurship’s" made six
   pages scroll sideways at 320px with 250% text and at 390px with 300% (integration fix round 1, product-2). It changes
   only a line that would otherwise overflow. */
.callout {
  background: var(--surface-2); border-radius: var(--radius); padding: 12px 14px; color: var(--ink-2);
  font-size: 0.93rem; margin: 10px 0; min-width: 0; overflow-wrap: anywhere;
}
.callout strong { color: var(--ink); }
.callout.warn { background: var(--warn-bg); color: var(--warn-ink); }
.callout.warn strong { color: inherit; }

.tooltip {
  position: fixed; pointer-events: none; z-index: 50; background: var(--surface); color: var(--ink);
  border: 1px solid var(--border-strong); border-radius: 8px; padding: 9px 11px; font-size: 0.85rem;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.14); opacity: 0; transition: opacity 80ms;
  /* common.js also fits the visual viewport, including a zoomed or resized screen. */
  width: max-content; max-width: min(max(300px, 18.75rem), calc(100vw - 16px));
  max-height: calc(100vh - 16px); overflow: auto; overscroll-behavior: contain; overflow-wrap: anywhere;
  visibility: hidden;
}
/* A shown tooltip takes the pointer (docs/handoff/FOLLOWUP-2026-10-31.md, PR #9): the mouse can cross from a defined
   term into its definition, a tap on the box never activates a link under it, and a long one (a dialog with the Close
   bar, common.js placeTip()) can be wheeled or swiped through. The exception is a small tooltip that follows the
   pointer over a map or chart (common.js show() without an owner, class "follows-pointer"): it lets the pointer
   through, as before PR #9, so it never hides the next country or bar from a hover or click. A long one (a dialog)
   lets it through too while the mouse moves, and takes it only once the mouse has rested (class "settled",
   common.js show()), so a quick move across the map or down a chart never lands on it (fix round 3, 2026-11-05);
   from then on it stays where it is while the mouse travels onto it (common.js holdTip(); suite review product-1). */
.tooltip.show { opacity: 1; visibility: visible; pointer-events: auto; }
.tooltip.show.follows-pointer:not([role="dialog"]),
.tooltip.show.follows-pointer:not(.settled) { pointer-events: none; }
.tooltip-actions {
  position: sticky; top: -9px; z-index: 1; display: flex; justify-content: flex-end;
  margin: -9px -11px 8px; padding: 8px 10px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.tooltip-close { min-width: 44px; min-height: 44px; justify-content: center; font-size: 0.85rem; }
.tt-title { font-weight: 650; margin-bottom: 4px; }
.tt-value { font-size: 1.05rem; font-weight: 700; }
.tt-row { display: flex; gap: 8px; justify-content: space-between; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.tt-row span:last-child { color: var(--ink); }
/* A row's label and value keep their words whole: under the tooltip's overflow-wrap: anywhere a row could squeeze its
   label inside the word ("M|ethod" beside a long method) and break a number ("330,00|0"), as a flex item's narrowest
   size was one letter (integration review round 3, product-1 and product-2). A short value, a figure ("$39 million /
   yr", a 90% interval; common.js placeTip() marks it "tt-fig"), keeps to one line and its label wraps at its spaces
   instead. Where the tooltip is narrower than a row's label and value side by side ("tt-stack": at phone widths with
   large text), the value goes under its label, at the right; a single word wider than the whole box still breaks. */
.tt-row > span { overflow-wrap: break-word; }
.tt-row > .tt-fig { white-space: nowrap; }
.tooltip.tt-stack .tt-row { flex-wrap: wrap; }
.tooltip.tt-stack .tt-row > span { min-width: 0; white-space: normal; }
.tooltip.tt-stack .tt-row > span:last-child { margin-left: auto; }
.tt-key { display: inline-block; width: 12px; height: 2px; vertical-align: middle; margin-right: 6px; }
.tt-sub { color: var(--muted); font-size: 0.8rem; margin-top: 4px; }

/* Treemap */
.tm-cell rect { stroke: var(--surface); stroke-width: 2px; }
.tm-cell text { pointer-events: none; font-size: 12px; }
.tm-cell .tm-name { font-weight: 600; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; max-width: 100%; }
/* The Wild page's table boxes (wild.html #why-table, oceanview.js, wildcard.js) scroll sideways as .table-wrap does,
   wherever they are. Until the GBS-2 review fix only those inside a .wild-analysis-card did: the Table tabs of "Why is
   the number so large?" (694px wide at 390px with default text, 1882px at 320px with 300%) and of the ocean map
   (637px at 320px) ran past the screen's edge, where the page cannot be scrolled, cutting their last columns off. */
.table-scroll { max-width: 100%; overflow-x: auto; }
table.data { border-collapse: collapse; width: 100%; font-size: 0.88rem; }
table.data th, table.data td { padding: 7px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
table.data th { font-weight: 600; color: var(--ink-2); font-size: 0.8rem; white-space: nowrap; position: sticky; top: 0; background: var(--surface); }
table.data th button { all: unset; cursor: pointer; }
table.data th button:hover { color: var(--ink); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* A family's heading row inside a table of wild groups (the "now split" view; reader-11). */
table.data tr.family-head th { position: static; color: var(--ink); font-size: 0.85rem; white-space: normal; padding-top: 12px; }
/* A value with its 90% interval under it, in one cell (the "now split" table; reader-11). */
table.split-table .v-line, table.split-table .iv-line { display: block; }
table.split-table .iv-line { white-space: normal; }
table.data.split-table th, table.data.split-table th.num { white-space: normal; }
/* "No estimate (counts only)" wraps, so the table fits a phone (reader-4); the values keep their non-breaking spaces. */
table.data.split-table td.num { white-space: normal; }
table.data tbody tr:hover { background: var(--surface-2); }

/* ---------- Tier badges ---------- */
.tier {
  display: inline-block; font-size: 0.72rem; font-weight: 650; border-radius: 4px; padding: 1px 6px;
  border: 1px solid var(--border-strong); color: var(--ink-2); white-space: nowrap; vertical-align: 1px;
}
.tier-1 { color: var(--ink); border-color: var(--ink-2); }
.tier-3 { opacity: 0.75; }
/* One column as wide as the box (minmax(0, 1fr)), not as wide as the longest word: with large text on a narrow screen
   ("Entrepreneurship)," at 250% on 320px) an auto column would push the list past the page's edge. */
.src-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.src-list li { font-size: 0.88rem; color: var(--ink-2); min-width: 0; overflow-wrap: anywhere; }
.src-list a { word-break: break-word; }

/* ---------- Cards / grids ---------- */
.grid { display: grid; gap: 12px; }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
/* A row of link cards fills the row: no empty track at the end (auto-fit, not auto-fill). */
.grid-3.grid-fill { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; min-width: 0;
}
a.card { text-decoration: none; color: inherit; display: block; }
a.card:hover, button.card:hover { border-color: var(--ink-2); }
.card h3 { margin-bottom: 4px; }
/* A wild group's card sits under its family's h3, so its title is an h4, styled as the other cards' h3 (reader-4). */
.card h4.card-title { font-size: 1.05rem; font-weight: 650; line-height: 1.2; margin: 0 0 4px; }
/* A wild family's heading stands apart from the cards of the family before it (reader-4). */
.picker-family { margin-top: 28px; }
.card .meta { font-size: 0.83rem; color: var(--muted); }
.badge {
  display: inline-flex; gap: 5px; align-items: center; font-size: 0.75rem; color: var(--ink-2);
  background: var(--surface-2); border-radius: 999px; padding: 2px 8px; white-space: nowrap;
}
/* A badge longer than its line (200% text on a phone) wraps inside its box rather than pushing the page sideways; on one
   line it looks as before (10px is half its height). UX pass, SPEC §9 item 6. */
.badge { white-space: normal; max-width: 100%; border-radius: 10px; }
/* A wild family's name is long: its badge wraps rather than run off a phone's screen (reader-6). */
#family-badge { white-space: normal; max-width: 100%; border-radius: 10px; }
/* The Atlas's controls card (UX pass, SPEC §3.4): the Measure in view, every other setting in "Change the assumptions".
   At 600px and below the card has no box, so the open panel's content keeps the width it had (the panel keeps its own
   box while closed). The panel's first line was the section's intro, which embeds hide with the other intros. */
#controls-measure { padding-top: 6px; }
.panel-intro { color: var(--ink-2); max-width: var(--prose); margin: 2px 0 4px; font-size: 0.95rem; }
.embed .panel-intro { display: none; }
@media (max-width: 600px) {
  #assumptions-card { border-color: transparent; background: transparent; border-radius: 0; margin-bottom: 14px; }
  #assumptions-card > .figure-body { padding: 0; }
}
/* "What SADs tell us, and what they don’t", closed under the Atlas's "Under these assumptions" line. */
details#sads-box { margin: 0 0 18px; }
details#sads-box > .more-body.callout { margin: 4px 0 0; }
.insight-text details.insight-more { margin: -0.4em 0 0.6em; }

/* ---------- One way to collapse: details.more (common.js more(), reveal(), initDisclosures(); UX pass, SPEC §1) ----------
   A summary that reads as a link with a chevron: the label in the link colour (0.92rem, weight 500), wrapping beside
   the chevron, with an optional muted line under it (.more-meta) that hides while open. At least 44px tall under a
   coarse pointer, 32px otherwise. The chevron is drawn with currentColor borders, so it shows in forced colours; it turns
   when open, with no transition under reduced motion. The worldview's own small disclosures (.wv-src, .wv-why) and the
   sliders' sources (.yn-src) keep their look. */
details.more { margin: 2px 0 4px; }
details.more > summary {
  list-style: none; cursor: pointer; display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 8px;
  align-items: start; align-content: center; width: fit-content; max-width: 100%; min-height: 32px; padding: 4px 4px 4px 0;
  color: var(--link); font-size: 0.92rem; font-weight: 500; line-height: 1.4; border-radius: 4px;
}
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::marker { content: ""; }
details.more > summary::before {
  content: ""; grid-column: 1; grid-row: 1 / span 2; width: 0.42em; height: 0.42em; margin: 0.42em 3px 0 2px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform 0.15s ease;
}
details.more[open] > summary::before { transform: rotate(45deg); margin-top: 0.3em; }
details.more > summary .more-label { grid-column: 2; min-width: 0; overflow-wrap: break-word; }
/* Only where the pointer can hover: touch browsers keep :hover after a tap, which left a tapped label underlined (fix
   round 1, reader-11). */
@media (hover: hover) { details.more > summary:hover .more-label { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; } }
details.more > summary .more-meta { grid-column: 2; display: block; min-width: 0; color: var(--muted); font-size: 0.85rem; font-weight: 400; overflow-wrap: break-word; }
details.more[open] > summary .more-meta { display: none; }
details.more[open] > summary { margin-bottom: 4px; }
.more-body { min-width: 0; }
.more-body > :last-child { margin-bottom: 0; }
@media (pointer: coarse) { details.more > summary { min-height: 44px; } }
@media (prefers-reduced-motion: reduce) { details.more > summary::before { transition: none; } }
/* A point of a list (ol.more-points): its bold lead is the label. */
ol.more-points { list-style: none; margin: 4px 0 12px; padding: 0; }
ol.more-points > li { margin: 0; }
details.more.more-point { margin: 0; }
details.more.more-point > summary { color: var(--ink); }
details.more.more-point > summary .more-label { font-weight: 650; }
details.more.more-point > summary::before { color: var(--link); }
/* A boxed bar for a block of controls; open, it turns the card's colour. Below 1024px the open panel drops its box and
   side padding, so the controls inside keep the width they had before the UX pass (at 600px and below since the pass;
   up to 1023px since UX fix round 3, desktop-2: at 768px the boxed panel made the controls 26px narrower, the group
   chips took three rows and "Try your own numbers" 40px more). From 1024px the box costs no line. */
details.more.more-panel { border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface-2); padding: 0 12px; margin: 10px 0 0; }
details.more.more-panel > summary { width: 100%; padding-top: 8px; padding-bottom: 8px; }
details.more.more-panel > summary .more-label { font-weight: 650; }
details.more.more-panel[open] { background: var(--surface); padding-bottom: 12px; }
@media (max-width: 1023px) { details.more.more-panel[open] { border-color: transparent; background: transparent; padding-left: 0; padding-right: 0; } }
/* Forced colours draw a transparent border as a solid line, which then touched the unboxed controls: give the unboxed
   card and panel the page's own colour (a system colour, which forced colours keep), so the lines stay hidden and the
   width is the same (UX final step, a11y-1). */
@media (forced-colors: active) and (max-width: 600px) { #assumptions-card { border-color: Canvas; } }
@media (forced-colors: active) and (max-width: 1023px) { details.more.more-panel[open] { border-color: Canvas; } }
/* A section fold: the heading and a one-line lead stay in view, the rest in "Read the whole section". */
.fold-lead { color: var(--ink-2); max-width: var(--prose); margin: 6px 0 0; }
/* Printing: the text prints open (common.js beforeprint, and the fallback below), without chevrons; generic rows ("Read
   the whole section", "More about this …", "Show the other …") are left out, other summaries print as bold text. */
@media print {
  details.more > summary::before { display: none; }
  details.more > summary { color: var(--ink); min-height: 0; padding: 0; display: block; }
  details.more > summary .more-label { font-weight: 650; }
  details.more > summary .more-meta { display: none; }
  details.more.fold-more > summary, details.more.more-generic > summary { display: none; }
  details.more.more-panel { border: 0; background: none; padding: 0; }
}
/* Print without the beforeprint event (a PDF made by a script, a browser that skips it): a closed disclosure's content
   still prints, where the browser exposes ::details-content. A rule of its own, so a browser without it drops only this. */
@media print { details::details-content { content-visibility: visible; display: block; } }
/* Embeds (common.js initEmbed, embedFormHeight): an embedded figure shows its disclosures open, without their summary
   rows, as before the UX pass. The second rule covers a disclosure drawn after initEmbed opened the others. */
.embed figure.figure details.more > summary, .embed-form details.more > summary { display: none !important; }
.embed figure.figure details::details-content { content-visibility: visible; display: block; }

/* Species detail */
.sp-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .sp-grid { grid-template-columns: 1fr; } }
.back-link { display: inline-block; margin-bottom: 12px; font-size: 0.9rem; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); padding: 26px 0 36px; font-size: 0.86rem; color: var(--muted); }
.site-footer .wrap { display: flex; gap: 18px 36px; flex-wrap: wrap; justify-content: space-between; }
.site-footer p { margin: 0 0 6px; max-width: 70ch; }

/* Formula block */
.formula {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.88rem; background: var(--surface-2);
  border-radius: var(--radius); padding: 12px 14px; overflow-x: auto; color: var(--ink); white-space: pre;
}

@media (forced-colors: active) {
  .chip[aria-pressed="true"], .seg button[aria-pressed="true"], .tab[aria-selected="true"] { outline: 2px solid CanvasText; }
  /* Inside the button too, as its focus ring is: the pressed button's only mark here (a11y-6). */
  .seg button[aria-pressed="true"] { outline-offset: -2px; }
  /* Keyboard focus is another kind of mark here: a dashed frame in the system's Highlight colour inside the button, 2px
     in from the pressed outline (Windows' own focus mark). Forced colours drop the ring's inner band, and the pressed
     outline, the more specific rule, took the ring's place, so focus on the pressed button showed nothing; on another
     button the ring had the pressed outline's shape and place (UX polish round 2, a11y-7, code-6). The pressed button
     keeps its outline when it has focus; another button with focus has no outline, only the frame. */
  .seg button { position: relative; }
  .seg button:focus-visible:not([aria-pressed="true"]) { outline: none; }
  .seg button:focus-visible::after { content: ""; position: absolute; inset: 4px; border: 2px dashed Highlight; pointer-events: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print {
  /* Printing uses the light text palette even when the reader has selected dark mode. */
  :root:not([data-theme]), :root[data-theme] {
    color-scheme: light;
    --page: #fff; --surface: #fff; --surface-2: #f2f1ed;
    --ink: #0b0b0b; --ink-2: #52514e; --muted: #6f6d68;
    --axis-ink: #737169; --grid: #e1e0d9; --axis: #c3c2b7;
    --border: rgba(11, 11, 11, 0.10); --border-strong: rgba(11, 11, 11, 0.18);
    --link: #1c5cab; --good: #006300; --warn-bg: #fdf3dc; --warn-ink: #6b4a00;
  }
  .site-header, .site-footer, .controls, .tabs, .theme-toggle { display: none !important; }
  .tooltip { display: none !important; }
  body { background: #fff; }
}

@media (max-width: 600px) {
  #ctl-metric.seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  #ctl-metric.seg button { border-bottom: 1px solid var(--border); text-align: center; min-width: 0; overflow-wrap: break-word; }
  #ctl-metric.seg button:nth-child(2n) { border-right: 0; }
  #ctl-metric.seg button:nth-last-child(-n + 2) { border-bottom: 0; }
}
/* The Measure buttons two a row need about 4.5rem of text and their padding each ("population"). Where a phone has
   less (320px from about 175% text, 390px from about 225%), they take one a row: two a row cut "Welfare-adjusted
   population" and "Killed per year" off at the control's clipped edge (GBS-2). The columns above can also narrow below
   a word, which then breaks, so no font can push a button past the control. At the default size phones keep two. */
@media (max-width: 600px) and (max-width: calc(9.5rem + 84px)) {
  #ctl-metric.seg { grid-template-columns: minmax(0, 1fr); }
  #ctl-metric.seg button { border-right: 0; }
  #ctl-metric.seg button:nth-last-child(2) { border-bottom: 1px solid var(--border); }
}
.toc { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 22px; font-size: 0.9rem; }
/* A long contents link wraps at large text sizes rather than make the page scroll sideways (reader-10). */
.toc a { white-space: normal; overflow-wrap: break-word; max-width: 100%; }

/* ---------- Methodology: folded sections, the point list, "Open all sections" and the slim page bar (UX pass, SPEC §6) ----------
   Each section is a .fold: its h2 and a one-line lead in view, the rest (tables included) in "Read the whole section".
   "Caveats that matter most" is a point list; "Corrections and contributions" is not folded. */
.toc-all, .page-bar-all {
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink); border-radius: 6px;
  padding: 2px 10px; font: inherit; font-size: 0.85rem; line-height: 1.4; cursor: pointer; white-space: nowrap;
}
.toc-all:hover, .page-bar-all:hover { background: var(--surface-2); }
/* In the contents it is a small chip on the links' line height, at least 24px tall (WCAG 2.5.8) also under touch. */
.toc .toc-all { padding: 1px 8px; font-size: 0.82rem; min-height: 24px; }
/* Where "Open all sections" alone is wider than its line (320px with 300% text), its words wrap inside it rather than
   run past the screen's edge; elsewhere it stays on one line, moving to the next line of links as a whole (fix round 1
   of the owner's answers of 2026-11-09, reader-4; the Wild page's, wild.css, likewise). */
.toc .toc-all, .wild-page-links .toc-all { white-space: normal; max-width: 100%; text-align: left; }
/* The reference pages (methodology, data) on a phone: a tighter page head and contents, so the first section's text
   starts within about half a screen (SPEC §8). */
@media (max-width: 600px) {
  .page-head.compact { padding: 16px 0 8px; }
  .page-head.compact p { font-size: 1rem; margin-top: 6px; }
  .toc { gap: 4px 12px; font-size: 0.86rem; margin-bottom: 12px; }
}
.method-sections > * + * { margin-top: 30px; }
@media (max-width: 600px) { .method-sections > * + * { margin-top: 24px; } }
.method-sections h2 { margin: 0; }
.method-sections .fold-lead { margin: 6px 0 0; }
.method-sections details.fold-more { margin: 2px 0 0; }
.method-sections details.fold-more > .more-body { padding-top: 6px; }
.method-sections details.fold-more > .more-body > .figure { margin: 4px 0 20px; }
.method-sections .method-sec > h2 + * { margin-top: 8px; }
ol.method-points { margin: 8px 0 14px; }
/* The open text continues its bold lead, so it lines up under the lead, not under the chevron. */
ol.method-points details.more-point > .more-body { padding-left: calc(0.39rem + 13px); }
ol.method-points details.more-point > .more-body > p { margin: 0 0 8px; }
/* The bar: fixed below the sticky header from 761px (at the top below, where the header scrolls away), shown only while
   the table of contents is out of view (methodology.js initPageBar); otherwise invisible and inert. At most 48px tall. */
.page-bar {
  position: fixed; left: 0; right: 0; top: 0; z-index: 19; overflow: hidden;
  background: var(--surface); border-bottom: 1px solid var(--border);
  visibility: hidden; opacity: 0; transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s linear 0.15s;
}
@media (min-width: 761px) { .page-bar { top: var(--header-h, 61px); } }
.page-bar.is-shown { visibility: visible; opacity: 1; transform: none; transition: opacity 0.15s ease, transform 0.15s ease; }
.page-bar-in { display: flex; align-items: center; gap: 12px; min-height: 32px; padding-top: 4px; padding-bottom: 4px; }
.page-bar-toc { flex: none; display: inline-flex; align-items: center; min-height: 32px; font-size: 0.88rem; white-space: nowrap; text-decoration: none; }
.page-bar-toc:hover { text-decoration: underline; }
.page-bar-arrow { margin-right: 0.3em; }
.page-bar-title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.88rem; font-weight: 600; color: var(--ink-2); }
.page-bar-all { flex: none; }
/* Large text or a narrow screen (fix round 1, reader-5, reader-11): "↑ Contents" becomes the arrow alone (the word
   stays for screen readers), so the title keeps room and nothing is cut off; in rem, so it follows the text size. The
   bar's button is the short "Open all" / "Close all" everywhere. */
.page-bar { container: page-bar / inline-size; }
@container page-bar (max-width: 25rem) {
  .page-bar-toc-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; margin: -1px; }
  .page-bar-toc { min-width: 32px; justify-content: center; }
  .page-bar-arrow { margin-right: 0; }
  /* The title wraps to two lines rather than being cut to its first word (UX fix round 3, reader-2: at 200% text
     "Groups converted …" and "Groups we found …" both read "Groups …"); at 100% text two lines stay within 48px. */
  .page-bar-title { white-space: normal; line-height: 1.2; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow-wrap: anywhere; }
}
@media (pointer: coarse) { .page-bar-in { padding-top: 3px; padding-bottom: 3px; } .page-bar-in, .page-bar-toc, .page-bar-all { min-height: 40px; } }
/* Links land below the header (when it is sticky) and the bar: --header-h and --page-bar-h are measured. */
html.has-page-bar { scroll-padding-top: calc(var(--page-bar-h, 41px) + 12px); }
@media (min-width: 761px) { html.has-page-bar { scroll-padding-top: calc(var(--header-h, 61px) + var(--page-bar-h, 41px) + 12px); } }
/* A short screen, where the sticky header and the bar would cover more than a quarter of it (a phone held sideways, 137px
   of 390; large text on a tablet): the header scrolls away and the bar sits at the top (methodology.js fit(); UX final
   step, reader-1, desktop-2). */
html.bar-alone .site-header { position: static; }
html.bar-alone .page-bar, html.header-scrolls .page-bar { top: 0; }
@media (min-width: 761px) { html.has-page-bar.bar-alone, html.has-page-bar.header-scrolls { scroll-padding-top: calc(var(--page-bar-h, 41px) + 12px); } }
/* The bar's controls draw their focus ring inside the bar, which clips what passes its edges (UX final step, a11y-2:
   under touch the 40px controls left 3px, and the ring, 2px out at a 2px offset, lost 1px at the top and bottom). At
   a 1px offset it ends at the bar's edge under touch and keeps a gap from "↑ Contents"'s glyphs and "Open all"'s own
   border, which it touched at 0 (UX polish round 1, a11y-4). */
.page-bar-toc:focus-visible, .page-bar-all:focus-visible { outline-offset: 1px; }
@media print { .page-bar, .toc-all { display: none !important; } }

/* ---------- Data page (UX pass, SPEC §7): the downloads, the sources (ten in view, the rest one tap down), then how to
   cite and reuse ---------- */
.data-h2 { margin: 36px 0 8px; }
#downloads-title { margin-top: 8px; margin-bottom: 12px; }
/* Both source tables share fixed column widths, so the rows one tap down line up with those in view; a phone scrolls a
   table sideways inside its box, and from 768px each fits its box. The least width is also in rem, so with large text
   the table grows with its em columns and scrolls inside its box, as before the UX pass, rather than squeezing the
   others until "Organisation / authors" ran under "Year" (UX final step, desktop-1; 680px at 100% text, as before).
   With 42.5rem a laptop at 175-200% text (1280px) scrolled a quarter of "Used for" out of its box (UX polish round 1,
   desktop-1); at 34rem it was still 2px wider than the box's 1,086px at 200% text, so a scrollbar showed under each table
   where scrollbars always show: 33.9rem fits (UX polish round 2, desktop-1). Since the cards show wherever the box is
   under 42.5em (below), the table has columns only where it fits its box, so this least width no longer makes it
   scroll (UX polish round 3). */
table.data.sources-tbl { table-layout: fixed; min-width: max(680px, 33.9rem); }
table.sources-tbl col.c-tier { width: 5.6em; }
/* The "Used for" notes, the longest cells, get the rest of the width, so the ten rows in view are within about 2% of
   their height before the UX pass from 768 to 1280px (fix round 1, desktop-2; 32% and 19% made them 2-7% taller). */
table.sources-tbl col.c-src { width: 28%; }
table.sources-tbl col.c-org { width: 16%; }
table.sources-tbl col.c-year { width: 4.6em; }
/* On a phone each source is a stacked card (fix round 1, reader-8): the title (and licence) beside its tier, then the
   organisation and year, then what it is used for. No sideways scroll and no blank space under short cells; the
   column headers stay for screen readers (the table keeps its roles, data.js). Wherever the box is narrower than the
   table's least width at 100% text, a phone held sideways too: from 601 to 751px the table was 680px in a 527-679px
   box, with up to 133px of "Used for" out of view (UX polish round 2, desktop-3). The width is the box's in em, as for
   the prose tables (.stack-wrap below): 42.5em is 680px at 100% text, and with large text the cards show on wider
   screens too, where the table had grown wider than its box and hid "Used for" behind a sideways scroll (768x1024 at
   150-200% text: 120-391px; 844x390 at 150-200%: 44-315px; 1024x768 at 200%: 135px; 1280px at 225%: 134px). The table
   keeps its columns where its box is at least 42.5em (at 1024px up to 137.5% text, at 1280-1440px up to 150%); 680px
   stays the floor, for text smaller than 100% (UX polish round 3, a11y-1, code-3, reader-19, desktop-2). Under 40em the organisation's
   column took 1.5% more, for "Organisation" with large text (UX polish round 2, desktop-2): such a box now gets the
   cards, so that rule went. */
#sources-table, #sources-rest { container: sources / inline-size; }
@container sources (width < 680px) or (width < 42.5em) {
  table.data.sources-tbl, table.data.sources-tbl tbody { display: block; min-width: 0; width: 100%; }
  table.data.sources-tbl colgroup { display: none; }
  table.data.sources-tbl thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  table.data.sources-tbl tbody tr {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "tier src src" "tier org year" "tier used used";
    column-gap: 10px; row-gap: 2px; padding: 9px 0; border-bottom: 1px solid var(--border);
  }
  table.data.sources-tbl tbody td { display: block; padding: 0; border: 0; }
  table.data.sources-tbl td.c-tier { grid-area: tier; }
  table.data.sources-tbl td.c-src { grid-area: src; }
  table.data.sources-tbl td.c-org { grid-area: org; font-size: 0.82rem; }
  table.data.sources-tbl td.c-year { grid-area: year; font-size: 0.82rem; color: var(--ink-2); }
  table.data.sources-tbl td.c-used { grid-area: used; }
  /* The label is for the eye only (alternative text ""): screen readers hear the column header (UX polish round 1,
     a11y-5); the first declaration is for browsers without the "/ alt" syntax. */
  table.data.sources-tbl td.c-used:not(:empty)::before { content: "Used for: "; content: "Used for: " / ""; font-weight: 600; }
}
/* Two prose tables stacked on a phone, as the sources are (UX final step, reader-2): the map's "Not on this map" and a
   species page's welfare-level estimates. Each row is its name and value on one line, then its prose, full width (the
   reason; the range, method and source, each named), so nothing is cut off at the box's edge and no cell is a column
   of single words. The column headers stay for screen readers (the table keeps its roles, map.js and species.js), and
   the labels are for the eye only (alternative text "", after a declaration for browsers without that syntax), so a
   cell is not announced with its header and then the label again (UX polish round 1, code-2, a11y-5). Up to 700px, a
   phone held sideways too: from 601px laying hens' five estimates were wider than their box, and every such table two
   to three times as tall as stacked (UX polish round 1, reader-9). The width is the table's box in em (.stack-wrap, a
   container), so it follows the text size: 41.75em is the box at 700px with 100% text (668px), and with large text the
   tables stack on wider screens too, where they had grown wider than their box and scrolled sideways (laying hens'
   1,135px in 812 at 844px with 200% text, 747px in 736 at 768px with 125%; UX polish round 2, reader-13, desktop-3). */
.stack-wrap { container: stack-wrap / inline-size; }
@container stack-wrap (max-width: 41.75em) {
  table.data.stack-sm, table.data.stack-sm tbody { display: block; width: 100%; }
  /* 4px each side keeps a link's focus ring (2px at a 2px offset) inside the box, which clips what passes its edges
     (overflow-x: auto): with no cell padding a link whose line starts at the edge lost the ring's left side (laying
     hens: 3 of 11 links at 390px, 8 of 11 with 200% text; UX polish round 3, a11y-2). */
  table.data.stack-sm { box-sizing: border-box; padding-inline: 4px; }
  table.data.stack-sm thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  /* A row wraps: the name and the value share the first line while both fit (the value moves under the name when they
     do not, at large text on a narrow screen), and every other cell takes a line of its own. */
  table.data.stack-sm tbody tr { display: flex; flex-wrap: wrap; column-gap: 12px; row-gap: 3px; padding: 9px 0; border-bottom: 1px solid var(--border); }
  table.data.stack-sm tbody td { display: block; flex: 0 0 100%; padding: 0; border: 0; min-width: 0; overflow-wrap: break-word; white-space: normal; text-align: left; }
  table.data.stack-sm td.st-name { flex: 1 1 10em; font-weight: 600; }
  table.data.stack-sm td.st-value { flex: 0 1 auto; margin-left: auto; text-align: right; }
  table.data.stack-sm td.st-range::before, table.data.stack-sm td.st-method::before, table.data.stack-sm td.st-src::before {
    content: attr(data-label) ": "; content: attr(data-label) ": " / ""; font-weight: 600; color: var(--ink-2);
  }
  /* A value says what it counts under it ("SADs per year"), as its column's heading did; every value, also "No
     estimate" and "—" (UX polish round 1, reader-6). The label comes right under the number, before a note the cell
     carries ("your own figure"), which it was read as part of when it came last (UX polish round 2, reader-15). */
  table.data.stack-sm td.st-value { display: flex; flex-direction: column; align-items: flex-end; }
  table.data.stack-sm td.st-value[data-label]::after { content: attr(data-label); content: attr(data-label) / ""; display: block; font-size: 0.78rem; font-weight: 400; color: var(--muted); order: 1; }
  table.data.stack-sm td.st-value > * { order: 2; }
}
#s-rest { margin: -12px 0 0; }
#s-rest > .more-body > .figure { margin-top: 4px; }
.fold.cite-fold .fold-lead { margin: 0 0 2px; }
.fold.cite-fold .cite-licence { color: var(--ink-2); max-width: var(--prose); }
/* On a phone each download is a compact row: its title and buttons on one line, what it holds under them. */
@media (max-width: 600px) {
  .downloads.grid-3 { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .downloads .card {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "title files" "what what";
    align-items: center; column-gap: 10px; row-gap: 2px; padding: 10px 12px;
  }
  .downloads .card h3 { grid-area: title; margin: 0; }
  .downloads .card .meta { grid-area: what; margin: 0; }
  .downloads .card .chips { grid-area: files; flex-wrap: nowrap; }
}

/* ---------- Existing views: figure links, notes, profiles, filters ---------- */
/* Links at the right of a figure footer, next to the Data source / Note lines. */
.figure-links { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; }
@media (max-width: 600px) { .figure-links { align-items: flex-start; text-align: left; } }

/* Numbered notes under a chart; the numbers match superscripts on the rows. */
.chart-notes { margin: 8px 0 4px; padding-left: 1.6em; display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }
.chart-notes li { padding-left: 2px; min-width: 0; overflow-wrap: anywhere; }
.chart-notes li::marker { color: var(--ink); font-variant-numeric: tabular-nums; }

/* Two-column callout ("What SADs tell us" / "What SADs don’t tell us"). */
.callout.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 28px; padding: 16px 18px; margin: 0 0 24px; }
.callout.two-col h3 { font-size: 1rem; color: var(--ink); margin: 0 0 6px; }
.callout.two-col p { margin: 0; }
.callout.two-col ul { margin: 0; padding-left: 1.15em; display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }
@media (max-width: 699px) { .callout.two-col { grid-template-columns: minmax(0, 1fr); } }
.prose .callout.two-col p, .prose .callout.two-col li { color: var(--ink-2); }

/* Species profile: "What you should know about this estimate". */
.callout.know { margin: 4px 0 14px; padding: 14px 16px; }
.callout.know h2 { font-family: var(--font-sans); font-size: 1rem; font-weight: 650; color: var(--ink); margin: 0 0 6px; letter-spacing: 0; }
.callout.know ul { margin: 0; padding-left: 1.15em; display: grid; grid-template-columns: minmax(0, 1fr); gap: 3px; }

/* Species profile: key facts, sized by the text, not the window (UX polish round 4, reader-1-p3, desktop-1-p3). Two
   columns where each is at least 22.2em (320px at 100% text: the list at 700px wide, where the columns began before)
   and a third of the list (never three); one otherwise. A pair puts its label above its value where it is under 19.5em
   (its own container, in its own em), so the value keeps at least about 10em: the longest word, "Entrepreneurship" in
   "Charity Entrepreneurship (now Ambitious Impact), 2018", is 8.1em. With an 8.5em label beside it at any width, the
   value column had shrunk to 103-164px on a phone with 150-200% text and 38-234px on a tablet or laptop with 150-250%,
   and that word broke without a hyphen ("Entrepreneurshi/p"). At 100% text nothing moves (390, 768 and 1280px). */
.keyfacts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, max(22.2em, 34%)), 1fr)); gap: 0 28px; margin: 0 0 8px; font-size: 0.9rem; }
.keyfacts > div { container: kf-pair / inline-size; display: grid; grid-template-columns: minmax(0, 8.5em) minmax(0, 1fr); gap: 2px 10px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.keyfacts dt { color: var(--muted); }
.keyfacts dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
@container kf-pair (width < 19.5em) { .keyfacts dt, .keyfacts dd { grid-column: 1 / -1; } }

/* Species profile: low / central / high panels (three columns from 760px). */
.range-panels { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin: 4px 0 8px; }
@media (min-width: 760px) { .range-panels { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
/* The SADs range sits alone under its tiles (SPEC §5): two of the three columns, so its row is not mostly empty and a
   wild page's log scale and its words have room (UX fix round 2, desktop-1). Its height does not depend on its width. */
@media (min-width: 760px) { .range-panels.range-panels-sads { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } }
.range-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px 10px; min-width: 0; }
.range-title { font-size: 0.85rem; color: var(--ink-2); margin-bottom: 6px; }

/* Clear endpoints for wild species' log ranges (owner approved 2026-11-03).
   This mark color is scoped here; the site's categorical wild palette is separate. */
.log-range { --range-mark: #137653; --range-halo: var(--surface); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .log-range { --range-mark: #5bd6ab; }
}
:root[data-theme="dark"] .log-range { --range-mark: #5bd6ab; }
.log-range .range-words { margin-bottom: 0; }
.log-range-key { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 12px; color: var(--muted); font-size: .8rem; }
.log-range-key > span { display: inline-flex; align-items: center; gap: 6px; width: max-content; max-width: 100%; }
.log-range-key-dot { flex: 0 0 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--range-mark); }
.log-range-key-interval { position: relative; flex: 0 0 24px; width: 24px; height: 12px; border-inline: 2px solid var(--range-mark); }
.log-range-key-interval::before { content: ""; position: absolute; left: 0; right: 0; top: 5px; border-top: 2px solid var(--range-mark); }
@media print { .log-range { --range-mark: #137653 !important; } }
@media (forced-colors: active) {
  .log-range { --range-mark: CanvasText !important; --range-halo: Canvas; }
  .log-range-interval, .log-range-endpoint, .log-range-zero, .log-range-central,
  .log-range-key-dot, .log-range-key-interval { forced-color-adjust: none; }
}

/* Species profile: the folded parts (UX pass, SPEC §5): the count ranges, the rest of the top countries, the welfare
   method, the pain-hour notes, the citations and the sources. */
details#count-ranges > .more-body.range-panels { margin-top: 4px; }
.country-section details.more { margin: 2px 0 0; }
.country-section details.more .country-bars { margin-top: 2px; }
.pain-fig details#pain-notes { margin-top: 10px; }
.fold.cite-section .fold-lead, .fold.sources-fold .fold-lead { margin: 0 0 2px; }

/* Species list: two cards to a row on a phone; each wild family's cards one tap down (SPEC §5, "Species list"). */
@media (max-width: 600px) {
  .grid-3.grid-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .grid-cards .card { padding: 10px 12px; }
}
/* The list's cards keep their place with very large text (two a row for the human-caused groups): a word wider than the
   card's line ("estimate" in "SADs: no estimate", "million", a wild group's "Earthworms") breaks inside it instead of
   running past the card and the screen's edge (320px with 250% and 300% text; GBS-2 review fix). At the default size
   every card is as before. */
#picker .card { overflow-wrap: break-word; }
details.more.family-fold { margin: 0 0 8px; }
details.more.family-fold > .more-body { padding-top: 4px; }

/* Species profile: "Where these animals are" (top countries). */
.country-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.country-bars li {
  display: grid; grid-template-columns: minmax(7.5em, 11em) minmax(60px, 1fr) minmax(7em, auto) minmax(0, 15em);
  gap: 2px 12px; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--border); font-size: 0.9rem;
}
.country-bars li:last-child { border-bottom: 0; }
.cb-name { color: var(--ink); min-width: 0; overflow-wrap: anywhere; }
.cb-rank { color: var(--muted); font-variant-numeric: tabular-nums; display: inline-block; min-width: 2.1em; }
.cb-track { height: 12px; position: relative; min-width: 0; }
.cb-bar { position: absolute; left: 0; top: 0; bottom: 0; background: var(--ink-2); border-radius: 0 3px 3px 0; min-width: 2px; }
.cb-val { color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.cb-count { color: var(--muted); font-size: 0.82rem; font-variant-numeric: tabular-nums; min-width: 0; }
.cb-head { font-size: 0.78rem; color: var(--muted); padding-bottom: 4px; }
/* On a phone: the name with its value beside it, the bar and the count below. The row wraps (flex), so with large
   text on a narrow screen the value moves under the name and wraps at its spaces, instead of squeezing the name's
   column to nothing and pushing the value past the page's edge (a grid's auto column cannot shrink below its
   unbroken text). The value goes under the name only when the name would get narrower than 5em, about its rank and
   a short name, so up to 200% text the rows keep the value beside the name as the grid did; the header's "Country"
   needs only its own width (product-3, 2026-11-04). At the default text size the rows look as before. */
@media (max-width: 699px) {
  .country-bars li { display: flex; flex-wrap: wrap; column-gap: 12px; row-gap: 2px; }
  .cb-name { flex: 1 1 5em; }
  .cb-head .cb-name { flex-basis: auto; }
  .cb-val { flex: 0 1 auto; order: 1; margin-left: auto; white-space: normal; overflow-wrap: anywhere; }
  .cb-track { flex: 1 0 100%; order: 2; }
  .cb-count { flex: 1 0 100%; order: 3; }
  .cb-head .cb-track, .cb-head .cb-count { display: none; }
}

/* ---------- Figure footer lines and citations (common.js figureFooter, citeBlock) ---------- */
.figure-lines { display: grid; gap: 3px; flex: 1 1 320px; min-width: 0; }
.figure-source, .figure-note { margin: 0; font-size: 0.82rem; color: var(--muted); line-height: 1.45; overflow-wrap: anywhere; }
.figure-source-label { color: var(--ink-2); font-weight: 600; }
.figure-source .btn-link { font-size: inherit; }
.cite-block { display: grid; gap: 12px; margin: 8px 0 4px; }
.cite-row { background: var(--surface-2); border-radius: var(--radius); padding: 10px 12px; min-width: 0; }
.cite-label { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.cite-text { margin: 0 0 8px; font-size: 0.9rem; color: var(--ink); overflow-wrap: anywhere; }
/* Give chart citations the card's full width when enlarged text leaves a narrow line. A word too long even for
   that line gets a language-aware hyphen; URLs in the full citation can still wrap at any character. */
.species-download { container: species-download / inline-size; }
@container species-download (width < 14em) {
  .cite-block { margin-inline: -12px; }
  .cite-row { padding-inline: 6px; }
  .cite-text { hyphens: auto; }
}
.cite-actions { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.cite-status { font-size: 0.82rem; }

/* ---------- P2 extras: defined terms, downloads and embeds, every second, key insights, squares ---------- */

/* Five tabs (Chart | Squares | Table | Sources | Download) fit a phone without scrolling the strip. */
@media (max-width: 420px) { .tabs { padding: 0 4px; } .tab { padding: 9px 7px; } }

/* Defined terms (common.js defineTerms): a dotted underline; the definition shows in the shared tooltip. */
button.dod {
  font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; display: inline; cursor: help;
  text-align: inherit; letter-spacing: inherit; line-height: inherit;
  /* A button is laid out as one box: no wider than its line, so a term's word wider than the line ("copepods" with
     very large text on a phone) breaks inside it (GBS-2). */
  max-width: 100%;
  text-decoration: underline dotted; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: var(--axis-ink);
}
button.dod:hover { text-decoration-color: var(--ink); }
/* A term with the punctuation beside it (common.js markTerms, button.dod-p): no line break between them (round 6,
   reader-8). The punctuation is inside the button, so the pair is one box: it moves to the next line whole wherever it
   fits on a line, as white-space: nowrap made it, and where it is wider than the whole line (very large text on a
   phone) it wraps inside like any text, the bracket or comma with the word beside it, never alone on a line and never
   past the line (GBS-2 and its review fix). Only the term is underlined, as before. */
button.dod.dod-p { text-decoration: none; }
button.dod-p > .dod-t {
  text-decoration: underline dotted; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: var(--axis-ink);
}
button.dod-p:hover > .dod-t { text-decoration-color: var(--ink); }
.dod-text { color: var(--ink-2); line-height: 1.45; }

/* Download tabs: image buttons, embed code */
.dl-head { font-size: 0.92rem; font-weight: 650; margin: 16px 0 4px; color: var(--ink); line-height: inherit; }
.img-dl { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 6px 0 4px; }
.img-btn { text-align: left; display: inline-block; max-width: 100%; line-height: 1.35; }
.img-btn strong { font-weight: 650; }
.img-desc { color: var(--ink-2); }
.img-btn[disabled] { opacity: 0.6; cursor: progress; }
.img-status { font-size: 0.82rem; }
.dl-view-row { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin: 4px 0 6px; }
.embed-block { margin: 2px 0 6px; max-width: 760px; }
.embed-block .chart-note { margin-top: 2px; }
textarea.embed-code {
  display: block; width: 100%; resize: vertical; font: 0.8rem/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--ink); background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 7px; padding: 8px 10px; margin: 0 0 8px;
}

/* Embeds (?embed, ?embed=<figure id>): no site header, footer, hero or section intros. */
.embed .site-header, .embed .site-footer, .embed .hero, .embed .section-head, .embed .skip-link { display: none !important; }
html.embed { scroll-padding-top: 0; } /* no header to clear (S16) */
.embed-hidden { display: none !important; }
.embed main { padding: 8px 0 0; }
.embed .section { padding: 8px 0 0; }
.embed .page-head { padding-top: 12px; }
.embed-one .figure { margin-bottom: 8px; }
.embed-credit { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter) 12px; font-size: 0.8rem; color: var(--muted); }

/* "Killed every second" strip (hero) */
.per-second { margin: 22px 0 4px; container-type: inline-size; }
.ps-title { font-family: var(--font-sans); font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 8px; }
.ps-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 760px) { .ps-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.ps-item { border-top: 2px solid var(--ink); padding: 8px 2px 0; min-width: 0; }
/* A number shrinks to fit its tile at large text sizes (two tiles a row: about 45cqi each; four: 22cqi), rather than
   break inside ("49,00 / 0"; reader-6); at normal sizes the cap is above the size set here. */
.ps-value { color: var(--ink); font-size: min(clamp(1.7rem, 4.6vw, 2.6rem), 11cqi); font-weight: 700; letter-spacing: -0.02em; line-height: 1.05; font-variant-numeric: tabular-nums; overflow-wrap: break-word; }
@media (min-width: 760px) { .ps-value { font-size: min(clamp(1.7rem, 4.6vw, 2.6rem), 5.4cqi); } }
.ps-label { color: var(--ink); font-size: 1rem; font-weight: 600; margin-top: 2px; overflow-wrap: anywhere; }
.ps-note { color: var(--muted); font-size: 0.8rem; line-height: 1.4; overflow-wrap: anywhere; }
/* With large text the tiles take fewer columns, so the label ("chickens") and the note's words ("crustaceans") fit
   their tile instead of running past it and the page's edge (+34px at 320px with 250% text, +71px with 300%;
   integration fix round 1, product-3): two a row where the strip is narrower than 22 of its ems (from about 209%
   text at 768px, 282% at 1024px), one where it is narrower than 10.5 (from about 172% text at 320px, 195% at 360px,
   213% at 390px; this comment had said 200% at 320px and 250% at 390px, integration review round 3, product-3). The
   switch comes a little before words would break: measured with the columns kept, "crustaceans" breaks inside in two
   columns once the strip is under about 10 of its ems (320px by 181% text, 360px by 212.5%, 390px by 250%) and
   "chickens" in four once it is under about 20 (768px by 250%). At the default text size the strip is wider than
   22em from 760px, where it has four, and between 10.5 and 22em below, where it has two, as before; a word still too
   long for its tile breaks inside it (overflow-wrap). */
@container (max-width: 22em) {
  .ps-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ps-value { font-size: min(clamp(1.7rem, 4.6vw, 2.6rem), 11cqi); }
}
@container (max-width: 10.5em) {
  .ps-grid { grid-template-columns: minmax(0, 1fr); }
  .ps-value { font-size: min(clamp(1.7rem, 4.6vw, 2.6rem), 22cqi); }
}
.ps-foot { font-size: 0.8rem; color: var(--muted); margin: 10px 0 0; }

/* Key insights: claims as tabs, then a text | chart panel (5 / 7 from 900px) */
.insights-section { padding-top: 20px; }
.insight-tabs { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
/* Two or four a row where each tab has room for its longest word, its number and padding (about 5.75rem and 40px); with
   very large text (1024px at 300%) four a row cut the titles off at each tab's edge and pushed the page past the
   screen, so the row keeps two, or one (GBS-2). At the default size every width is as before. */
@media (min-width: 600px) and (min-width: calc(11.5rem + 140px)) { .insight-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1000px) and (min-width: calc(23rem + 240px)) { .insight-tabs { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.insight-tabs .tab.insight-tab {
  display: flex; gap: 10px; align-items: flex-start; text-align: left; white-space: normal; margin: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px 11px;
  color: var(--ink-2); font-weight: 500; font-size: 0.92rem; line-height: 1.38; min-width: 0;
}
.insight-tabs .tab.insight-tab > span:last-child { min-width: 0; overflow-wrap: break-word; }
.insight-tabs .tab.insight-tab:hover { border-color: var(--ink-2); color: var(--ink); }
.insight-tabs .tab.insight-tab[aria-selected="true"] { border-color: var(--ink); color: var(--ink); font-weight: 500; box-shadow: inset 0 -3px 0 var(--ink); }
.insight-num {
  flex: none; width: 1.55em; height: 1.55em; border-radius: 50%; display: inline-grid; place-items: center; font-size: 0.78rem; font-weight: 650;
  border: 1px solid var(--border-strong); color: var(--ink-2); margin-top: 1px; font-variant-numeric: tabular-nums;
}
.insight-tab[aria-selected="true"] .insight-num { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.insight-panel {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px 32px; margin-top: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px;
}
@media (min-width: 900px) { .insight-panel { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); } }
@media (max-width: 600px) { .insight-panel { padding: 14px 12px; } }
.insight-panel:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.insight-text { min-width: 0; color: var(--ink-2); font-size: 0.95rem; }
.insight-text p { margin: 0 0 0.8em; }
/* One column as wide as the list's box, not as its longest word, and a word wider than the line breaks inside it: with
   300% text at 320px "Entrepreneurship's" made the column 339px in a 215px line, so Key insight 4's caveats ran up to
   125px past the screen's edge (and insight 3's "consumption:" 4px), at 250% text and at 390px too (GBS-2 review fix,
   as .callout.two-col ul). At the default size nothing changes. */
.insight-caveats { margin: 0 0 0.9em; padding-left: 1.15em; display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; font-size: 0.86rem; color: var(--muted); }
.insight-caveats > li { min-width: 0; overflow-wrap: break-word; }
.insight-links { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 0.88rem; margin: 0; }
.insight-asset { min-width: 0; }
.insight-fig { margin: 0; min-width: 0; }
.insight-cap { font-size: 0.82rem; color: var(--muted); margin: 0 0 8px; }
.insight-key { font-size: 0.8rem; color: var(--ink-2); margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.insight-key-item { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; }
.insight-key-item .swatch { flex-shrink: 0; }
.insight-key .bin-item { display: inline-flex; gap: 5px; align-items: center; white-space: nowrap; }
.insight-key .swatch.hatch { background: repeating-linear-gradient(-45deg, var(--map-hatch) 0 1px, var(--map-hatch-bg, transparent) 1px 4px); box-shadow: inset 0 0 0 1px var(--border-strong); }

/* Share bars (insight 1 and continents) */
.ins-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.ins-bars li { display: grid; grid-template-columns: minmax(7em, 13em) minmax(40px, 1fr) 3.4em; gap: 10px; align-items: center; font-size: 0.86rem; min-width: 0; }
.ins-bars .ib-name { color: var(--ink-2); min-width: 0; overflow-wrap: anywhere; line-height: 1.3; }
.ins-bars .ib-name a { color: inherit; }
.ins-bars li.hl .ib-name { color: var(--ink); font-weight: 600; }
.ins-bars .ib-track { height: 12px; position: relative; min-width: 0; }
.ins-bars .ib-bar { position: absolute; left: 0; top: 0; bottom: 0; background: var(--g-other); border-radius: 0 3px 3px 0; min-width: 2px; }
.ins-bars li.hl .ib-bar { background: var(--ink-2); }
.ins-bars .ib-val { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); white-space: nowrap; }
.ins-bars li.hl .ib-val { color: var(--ink); font-weight: 600; }
.insight-fig .ins-bars { margin-top: 12px; }
@media (max-width: 480px) { .ins-bars li { grid-template-columns: minmax(0, 1fr) 3.4em; } .ins-bars .ib-track { grid-column: 1 / -1; grid-row: 2; } }

/* Values on one logarithmic axis (insights 2 and 4) */
.log-rows { display: grid; gap: 2px; font-size: 0.84rem; }
.lr-row { display: grid; grid-template-columns: minmax(7em, 12em) minmax(60px, 1fr) 5.4em; gap: 10px; align-items: center; min-height: 24px; }
.lr-name { color: var(--ink-2); min-width: 0; overflow-wrap: anywhere; line-height: 1.25; }
.lr-name a { color: inherit; }
.lr-row.hl .lr-name { color: var(--ink); font-weight: 600; }
.lr-track { position: relative; height: 18px; min-width: 0; }
.lr-grid { position: absolute; top: -3px; bottom: -3px; width: 1px; background: var(--grid); }
.lr-band { position: absolute; top: 7px; height: 4px; border-radius: 2px; background: var(--axis-ink); opacity: 0.45; }
.lr-band.to-zero { border-radius: 0 2px 2px 0; }
.lr-band.to-zero::before { content: ""; position: absolute; left: -1px; top: -3px; border: 5px solid transparent; border-left: 0; border-right: 7px solid var(--axis-ink); }
.lr-dot { position: absolute; top: 4px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: var(--axis-ink); box-shadow: 0 0 0 2px var(--surface); }
.lr-row.hl .lr-band { background: var(--ink-2); opacity: 0.5; }
.lr-row.hl .lr-dot { background: var(--ink); }
.lr-val { text-align: right; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.lr-axis { min-height: 18px; }
.lr-axis .lr-name { font-size: 0.75rem; color: var(--axis-ink); }
.lr-tick { position: absolute; top: 0; transform: translateX(-50%); font-size: 0.72rem; color: var(--axis-ink); white-space: nowrap; font-variant-numeric: tabular-nums; }
.lr-tick.first { transform: none; }
.lr-tick.last { transform: translateX(-100%); }
.lr-key-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--ink); }
.lr-key-band { display: inline-block; width: 20px; height: 4px; border-radius: 2px; background: var(--ink-2); opacity: 0.5; margin-left: 6px; }
@media (max-width: 480px) {
  .lr-row { grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; }
  .lr-track { grid-column: 1 / -1; grid-row: 2; }
  .lr-axis .lr-name { display: none; }
  .lr-axis .lr-track { grid-row: 1; }
}
/* The same layout, the track under the name and value, wherever the chart is narrower than its three columns' least
   widths (7em, 60px and 5.4em with their gaps): Key insights 2 and 4 at 1024×768 with 300% text pushed the page 7px
   past the screen ("3.5T", "10¹⁸" cut off; GBS-2 review fix, found once every tab was measured). At the default size
   every wider screen keeps three columns. */
.log-rows { container: log-rows / inline-size; }
@container log-rows (width < calc(12.4em + 80px)) {
  .lr-row { grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; }
  .lr-track { grid-column: 1 / -1; grid-row: 2; }
  .lr-axis .lr-name { display: none; }
  .lr-axis .lr-track { grid-row: 1; }
}

/* Wild vs human-caused split (insight 4) */
.insight-split { display: flex; gap: 2px; height: 16px; border-radius: 3px; overflow: hidden; margin: 4px 0 0; }
.insight-split .is-wild { background: var(--g-wild); flex-basis: 0; }
.insight-split .is-human { background: var(--ink-2); flex-basis: 0; min-width: 3px; }
.insight-fig .log-rows { margin-top: 16px; }

/* Map thumbnail (insight 3) */
.insight-map { display: block; position: relative; border-radius: 6px; overflow: hidden; aspect-ratio: 960 / 470; background: var(--surface-2); }
.insight-map:hover { box-shadow: 0 0 0 1px var(--ink-2); }
.insight-map-svg { display: block; width: 100%; height: auto; }
.insight-map-msg { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 0.88rem; text-align: center; padding: 12px; }

/* Squares (waffle.js) */
.waffle { margin-top: 14px; }
.waffle svg { display: block; max-width: 100%; height: auto; overflow: visible; }
.waffle-group { cursor: pointer; outline: none; }
.waffle-group[role="img"] { cursor: default; }
.waffle-group:hover rect { filter: brightness(1.12); }
.waffle-group:focus-visible rect { stroke: var(--focus); stroke-width: 2px; }
.waffle-list .swatch { vertical-align: -1px; }
.waffle-list .btn-link { font-size: inherit; }
.waffle-item { white-space: normal; }
.waffle-note { color: var(--muted); }

@media (forced-colors: active) {
  /* Data marks keep their colours: forced colours would drop the backgrounds that draw them. */
  .ib-bar, .lr-band, .lr-dot, .lr-band.to-zero::before, .lr-key-dot, .lr-key-band, .insight-split span, .insight-map-svg, .waffle svg,
  .insight-key .swatch, .waffle-list .swatch, #share-legend-sq .swatch { forced-color-adjust: none; }
  /* The legends key the marks' colours, so their swatches keep them too (reader-15). */
  .legend-item .swatch, .legend-item > [aria-hidden="true"], .chip .swatch, .badge .swatch { forced-color-adjust: none; }
  .ib-track, .lr-row:not(.lr-axis) .lr-track { outline: 1px solid CanvasText; outline-offset: -1px; }
  button.dod, button.dod-p > .dod-t { text-decoration-color: CanvasText; }
  .keyfacts dt { font-weight: 650; }
  .insight-tabs .tab.insight-tab[aria-selected="true"] { outline: 2px solid CanvasText; }
}
@media print {
  .per-second, .insights-section { break-inside: avoid; }
}

/* ---------- Try your own numbers (Atlas, assets/js/yournumbers.js; docs/design.md "Sliders") ----------
   Each mark sits at calc(T/2 + (100% − T) × f), T the thumb's diameter and f the fraction along the track, so it lines
   up with the centre of a native range input's thumb. The marks are inputs, not amounts of suffering: "darker means
   more" does not apply to them. */
.yn { --yn-t: 24px; --yn-h: 40px; --yn-band-op: 0.65; border-top: 1px solid var(--border); padding: 14px 0 6px; margin-top: 8px; }
/* The band's opacity per theme: 0.65 makes it 3.2:1 against the light card (0.5 gave 2.4:1); in dark, 0.5 gives 3.4:1
   and keeps the light tick 4.5:1 against it. docs/design.md "Sliders" has the measured contrasts. */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .yn { --yn-band-op: 0.5; } }
:root[data-theme="dark"] .yn { --yn-band-op: 0.5; }
@media (pointer: coarse) { .yn { --yn-t: 28px; --yn-h: 44px; } }
.yn > h3 { margin: 0 0 4px; }
.yn-intro { max-width: 80ch; margin: 0 0 12px; }
.yn-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
@media (min-width: 761px) {
  .yn-grid { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); column-gap: 28px; row-gap: 14px; }
  .yn-right { padding-top: 22px; }
}
.yn-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.yn-col > * { margin: 0; }
.yn-pick { display: flex; flex-direction: column; gap: 4px; }
#yn-animal { width: 100%; height: 38px; }
@media (min-width: 761px) { #yn-animal { max-width: 22rem; } }
@media (pointer: coarse) { #yn-animal { height: 44px; font-size: 16px; } }
.yn-notice { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; font-size: 0.9rem; color: var(--ink-2); }
.yn-notice p { margin: 0 0 8px; }
.yn-btns { display: flex; flex-wrap: wrap; gap: 8px; }

/* One slider: label and value box on the first row, then the track, its scale and the caption. */
.yn-ctl { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; align-items: end; }
.yn-lab { grid-column: 1; grid-row: 1; min-width: 0; }
.yn-lab label { display: block; font-weight: 600; font-size: 0.95rem; color: var(--ink); line-height: 1.3; }
.yn-sub { display: block; font-size: 0.8rem; color: var(--muted); line-height: 1.35; }
.yn-boxw { grid-column: 2; grid-row: 1; display: inline-flex; align-items: center; gap: 4px; color: var(--ink-2); }
.yn-box {
  font: inherit; font-size: 0.95rem; height: 36px; padding: 4px 8px; text-align: right; font-variant-numeric: tabular-nums;
  color: var(--ink); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 7px;
}
.yn-box.is-own { font-weight: 650; border-color: var(--ink); }
.yn-box:disabled { opacity: 0.4; cursor: not-allowed; }
@media (pointer: coarse) { .yn-box { height: 40px; font-size: 16px; } }
.yn-boxnote { grid-column: 1 / -1; grid-row: 2; justify-self: end; font-size: 0.8rem; margin: 2px 0 0; }
.yn-track { grid-column: 1 / -1; grid-row: 3; position: relative; height: var(--yn-h); touch-action: pan-y; }
.yn-ctl.is-disabled .yn-track { opacity: 0.4; }
.yn-deco { position: absolute; inset: 0; pointer-events: none; }
.yn-deco > span { position: absolute; top: 50%; }
.yn-rail { left: calc(var(--yn-t) / 2); right: calc(var(--yn-t) / 2); height: 4px; margin-top: -2px; border-radius: 2px; background: var(--grid); }
/* Rethink Priorities' 5th–95th percentile range: the band of the Key insights' interval rows (.lr-band, .lr-key-band). */
.yn-band {
  height: 12px; margin-top: -6px; border-radius: 6px; background: var(--ink-2); opacity: var(--yn-band-op);
  left: calc(var(--yn-t) / 2 + (100% - var(--yn-t)) * var(--f0, 0));
  width: calc((100% - var(--yn-t)) * (var(--f1, 0) - var(--f0, 0)));
}
/* A 5th percentile of zero on a log track: the band runs to the left edge and ends in the site's "reaches zero" arrow. */
.yn-band.to-zero { left: 10px; width: calc(var(--yn-t) / 2 + (100% - var(--yn-t)) * var(--f1, 0) - 10px); border-radius: 0 6px 6px 0; }
.yn-band.to-zero::before {
  content: ""; position: absolute; left: -10px; top: -4px;
  border-style: solid; border-width: 10px 10px 10px 0; border-color: transparent var(--ink-2) transparent transparent;
}
/* The starting point. */
.yn-tick { width: 2px; height: 24px; margin: -12px 0 0 -1px; background: var(--ink); box-shadow: 0 0 0 1px var(--surface); left: calc(var(--yn-t) / 2 + (100% - var(--yn-t)) * var(--f, 0)); }
.yn-range {
  -webkit-appearance: none; appearance: none; position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0;
  background: transparent; cursor: pointer; touch-action: pan-y;
}
.yn-range:disabled { cursor: not-allowed; }
/* The ring stays inside the 40/44px track (offset −2px), clear of the scale labels under it. */
.yn-range:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.yn-range::-webkit-slider-runnable-track { height: 100%; background: transparent; border: 0; }
.yn-range::-moz-range-track { height: 100%; background: transparent; border: 0; }
/* The thumb: hollow at the starting point, filled with the reader's number, dashed when no weight is set. */
.yn-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; box-sizing: border-box; width: var(--yn-t); height: var(--yn-t);
  margin-top: calc((var(--yn-h) - var(--yn-t)) / 2); border-radius: 50%; background: var(--surface); border: 2px solid var(--ink);
}
.yn-range::-moz-range-thumb { box-sizing: border-box; width: var(--yn-t); height: var(--yn-t); border-radius: 50%; background: var(--surface); border: 2px solid var(--ink); }
.yn-range.is-own::-webkit-slider-thumb { background: var(--ink); border-color: var(--surface); box-shadow: 0 0 0 1px var(--ink); }
.yn-range.is-own::-moz-range-thumb { background: var(--ink); border-color: var(--surface); box-shadow: 0 0 0 1px var(--ink); }
.yn-range.is-unset::-webkit-slider-thumb { background: var(--surface); border: 2px dashed var(--ink-2); box-shadow: none; }
.yn-range.is-unset::-moz-range-thumb { background: var(--surface); border: 2px dashed var(--ink-2); box-shadow: none; }
.yn-range:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--focus); outline-offset: 2px; }
.yn-range:focus-visible::-moz-range-thumb { outline: 2px solid var(--focus); outline-offset: 2px; }
.yn-scale { grid-column: 1 / -1; grid-row: 4; position: relative; height: 1.3em; font-size: 0.75rem; color: var(--axis-ink); font-variant-numeric: tabular-nums; margin-top: 2px; }
.yn-scale > span { position: absolute; top: 0; white-space: nowrap; transform: translateX(-50%); left: calc(var(--yn-t) / 2 + (100% - var(--yn-t)) * var(--f, 0)); }
.yn-scale > span.first { left: 0; transform: none; }
.yn-scale > span.last { left: auto; right: 0; transform: none; }
.yn-cap { grid-column: 1 / -1; grid-row: 5; font-size: 0.82rem; color: var(--ink-2); margin: 4px 0 0; line-height: 1.45; }
/* Side by side, a slider's label needs room for its longest word ("experiences", about 4.2em) beside the value box (up
   to 6.2em) and the 12px gap. In a control narrower than that (large text on a phone: 320px from about 175% text, 390px
   from about 200%) the box goes on a line of its own under the label, narrowed to the control's width if it must be,
   so neither the label's words nor the box run past the screen's edge (GBS-2). At the default text size every phone
   keeps them side by side, as before. */
.yn-ctl { container: yn-ctl / inline-size; }
@container yn-ctl (width < calc(11em + 12px)) {
  .yn-lab { grid-column: 1 / -1; }
  .yn-boxw { grid-column: 1 / -1; grid-row: 2; justify-self: end; max-width: 100%; min-width: 0; }
  .yn-box { min-width: 0; }
  .yn-boxnote { grid-row: 3; }
  .yn-track { grid-row: 4; }
  .yn-scale { grid-row: 5; }
  .yn-cap { grid-row: 6; }
}
.yn-src > summary { cursor: pointer; color: var(--link); font-size: 0.88rem; width: max-content; max-width: 100%; }
.yn-src[open] > summary { margin-bottom: 8px; }
.yn-src .chart-note { margin-top: 8px; }

/* Readout: the starting point against the reader's numbers, in three columns. The numbers get their full width first and
   wrap between the figure and its word ("2.8 / trillion") only when there is no room; the name column keeps at least
   7em and wraps between words. In a panel narrower than 16rem (large text on a phone, where three columns cannot fit
   "480 quintillion") each row stacks: the name, then "Starting point" and "Yours" on lines of their own. The ARIA roles
   in the markup keep it a table for screen readers in either layout. */
#yn-readout { container: yn-readout / inline-size; }
.yn-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; font-variant-numeric: tabular-nums; }
.yn-table th, .yn-table td { padding: 5px 0 5px 8px; border-bottom: 1px solid var(--border); text-align: right; vertical-align: baseline; }
.yn-table th:first-child { text-align: left; padding-left: 0; font-weight: 400; color: var(--ink); min-width: 7em; overflow-wrap: break-word; }
.yn-table thead th { font-weight: 600; color: var(--ink-2); font-size: 0.8rem; }
.yn-table thead th:first-child { color: var(--ink-2); font-weight: 600; }
.yn-table td { color: var(--ink); }
.yn-table td.same { color: var(--muted); }
/* A grid of subgrid rows, so the number columns are sized before the name column (a table shares a squeeze among all
   its columns, which wrapped "2.8 trillion" while the names still had room). Without subgrid: the table above. */
@supports (grid-template-columns: subgrid) {
  .yn-table { display: grid; grid-template-columns: minmax(7em, 1fr) auto auto; }
  .yn-table thead, .yn-table tbody, .yn-table tr { display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; }
}
@container yn-readout (max-width: 15.99rem) {
  .yn-table, .yn-table thead, .yn-table tbody, .yn-table tr, .yn-table th { display: block; }
  .yn-table tr { border-bottom: 1px solid var(--border); padding: 5px 0; }
  .yn-table th, .yn-table td { border-bottom: 0; padding: 0; text-align: left; }
  .yn-table th:first-child { min-width: 0; }
  /* The column heads stay for screen readers; each number carries its column's name instead. */
  .yn-table thead th:not(:first-child) {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; margin: -1px;
  }
  .yn-table td { display: flex; flex-wrap: wrap; column-gap: 0.75em; padding-top: 2px; }
  /* The label is decoration (alt text ""): screen readers already hear the column head. */
  .yn-table td::before { content: attr(data-label); content: attr(data-label) / ""; color: var(--muted); }
  .yn-table td .yn-v { margin-left: auto; text-align: right; }
}
.yn-sum { font-size: 0.92rem; color: var(--ink); }
.yn-sum.chart-note { font-size: 0.85rem; color: var(--muted); }
.yn-links { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; }
.yn .btn-link, #own-numbers-note .btn-link { display: inline-block; min-height: 24px; line-height: 24px; text-align: left; }
.yn .chip { min-height: 28px; }
#yn-changes .chips { margin-top: 4px; }
#yn-changes .chip[aria-pressed="false"] { border-style: solid; color: var(--ink-2); }
#yn-changes .chip[aria-pressed="true"] { border-color: var(--ink); color: var(--ink); font-weight: 600; }
.yn-reset-all-row { margin: 8px 0 0; font-size: 0.85rem; }
#own-numbers-note { margin: 12px 0 0; max-width: 64ch; }
.yn > h4 { font-size: 1rem; font-weight: 650; margin: 0 0 4px; line-height: 1.3; }

/* ---------- Worldview questions (Atlas, assets/js/worldview.js; docs/design.md "Sliders") ----------
   One column at every width (a fieldset's legend cannot be a grid item), no auto-advance and no animation. The progress
   line and the "site’s default" tag are not amounts of suffering, so "darker means more" does not apply: tokens only
   (--grid, --ink-2, --border-strong, --surface, --surface-2), no new colour role. */
.wv { background: var(--surface-2); border-radius: 8px; padding: 14px; margin: 0 0 14px; }
/* The lede's "answer a few questions" lands just below the top edge, never a fraction of a pixel above it. */
#worldview { scroll-margin-top: 8px; }
/* 10px on a phone, so that question 1's answers fit the card (ux-4). */
@media (max-width: 600px) { .wv { padding: 10px; } }
.wv-card { max-width: 46rem; min-width: 0; }
.wv h4 { font-size: 1rem; font-weight: 650; line-height: 1.3; margin: 0 0 4px; color: var(--ink); }
.wv-card > p, .wv-form > p { margin: 0 0 8px; }
.wv-lead { font-size: 0.92rem; color: var(--ink-2); }
.wv-start { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 0.85rem; }
.wv-note { font-size: 0.82rem; color: var(--ink-2); line-height: 1.4; }
.wv-after { color: var(--muted); }
.wv-progress { height: 4px; border-radius: 2px; background: var(--grid); overflow: hidden; margin: 0 0 8px; }
.wv-progress > span { display: block; height: 100%; background: var(--ink-2); }
.wv fieldset { border: 0; margin: 0 0 8px; padding: 0; min-width: 0; }
.wv legend { font-size: 1.05rem; font-weight: 650; line-height: 1.3; color: var(--ink); padding: 0; margin: 0 0 4px; white-space: normal; max-width: 100%; }
.wv-help { font-size: 0.85rem; color: var(--ink-2); line-height: 1.3; margin: 0 0 8px; }
.wv-help2 { display: block; color: var(--muted); margin-top: 3px; }
.wv-opts { display: flex; flex-direction: column; gap: 4px; }
.wv-opt {
  display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 10px; align-items: start; min-height: 36px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 4px 10px; cursor: pointer;
}
@media (pointer: coarse) { .wv-opt { min-height: 44px; } }
.wv-opt input { grid-row: 1 / span 2; width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--ink); }
.wv-opt:has(:checked) { border: 2px solid var(--ink); padding: 3px 9px; }
@media (max-width: 600px) {
  .wv-opt { column-gap: 6px; padding-left: 6px; padding-right: 6px; }
  .wv-opt:has(:checked) { padding-left: 5px; padding-right: 5px; }
}
.wv-opt:has(:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.wv-main { font-size: 0.95rem; line-height: 1.3; color: var(--ink); overflow-wrap: break-word; }
/* The detail line, with the "site’s default" tag running on after it (it wraps as one piece). */
.wv-sub { grid-column: 2; display: block; min-width: 0; font-size: 0.85rem; line-height: 1.3; color: var(--ink-2); overflow-wrap: break-word; }
.wv-detail { margin-right: 2px; }
.wv-tag {
  display: inline-block; padding: 0 6px; border: 1px solid var(--border-strong); border-radius: 999px;
  font-size: 0.75rem; line-height: 1.35; color: var(--ink-2); white-space: nowrap; vertical-align: 1px;
}
.wv-divider { border-top: 1px dashed var(--border-strong); margin: 2px 0; }
/* Back on the left, Next on the right edge of the answers; on a phone, half the width each. At large text they wrap,
   one above the other. */
.wv-nav { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin: 10px 0 0; }
.wv-nav .btn { flex: 0 1 auto; min-width: min(100%, 10em); min-height: 40px; justify-content: center; text-align: center; }
.wv-nav.no-back { justify-content: flex-end; }
@media (max-width: 600px) {
  .wv-nav .btn { flex: 1 1 calc(50% - 5px); min-width: min(100%, 9em); }
  .wv-nav.no-back .btn { flex-grow: 0; }
}
.wv-form > .wv-cancel { margin: 2px 0 0; font-size: 0.9rem; }
.wv .btn-link { display: inline-block; min-height: 24px; line-height: 24px; text-align: left; }
.wv-src { margin-top: 4px; }
.wv-src > summary { cursor: pointer; color: var(--link); font-size: 0.88rem; width: max-content; max-width: 100%; }
.wv-src[open] > summary { margin-bottom: 8px; }
.wv-src-body p { font-size: 0.85rem; color: var(--ink-2); line-height: 1.45; margin: 0 0 8px; }
.wv-src-body .table-wrap { margin: 0 0 8px; }
.wv-table { font-size: 0.82rem; }
/* The chances table fits a 390px phone without scrolling sideways (F4): headers wrap, cells are a little tighter. */
.wv-table thead th, .wv-table thead th.num { white-space: normal; vertical-align: bottom; }
.wv-table tbody th { white-space: normal; }
/* A family's range ("1.6% to 7.9%") may wrap at its spaces, so the table fits a phone (F4, ux-8). */
table.data.wv-table td.num { white-space: normal; }
.wv-basis { display: block; font-weight: 400; color: var(--muted); }
/* table.data's own padding is more specific than .wv-table's: name both (ux-8). */
table.data.wv-table th, table.data.wv-table td { padding: 6px 7px; }
/* A 320px phone: smaller type and less padding, so the longest words ("crustaceans", "arthropods", "Central") fit
   without the table scrolling sideways (ux-8). */
@media (max-width: 360px) {
  table.data.wv-table th, table.data.wv-table td { padding: 6px 4px; font-size: 0.76rem; }
}
.wv-lines { margin: 0 0 8px; padding-left: 1.2em; font-size: 0.92rem; color: var(--ink); }
.wv-lines li { margin: 2px 0; }
/* A second reason for a total, behind "Another reason" (ux-2). */
.wv-why { margin: 2px 0 4px; }
.wv-why > summary { cursor: pointer; color: var(--link); font-size: 0.85rem; width: max-content; max-width: 100%; min-height: 24px; line-height: 24px; }
.wv-why > p { margin: 2px 0 0; font-size: 0.85rem; color: var(--ink-2); line-height: 1.45; }
.wv-cmp-lead { font-size: 0.92rem; font-weight: 600; color: var(--ink); }
.wv-flash { font-size: 0.92rem; color: var(--ink); font-weight: 600; }
.wv-closing { color: var(--muted); }
.wv-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 10px; font-size: 0.9rem; }
.wv-share-url { width: 100%; max-width: 46rem; font: inherit; font-size: 0.85rem; color: var(--ink); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 7px; padding: 6px 8px; }
@media (forced-colors: active) {
  .wv-progress { outline: 1px solid CanvasText; }
  .wv-progress > span { forced-color-adjust: none; background: CanvasText; }
  .wv-opt:has(:checked) { border-color: Highlight; }
}

@media (forced-colors: active) {
  .yn-deco, .yn-range { forced-color-adjust: none; }
  .yn-rail, .yn-tick { background: CanvasText; }
  .yn-tick { box-shadow: 0 0 0 1px Canvas; }
  .yn-band { background: Highlight; opacity: 1; }
  .yn-band.to-zero::before { border-right-color: Highlight; }
  .yn-range::-webkit-slider-thumb { background: Canvas; border-color: ButtonText; }
  .yn-range::-moz-range-thumb { background: Canvas; border-color: ButtonText; }
  .yn-range.is-own::-webkit-slider-thumb { background: Highlight; border-color: Canvas; box-shadow: 0 0 0 1px CanvasText; }
  .yn-range.is-own::-moz-range-thumb { background: Highlight; border-color: Canvas; box-shadow: 0 0 0 1px CanvasText; }
  .yn-range.is-unset::-webkit-slider-thumb { background: Canvas; border-color: ButtonText; }
  .yn-range.is-unset::-moz-range-thumb { background: Canvas; border-color: ButtonText; }
  .yn-range:focus-visible { outline-color: Highlight; }
}

/* Species pages' "Notes on each number": label and note side by side, stacked on a phone, never wider than the page
   (fix round 1 after the source checks, reader-7). */
.field-notes-dl { display: grid; grid-template-columns: minmax(0, max-content) minmax(0, 1fr); gap: 6px 14px; font-size: 0.9rem; }
.field-notes-dl dt, .field-notes-dl dd { min-width: 0; }
.field-notes-dl dd { margin: 0; overflow-wrap: break-word; }
@media (max-width: 480px) {
  .field-notes-dl { grid-template-columns: minmax(0, 1fr); row-gap: 2px; }
  .field-notes-dl dd { margin-bottom: 8px; }
}
