/* ==========================================================================
   Design Brain v2 — stylesheet
   A reference, not a magazine. Two families with two jobs, one accent, a
   five-step type scale, spacing on an 8px grid, and nothing that moves.
   Build-free: no preprocessor, no framework. Custom properties only.
   The decisions behind every value are in site/DECISIONS.md.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */

:root {
  /* Paper and ink. Light is the default; dark overrides below.
     Measured on the paper: ink-2 clears 7:1, ink-3 clears 4.5:1 and is the
     quietest colour any text is set in. ink-4 is for rules and icons only. */
  --paper:        #f4f3ef;
  --paper-raised: #fbfaf7;
  --paper-sunk:   #eae8e2;
  --ink:          #1b1a17;
  --ink-2:        rgba(27, 26, 23, 0.74);
  --ink-3:        rgba(27, 26, 23, 0.66);
  --ink-4:        rgba(27, 26, 23, 0.56);
  --rule:         rgba(27, 26, 23, 0.14);
  --rule-strong:  rgba(27, 26, 23, 0.28);

  /* One accent: the rust the verdict chips already used. Warm on a cool-
     neutral ground, so it advances (#311). 6.3:1 on the paper as text. */
  --accent:       #9b3a20;
  --accent-soft:  rgba(155, 58, 32, 0.10);
  --accent-line:  rgba(155, 58, 32, 0.40);

  /* Verdict and status signals. Never the only cue: always paired with a word. */
  --sig-core:     #2f6146;
  --sig-adjacent: #8a5a12;
  --sig-disputed: #9b3a20;
  --sig-cut:      #7a1f1f;
  --sig-bg:       rgba(27, 26, 23, 0.045);

  /* Two families, two jobs (#339). Newsreader carries everything that is read,
     and its optical-size axis gives the headings their own cut (#348). IBM Plex
     Sans carries the chrome: labels, numbers, controls. Plex Mono appears only
     inside the demos and on the keyboard hint. */
  --font-text: 'Newsreader', Georgia, 'Iowan Old Style', 'Times New Roman', serif;
  --font-ui:   'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  /* Type scale: base 18, ratio 1.25 (#345). 16 is the floor, used for chrome. */
  --t-xs:   1rem;        /* 16  labels, numbers, chrome, notes */
  --t-sm:   1rem;        /* 16  kept as an alias so older rules still resolve */
  --t-base: 1.125rem;    /* 18  reading text */
  --t-lg:   1.375rem;    /* 22  lead, one-line rule, list titles */
  --t-xl:   1.75rem;     /* 28  entry and group titles */
  --t-2xl:  2.1875rem;   /* 35  section titles, small screens */
  --t-3xl:  2.75rem;     /* 44  section titles, home title small */
  --t-4xl:  3.4375rem;   /* 55  home title */

  /* Spacing: 4, 8, 12, 16, 24, 32, 48, 64, 96, 128 (#413) */
  --s-1: 0.25rem;  --s-2: 0.5rem;  --s-3: 0.75rem;  --s-4: 1rem;
  --s-5: 1.5rem;   --s-6: 2rem;    --s-7: 3rem;     --s-8: 4rem;
  --s-9: 6rem;     --s-10: 8rem;

  /* Measure. Newsreader's 0 is wide, so 56ch lands a body line near 66
     characters, inside the 45 to 75 band (#372). Measured, not assumed. */
  --measure: 56ch;
  --measure-tight: 46ch;

  --rail: 272px;
  --gutter: 144px;      /* field-label gutter inside an entry */
  --radius: 3px;

  color-scheme: light;
}

:root[data-theme='dark'] {
  --paper:        #161614;
  --paper-raised: #1e1e1b;
  --paper-sunk:   #111110;
  --ink:          #ebe9e3;
  --ink-2:        rgba(235, 233, 227, 0.76);
  --ink-3:        rgba(235, 233, 227, 0.68);
  --ink-4:        rgba(235, 233, 227, 0.56);
  --rule:         rgba(235, 233, 227, 0.14);
  --rule-strong:  rgba(235, 233, 227, 0.28);
  --accent:       #e08a6c;
  --accent-soft:  rgba(224, 138, 108, 0.12);
  --accent-line:  rgba(224, 138, 108, 0.42);
  --sig-core:     #7fc0a0;
  --sig-adjacent: #d9a558;
  --sig-disputed: #e08a6c;
  --sig-cut:      #e07070;
  --sig-bg:       rgba(235, 233, 227, 0.05);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --paper:        #161614;
    --paper-raised: #1e1e1b;
    --paper-sunk:   #111110;
    --ink:          #ebe9e3;
    --ink-2:        rgba(235, 233, 227, 0.76);
    --ink-3:        rgba(235, 233, 227, 0.68);
    --ink-4:        rgba(235, 233, 227, 0.56);
    --rule:         rgba(235, 233, 227, 0.14);
    --rule-strong:  rgba(235, 233, 227, 0.28);
    --accent:       #e08a6c;
    --accent-soft:  rgba(224, 138, 108, 0.12);
    --accent-line:  rgba(224, 138, 108, 0.42);
    --sig-core:     #7fc0a0;
    --sig-adjacent: #d9a558;
    --sig-disputed: #e08a6c;
    --sig-cut:      #e07070;
    --sig-bg:       rgba(235, 233, 227, 0.05);
    color-scheme: dark;
  }
}

/* --------------------------------------------------------------------------
   2. Reset and base
   -------------------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 96px;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: var(--t-base);
  line-height: 1.6;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0; font-weight: 500; line-height: 1.15; }
p { margin: 0 0 var(--s-4); }
p:last-child { margin-bottom: 0; }
ul, ol { margin: 0; padding: 0; }
li { list-style: none; }

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

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

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

button, input { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }
code { font-family: var(--font-mono); font-size: var(--t-xs); }

hr { height: 1px; border: 0; background: var(--rule); margin: var(--s-7) 0; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--rule-strong); border-radius: 6px; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: var(--s-2);
  z-index: 200;
  background: var(--ink);
  color: var(--paper);
  padding: var(--s-2) var(--s-4);
  font-family: var(--font-ui);
  font-size: var(--t-xs);
}
.skip-link:focus { left: var(--s-4); }

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

/* --------------------------------------------------------------------------
   3. Shared primitives
   -------------------------------------------------------------------------- */

/* A label: sentence case, the UI face, semibold. The old site set these in
   tracked mono capitals on every screen, which spent the only emphasis
   device on furniture (#397). */
.mono-label {
  font-family: var(--font-ui);
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--ink-3);
  line-height: 1.5;
}

.rule-label {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  margin-bottom: var(--s-5);
}
.rule-label::after { content: ''; flex: 1; height: 1px; background: var(--rule); }

.lead {
  font-size: var(--t-lg);
  line-height: 1.5;
  color: var(--ink-2);
  max-width: var(--measure);
}

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

.num {
  font-family: var(--font-ui);
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   4. Shell: top bar, rail, main
   -------------------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: var(--s-5);
  height: 64px;
  padding: 0 var(--s-5);
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: var(--s-3);
  text-decoration: none;
  flex: 0 0 auto;
  min-height: 44px;
}
.brand__mark {
  font-family: var(--font-text);
  font-size: var(--t-lg);
  font-variation-settings: 'opsz' 24;
  font-weight: 500;
  white-space: nowrap;
  line-height: 44px;
}
/* The owner's name is chrome, not wayfinding: it goes first on a narrow
   screen so the search field keeps a usable width. */
@media (max-width: 560px) { .brand__owner { display: none; } }
.brand__v {
  font-family: var(--font-ui);
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--accent);
  margin-left: 0.2em;
}
.brand__meta {
  font-family: var(--font-ui);
  font-size: var(--t-xs);
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
@media (max-width: 700px) { .brand__meta { display: none; } }

.topbar__search { flex: 1 1 auto; max-width: 520px; position: relative; }

.search-input {
  width: 100%;
  height: 44px;
  padding: 0 var(--s-8) 0 40px;
  font-family: var(--font-ui);
  font-size: var(--t-xs);
  color: var(--ink);
  background: var(--paper-raised);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
}
.search-input::placeholder { color: var(--ink-3); }
.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search-icon {
  position: absolute;
  left: 13px; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--ink-3);
  pointer-events: none;
}
.search-kbd {
  position: absolute;
  right: 10px; top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-ui);
  font-size: var(--t-xs);
  line-height: 1;
  color: var(--ink-3);
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
  padding: 4px 8px;
  pointer-events: none;
}
.search-input:focus + .search-icon + .search-kbd,
.search-input:not(:placeholder-shown) + .search-icon + .search-kbd { opacity: 0; }

.topbar__actions { display: flex; align-items: center; gap: var(--s-2); flex: 0 0 auto; }

/* The way in for anyone who wants the skill: labelled, not an icon to decode (#493). */
.gh-link {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 44px;
  padding: 0 var(--s-3);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.gh-link:hover { border-color: var(--accent); color: var(--accent); }
.gh-link svg { width: 20px; height: 20px; flex: none; }
@media (max-width: 700px) {
  .topbar { gap: var(--s-3); }
  .gh-link { padding: 0; width: 44px; justify-content: center; border: 0; }
  .gh-link span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .icon-btn--audit { display: none; } /* still one tap away in the rail */
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  border-radius: var(--radius);
  color: var(--ink-2);
}
.icon-btn:hover { color: var(--ink); background: var(--sig-bg); }
.icon-btn svg { width: 18px; height: 18px; }

.nav-toggle { display: none; }
@media (max-width: 1080px) { .nav-toggle { display: grid; } }

.layout {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  align-items: start;
}
@media (max-width: 1080px) { .layout { grid-template-columns: minmax(0, 1fr); } }

/* Rail --------------------------------------------------------------------- */

.rail {
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  overflow-y: auto;
  overscroll-behavior: contain;
  border-right: 1px solid var(--rule);
  padding: var(--s-5) 0 var(--s-8);
  font-family: var(--font-ui);
}
@media (max-width: 1080px) {
  .rail {
    position: fixed;
    top: 64px; left: 0;
    width: min(320px, 86vw);
    background: var(--paper);
    border-right: 1px solid var(--rule-strong);
    transform: translateX(-102%);
    z-index: 55;
  }
  body.nav-open .rail { transform: translateX(0); }
  .rail__link { min-height: 44px; padding-top: 8px; padding-bottom: 8px; }
}

.rail__group { margin-bottom: var(--s-5); }
.rail__heading {
  padding: 0 var(--s-5) var(--s-2);
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--ink);
}

.rail__link {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: var(--s-2);
  align-items: baseline;
  min-height: 32px;
  padding: 4px var(--s-5);
  font-size: var(--t-xs);
  line-height: 1.5;
  color: var(--ink-2);
  text-decoration: none;
  border-left: 3px solid transparent;
}
.rail__link:hover { color: var(--ink); background: var(--sig-bg); }
.rail__link[aria-current='page'] {
  color: var(--ink);
  border-left-color: var(--accent);
  background: var(--accent-soft);
}
.rail__num {
  font-size: var(--t-xs);
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.rail__link[aria-current='page'] .rail__num { color: var(--accent); }
.rail__count { font-size: var(--t-xs); color: var(--ink-3); font-variant-numeric: tabular-nums; margin-left: var(--s-1); }

.scrim {
  position: fixed;
  inset: 64px 0 0;
  background: rgba(0, 0, 0, 0.32);
  opacity: 0;
  pointer-events: none;
  z-index: 54;
}
body.nav-open .scrim { opacity: 1; pointer-events: auto; }
@media (min-width: 1081px) { .scrim { display: none; } }

/* Main --------------------------------------------------------------------- */

.main { min-width: 0; padding: var(--s-7) var(--s-6) var(--s-10); }
@media (max-width: 700px) { .main { padding: var(--s-6) var(--s-5) var(--s-9); } }

.wrap { max-width: 980px; margin: 0 auto; }

/* --------------------------------------------------------------------------
   5. Home
   -------------------------------------------------------------------------- */

.hero { padding: var(--s-4) 0 var(--s-7); border-bottom: 1px solid var(--rule); margin-bottom: var(--s-7); }

.hero__title {
  font-family: var(--font-text);
  font-weight: 500;
  font-size: clamp(var(--t-2xl), 6.5vw, var(--t-4xl));
  line-height: 1.05;
  letter-spacing: -0.012em;
  font-variation-settings: 'opsz' 72;
  max-width: 24ch;
  margin-bottom: var(--s-4);
}
.hero__v {
  font-family: var(--font-ui);
  font-size: var(--t-lg);
  font-weight: 600;
  color: var(--accent);
  vertical-align: 0.5em;
  margin-left: 0.1em;
}
.hero__lead {
  font-size: var(--t-lg);
  line-height: 1.5;
  color: var(--ink-2);
  max-width: var(--measure);
  margin-bottom: var(--s-6);
}

/* The search is the focal point (#94): the biggest control on the page,
   and the one thing a stranger can do without reading anything. */
.hero__search {
  display: flex;
  gap: var(--s-2);
  max-width: 640px;
  margin-bottom: var(--s-6);
}
.hero__input {
  flex: 1 1 auto;
  min-width: 0;
  height: 56px;
  padding: 0 var(--s-4);
  font-family: var(--font-ui);
  font-size: var(--t-base);
  background: var(--paper-raised);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
}
.hero__input::placeholder { color: var(--ink-3); }
.hero__input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.hero__btn {
  flex: 0 0 auto;
  height: 56px;
  padding: 0 var(--s-5);
  font-family: var(--font-ui);
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--paper);
  background: var(--ink);
  border-radius: var(--radius);
}
.hero__btn:hover { background: var(--accent); }

/* Three ways in: a list, not cards. The titles carry the ranking (#96). */
.ways { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-5); max-width: 860px; }
@media (max-width: 760px) { .ways { grid-template-columns: minmax(0, 1fr); gap: var(--s-2); } }
.ways a {
  display: block;
  padding: var(--s-3) 0;
  border-top: 1px solid var(--rule-strong);
  text-decoration: none;
  min-height: 44px;
}
.ways strong { display: block; font-family: var(--font-text); font-weight: 500; font-size: var(--t-lg); line-height: 1.3; margin-bottom: var(--s-1); }
.ways span { display: block; color: var(--ink-2); font-size: var(--t-xs); font-family: var(--font-ui); line-height: 1.45; }
.ways a:hover strong { color: var(--accent); }

.hero__note { margin-top: var(--s-6); max-width: var(--measure); color: var(--ink-2); font-size: var(--t-base); }
.hero__note a { color: var(--accent); font-weight: 500; }

/* Install block: the two commands, and where to read more. */
.install { padding-top: var(--s-5); border-top: 1px solid var(--rule); margin-bottom: var(--s-7); }
.install p { max-width: var(--measure); color: var(--ink-2); }
.install pre {
  margin: var(--s-4) 0;
  padding: var(--s-4);
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  line-height: 1.6;
  overflow-x: auto;
  max-width: var(--measure);
}

/* The sections, in seven named groups. A directory, not a grid of equals. */
.groups { columns: 2; column-gap: var(--s-8); }
@media (max-width: 860px) { .groups { columns: 1; } }
.group { margin-bottom: var(--s-7); min-width: 0; break-inside: avoid; }
.group__title {
  font-family: var(--font-text);
  font-weight: 500;
  font-size: var(--t-xl);
  font-variation-settings: 'opsz' 32;
  letter-spacing: -0.006em;
  line-height: 1.2;
  padding-bottom: var(--s-3);
  border-bottom: 1px solid var(--rule-strong);
  margin-bottom: var(--s-2);
}
.group__list li { border-bottom: 1px solid var(--rule); }
.group__list li:last-child { border-bottom: 0; }

.sec-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: var(--s-3);
  padding: var(--s-3) 0;
  text-decoration: none;
  min-height: 44px;
}
.sec-row:hover .sec-row__title { color: var(--accent); }
.sec-row__num {
  font-family: var(--font-ui);
  font-size: var(--t-xs);
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  padding-top: 4px;
}
.sec-row__body { min-width: 0; }
.sec-row__title { display: block; font-size: var(--t-lg); line-height: 1.3; font-variation-settings: 'opsz' 24; }
.sec-row__count { font-family: var(--font-ui); font-size: var(--t-xs); color: var(--ink-3); font-variant-numeric: tabular-nums; margin-left: var(--s-1); }
.sec-row__blurb { display: block; font-size: var(--t-base); line-height: 1.5; color: var(--ink-2); max-width: var(--measure); }

.anatomy { padding-top: var(--s-5); border-top: 1px solid var(--rule); }
.anatomy p { max-width: var(--measure); color: var(--ink-2); }

/* --------------------------------------------------------------------------
   6. Section page
   -------------------------------------------------------------------------- */

.page-head { padding-bottom: var(--s-5); border-bottom: 1px solid var(--rule-strong); margin-bottom: var(--s-5); }
.page-head__eyebrow { margin-bottom: var(--s-3); }
.page-head__title {
  font-family: var(--font-text);
  font-weight: 500;
  font-size: clamp(var(--t-2xl), 4.4vw, var(--t-3xl));
  letter-spacing: -0.01em;
  line-height: 1.1;
  font-variation-settings: 'opsz' 60;
  max-width: 22ch;
}
.page-head__intro { font-size: var(--t-lg); line-height: 1.5; color: var(--ink-2); max-width: var(--measure); margin-top: var(--s-4); }

/* The table of contents comes before the introduction: a reader arrives with
   a question, not a wish to be introduced (#528, #683). */
.toc {
  border-bottom: 1px solid var(--rule);
  padding-bottom: var(--s-5);
  margin-bottom: var(--s-6);
  columns: 2;
  column-gap: var(--s-7);
  font-family: var(--font-text);
}
@media (max-width: 700px) { .toc { columns: 1; } .toc a { min-height: 44px; padding: 8px 0; } }
.toc a {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: var(--s-2);
  align-items: baseline;
  font-size: var(--t-base);
  line-height: 1.4;
  min-height: 32px;
  padding: 4px 0;
  color: var(--ink);
  text-decoration: none;
  break-inside: avoid;
}
.toc a:hover { color: var(--accent); }
.toc .n {
  font-family: var(--font-ui);
  font-size: var(--t-xs);
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.section-intro { margin-bottom: var(--s-6); }
.section-intro h2 { font-size: var(--t-xl); font-variation-settings: 'opsz' 32; margin-bottom: var(--s-3); }
.section-intro p { max-width: var(--measure); color: var(--ink-2); }

/* --------------------------------------------------------------------------
   7. Entry
   -------------------------------------------------------------------------- */

.entry {
  padding: var(--s-7) 0;
  border-top: 1px solid var(--rule-strong);
  scroll-margin-top: 88px;
}

.entry__head { margin-bottom: var(--s-5); }

.entry__num {
  font-family: var(--font-ui);
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  display: block;
  margin-bottom: var(--s-2);
}

.entry__title {
  font-family: var(--font-text);
  font-weight: 500;
  font-size: var(--t-xl);
  letter-spacing: -0.006em;
  font-variation-settings: 'opsz' 32;
  line-height: 1.2;
  margin-bottom: var(--s-3);
  display: flex;
  align-items: baseline;
  gap: var(--s-3);
  flex-wrap: wrap;
}
.entry__anchor {
  font-family: var(--font-ui);
  font-size: var(--t-xs);
  color: var(--ink-3);
  opacity: 0;
  text-decoration: none;
  min-width: 24px;
  display: inline-block;
  text-align: center;
}
.entry:hover .entry__anchor, .entry__anchor:focus { opacity: 1; }

.entry__aka {
  font-family: var(--font-ui);
  font-size: var(--t-xs);
  color: var(--ink-3);
  margin-bottom: var(--s-3);
}

.entry__oneline {
  font-size: var(--t-lg);
  line-height: 1.45;
  color: var(--ink);
  max-width: var(--measure);
  margin-bottom: var(--s-5);
}

/* Field rows: a label in the left gutter, content in the measure column. */
.field {
  display: grid;
  grid-template-columns: var(--gutter) minmax(0, 1fr);
  gap: var(--s-5);
  padding: var(--s-4) 0;
  border-top: 1px solid var(--rule);
  align-items: start;
}
@media (max-width: 760px) {
  .field { grid-template-columns: minmax(0, 1fr); gap: var(--s-2); }
}
.field__label { padding-top: 0; }
.field__body { max-width: var(--measure); min-width: 0; }
.field__body > p { margin-bottom: var(--s-3); }
.no-visual { color: var(--ink-2); }
.note { font-size: var(--t-xs); font-family: var(--font-ui); color: var(--ink-2); line-height: 1.5; }

.how-list { display: flex; flex-direction: column; gap: var(--s-3); counter-reset: how-counter; }
.how-list li {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: var(--s-2);
  align-items: baseline;
}
.how-list li::before {
  content: counter(how-counter);
  counter-increment: how-counter;
  font-family: var(--font-ui);
  font-size: var(--t-xs);
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

/* Pitfalls and numbers used to sit in tinted boxes with a coloured left rule.
   The field label already says what they are; the box was decoration. */
.callout { line-height: 1.55; }
.callout--numbers {
  font-family: var(--font-ui);
  font-size: var(--t-xs);
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
}

.source-line { color: var(--ink-2); }

/* Chips --------------------------------------------------------------------- */

.chips { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-family: var(--font-ui);
  font-size: var(--t-xs);
  font-weight: 600;
  padding: 4px 8px;
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
  color: var(--ink-2);
  white-space: nowrap;
  min-height: 28px;
}
.chip::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
}
.chip--core     { color: var(--sig-core);     border-color: color-mix(in srgb, var(--sig-core) 45%, transparent); }
.chip--adjacent { color: var(--sig-adjacent); border-color: color-mix(in srgb, var(--sig-adjacent) 45%, transparent); }
.chip--cut      { color: var(--sig-cut);      border-color: color-mix(in srgb, var(--sig-cut) 50%, transparent); }
.chip--verified { color: var(--sig-core);     border-color: color-mix(in srgb, var(--sig-core) 45%, transparent); }
.chip--adjusted { color: var(--sig-adjacent); border-color: color-mix(in srgb, var(--sig-adjacent) 45%, transparent); }
.chip--disputed { color: var(--sig-disputed); border-color: color-mix(in srgb, var(--sig-disputed) 50%, transparent); }
.chip--unverified { color: var(--ink-2); border-style: dashed; }

.entry--cut .entry__title { text-decoration: line-through; text-decoration-color: var(--sig-cut); text-decoration-thickness: 1px; }

.related { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.related a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  font-family: var(--font-ui);
  font-size: var(--t-xs);
  padding: 4px 8px;
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
  text-decoration: none;
  color: var(--ink-2);
}
.related a:hover { border-color: var(--accent); color: var(--accent); }

/* --------------------------------------------------------------------------
   8. Search
   -------------------------------------------------------------------------- */

.results { border-top: 1px solid var(--rule); }

.result {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: var(--s-4);
  align-items: baseline;
  padding: var(--s-4) var(--s-3) var(--s-4) 0;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
  min-height: 44px;
}
.result:hover, .result.is-active { background: var(--sig-bg); }
.result__n {
  font-family: var(--font-ui);
  font-size: var(--t-xs);
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.result__t { font-family: var(--font-text); font-weight: 500; font-size: var(--t-lg); line-height: 1.3; }
.result__o { display: block; font-size: var(--t-base); color: var(--ink-2); line-height: 1.45; margin-top: 4px; }
.result__s { font-family: var(--font-ui); font-size: var(--t-xs); color: var(--ink-3); text-align: right; white-space: nowrap; }
@media (max-width: 600px) { .result { grid-template-columns: 40px minmax(0, 1fr); } .result__s { display: none; } }
mark { background: var(--accent-soft); color: inherit; padding: 0 1px; border-radius: 2px; }

/* --------------------------------------------------------------------------
   9. Audit
   -------------------------------------------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--s-4) var(--s-5);
  margin: var(--s-5) 0 0;
  padding-top: var(--s-4);
  border-top: 1px solid var(--rule);
  font-family: var(--font-ui);
}
.stats div { display: flex; flex-direction: column; gap: 4px; }
.stats dt { order: 2; font-size: var(--t-xs); color: var(--ink-2); }
.stats dd { order: 1; margin: 0; font-family: var(--font-text); font-size: var(--t-xl); font-variation-settings: 'opsz' 32; line-height: 1.1; font-variant-numeric: tabular-nums; }

.filters { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-bottom: var(--s-6); }
.filter-btn {
  font-family: var(--font-ui);
  font-size: var(--t-xs);
  font-weight: 600;
  min-height: 40px;
  padding: 0 var(--s-4);
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
  color: var(--ink-2);
}
.filter-btn:hover { border-color: var(--accent); color: var(--accent); }
.filter-btn[aria-pressed='true'] { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.audit-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1.1fr) auto minmax(0, 1.9fr);
  gap: var(--s-4);
  padding: var(--s-4) 0;
  border-bottom: 1px solid var(--rule);
  align-items: start;
}
@media (max-width: 860px) {
  .audit-row { grid-template-columns: 40px minmax(0, 1fr); }
  .audit-row .audit-verdict { grid-column: 2; }
  .audit-row .audit-why { grid-column: 2; }
}
.audit-num {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  font-family: var(--font-ui);
  font-size: var(--t-xs);
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  text-decoration: none;
  justify-content: flex-end;
  width: 100%;
}
.audit-title { text-decoration: none; display: block; min-height: 24px; }
.audit-title strong { font-family: var(--font-text); font-weight: 500; font-size: var(--t-lg); line-height: 1.3; display: block; }
.audit-title span { font-family: var(--font-ui); font-size: var(--t-xs); color: var(--ink-3); }
.audit-why { color: var(--ink-2); line-height: 1.5; }
.audit-why em { color: var(--ink-2); }

/* --------------------------------------------------------------------------
   10. Footer, empty states, pagination, loading, print
   -------------------------------------------------------------------------- */

.colophon {
  margin-top: var(--s-9);
  padding-top: var(--s-5);
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-4) var(--s-6);
  justify-content: space-between;
  font-family: var(--font-ui);
  font-size: var(--t-xs);
  color: var(--ink-2);
  line-height: 1.6;
}

.empty { padding: var(--s-7) 0; max-width: var(--measure-tight); }
.empty__title { font-family: var(--font-text); font-size: var(--t-xl); font-variation-settings: 'opsz' 32; margin-bottom: var(--s-4); }
.empty p { color: var(--ink-2); }

.pagination {
  display: flex;
  justify-content: space-between;
  gap: var(--s-5);
  margin-top: var(--s-7);
  padding-top: var(--s-5);
  border-top: 1px solid var(--rule-strong);
}
.pagination a { text-decoration: none; max-width: 46%; display: block; min-height: 44px; }
.pagination .mono-label { margin-bottom: var(--s-1); }
.pagination__t { font-family: var(--font-text); font-weight: 500; font-size: var(--t-lg); line-height: 1.3; }
.pagination__next { text-align: right; margin-left: auto; }

.loading {
  padding: var(--s-7) 0;
  font-family: var(--font-ui);
  font-size: var(--t-xs);
  color: var(--ink-2);
}

@media print {
  .topbar, .rail, .scrim, .pagination, .hero__search { display: none !important; }
  .layout { grid-template-columns: 1fr; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .entry { break-inside: avoid; border-bottom: 1px solid #ccc; }
  a { text-decoration: none; color: #000; }
}
