/* /styles/tokens.css */
/* Design tokens — Porchlamp v2 UI.
 *
 * Source of truth: docs/UI_UX_SPECIFICATION.md §3 (color, type, spacing,
 * radius, elevation, motion), overridden by docs/v2/06-UX-DESIGN.md where
 * the two disagree (06 wins on interaction semantics; it does not restate
 * these token values, so the spec's numbers stand).
 *
 * One deliberate deviation from the spec, required by this packet's rules
 * (no external resources, fonts included): the spec's "Inter" / "JetBrains
 * Mono" font stacks are replaced by system font stacks. Every fallback
 * already listed in the spec's own stack is kept; only the two named
 * webfonts are dropped.
 *
 * Dark is the product's default aesthetic (spec §3: "Dark-Mode First
 * Engineering Aesthetic"). Each themed token is written once, with both
 * values: `var(--on-light, <light>) var(--on-dark, <dark>)`. Of the two
 * switches, the theme in force has `initial`, so its var() takes the
 * value, and the other is empty, so its var() adds nothing. Bare :root sets
 * dark; the light rules below set light under prefers-color-scheme for
 * users who have not chosen explicitly, and under [data-theme] so the
 * in-app toggle (T) wins in both directions. (CSS light-dark() would read
 * the same, but it leaves every themed colour unset in browsers before
 * 2024, and the matrix canvas reads the quadrant tokens as plain colours
 * through getComputedStyle.) --text-muted in both themes is tuned to
 * clear WCAG AA 4.5:1 against every surface token, including the lightest
 * (elevated) one — the spec's own muted value fails that on measurement,
 * see tests/test_ui_contrast.py.
 */

:root {
  /* The theme switches (see above): dark here, light in the two rules below. */
  --on-light: ;
  --on-dark: initial;
  --lamp-glow: var(--on-light, #f59e0b) var(--on-dark, #fbbf24);
  color-scheme: dark;

  /* Canvas & surfaces */
  --bg-base: var(--on-light, #f8fafc) var(--on-dark, #090d16);
  --bg-surface: var(--on-light, #ffffff) var(--on-dark, #0f172a);
  --bg-surface-elevated: var(--on-light, #f1f5f9) var(--on-dark, #1e293b);
  --bg-surface-hover: var(--on-light, #e2e8f0) var(--on-dark, #334155);
  --border-subtle: var(--on-light, #e2e8f0) var(--on-dark, #1e293b);
  --border-strong: var(--on-light, #cbd5e1) var(--on-dark, #334155);
  --border-focus: var(--on-light, #0284c7) var(--on-dark, #38bdf8);

  /* Text */
  --text-primary: var(--on-light, #0f172a) var(--on-dark, #f8fafc);
  --text-secondary: var(--on-light, #475569) var(--on-dark, #94a3b8);
  --text-muted: var(--on-light, #5b6472) var(--on-dark, #8896aa);
  --text-success: var(--on-light, #15803d) var(--on-dark, #22c55e);  /* a gain in text (a rank moved up): AA on the dark surfaces, and on the light ones, where the accent green is not */
  --text-warning: var(--on-light, #dc2626) var(--on-dark, #f87171);  /* a flag or a loss in text: AA on the dark surfaces */
  --text-on-accent: var(--on-light, #f8fafc) var(--on-dark, #0b1220);

  /* Quadrants (dual-encoded with glyphs in copy.js; never color-only) */
  --quad-sweet-spot: var(--on-light, #065f46) var(--on-dark, #10b981);
  --quad-crucible: var(--on-light, #4f46e5) var(--on-dark, #6366f1);
  --quad-nursery: var(--on-light, #92400e) var(--on-dark, #f59e0b);
  --quad-graveyard: var(--on-light, #b91c1c) var(--on-dark, #ef4444);
  --quad-sweet-spot-wash: var(--on-light, rgba(6, 95, 70, 0.08)) var(--on-dark, rgba(16, 185, 129, 0.1));
  --quad-crucible-wash: var(--on-light, rgba(79, 70, 229, 0.08)) var(--on-dark, rgba(99, 102, 241, 0.1));
  --quad-nursery-wash: var(--on-light, rgba(146, 64, 14, 0.08)) var(--on-dark, rgba(245, 158, 11, 0.1));
  --quad-graveyard-wash: var(--on-light, rgba(185, 28, 28, 0.08)) var(--on-dark, rgba(239, 68, 68, 0.1));

  /* Coverage bands */
  --coverage-full: var(--on-light, #16a34a) var(--on-dark, #22c55e);
  --coverage-a: var(--on-light, #0891b2) var(--on-dark, #06b6d4);
  --coverage-b: var(--on-light, #b45309) var(--on-dark, #f59e0b);
  --coverage-below: var(--on-light, #dc2626) var(--on-dark, #ef4444);

  /* Functional accents */
  --accent-cyan: var(--on-light, #155e75) var(--on-dark, #06b6d4);  /* link and label text: 4.5:1 or better on every light surface, the hovered row's included */
  --accent-violet: #8b5cf6;
  --accent-warning: #dc2626;
  --accent-success: #22c55e;

  /* Corpus meter (rated / gated / unrated share of a snapshot).
   * VALIDATED 2026-09-21 with the dataviz six-checks validator against
   * --bg-surface. One accent plus two lightness-separated NEUTRALS, not
   * three status hues: an amber/green adjacent pair measured only
   * dE 5.7 for protanopia (below even the 6-8 floor band), while this
   * trio measures dE 12.3 (deutan) / 20.6 (normal vision) in dark and
   * 14.2 / 20.0 in light -- both PASS. The neutrals read as neutral ON
   * PURPOSE ("gated" is excluded-by-design, not an error, and must not
   * borrow the red of a failure), so the validator's chroma-floor and
   * lightness-band checks -- which it scopes to CATEGORICAL palettes --
   * do not apply -- every OTHER check passes, contrast included.
   *
   * MEASURED against the real ground (--bg-base), not guessed: the first
   * attempt put `gated` at #475569, which came out at 2.56:1 while the
   * other two measured 8.5 and 7.6 -- so the 60.8% MAJORITY segment was
   * the one share nobody could see, reading as empty space. Lightness now
   * carries the ordering (rated accent > unrated light > gated mid) and
   * all three clear 3:1 in both themes. Every segment also carries a
   * visible label and count, so colour never carries identity alone.
   * Re-run the validator before changing any of the six values. */
  --corpus-rated: var(--on-light, #16a34a) var(--on-dark, #22c55e);
  --corpus-unrated: var(--on-light, #475569) var(--on-dark, #cbd5e1);
  --corpus-gated: var(--on-light, #7a889f) var(--on-dark, #64748b);

  /* Screen F pillar-weight bars: one hue (magnitude, single series).
   * Graphic contrast vs --bg-surface, the card they render on (WCAG 1.4.11
   * needs 3:1): MEASURED 8.33:1 dark, 4.10:1 light. Pinned in
   * tests/test_ui_contrast.py. */
  --spec-bar: var(--on-light, #0284c7) var(--on-dark, #38bdf8);

  /* Tie-row band */
  --tie-row-band: var(--on-light, rgba(2, 132, 199, 0.08)) var(--on-dark, rgba(56, 189, 248, 0.08));

  /* Typography */
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --text-display: 2rem;
  --text-h1: 1.5rem;
  --text-h2: 1.125rem;
  --text-body-lg: 0.9375rem;
  --text-body-md: 0.8125rem;
  --text-caption: 0.6875rem;
  --metric-lg: 1.75rem;
  --metric-md: 0.875rem;
  --metric-pill: 0.625rem;

  /* Spacing scale */
  --space-2xs: 4px;
  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* The sticky app header's rendered height (approximate: it wraps its
   * controls at narrow widths, so this is a floor, not an exact match —
   * see the handoff's COULD NOT VERIFY note on multi-row header widths).
   * The table's `thead` sticks just below this. */
  --header-height: 60px;
  --primary-nav-height: 41px;

  /* Radius */
  --radius-badge: 4px;
  --radius-control: 6px;
  --radius-card: 8px;
  --radius-pill: 9999px;

  /* Elevation */
  --shadow-popover: var(--on-light, 0 10px 25px -5px rgba(15, 23, 42, 0.16)) var(--on-dark, 0 10px 25px -5px rgba(0, 0, 0, 0.6));
  --shadow-drawer: var(--on-light, -15px 0 40px rgba(15, 23, 42, 0.22)) var(--on-dark, -15px 0 40px rgba(0, 0, 0, 0.8));

  /* Motion (U-8 / 06 §5: <= 200ms, disabled under reduced motion below) */
  --motion-duration: 200ms;
  --motion-duration-fast: 120ms;
  --motion-easing: cubic-bezier(0.16, 1, 0.3, 1);
}

/* The light theme: for a system that asks for light, unless the reader chose dark, and for the reader who chose
 * light. Each turns the switches, so every themed token above takes its light value. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --on-light: initial;
    --on-dark: ;
    color-scheme: light;
  }
}

:root[data-theme="light"] {
  --on-light: initial;
  --on-dark: ;
  color-scheme: light;
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --motion-duration: 0ms;
    --motion-duration-fast: 0ms;
  }
}
/* /styles/base.css */
/* Base reset and layout shell. Zero external resources: system font stacks
 * only (see tokens.css). */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: var(--text-body-md);
  line-height: 1.4;
  min-height: 100vh;
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
}

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

.skip-link {
  position: absolute;
  top: -48px;
  left: var(--space-sm);
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-control);
  border: 1px solid var(--border-strong);
  z-index: 1000;
  transition: top var(--motion-duration-fast) var(--motion-easing);
}

.skip-link:focus {
  top: var(--space-sm);
}

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

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

button {
  cursor: pointer;
  background: none;
  border: none;
}

a {
  color: var(--accent-cyan);
}

.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Owner instruction 2026-09-13: "NO inner scroll box — the page itself
 * scrolls with a sticky header row." `main` flows normally (no fixed
 * height, no overflow); the document/window scrolls, `.app-header` stays
 * sticky above it, and the table's `thead` stays sticky just below the
 * header (see components.css). */
.app-main {
  flex: 1;
  padding: var(--space-md);
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
}

.app-header,
.app-primary-nav,
.app-footer {
  flex: none;
}

@media (max-width: 767px) {
  .app-main {
    padding: var(--space-sm);
  }
}

/* The frozen report copy /black-holes/2026-10-14/ (carried from the published tree, never re-rendered) uses the
 * .seo-fallback rules; no page the export writes does (scripts/export_static.py CARRIED_FROZEN_ASSETS). */
.seo-fallback {
  max-width: 960px;
  margin: 0 auto;
  padding: var(--space-md) 0;
  color: var(--text-primary);
  line-height: 1.55;
}

.seo-fallback h1 {
  font-size: var(--text-h1);
  margin: var(--space-xs) 0;
}

.seo-fallback h2 {
  font-size: var(--text-h2);
  margin: var(--space-lg) 0 var(--space-xs);
}

.seo-fallback p,
.seo-fallback li {
  color: var(--text-secondary);
}

.seo-fallback strong {
  color: var(--text-primary);
}

.seo-fallback-table-wrap {
  overflow-x: auto;
  max-width: 100%;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  background: var(--bg-surface);
}

.seo-fallback table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-body-md);
  font-variant-numeric: tabular-nums;
}

.seo-fallback th,
.seo-fallback td {
  padding: var(--space-xs) var(--space-sm);
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.seo-fallback th {
  color: var(--text-secondary);
  font-weight: 600;
}

.seo-fallback-meta {
  margin-top: var(--space-md);
  font-size: var(--text-caption);
  font-family: var(--font-mono);
}
/* /styles/components.css */
/* Reusable component styles: header, badges, table, sparkbars, keymap
 * overlay, drawer, banners, skeletons. */

/* ---- Header ---- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

/* The brand is a link to the rankings (components/chrome.js), laid out as the brand and slogan were. */
.brand-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-md);
  color: inherit;
  text-decoration: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: var(--text-h2);
  color: var(--text-primary);
  white-space: nowrap;
}

.brand-mark {
  width: 1.4em;
  height: 1.4em;
  flex: none;
}

.brand-mark-glow {
  fill: var(--lamp-glow);
}

.brand-mark-rays {
  stroke: var(--lamp-glow);
}

.brand-tagline {
  font-size: var(--text-body-md);
  color: var(--text-secondary);
  white-space: nowrap;
}

@media (max-width: 1365px) {
  .brand-tagline {
    display: none;
  }
}

.snapshot-chip {
  font-family: var(--font-mono);
  font-size: var(--text-caption);
  color: var(--text-secondary);
  background: var(--bg-surface-elevated);
  border-radius: var(--radius-pill);
  padding: 2px var(--space-sm);
  border: 1px solid var(--border-subtle);
}

/* NB-2: a failed snapshot fetch (U-15) — the chip must be visibly
 * distinct from its normal "id · version" state, never a silent
 * "Loading..." that never resolves. */
.snapshot-chip.error-chip {
  color: var(--text-primary);
  background: var(--quad-graveyard-wash);
  border-color: var(--quad-graveyard);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-left: auto;
  flex-wrap: wrap;
}

.header-filter-group {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
}

.header-filter-group[hidden] {
  display: none;
}

/* The search is a real form to the rankings, so it works on every page before (and without) the app. */
form.header-filter-group {
  margin: 0;
}

.field-label {
  font-size: var(--text-caption);
  color: var(--text-secondary);
  margin-right: var(--space-2xs);
}

select.control,
input.control {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  padding: 6px var(--space-sm);
  color: var(--text-primary);
}

/* A placeholder is text a reader must read (the search box's hint): the browser's own grey is under AA on this
 * surface (measured in Chrome: 4.21:1 light, 3.17:1 dark), so it takes the secondary text colour, unfaded. */
input.control::placeholder {
  color: var(--text-secondary);
  opacity: 1;
}

.icon-button {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  padding: 6px var(--space-sm);
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
}

.icon-button:hover {
  background: var(--bg-surface-hover);
}

/* The theme toggle shows the theme in force, as tokens.css decides it: dark on bare :root, light for a system that
 * asks for light unless the reader chose dark, and the reader's choice (data-theme, set by theme-init.js before the
 * first paint). Drawn here rather than by a script, so it is right from the first paint on every page. */
.theme-toggle::before {
  content: "🌙";
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .theme-toggle::before {
    content: "☀";
  }
}

:root[data-theme="light"] .theme-toggle::before {
  content: "☀";
}

/* ---- Primary nav (06 §2 Leaderboard/Matrix/Compare/Configure/Methodology) ---- */
.app-primary-nav {
  position: sticky;
  top: var(--header-height);
  z-index: 19;
  background: var(--bg-base);
}

.primary-tabs {
  position: relative;
  display: flex;
  gap: var(--space-xs);
  padding: 0 var(--space-md);
  background: var(--bg-base);
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.primary-tabs::-webkit-scrollbar {
  display: none;
}

.primary-tab {
  padding: var(--space-sm) var(--space-md);
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
}

.primary-tab:hover {
  color: var(--text-primary);
}

.primary-tab[aria-current="page"] {
  color: var(--text-primary);
  border-bottom-color: var(--accent-violet);
  /* On a phone the strip is wider than the screen: it opens with the current link in view, on every page (the app
   * also keeps it in view as the reader moves between its views: components/chrome.js centerCurrentLink). */
  scroll-initial-target: nearest;
  scroll-snap-align: center;
}

/* ---- Onboarding subtitle ---- */
.onboarding-banner {
  margin: 0 0 var(--space-xs);
  font-size: var(--text-body-md);
  color: var(--text-secondary);
  line-height: 1.45;
}

.onboarding-link {
  color: var(--accent-cyan);
  text-decoration: none;
  font-weight: 500;
}

.onboarding-link:hover {
  text-decoration: underline;
}

/* ---- The home's links to the lists: one row, opened by the reader (views/leaderboard.js renderBrowseLinks) ----
 * Every link stays in the page, so they are real links to a crawler and to a reader without JavaScript; closed, the
 * block is one row instead of five lines, which on a phone had pushed the ranking off the first screen. */
.browse-block {
  margin: 0 0 var(--space-sm);
}

.browse-summary {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  min-height: 40px;
  padding: 0 var(--space-sm);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  font-size: var(--text-body-md);
  cursor: pointer;
  list-style: none;
}

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

.browse-summary::before {
  content: "▸";
  color: var(--text-secondary);
}

.browse-more[open] > .browse-summary::before {
  content: "▾";
}

.browse-summary:hover {
  background: var(--bg-surface-hover);
}

.browse-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: var(--space-md) var(--space-lg);
  padding: var(--space-md) var(--space-2xs) var(--space-2xs);
  font-size: var(--text-body-md);
}

.browse-group-label {
  display: block;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Each link is a target of at least 24 px tall (an inline link is only as tall as its text). */
.browse-groups .onboarding-link {
  display: inline-block;
  line-height: 24px;
}

/* The page numbers of the whole ranking take the full row, each a target a thumb can hit. */
.browse-pages {
  grid-column: 1 / -1;
}

.browse-pages .onboarding-link {
  min-width: 32px;
  padding: 0 var(--space-2xs);
  text-align: center;
  border-radius: var(--radius-badge);
}

.browse-pages .onboarding-link:hover {
  background: var(--bg-surface-hover);
}

/* ---- Tabs (Leaderboard's own Ranked/Not-ranked sub-tabs) ---- */
.tabs {
  display: flex;
  gap: var(--space-xs);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--space-md);
}

.tab {
  padding: var(--space-xs) var(--space-md);
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-weight: 500;
  text-decoration: none;
}

.tab[aria-current="page"] {
  color: var(--text-primary);
  border-bottom-color: var(--accent-cyan);
}

.tab .count {
  font-family: var(--font-mono);
  color: var(--text-muted);
  margin-left: var(--space-2xs);
}

/* ---- Counts strip (always visible; U-2) ---- */
.counts-strip {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  font-size: var(--text-caption);
  color: var(--text-secondary);
  padding: var(--space-2xs) 0 var(--space-sm);
}

/* ---- Corpus meter: how much of the snapshot is rated at all ----
 * A part-to-whole of ONE population, so a single stacked bar, not three
 * bars. Segment colours come from --corpus-* (validated; see tokens.css).
 * The 2px surface gap between fills is the dataviz mark spec — it keeps
 * adjacent segments readable without an outline, including in
 * forced-colors mode where the fills may be overridden. */
.corpus-meter {
  display: flex;
  gap: 2px;
  height: 8px;
  border-radius: var(--radius-pill);
  overflow: hidden;
  /* No track fill. The segments always sum to the whole, so a track adds
   * nothing -- and it actively misled: the recessive `gated` segment (the
   * MAJORITY of a mid-collection snapshot) sat at 2.4:1 against
   * --bg-surface-elevated and read as empty track rather than as the
   * largest share. The 2px inter-segment gaps now show the page surface,
   * which delimits each segment crisply without a competing fill. */
}

.corpus-seg {
  flex-basis: 0;
  min-width: 2px; /* a tiny share stays visible instead of vanishing */
}

/* Rounded data-ends anchored to the ends of the bar (dataviz mark spec):
 * only the outer edges round, so the inner joins stay square and the
 * proportions read true. */
.corpus-meter .corpus-seg:first-child {
  border-radius: var(--radius-pill) 0 0 var(--radius-pill);
}

.corpus-meter .corpus-seg:last-child {
  border-radius: 0 var(--radius-pill) var(--radius-pill) 0;
}

.corpus-seg-rated { background: var(--corpus-rated); }
.corpus-seg-gated { background: var(--corpus-gated); }
.corpus-seg-unrated { background: var(--corpus-unrated); }

.corpus-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-md);
  align-items: baseline;
}

.corpus-key {
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-2xs);
}

/* The swatch is decoration; the label and count beside it carry identity,
 * which is what lets the muted segments sit below 3:1 on the surface. */
.corpus-swatch {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-badge);
  align-self: center;
  flex: none;
}

.corpus-count {
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.corpus-pct {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.corpus-lens {
  color: var(--text-primary);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  padding: 1px var(--space-xs);
}

@media (forced-colors: active) {
  /* Forced-colors drops the fills; the legend text still identifies each
   * segment, and a border keeps the proportions visible. */
  .corpus-seg,
  .corpus-swatch {
    border: 1px solid CanvasText;
  }
}

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  padding: 2px var(--space-xs);
  border-radius: var(--radius-badge);
  font-family: var(--font-mono);
  font-size: var(--metric-pill);
  font-weight: 600;
}

.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}

.badge-coverage-full .badge-dot {
  background: var(--coverage-full);
}

.badge-coverage-a .badge-dot {
  background: var(--coverage-a);
}

.badge-coverage-b .badge-dot {
  background: var(--coverage-b);
}

.badge-coverage-below .badge-dot {
  background: var(--coverage-below);
}

.tier-pill {
  font-family: var(--font-mono);
  font-weight: 700;
}

.tier-capped {
  color: var(--text-secondary);
  font-weight: 400;
  cursor: help;
  text-decoration: underline dotted;
  text-underline-offset: 2px;
}

/* No audited stars in the rows on screen: hide the column as a unit (th + td share data-col/data-cell). */
.stars-unaudited [data-col="stars"],
.stars-unaudited [data-cell="stars"] {
  display: none;
}

.quadrant-glyph {
  font-size: 1rem;
  margin-right: var(--space-2xs);
}

.quad-sweet-spot {
  color: var(--quad-sweet-spot);
}

.quad-crucible {
  color: var(--quad-crucible);
}

.quad-nursery {
  color: var(--quad-nursery);
}

.quad-graveyard {
  color: var(--quad-graveyard);
}

.suspicion-icon {
  color: var(--text-warning);
  cursor: default;
}

.tie-mark {
  color: var(--accent-cyan);
  font-weight: 700;
  margin-left: var(--space-2xs);
  cursor: default;
}

/* ---- Sparkbars (five-pillar mini bars) ---- */
.sparkbar-group {
  display: flex;
  gap: 3px;
  align-items: flex-end;
  height: 20px;
}

.sparkbar {
  width: 6px;
  border-radius: 2px 2px 0 0;
  background: var(--accent-cyan);
  position: relative;
}

.sparkbar[data-unmeasured="true"] {
  background: var(--bg-surface-hover);
  border: 1px dashed var(--border-strong);
}

/* ---- Table ---- */
.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-body-md);
}

/* Owner instruction 2026-09-13: "the page itself scrolls with a sticky
 * header row." The document/window scrolls now (not a bounded `main` box),
 * so the thead sticks relative to the viewport, offset by the also-sticky
 * app header + primary nav height so they never overlap. */
.leaderboard-table thead th {
  position: sticky;
  top: calc(var(--header-height) + var(--primary-nav-height, 41px));
  z-index: 18;
  background: var(--bg-surface-elevated);
}

.leaderboard-table th {
  text-align: left;
  padding: var(--space-xs) var(--space-sm);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: var(--text-caption);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.leaderboard-table th[data-sortable="true"] {
  cursor: pointer;
}

.leaderboard-table th[data-sortable="true"]:hover,
.leaderboard-table th[data-sortable="true"].is-active {
  color: var(--text-primary);
}

.sort-arrow {
  margin-left: 3px;
  color: var(--accent-cyan);
  font-size: 0.9em;
}

.pillars-col-header {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.pillar-sort-btn {
  border: 0;
  background: transparent;
  padding: 2px 3px;
  border-radius: var(--radius-badge);
  font: inherit;
  color: var(--text-secondary);
  cursor: pointer;
}

.pillar-sort-btn:hover,
.pillar-sort-btn.is-active {
  color: var(--text-primary);
  background: var(--bg-surface-hover);
}

.pillar-sort-sep {
  color: var(--text-muted);
}

.leaderboard-table td {
  padding: var(--space-xs) var(--space-sm);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.leaderboard-table td[data-cell="repository"] {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 1023px) {
  .leaderboard-table {
    font-size: var(--text-caption);
  }

  .leaderboard-table th,
  .leaderboard-table td {
    padding: var(--space-xs) 3px;
  }

  .pillar-sort-btn {
    padding: 1px 1px;
  }

  .leaderboard-table [data-col="stars"],
  .leaderboard-table [data-cell="stars"],
  .leaderboard-table [data-col="suspicion"],
  .leaderboard-table [data-cell="suspicion"],
  .leaderboard-table [data-col="no_reply_14d"],
  .leaderboard-table [data-cell="no_reply_14d"],
  .leaderboard-table [data-col="quadrant"],
  .leaderboard-table [data-cell="quadrant"] {
    display: none;
  }

  .leaderboard-table td[data-cell="repository"] {
    max-width: 135px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* Fixed row height so the DOM's real rendered height matches
 * components/table.js's ROW_HEIGHT_PX exactly — the windowing spacers'
 * inline heights are computed from that same constant, and any drift
 * between the two would misalign the scrollbar against the real content. */
.leaderboard-table tbody tr:not([aria-hidden="true"]) {
  height: 40px;
  box-sizing: border-box;
  cursor: pointer;
}

.leaderboard-table tbody tr:not([aria-hidden="true"]) td {
  box-sizing: border-box;
  overflow: hidden;
  white-space: nowrap;
}

.leaderboard-table tbody tr:hover,
.leaderboard-table tbody tr.row-selected {
  background: var(--bg-surface-hover);
}

.leaderboard-table tbody tr.row-tied {
  background: var(--tie-row-band);
}

/* Windowing spacers (components/table.js createSpacerElement): no border,
 * no padding, no hover/cursor styling — only their inline `height` counts. */
.leaderboard-table tbody tr[aria-hidden="true"] {
  cursor: default;
  border: 0;
}

.leaderboard-table tbody tr[aria-hidden="true"] td {
  padding: 0;
  border: 0;
}

.leaderboard-cards > div[aria-hidden="true"] {
  padding: 0;
  margin: 0;
  border: 0;
}

.cell-numeric {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.cell-missing {
  color: var(--text-muted);
  cursor: help;
}

.repo-name {
  color: var(--text-primary);
  font-weight: 500;
}

.repo-owner {
  color: var(--text-secondary);
}

/* The repository name is a real link to the project's page; the row looks as it did, not cyan and underlined. */
.repo-link {
  color: inherit;
  text-decoration: none;
}

/* A row's and a card's name line (components/table.js repoLineHtml): a long name ends in "…" and its ecosystem chip
 * stays whole beside it, inside the cell or the card. */
.repo-line {
  display: flex;
  align-items: baseline;
  min-width: 0;
  max-width: 100%;
}

.repo-line-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.repo-line .eco-chip {
  flex: none;
  white-space: nowrap;
}

.eco-chip {
  font-size: var(--text-caption);
  color: var(--text-secondary);
  background: var(--bg-surface-elevated);
  border-radius: var(--radius-pill);
  padding: 1px var(--space-xs);
  margin-left: var(--space-xs);
}

.delta-up {
  color: var(--text-success);
}

.delta-down {
  color: var(--text-warning);
}

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

/* ---- Card list (< 768px leaderboard) ---- */
/* No flex `gap` here: each real card's own `margin-bottom` supplies the
 * spacing, so a card's total vertical footprint (content + margin) is one
 * fixed number that matches components/table.js's CARD_HEIGHT_PX exactly —
 * the same fixed-height contract the desktop table's rows keep, needed for
 * the windowing spacers' inline heights to line up with real content. */
.mobile-sort-bar {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  margin-bottom: var(--space-sm);
  font-size: var(--text-caption);
  color: var(--text-secondary);
}

.mobile-sort-bar label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  flex: 1;
  min-width: 0;
}

.mobile-sort-bar select.control {
  flex: 1;
  min-width: 0;
}

.leaderboard-cards {
  display: block;
}

.leaderboard-card {
  height: 180px;
  box-sizing: border-box;
  overflow: hidden;
  margin-bottom: 12px; /* 180 + 12 = components/table.js CARD_HEIGHT_PX (192): six lines, the replies one of them */
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  padding: 8px var(--space-sm);
  cursor: pointer;
}

.leaderboard-card > div:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-card.row-tied {
  background: var(--tie-row-band);
}

.leaderboard-card:hover,
.leaderboard-card.row-selected {
  background: var(--bg-surface-hover);
  border-color: var(--border-strong);
}

.leaderboard-card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.leaderboard-card-line-4 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-top: var(--space-2xs);
}

.leaderboard-card-replies {
  margin-top: var(--space-2xs);
  font-size: var(--text-caption);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* The fastest-reply lists print a median's sample under it (components/table.js firstReplyHtml). */
.reply-sample {
  display: block;
  font-size: var(--text-caption);
  color: var(--text-secondary);
}

.leaderboard-card-replies .reply-sample {
  display: inline;
  margin-left: var(--space-2xs);
}

/* ---- A list at its own address: heading, intro, caveat, its other lists, the ranking's page links ---- */
.list-head {
  margin: 0 0 var(--space-md);
  max-width: 72ch;
}

.list-head .view-heading {
  margin-bottom: var(--space-xs);
}

.list-intro,
.list-caveat,
.list-sublinks {
  margin: 0 0 var(--space-xs);
  font-size: var(--text-body-md);
  line-height: 1.45;
}

.list-caveat {
  color: var(--text-secondary);
}

.list-pages {
  margin: var(--space-sm) 0;
  font-size: var(--text-body-md);
  line-height: 1.8;
}

.list-pages a[aria-current="page"],
[data-ranking-pages] a[aria-current="page"] {
  color: var(--text-primary);
  font-weight: 700;
  text-decoration: none;
}

/* ---- The not-ranked lists by reason (views/notranked.js): the lists line, and one sentence a project ---- */
.reason-lists {
  margin: var(--space-sm) 0;
  font-size: var(--text-body-md);
  line-height: 1.8;
}

.reason-list {
  margin: 0;
  padding-left: 4.5em;
  font-size: var(--text-body-md);
  line-height: 1.45;
}

.reason-list li {
  padding: var(--space-2xs) 0;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.reason-list li:hover {
  background: var(--bg-surface-hover);
}

/* ---- Reason chips (Not ranked) ---- */
.reason-chip {
  display: inline-block;
  max-width: 100%;
  white-space: normal;
  padding: 2px var(--space-sm);
  border-radius: var(--radius-pill);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-strong);
  font-size: var(--text-caption);
  color: var(--text-secondary);
}

.notranked-group {
  margin-bottom: var(--space-lg);
}

.notranked-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm);
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
}

/* The name and its ecosystem chip may shrink and break anywhere: a long name with no break points otherwise
 * pushes the row past a 320 px screen. */
.notranked-row > :first-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.notranked-row:hover,
.notranked-row.row-selected {
  background: var(--bg-surface-hover);
}

/* ---- States: skeleton / empty / error / partial ---- */
.skeleton-row {
  height: 32px;
  border-radius: var(--radius-control);
  background: linear-gradient(
    90deg,
    var(--bg-surface-elevated) 25%,
    var(--bg-surface-hover) 50%,
    var(--bg-surface-elevated) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
  margin-bottom: var(--space-xs);
}

@media (prefers-reduced-motion: reduce) {
  .skeleton-row {
    animation: none;
  }
}

@keyframes skeleton-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.empty-state,
.error-banner {
  padding: var(--space-md);
  border-radius: var(--radius-card);
  margin-bottom: var(--space-md);
}

.empty-state {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.error-banner {
  background: var(--quad-graveyard-wash);
  border: 1px solid var(--quad-graveyard);
  color: var(--text-primary);
}

.stale-table {
  opacity: 0.55;
  pointer-events: none;
}

/* Ruling C: persona refetch keeps the old table visible+greyed (via
 * .stale-table above) with this thin indeterminate progress bar, instead
 * of a full-page skeleton. */
.refetch-progress {
  position: sticky;
  top: calc(var(--header-height) + var(--primary-nav-height, 41px));
  left: 0;
  z-index: 19;
  height: 2px;
  overflow: hidden;
  background: var(--bg-surface-elevated);
}

.refetch-progress::before {
  content: "";
  display: block;
  height: 100%;
  width: 40%;
  background: var(--accent-cyan);
  animation: refetch-progress-sweep 1.1s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .refetch-progress::before {
    animation: none;
    width: 100%;
  }
}

@keyframes refetch-progress-sweep {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(250%);
  }
}

/* ---- Keymap overlay ---- */
.keymap-overlay-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.keymap-overlay {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-card);
  padding: var(--space-lg);
  max-width: 480px;
  width: 90%;
  box-shadow: var(--shadow-popover);
}

.keymap-overlay table {
  width: 100%;
  border-collapse: collapse;
  margin-top: var(--space-sm);
}

.keymap-overlay td {
  padding: var(--space-2xs) var(--space-xs);
  border-bottom: 1px solid var(--border-subtle);
}

.keymap-overlay kbd {
  font-family: var(--font-mono);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-badge);
  padding: 1px 6px;
}

/* ---- Drawer ---- */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 90;
  display: flex;
  justify-content: flex-end;
}

.drawer {
  width: 520px;
  max-width: 100%;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-strong);
  box-shadow: var(--shadow-drawer);
  overflow-y: auto;
  overflow-x: hidden; /* the wide tables inside scroll in their own .table-scroll box */
  padding: var(--space-md);
  transition: transform var(--motion-duration) var(--motion-easing);
}

@media (max-width: 767px) {
  .drawer-backdrop {
    align-items: flex-end;
  }

  .drawer {
    width: 100%;
    max-height: 90vh;
    border-left: none;
    border-top: 1px solid var(--border-strong);
  }
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-sm);
  margin-bottom: var(--space-md);
}

/* The title takes the room the buttons leave and breaks a long owner/name instead of pushing the panel wider. */
.drawer-header > :first-child {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  flex: 1 1 16ch;
  min-width: 0;
  overflow-wrap: anywhere;
}

.drawer-actions {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-shrink: 0;
}

.drawer-compare-btn,
.drawer-github-link,
.drawer [data-drawer-close] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  box-sizing: border-box;
  padding: 4px var(--space-sm);
  font-size: var(--text-caption);
  font-weight: 500;
  border-radius: var(--radius-control);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
}

.drawer-compare-btn:hover,
.drawer-github-link:hover {
  background: var(--bg-surface-hover);
}

/* A ranked project's own page, under its name in the side panel (views/drawer.js renderIdentity). */
.drawer-page-link {
  font-size: var(--text-caption);
  font-weight: 500;
  color: var(--accent-cyan);
  text-decoration: none;
}

.drawer-page-link:hover {
  text-decoration: underline;
}

/* The not-in-snapshot drawer body and its opt-in live check (06 §3 C;
 * components/livepanel.js). Every status pill carries its label as text, so
 * colour is never the only signal. */
.live-check {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}

.live-check:focus {
  outline: none;
}

.live-check:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 4px;
}

.live-check-lede {
  margin: 0;
  color: var(--text-primary);
  font-size: var(--text-body-md);
}

.live-check-title {
  margin: var(--space-xs) 0 0;
  font-size: var(--text-h2);
  font-weight: 600;
}

.live-check-start {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 var(--space-md);
  border-radius: var(--radius-control);
  border: 1px solid var(--border-focus);
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.live-check-start:hover {
  background: var(--bg-surface-hover);
}

.live-check-note,
.live-check-disclaimer,
.live-check-foot {
  margin: 0;
  font-size: var(--text-caption);
  color: var(--text-secondary);
  line-height: 1.5;
}

.live-check-disclaimer {
  padding: var(--space-xs) var(--space-sm);
  border-left: 3px solid var(--border-strong);
  background: var(--bg-surface-elevated);
  border-radius: 0 var(--radius-control) var(--radius-control) 0;
}

.live-check-status,
.live-check-renamed,
.live-check-description {
  margin: 0;
  font-size: var(--text-body-md);
  color: var(--text-primary);
}

.live-check-description {
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.live-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--space-xs) var(--space-md);
  width: 100%;
  margin: 0;
}

.live-fact dt {
  font-size: var(--text-caption);
  color: var(--text-muted);
}

.live-fact dd {
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--text-body-md);
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

.live-gates {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.live-gate {
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-control);
  background: var(--bg-surface);
}

.live-gate-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.live-gate-name {
  font-weight: 600;
  color: var(--text-primary);
}

.live-gate-reason {
  margin: 2px 0 0;
  font-size: var(--text-caption);
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.live-pill {
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  font-size: var(--text-caption);
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.live-pill.is-pass,
.live-pill.is-routed {
  border-color: var(--coverage-full);
}

.live-pill.is-fail {
  border-color: var(--coverage-below);
}

.live-pill.is-undecided,
.live-pill.is-not-checked {
  border-style: dashed;
  color: var(--text-secondary);
}

/* The project view's cards sit on the page ground inside the drawer, so they read as cards on its surface. */
.drawer .project-card {
  background: var(--bg-base);
}

.drawer-fallback-title {
  font-size: var(--text-h1);
  margin: 0 0 var(--space-2xs);
}

.drawer-kicker {
  font-size: var(--text-caption);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin: 0 0 var(--space-2xs);
}

/* `.cell-numeric` breaks anywhere (views.css) so a digit run or digest never
 * overflows a cell. The drawer also puts the class on four PARAGRAPHS of
 * spaced text (pillar summary, Porchlamp line, hash, snapshot id), where break-all
 * split words mid-letter ("Governan|ce", MEASURED 2026-09-22). A paragraph
 * wraps at spaces and breaks a word only if it alone would overflow. */
p.cell-numeric {
  word-break: normal;
  overflow-wrap: break-word;
}

.gate-banner {
  background: var(--quad-graveyard-wash);
  border: 1px solid var(--quad-graveyard);
  border-radius: var(--radius-card);
  padding: var(--space-sm);
  margin-bottom: var(--space-md);
}

/* README badge box, the last thing in the drawer's Composite section. The
 * preview keeps its own line: the widest badge is 397 px, wider than a phone's
 * drawer, so it scales down (proportionally) instead of overflowing. */
.maintainer-badge-box {
  margin-top: var(--space-sm);
  padding: var(--space-sm);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  background: var(--bg-surface-elevated);
}

.maintainer-badge-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-sm);
  margin-bottom: var(--space-xs);
}

.maintainer-badge-head .reproduce-copy {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  padding: 3px var(--space-xs);
  font-size: var(--text-caption);
  color: var(--text-primary);
  cursor: pointer;
  white-space: nowrap;
}

.maintainer-badge-head .reproduce-copy:hover {
  background: var(--bg-surface-hover);
}

.maintainer-badge-preview {
  display: block;
  max-width: 100%;
  height: auto;
  margin-bottom: var(--space-xs);
}

.maintainer-badge-note {
  margin: 0 0 var(--space-xs);
  color: var(--text-secondary);
  font-size: var(--text-caption);
}

.maintainer-badge-snippet {
  margin: 0;
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: var(--text-caption);
  white-space: pre-wrap;
  word-break: normal;
  overflow-wrap: anywhere;
  max-height: 6.5rem;
  overflow-y: auto;
  -webkit-user-select: all;
  user-select: all;
}

/* ---- Footer ---- */
.app-footer {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
  padding: var(--space-sm) var(--space-md);
  border-top: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: var(--text-caption);
  color: var(--text-secondary);
}

.app-live-region {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

/* The pager below the list: the same controls, spaced off the last row. */
.pager-bottom {
  margin-top: var(--space-md);
  margin-bottom: var(--space-md);
}

/* ---- Phone header and tab bar ----
 * MEASURED 2026-10-12 at 375 px: the sticky header wrapped to 330 px (40% of the screen, on every screen) and the
 * five tabs ran off the right edge with no hint. Now: the header scrolls away with the page, its three controls
 * sit in two rows, the tab bar is the one thing that stays, and it fades at an edge that has more behind it. */
@media (max-width: 767px) {
  :root {
    --header-height: 0px; /* the header no longer sticks: whatever sticks, sticks under the tab bar */
  }

  .app-header {
    position: static;
    gap: var(--space-xs) var(--space-sm);
    padding: var(--space-xs) var(--space-sm);
  }

  .header-controls {
    display: contents;
  }

  /* Rows: brand and snapshot / persona and ecosystem / search and the theme toggle. */
  .header-controls > [data-theme-toggle] {
    order: 5;
    flex: 0 0 auto;
    align-self: flex-end;
  }

  .header-filter-group {
    order: 3;
    flex: 1 1 calc(50% - var(--space-sm));
    min-width: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
  }

  .header-filter-group[data-header-search-group] {
    order: 4;
    flex: 1 1 calc(100% - 64px); /* a row of its own, with room beside it for the theme toggle */
  }

  .header-filter-group[hidden] {
    display: none;
  }

  .header-filter-group select.control,
  .header-filter-group input.control {
    width: 100%;
    min-width: 0;
  }

  .header-filter-group .field-label {
    margin: 0;
  }

  .app-primary-nav {
    position: sticky;
    top: 0;
    z-index: 19;
  }

  .primary-tabs {
    position: relative; /* its own offsetParent: the active tab is centred from its offsetLeft */
    padding: 0 var(--space-xs);
    gap: 0;
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 var(--space-sm), #000 calc(100% - var(--space-xl)), transparent 100%);
    mask-image: linear-gradient(to right, transparent 0, #000 var(--space-sm), #000 calc(100% - var(--space-xl)), transparent 100%);
  }

  .primary-tab {
    padding: var(--space-sm);
  }
}

/* The ways out of an empty list: side by side, wrapping on a phone. */
.empty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-md);
  justify-content: flex-start; /* with the message above them */
  margin: var(--space-xs) 0 0;
}

/* Black-hole determination evidence panel (D-GATE-5, Packet 4) */
.black-hole-evidence {
  margin-top: var(--space-md);
  margin-bottom: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
}

.black-hole-stat {
  margin: var(--space-sm) 0 var(--space-xs) 0;
  font-size: var(--text-body-lg);
  font-weight: 600;
  color: var(--text-primary);
}

.black-hole-pr-scroll {
  margin: var(--space-sm) 0;
  max-height: 240px;
  overflow: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-control);
}

.black-hole-pr-table {
  width: 100%;
  font-size: var(--text-caption);
}

.black-hole-pr-table a {
  color: var(--text-primary);
  font-family: var(--font-mono);
  text-decoration: underline;
}
/* /styles/views.css */
/* View-level layout: leaderboard toolbar/paging, not-ranked groups. */

.view-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
  flex-wrap: wrap;
}

.view-toolbar .spacer {
  flex: 1;
}

.pager {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
  font-size: var(--text-caption);
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.pager button {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  padding: 4px var(--space-sm);
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
}

.pager button:hover:not(:disabled) {
  background: var(--bg-surface-hover);
}

.pager button:disabled {
  opacity: 0.4;
  cursor: default;
}

.pager [data-pager-status],
.pager [data-notranked-pager-status] {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.table-scroll {
  overflow-x: auto;
}

.view-heading {
  font-size: var(--text-h1);
  margin: 0 0 var(--space-sm);
}

/* ---- An address no view answers (views/notfound.js) ---- */
.not-found {
  max-width: 640px;
}

.not-found-search {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs);
  margin: var(--space-md) 0;
}

.not-found-search .field-label {
  flex: 1 1 100%;
  margin: 0;
}

.not-found-search input.control {
  flex: 1 1 16ch;
  min-width: 0;
}

/* ---- Screen B: Matrix (06 §3 B) ---- */
.matrix-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-bottom: var(--space-md);
}

.matrix-toolbar-controls {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.matrix-plotted-pill {
  font-family: var(--font-mono);
  font-size: var(--text-caption);
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
}

.matrix-legend {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.matrix-legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  padding: 4px var(--space-sm);
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  font-size: var(--text-caption);
}

.matrix-legend-count {
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.matrix-legend-chip[aria-pressed="false"] {
  opacity: 0.4;
  text-decoration: line-through;
}

.matrix-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-lg);
  align-items: start;
}

@media (min-width: 1120px) {
  .matrix-layout {
    grid-template-columns: minmax(420px, 600px) minmax(0, 1fr);
  }
}

.matrix-plot-col {
  min-width: 0;
}

.matrix-axis-labels {
  max-width: 720px; /* the plot's own width: the labels sit over the plot, not at the page edges */
  margin-inline: auto;
  display: flex;
  justify-content: space-between;
  color: var(--text-secondary);
  font-size: var(--text-caption);
  margin-bottom: var(--space-2xs);
}

.matrix-stage {
  position: relative;
  width: 100%;
  max-width: 720px;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  padding: 6px;
  box-sizing: border-box;
  overflow: hidden;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
}

.matrix-stage:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.matrix-svg,
.matrix-canvas-wrap {
  width: 100%;
  height: 100%;
  display: block;
}

.matrix-canvas-wrap {
  position: relative;
}

.matrix-svg {
  overflow: hidden;
}

.matrix-backdrop-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.matrix-canvas {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
}

.matrix-focus-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.matrix-corner-label {
  position: absolute;
  z-index: 3;
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: var(--text-caption);
  font-weight: 500;
  opacity: 0.9;
}

.matrix-corner-title {
  font-weight: 600;
  color: var(--text-primary);
}

.matrix-corner-desc {
  color: var(--text-secondary);
}

@media (max-width: 600px) {
  .matrix-corner-desc {
    display: none;
  }
}

.matrix-corner-top-left,
.matrix-corner-label--tl {
  top: 10px;
  left: 10px;
}

.matrix-corner-top-right,
.matrix-corner-label--tr {
  top: 10px;
  right: 10px;
}

.matrix-corner-bottom-left,
.matrix-corner-label--bl {
  bottom: 10px;
  left: 10px;
}

.matrix-corner-bottom-right,
.matrix-corner-label--br {
  bottom: 10px;
  right: 10px;
}

.matrix-wash-quad-sweet-spot { fill: var(--quad-sweet-spot-wash); }
.matrix-wash-quad-crucible { fill: var(--quad-crucible-wash); }
.matrix-wash-quad-nursery { fill: var(--quad-nursery-wash); }
.matrix-wash-quad-graveyard { fill: var(--quad-graveyard-wash); }

.matrix-axis-line {
  stroke: var(--border-strong);
  stroke-width: 0.3;
  stroke-dasharray: 1.5 1.5;
}

.matrix-marker {
  cursor: pointer;
}

.matrix-marker.quad-sweet-spot { fill: var(--quad-sweet-spot); color: var(--quad-sweet-spot); }
.matrix-marker.quad-crucible { fill: var(--quad-crucible); color: var(--quad-crucible); }
.matrix-marker.quad-nursery { fill: var(--quad-nursery); color: var(--quad-nursery); }
.matrix-marker.quad-graveyard { fill: var(--quad-graveyard); stroke: var(--quad-graveyard); color: var(--quad-graveyard); }

.matrix-marker:focus,
.matrix-marker:focus-visible {
  outline: none;
}

.matrix-marker.marker-focused,
.matrix-marker:focus-visible {
  stroke: var(--border-focus);
  stroke-width: 1.5px;
  vector-effect: non-scaling-stroke;
}

.matrix-marker.marker-focused > :not(line),
.matrix-marker:focus-visible > :not(line) {
  vector-effect: non-scaling-stroke;
}

.matrix-marker.quad-graveyard.marker-focused,
.matrix-marker.quad-graveyard:focus-visible {
  filter: drop-shadow(0 0 2px var(--border-focus));
}

.matrix-hover-card {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  pointer-events: none;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-card);
  padding: var(--space-sm);
  box-shadow: var(--shadow-popover);
  max-width: 220px;
  font-size: var(--text-body-md);
  z-index: 10;
}

.matrix-hover-card p {
  margin: 0 0 2px;
}

.matrix-hover-card p:last-child {
  margin-bottom: 0;
}

.matrix-hover-card .repo-name {
  overflow-wrap: anywhere;
}

@media (max-width: 480px) {
  .matrix-hover-card {
    max-width: min(170px, 45%);
    padding: var(--space-xs);
    font-size: var(--text-caption);
  }
}

.matrix-hover-card--top-left {
  right: auto;
  left: var(--space-sm);
}

.matrix-grid-line {
  stroke: var(--border-subtle);
  stroke-dasharray: 1, 1;
  stroke-width: 0.35;
  opacity: 0.7;
}

.matrix-scale-tick {
  font-size: 2.8px;
  font-family: var(--font-mono);
  fill: var(--text-muted);
  opacity: 0.75;
}

.matrix-hover-card .hint {
  color: var(--text-muted);
  font-size: var(--text-caption);
  margin: var(--space-2xs) 0 0;
}

.matrix-captions {
  margin-top: var(--space-xs);
}

.matrix-caption {
  color: var(--text-secondary);
  font-size: var(--text-caption);
  margin: var(--space-2xs) 0;
}

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

.matrix-spotlight {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.matrix-spotlight-title {
  margin: 0 0 4px;
  font-size: var(--text-h2);
  font-weight: 600;
  color: var(--text-primary);
}

.matrix-spotlight-sub {
  margin: 0;
  font-size: var(--text-body-md);
  color: var(--text-secondary);
}

.matrix-quad-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-md);
}

.matrix-quad-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.matrix-quad-card.is-quad-hidden {
  opacity: 0.5;
}

.matrix-quad-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xs);
}

.matrix-quad-card-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: none;
  padding: 0;
  font-size: var(--text-body-lg);
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
}

.matrix-quad-card-toggle:hover {
  text-decoration: underline;
}

.matrix-quad-card-count {
  font-family: var(--font-mono);
  font-size: var(--text-caption);
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.matrix-quad-bar {
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--bg-surface-elevated);
  overflow: hidden;
}

.matrix-quad-bar-fill {
  display: block;
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--accent-cyan);
}

.matrix-quad-bar-fill.quad-sweet-spot { background: var(--quad-sweet-spot); }
.matrix-quad-bar-fill.quad-crucible { background: var(--quad-crucible); }
.matrix-quad-bar-fill.quad-nursery { background: var(--quad-nursery); }
.matrix-quad-bar-fill.quad-graveyard { background: var(--quad-graveyard); }

.matrix-quad-axes {
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--text-caption);
  font-weight: 600;
  color: var(--text-secondary);
}

.matrix-quad-guidance {
  margin: 0;
  font-size: var(--text-caption);
  color: var(--text-secondary);
  line-height: 1.45;
}

.matrix-quad-top-section {
  margin-top: auto;
  padding-top: var(--space-xs);
  border-top: 1px solid var(--border-subtle);
}

.matrix-quad-top-label {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.matrix-top-repos {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.matrix-top-repo-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xs);
  padding: 5px 8px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-control);
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  font-size: var(--text-caption);
  cursor: pointer;
  text-align: left;
}

.matrix-top-repo-btn:hover,
.matrix-top-repo-btn.is-active {
  border-color: var(--border-focus);
  background: var(--bg-surface-hover);
}

.matrix-top-repo-name {
  font-family: var(--font-mono);
  overflow-wrap: anywhere;
  min-width: 0;
}

.matrix-top-repo-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.matrix-top-repo-score {
  font-weight: 600;
  color: var(--text-primary);
}

.matrix-quad-empty {
  margin: 0;
  font-size: var(--text-caption);
  color: var(--text-muted);
  font-style: italic;
}

/* ---- Screen D: Configure weights (06 §3 D) ---- */
.weight-controls {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
}

.weight-sliders {
  display: grid;
  gap: var(--space-sm);
}

.weight-slider-row {
  display: grid;
  grid-template-columns: 140px 1fr 56px auto;
  align-items: center;
  gap: var(--space-sm);
}

@media (max-width: 767px) {
  .weight-slider-row {
    grid-template-columns: 1fr auto auto;
    grid-template-rows: auto auto;
    gap: var(--space-2xs) var(--space-xs);
  }

  .weight-slider-label {
    grid-column: 1;
    grid-row: 1;
  }

  .weight-slider-value {
    grid-column: 2;
    grid-row: 1;
  }

  .weight-lock-toggle {
    grid-column: 3;
    grid-row: 1;
  }

  .weight-slider {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

.weight-slider {
  width: 100%;
}

.weight-slider-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.weight-lock-toggle {
  padding: 4px var(--space-xs);
}

.weight-presets {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-wrap: wrap;
  margin-top: var(--space-md);
}

.weight-sum {
  font-family: var(--font-mono);
  margin-top: var(--space-sm);
  color: var(--text-secondary);
}

.weight-sum-warning {
  color: var(--accent-warning);
}

.custom-label-note {
  color: var(--text-muted);
  font-size: var(--text-caption);
}

.configure-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: var(--space-md);
  align-items: start;
}

@media (max-width: 1439px) {
  .configure-table-col .leaderboard-table [data-col="stars"],
  .configure-table-col .leaderboard-table [data-cell="stars"],
  .configure-table-col .leaderboard-table [data-col="suspicion"],
  .configure-table-col .leaderboard-table [data-cell="suspicion"],
  .configure-table-col .leaderboard-table [data-col="no_reply_14d"],
  .configure-table-col .leaderboard-table [data-cell="no_reply_14d"] {
    display: none;
  }
}

@media (max-width: 1279px) {
  .configure-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .configure-delta-col {
    position: static;
  }
}

/* Wide viewports (>= 1024px): keep overflow-x visible so the window is the
 * scroll container and `.leaderboard-table thead th` sticks below the nav.
 * Narrow viewports (< 1024px): scroll horizontally in its own box and disable
 * sticky thead offset inside the non-vertically-scrolling box. */
.configure-table-col {
  min-width: 0;
}

@media (max-width: 1023px) {
  .configure-table-col {
    overflow-x: auto;
  }

  .configure-table-col .leaderboard-table thead th {
    position: static;
  }
}

.configure-delta-col {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  padding: var(--space-sm) var(--space-md);
  position: sticky;
  top: calc(var(--header-height) + var(--primary-nav-height, 41px) + var(--space-md));
}

.delta-list h3 {
  font-size: var(--text-body-md);
  margin: var(--space-sm) 0 var(--space-2xs);
}

.delta-list ul {
  list-style: none;
  padding: 0;
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--text-caption);
}

.delta-list li {
  padding: 2px 0;
}

/* ---- Screen E: Compare (06 §3 E) ---- */
.compare-chips {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-wrap: wrap;
  margin-bottom: var(--space-sm);
}

.compare-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  overflow-wrap: anywhere;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  padding: 4px var(--space-sm);
  font-family: var(--font-mono);
  font-size: var(--text-caption);
}

.compare-chip button {
  color: var(--text-secondary);
  font-size: var(--text-body-lg);
  line-height: 1;
}

.compare-clear-btn {
  font-size: var(--text-caption);
  color: var(--text-secondary);
  padding: 4px var(--space-xs);
}

.compare-picker {
  position: relative;
  margin-bottom: var(--space-md);
  max-width: 420px;
}

.compare-picker input {
  width: 100%;
}

.compare-results {
  position: absolute;
  z-index: 5;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  list-style: none;
  margin: var(--space-2xs) 0 0;
  padding: var(--space-2xs) 0;
  max-height: 240px;
  overflow-y: auto;
  box-shadow: var(--shadow-popover);
}

.compare-results:empty {
  display: none;
}

.compare-results button {
  display: block;
  width: 100%;
  text-align: left;
  padding: var(--space-xs) var(--space-sm);
  color: var(--text-primary);
}

.compare-results button:hover {
  background: var(--bg-surface-hover);
}

.compare-onboarding {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  margin-top: var(--space-md);
}

.compare-onboarding-title {
  margin: 0 0 4px;
  font-size: var(--text-h2);
  font-weight: 600;
  color: var(--text-primary);
}

.compare-onboarding-sub {
  margin: 0 0 var(--space-sm);
  font-size: var(--text-body-md);
  color: var(--text-secondary);
}

.compare-presets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-md);
}

.compare-preset-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-xs);
  padding: var(--space-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  text-align: left;
  cursor: pointer;
  color: var(--text-primary);
}

.compare-preset-card:hover {
  border-color: var(--border-strong);
  background: var(--bg-surface-elevated);
}

.compare-preset-title {
  font-size: var(--text-body-lg);
  font-weight: 600;
  color: var(--text-primary);
}

.compare-preset-desc {
  font-size: var(--text-caption);
  color: var(--text-secondary);
  line-height: 1.45;
}

.compare-preset-repos {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: auto;
  padding-top: var(--space-2xs);
}

.compare-suggestions-title {
  margin: 0 0 var(--space-xs);
  font-size: var(--text-caption);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.compare-suggestions-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.compare-quick-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px var(--space-sm);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: var(--text-caption);
  cursor: pointer;
}

.compare-quick-chip:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--border-focus);
}

.compare-cards-section {
  margin-bottom: var(--space-md);
}

.compare-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: var(--space-md);
}

.compare-repo-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  min-width: 0;
}

.compare-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.compare-card-title {
  font-family: var(--font-mono);
  font-size: var(--text-body-md);
  font-weight: 600;
  overflow-wrap: break-word;
}

.compare-status-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: var(--text-caption);
  font-weight: 500;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-elevated);
  color: var(--text-secondary);
}

.compare-status-pill.is-rated {
  border-color: var(--coverage-full);
  color: var(--text-primary);
}

.compare-status-pill.is-gated {
  border-color: var(--border-strong);
  color: var(--text-secondary);
}

/* Gate and unrated reasons are sentences that wrap; a pill radius on a
 * multi-line box reads as a lozenge. */
.compare-status-pill.is-gated,
.compare-status-pill.is-unrated {
  border-radius: var(--radius-control);
}

.compare-card-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-sm);
  flex-wrap: wrap;
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--border-subtle);
}

.compare-card-score-block {
  display: flex;
  flex-direction: column;
}

.compare-card-score-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
}

.compare-card-score-num {
  font-family: var(--font-mono);
  font-size: var(--metric-lg);
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.compare-card-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.compare-card-quad {
  font-size: var(--text-caption);
  font-weight: 600;
  color: var(--text-secondary);
}

.compare-card-wins {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px;
  border-radius: var(--radius-control);
  background: var(--bg-surface-elevated);
  font-size: var(--text-caption);
}

.compare-card-wins-label {
  color: var(--text-secondary);
}

.compare-card-wins-val {
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.compare-card-pillars {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.compare-mini-pillar {
  display: grid;
  grid-template-columns: 3.2rem 1fr 2.2rem;
  align-items: center;
  gap: 6px;
  font-size: var(--text-caption);
}

.compare-mini-pillar-name {
  color: var(--text-secondary);
}

.compare-mini-pillar-bar {
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--bg-surface-elevated);
  overflow: hidden;
}

.compare-mini-pillar-fill {
  display: block;
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--spec-bar, var(--accent-cyan));
}

.compare-mini-pillar-val {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--text-primary);
}

/* Side by side means equal columns: a fixed layout splits the width evenly
 * between the compared repositories after the label column. With the auto
 * layout one long gate reason took 798 px of a 1,408 px table at 1440 px,
 * leaving 153-249 px for the others (MEASURED 2026-10-15). */
.compare-table {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
  table-layout: fixed;
}

.compare-table thead th:first-child {
  width: 15rem;
}

@media (max-width: 767px) {
  .compare-table thead th:first-child {
    width: 9rem;
  }
}

.compare-table .repo-name {
  overflow-wrap: break-word;
  max-width: 100%;
}

.link-button {
  border: 0;
  background: transparent;
  padding: 0;
  font: inherit;
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
}

.link-button:hover {
  color: var(--accent-cyan);
  text-decoration: underline;
}

.compare-section-row th {
  background: var(--bg-surface-elevated);
  color: var(--text-secondary);
  font-size: var(--text-caption);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 6px var(--space-sm);
}

.unmeasured-badge {
  display: inline-block;
  padding: 1px 6px;
  font-size: var(--text-caption);
  border-radius: var(--radius-pill);
  background: var(--bg-surface-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  font-style: italic;
}

.compare-table th,
.compare-table td {
  border-bottom: 1px solid var(--border-subtle);
  padding: var(--space-xs) var(--space-sm);
  text-align: left;
}

.compare-cell-metric {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.compare-inline-bar {
  display: block;
  height: 4px;
  max-width: 120px;
  border-radius: var(--radius-pill);
  background: var(--bg-surface-elevated);
  overflow: hidden;
}

.compare-inline-bar-fill {
  display: block;
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--spec-bar, var(--accent-cyan));
}

.compare-param-th {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.compare-dir-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
}

[data-compare-table-host] > .table-scroll {
  overflow-x: visible;
}

.compare-table thead th {
  position: sticky;
  top: calc(var(--header-height) + var(--primary-nav-height, 41px));
  z-index: 18;
  background: var(--bg-surface-elevated);
}

@media (max-width: 1023px) {
  [data-compare-table-host] > .table-scroll {
    overflow-x: auto;
  }

  .compare-table thead th {
    position: static;
  }
}

.compare-better-mark {
  color: var(--accent-success);
}

.compare-better-cell {
  background: var(--quad-sweet-spot-wash);
}

.compare-verdict {
  margin-bottom: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
}

.compare-verdict h2 {
  margin: 0 0 var(--space-2xs);
  font-size: var(--text-h2);
}

.compare-verdict-main {
  margin: 0 0 4px;
  color: var(--text-primary);
  font-weight: 500;
}

.compare-verdict-subset {
  margin: 6px 0;
  padding: 6px 10px;
  border-left: 3px solid var(--coverage-full);
  background: var(--bg-surface-elevated);
  border-radius: 0 var(--radius-control) var(--radius-control) 0;
  color: var(--text-primary);
  font-size: var(--text-body-md);
}

/* Under a subset verdict the next line says which repository it leaves out:
 * an explanation, not the result. */
.compare-verdict-subset + .compare-verdict-main {
  color: var(--text-secondary);
  font-weight: 400;
}

.app-main code,
.app-main pre,
.cell-numeric {
  overflow-wrap: break-word;
  word-break: break-all;
}

/* ---- Screen F: Methodology and snapshot (06 §3 F) ----
 * Redesign 2026-09-22. Screen F is a reference document, so it is laid out
 * as one: an "On this page" index (a sticky rail on wide screens) beside one
 * card per section, in the order the rating pipeline runs.
 *
 * What it replaces, MEASURED at a 1440 px viewport: nine collapsed <details>
 * hairlines, and one generic `.evidence-table` whose cells were all `nowrap`
 * except the first (`word-break: break-word`). Long prose cells pushed three
 * tables to 1,545 / 2,092 / 3,079 px and the auto table layout squeezed the
 * one breakable column to ~21 px, stacking identifiers one character per
 * line. Every table cell now declares a role -- identifier (.cell-id),
 * number (.num), prose (.cell-prose), meta (.cell-meta) -- and the
 * prose-heavy lists (gates, detectors, change log) are entry lists.
 *
 * Wrapping rule used throughout: `overflow-wrap: break-word`, never
 * `anywhere`/`break-all` inside a table or flex row. break-word still
 * breaks a token that would overflow its line, but it does NOT lower the
 * token's min-content size, so it can never collapse a column. */

.doc-page-head {
  margin-bottom: var(--space-lg);
}

.doc-page-head .view-heading {
  margin-bottom: var(--space-2xs);
}

.doc-lede {
  margin: 0;
  color: var(--text-secondary);
  font-size: var(--text-body-md);
}

/* "Why Porchlamp": the one idea and the finding behind it, above the document. */
.why-card {
  margin: 0 0 var(--space-lg);
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
}

.why-title {
  margin: 0 0 var(--space-sm);
  color: var(--text-primary);
  font-size: var(--text-h2);
  font-weight: 600;
  line-height: 1.3;
  text-wrap: balance;
}

.why-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-md);
}

@media (min-width: 960px) {
  .why-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.why-item {
  padding: var(--space-md);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-control);
  background: var(--bg-surface-elevated);
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
}

.why-kicker {
  font-family: var(--font-mono);
  font-size: var(--text-caption);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.why-card p {
  margin: 0;
  color: var(--text-secondary);
  font-size: var(--text-body-md);
  line-height: 1.6;
}

.app-main .doc-page code {
  word-break: normal;
  overflow-wrap: break-word;
}

.doc-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-lg);
  align-items: start;
}

@media (min-width: 1200px) {
  .doc-layout {
    grid-template-columns: 13.5rem minmax(0, 1fr);
    gap: var(--space-xl);
  }
}

/* The index: a wrapped row of chips on narrow screens, a sticky rail on
 * wide ones. No max-height/overflow on the rail: ten links fit any desktop
 * viewport, and the owner rule (base.css) is no inner scroll boxes. */
.doc-index-title {
  margin: 0 0 var(--space-xs);
  font-size: var(--text-caption);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.doc-index-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs);
  margin: 0;
  padding: 0;
  list-style: none;
}

.doc-index-link {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-xs);
  padding: 4px var(--space-sm);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: var(--text-body-md);
  text-decoration: none;
}

.doc-index-link:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.doc-index-count {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-caption);
  font-variant-numeric: tabular-nums;
}

@media (min-width: 1200px) {
  .doc-index {
    position: sticky;
    top: calc(var(--header-height) + var(--primary-nav-height, 41px) + var(--space-md));
    padding: var(--space-md);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-card);
  }

  .doc-index-list {
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 2px;
  }

  .doc-index-link {
    padding: 6px var(--space-sm);
    border: 0;
    border-left: 2px solid transparent;
    border-radius: 0 var(--radius-control) var(--radius-control) 0;
    background: none;
  }

  .doc-index-link:hover {
    border-left-color: var(--border-strong);
    background: var(--bg-surface-elevated);
  }
}

/* ---- Sections ---- */
.doc-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  min-width: 0;
}

.doc-section {
  min-width: 0;
  padding: var(--space-lg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  background: var(--bg-surface);
  scroll-margin-top: calc(var(--header-height) + var(--primary-nav-height, 41px) + var(--space-md));
}

.doc-section-head {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

/* The static methodology page's anchors (#gates, #lenses, #missing-data, ...) are on the section heads, #reproduce and
 * #hashes on those blocks: a deep link lands where the section's own link would, under the sticky header and nav. */
.doc-section-head[id] {
  scroll-margin-top: calc(var(--header-height) + var(--primary-nav-height, 41px) + var(--space-md) + var(--space-lg));
}

.identity-grid[id],
.reproduce[id] {
  scroll-margin-top: calc(var(--header-height) + var(--primary-nav-height, 41px) + var(--space-md));
}

.doc-section-title {
  margin: 0;
  color: var(--text-primary);
  font-size: var(--text-h2);
  font-weight: 600;
  line-height: 1.3;
}

.doc-section-lede {
  max-width: 72ch;
  margin: var(--space-2xs) 0 var(--space-md);
  color: var(--text-secondary);
  font-size: var(--text-body-lg);
  line-height: 1.55;
}

.doc-subhead {
  margin: var(--space-lg) 0 var(--space-xs);
  color: var(--text-muted);
  font-size: var(--text-caption);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.doc-muted,
.doc-page .is-muted {
  color: var(--text-muted);
}

/* Says how much is behind each section heading. */
.section-count {
  display: inline-block;
  padding: 0 6px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  background: var(--bg-surface-elevated);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: var(--text-caption);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

/* ---- Typed tables (parameters, personas, process constants) ---- */
/* MEASURED 2026-09-22 at 390 px: the page scrolled sideways (document
 * 794 px wide) with nothing visibly overflowing. The culprit was the
 * position:absolute `.sr-only` text inside a scrolled table: with no
 * positioned ancestor its containing block is the page, not the scroll
 * box, so at its static x (~780 px) it widened the document. Making the
 * scroll box the containing block keeps that overflow inside it. */
.doc-page .table-scroll {
  position: relative;
}

.spec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-body-md);
  line-height: 1.5;
}

.spec-table th,
.spec-table td {
  padding: var(--space-xs) var(--space-sm);
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
  vertical-align: top;
}

.spec-table thead th {
  border-bottom-color: var(--border-strong);
  color: var(--text-muted);
  font-size: var(--text-caption);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  vertical-align: bottom;
  white-space: nowrap;
}

.spec-table tbody th {
  color: var(--text-primary);
  font-weight: 500;
}

.spec-table tbody tr:not(.spec-group):hover > * {
  background: var(--bg-surface-elevated);
}

.spec-table .num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.spec-table .cell-id {
  white-space: nowrap;
}

/* The readable name above the identifier in the parameters table's row header.
 * It may wrap (normal white-space never lowers min-content below one word), so
 * the nowrap identifier stays what sizes the column. */
.spec-table .cell-id .param-label {
  display: block;
  margin-bottom: 2px;
  color: var(--text-primary);
  font-weight: 500;
  white-space: normal;
}

.spec-table .cell-id .param-label + code {
  color: var(--text-secondary);
}

/* An identifier must never split: `.app-main code` breaks anywhere (it
 * guards the rest of the app against unbroken digests). */
.app-main .doc-page .spec-table code {
  overflow-wrap: normal;
  font-size: 0.95em;
}

.app-main .doc-page .spec-table .cell-prose code {
  overflow-wrap: break-word;
}

.spec-table .col-prose {
  width: 40%;
}

.spec-table .col-meta {
  width: 12%;
}

.spec-table .col-domain {
  width: 19%;
}

/* An enum domain: levels worst to best, one per line, each with its score. */
.enum-caption {
  display: block;
  margin: 0 0 2px;
  color: var(--text-muted);
  font-size: var(--text-caption);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.enum-ladder {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.enum-ladder + .enum-caption {
  margin-top: var(--space-xs);
}

.spec-table .cell-meta {
  color: var(--text-secondary);
}

/* A 5x5 matrix of weights is read across a row: at 100% width its columns
 * sat ~180 px apart, so it shrinks to its content instead. Each weight's bar
 * has one FIXED length (never a % of its cell): cells are as wide as their
 * header, so a % bar drew the same weight shorter under "Rigor" than under
 * "Responsiveness" (columns measured 84 vs 174 px) -- not one scale. */
.spec-table-personas {
  width: auto;
}

.spec-table-personas .num {
  padding-left: var(--space-lg);
}

.persona-weight-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}

.persona-cell-bar {
  display: block;
  width: 64px;
  height: 5px;
  border-radius: var(--radius-pill);
  background: var(--bg-surface-elevated);
  overflow: hidden;
}

.persona-cell-bar-fill {
  display: block;
  height: 100%;
  width: calc(var(--w, 0) * 100%);
  border-radius: var(--radius-pill);
  background: var(--spec-bar);
}

@media (max-width: 959px) {
  .spec-table-personas .num {
    padding-left: var(--space-sm);
  }
}

.spec-group th {
  padding-top: var(--space-md);
  border-bottom-color: var(--border-strong);
  color: var(--text-primary);
  font-size: var(--text-body-md);
  font-weight: 600;
}

.spec-group-share {
  margin-left: var(--space-xs);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  font-weight: 400;
}

/* Narrow screens: a stackable table becomes one block per row -- the
 * identifier on its own line, numbers inline, prose and meta as labelled
 * blocks (labels from each cell's data-label). The parameters table's
 * narrowest possible width is 806 px (seven columns, three fixed), which
 * a card fits from ~890 px of viewport without the rail and ~1,120 px
 * with it -- hence stacking below 960 px and the rail only from 1200 px.
 * MEASURED before this at
 * 390 px: the parameters table showed only ID / Weight / Min n in its
 * scroll box, with rows ~100 px tall and blank because the off-screen
 * Curve column was wrapping. */
@media (max-width: 959px) {
  .spec-table-stack,
  .spec-table-stack tbody {
    display: block;
  }

  .spec-table-stack thead {
    display: none;
  }

  .spec-table-stack tr {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2xs) var(--space-md);
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--border-subtle);
  }

  .spec-table-stack tr > * {
    padding: 0;
    border: 0;
  }

  .spec-table-stack tbody th,
  .spec-table-stack td:not(.num) {
    flex: 1 1 100%;
  }

  .spec-table-stack .num {
    text-align: left;
  }

  /* "No proxy path" on 15 of 18 cards was a labelled dash each: noise. */
  .spec-table-stack td.is-empty {
    display: none;
  }

  .spec-table-stack td[data-label]::before {
    content: attr(data-label);
    margin-right: 6px;
    color: var(--text-muted);
    font-size: var(--text-caption);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  .spec-table-stack td:not(.num)::before {
    display: block;
    margin: 0 0 2px;
  }

  .spec-table-stack .spec-group {
    display: block;
    padding: var(--space-md) 0 var(--space-2xs);
    border-bottom: 1px solid var(--border-strong);
  }

  .spec-table-stack .spec-group th {
    display: block;
  }

  .spec-table-stack tbody tr:not(.spec-group):hover > * {
    background: none;
  }
}

/* ---- Entry lists (gates, detectors, persona gates, change log) ----
 * A definition layout: name on the left, meaning on the right. */
.spec-entries {
  margin: 0;
  padding: 0;
  list-style: none;
}

.spec-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-2xs) var(--space-lg);
  padding: var(--space-md) 0;
  border-top: 1px solid var(--border-subtle);
  scroll-margin-top: calc(var(--header-height) + var(--primary-nav-height, 41px) + var(--space-md));
}

.spec-entry:first-child {
  padding-top: var(--space-2xs);
  border-top: 0;
}

.spec-entry:last-child {
  padding-bottom: 0;
}

@media (min-width: 900px) {
  .spec-entry {
    grid-template-columns: minmax(10rem, 14rem) minmax(0, 1fr);
  }
}

.spec-entry-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2xs);
  min-width: 0;
}

.spec-entry-id,
.spec-entry-date {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-caption);
}

.spec-entry-title {
  margin: 0;
  color: var(--text-primary);
  font-size: var(--text-body-lg);
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: break-word;
}

.spec-entry-title code {
  font-size: 0.92em;
}

.spec-entry-body {
  min-width: 0;
}

.spec-prose {
  max-width: 72ch;
  margin: 0;
  color: var(--text-primary);
  font-size: var(--text-body-lg);
  line-height: 1.55;
}

.doc-page .spec-prose code,
.doc-page .spec-def dd code,
.doc-page .spec-rules code,
.doc-page .spec-step-note code {
  padding: 0 4px;
  border-radius: var(--radius-badge);
  background: var(--bg-surface-elevated);
  font-size: 0.88em;
}

.spec-facts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-lg);
  margin: var(--space-sm) 0 0;
}

.spec-fact {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-xs);
  min-width: 0;
}

.spec-fact dt,
.spec-stat dt,
.identity-label {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--text-caption);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.spec-fact dd {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2xs);
  min-width: 0;
  margin: 0;
}

.spec-chip {
  padding: 1px 6px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-badge);
  background: var(--bg-surface-elevated);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: var(--text-caption);
  white-space: nowrap;
}

.spec-chip-value {
  margin-left: 6px;
  color: var(--text-primary);
  font-weight: 600;
}

.spec-tag {
  display: inline-block;
  padding: 0 6px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  font-size: var(--text-caption);
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.6;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Text stays in text ink; the colour lives only in the ring and the dot
 * (graphics, 3:1), so the tag is legible in both themes. */
.spec-tag-current {
  border-color: var(--coverage-full);
  color: var(--text-primary);
}

.spec-tag-current::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--coverage-full);
  vertical-align: 1px;
}

/* A digest shortened by CSS only: the full value stays in the DOM, so one
 * click (user-select: all) or a copy takes all of it. */
.app-main .doc-page .spec-hash {
  display: inline-block;
  max-width: 13ch;
  overflow: hidden;
  color: var(--text-primary);
  font-size: var(--text-body-md);
  text-overflow: ellipsis;
  vertical-align: bottom;
  white-space: nowrap;
  -webkit-user-select: all;
  user-select: all;
}

.spec-hash-arrow {
  color: var(--text-muted);
}

/* ---- Missingness ---- */
.spec-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: var(--space-sm);
  margin: 0;
}

.spec-stat {
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-control);
  background: var(--bg-surface-elevated);
}

.spec-stat dd {
  margin: var(--space-2xs) 0 0;
  color: var(--text-primary);
  font-size: var(--metric-lg);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  line-height: 1.1;
}

.spec-defs {
  margin: 0;
}

.spec-def {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-2xs) var(--space-lg);
  padding: var(--space-sm) 0;
  border-top: 1px solid var(--border-subtle);
}

.spec-def:first-child {
  padding-top: 0;
  border-top: 0;
}

@media (min-width: 900px) {
  .spec-def {
    grid-template-columns: minmax(10rem, 14rem) minmax(0, 1fr);
  }
}

.spec-def dt code {
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: var(--text-body-md);
}

.spec-def dd {
  max-width: 72ch;
  margin: 0;
  color: var(--text-primary);
  font-size: var(--text-body-lg);
  line-height: 1.55;
}

.spec-rules {
  margin: 0;
  padding-left: var(--space-lg);
  font-size: var(--text-body-lg);
  line-height: 1.55;
}

/* ---- Tie-breakers: a real sequence, numbered by CSS counters ---- */
.spec-steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: spec-step;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-sm);
}

@media (min-width: 960px) {
  .spec-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.spec-step {
  display: grid;
  grid-template-columns: 1.75rem minmax(0, 1fr);
  column-gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-control);
  background: var(--bg-surface-elevated);
  counter-increment: spec-step;
}

.spec-step::before {
  content: counter(spec-step);
  grid-row: 1 / span 2;
  padding-top: 2px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-caption);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.spec-step-main {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-xs);
  min-width: 0;
}

.spec-step-field {
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: var(--text-body-md);
}

.spec-step-note {
  grid-column: 2;
  max-width: 72ch;
  margin: 2px 0 0;
  color: var(--text-secondary);
  font-size: var(--text-body-md);
  line-height: 1.5;
}

/* ---- Pillars: one bar per pillar, scaled to the heaviest ----
 * `--w` (the pillar's weight) and `--wmax` (the heaviest) come from the
 * payload as inline custom properties; the division happens here, so
 * views/methodology.js needs no numeric literal. Bars start at zero with no
 * track, and the printed percentage carries the value (dataviz: thin marks,
 * direct labels, rounded data end). */
.pillar-weights {
  width: 100%;
  max-width: 48rem;
  border-collapse: collapse;
  font-size: var(--text-body-md);
}

.pillar-weights th,
.pillar-weights td {
  padding: var(--space-xs) 0;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
  vertical-align: middle;
}

.pillar-weights thead th {
  border-bottom-color: var(--border-strong);
  color: var(--text-muted);
  font-size: var(--text-caption);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pillar-weights tbody th {
  width: 9.5rem;
  padding-right: var(--space-md);
  color: var(--text-primary);
  font-weight: 500;
}

.pillar-weight {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.pillar-bar {
  flex: 1;
  height: 8px;
}

.pillar-bar-fill {
  display: block;
  width: calc(var(--w) / var(--wmax) * 100%);
  height: 100%;
  border-radius: 0 4px 4px 0;
  background: var(--spec-bar);
}

.pillar-weight-value {
  min-width: 4ch;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  text-align: right;
}

/* ---- Snapshot ---- */
.snapshot-line {
  margin: 0 0 var(--space-sm);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: var(--text-body-md);
}

.doc-section .counts-strip {
  margin: 0 0 var(--space-md);
}

/* Digests and a commit: looked up and copied, never read as prose. Label
 * column beside a monospace value column; one click selects a whole value. */
.identity-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-2xs) var(--space-lg);
  margin: 0 0 var(--space-md);
}

@media (min-width: 900px) {
  .identity-grid {
    grid-template-columns: max-content minmax(0, 1fr);
    row-gap: var(--space-xs);
  }
}

.identity-row {
  display: contents;
}

.identity-grid .identity-label {
  padding-top: 2px;
}

.identity-value {
  min-width: 0;
  margin: 0 0 var(--space-xs);
}

@media (min-width: 900px) {
  .identity-value {
    margin: 0;
  }
}

.app-main .doc-page .identity-value code {
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: var(--text-body-md);
  -webkit-user-select: all;
  user-select: all;
}

.snapshot-detectors {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  margin: 0 0 var(--space-md);
}

.detector-flags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin: 0;
  padding: 0;
  list-style: none;
}

.detector-flag {
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-xs);
  padding: 4px var(--space-sm);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-control);
  background: var(--bg-surface-elevated);
}

.detector-flag a {
  color: var(--text-primary);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 3px;
}

.detector-flag a:hover {
  text-decoration-color: currentColor;
}

.detector-flag code {
  font-family: var(--font-mono);
  font-size: var(--text-body-md);
}

.detector-flag-count {
  color: var(--text-secondary);
  font-size: var(--text-body-md);
  font-variant-numeric: tabular-nums;
}

/* How to look up one project's record, under the reproduce command. */
.snapshot-check {
  margin: var(--space-sm) 0 0;
  color: var(--text-secondary);
  font-size: var(--text-body-md);
}

.reproduce-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-bottom: var(--space-2xs);
}

.reproduce-copy {
  padding: 3px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  font-size: var(--text-caption);
  font-weight: 600;
}

.reproduce-copy:hover {
  background: var(--bg-surface-hover);
}

.app-main .reproduce-command {
  margin: 0;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: var(--text-body-md);
  white-space: pre-wrap;
  word-break: normal;
  overflow-wrap: break-word;
}

@media (max-width: 767px) {
  .doc-section {
    padding: var(--space-md);
  }
}

@media (forced-colors: active) {
  .pillar-bar-fill,
  .spec-tag-current::before {
    background: CanvasText;
  }
}

/* ---- Report (views/report.js) ---- */
.report-page {
  max-width: 70rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  font-size: var(--text-body-lg);
  line-height: 1.6;
  color: var(--text-primary);
}

.report-page p {
  margin: 0;
}

.report-head {
  max-width: 72ch;
  padding-top: var(--space-xs);
}

.report-head .view-heading {
  margin: 0 0 var(--space-2xs);
  line-height: 1.25;
}

.report-lede {
  color: var(--text-secondary);
}

.report-page .report-intro {
  margin-top: var(--space-sm);
}

/* The lead: the headline figure, its sentence and the one lead chart. */
.report-lead {
  padding: var(--space-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--lamp-glow);
  border-radius: var(--radius-card);
  scroll-margin-top: calc(var(--header-height) + var(--primary-nav-height) + var(--space-md));
}

.report-figure {
  font-size: var(--text-display);
  font-weight: 700;
  line-height: 1.15;
}

.report-page .report-figure-text {
  max-width: 72ch;
  margin: var(--space-xs) 0 var(--space-md);
}

.share-track {
  height: 20px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--text-muted);
  border-radius: var(--radius-badge);
  overflow: hidden;
}

.share-fill {
  display: block;
  height: 100%;
  background: var(--spec-bar);
}

.share-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs) var(--space-lg);
  margin-top: var(--space-xs);
  color: var(--text-secondary);
  font-size: var(--text-body-md);
  font-variant-numeric: tabular-nums;
}

.share-key {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
}

.share-swatch {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  background: var(--spec-bar);
}

.share-swatch-track {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--text-muted);
}

/* Sections: the app's card (views.css .doc-section), one per heading. */
.report-section {
  min-width: 0;
  padding: var(--space-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
}

.report-h2 {
  margin: 0 0 var(--space-sm);
  font-size: var(--text-h2);
  font-weight: 600;
  line-height: 1.3;
  scroll-margin-top: calc(var(--header-height) + var(--primary-nav-height) + var(--space-md));
}

.report-page .report-section p + p {
  margin-top: var(--space-sm);
}

.report-answer,
.report-caveat {
  max-width: 72ch;
}

.report-caveat,
.report-note {
  color: var(--text-secondary);
}

.report-note {
  font-size: var(--text-body-md);
}

/* Findings: four cards, two by two on a wide screen. */
.finding-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-md);
}

@media (min-width: 960px) {
  .finding-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.finding {
  padding: var(--space-md);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-control);
  scroll-margin-top: calc(var(--header-height) + var(--primary-nav-height) + var(--space-md));
}

.finding:target,
.report-lead:target {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.finding-lead {
  margin: 0 0 var(--space-2xs);
  font-size: var(--text-body-lg);
  font-weight: 600;
  line-height: 1.4;
}

/* The bar charts: each is its own data table, full width, with an axis. */
.bar-table-wrap {
  margin: var(--space-md) 0;
}

.bar-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.bar-table th,
.bar-table td {
  padding: var(--space-xs) var(--space-sm);
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-subtle);
}

.bar-table thead th {
  font-size: var(--text-body-md);
  font-weight: 600;
  color: var(--text-secondary);
  vertical-align: bottom;
}

.bar-table .num {
  width: 7rem;
  text-align: right;
  white-space: nowrap;
}

.bar-label {
  width: 13rem;
  font-weight: 500;
}

.bar-scale {
  position: relative;
  display: block;
  height: 28px;
  margin-right: 3.5rem;
  border-right: 1px solid var(--border-subtle);
  background-image: linear-gradient(to right, var(--border-strong) 1px, transparent 1px);
  background-size: calc(100% / var(--ticks)) 100%;
}

.bar-cell {
  position: relative;
}

.bar {
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: calc(var(--f) * 100%);
  background: var(--spec-bar);
  border-radius: 0 var(--radius-badge) var(--radius-badge) 0;
}

/* The share sits just past its bar's end: the cell's left padding plus the bar's length on the scale. */
.bar-value {
  position: absolute;
  top: 50%;
  left: calc(var(--space-sm) + (100% - 2 * var(--space-sm) - 3.5rem) * var(--f));
  transform: translateY(-50%);
  margin-left: var(--space-xs);
  font-weight: 600;
  white-space: nowrap;
}

.axis {
  display: block;
  margin-top: var(--space-2xs);
}

.axis-scale {
  height: 1.4em;
  border-right: 0;
  background: none;
}

.axis-tick {
  position: absolute;
  transform: translateX(-50%);
  font-weight: 400;
  color: var(--text-muted);
}

.axis-tick:first-child {
  transform: none;
}

.axis-tick:last-child {
  transform: translateX(-100%);
}

/* Method beside limits, data beside the citation. */
.report-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-lg);
}

@media (min-width: 960px) {
  .report-pair {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.report-list {
  margin: 0;
  padding-left: var(--space-lg);
}

.report-list li + li {
  margin-top: var(--space-xs);
}

.report-cite {
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-surface-elevated);
  border-left: 3px solid var(--border-strong);
  border-radius: 0 var(--radius-control) var(--radius-control) 0;
  overflow-wrap: anywhere;
}

.report-hashes {
  font-size: var(--text-body-md);
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.report-hashes [data-v] {
  font-family: var(--font-mono);
}

.app-footer a {
  color: var(--accent-cyan);
}

/* ---- Phone ---- */
@media (max-width: 767px) {
  .report-page {
    gap: var(--space-md);
  }

  .report-lead,
  .report-section {
    padding: var(--space-md);
  }

  /* Each chart row stacks: name, then the bar with its share, then the two counts. */
  .bar-table,
  .bar-table thead,
  .bar-table tbody,
  .bar-table thead tr {
    display: block;
  }

  .bar-table thead th {
    display: none;
  }

  .bar-table thead th.bar-head {
    display: block;
    padding: 0 0 var(--space-2xs);
  }

  .bar-table tbody tr {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: var(--space-md);
    padding: var(--space-xs) 0;
    border-bottom: 1px solid var(--border-subtle);
  }

  .bar-table tbody th,
  .bar-table tbody td {
    padding: 2px 0;
    border: 0;
  }

  .bar-label {
    grid-column: 1 / -1;
    width: auto;
    order: 1;
  }

  .bar-cell {
    grid-column: 1 / -1;
    order: 2;
  }

  /* The bar takes the full width; its share moves up to the end of the name's line. */
  .bar-scale {
    margin-right: 0;
  }

  .bar-table tbody .bar-label {
    padding-right: 4rem;
  }

  .bar-value {
    top: -1.6em;
    left: auto;
    right: 0;
    transform: none;
    margin-left: 0;
  }

  .bar-table .num {
    order: 3;
    width: auto;
    text-align: left;
    font-size: var(--text-body-md);
    color: var(--text-secondary);
  }

  .bar-table .num::before {
    content: attr(data-label) ": ";
  }
}

/* ---- Project (views/project.js) ---- */
.project-view {
  container: project / inline-size;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  font-size: var(--text-body-lg);
  line-height: 1.6;
  color: var(--text-primary);
}

.project-view.is-page {
  max-width: 70rem;
  margin: 0 auto;
}

.project-view.is-panel {
  gap: var(--space-md);
}

.project-view p {
  margin: 0;
}

.project-crumb {
  font-size: var(--text-body-md);
  color: var(--text-secondary);
}

.project-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-sm) var(--space-lg);
}

.project-identity {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
  flex: 1 1 24ch;
  min-width: 0;
  overflow-wrap: anywhere;
}

.project-view .drawer-kicker {
  margin: 0;
}

.project-title {
  margin: 0;
  font-size: var(--text-h1);
  font-weight: 700;
  line-height: 1.25;
}

.project-title .repo-owner {
  font-weight: 400;
}

.project-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs) var(--space-md);
}

.project-view .project-eco {
  margin-left: 0;
  font-size: var(--text-body-md);
  color: var(--text-secondary);
  text-decoration: none;
}

a.project-eco:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

.project-view .drawer-page-link {
  font-size: var(--text-body-md);
}

.project-intro {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
  margin-top: calc(-1 * var(--space-sm));
}

.project-lede {
  max-width: 72ch;
  color: var(--text-secondary);
}

.project-card {
  min-width: 0;
  padding: var(--space-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  scroll-margin-top: calc(var(--header-height) + var(--primary-nav-height) + var(--space-md));
}

.project-view .black-hole-evidence {
  margin: 0;
  background: var(--bg-surface);
}

.project-view .black-hole-evidence .project-h2 {
  margin: 0 0 var(--space-sm);
  font-size: var(--text-h2);
  font-weight: 600;
}

.project-view .black-hole-stat {
  margin: 0 0 var(--space-xs);
}

.project-h2 {
  margin: 0 0 var(--space-sm);
  font-size: var(--text-h2);
  font-weight: 600;
  line-height: 1.3;
}

.project-h3 {
  margin: var(--space-lg) 0 var(--space-2xs);
  font-size: var(--text-body-lg);
  font-weight: 600;
}

.project-h2 + .project-h3 {
  margin-top: 0;
}

.project-view .project-card p + p,
.project-view .project-card dl + p {
  margin-top: var(--space-xs);
}

.project-note,
.project-reason,
.project-muted {
  color: var(--text-secondary);
}

.project-note {
  max-width: 72ch;
  font-size: var(--text-body-md);
}

.project-mono {
  font-family: var(--font-mono);
  font-size: var(--text-body-md);
  overflow-wrap: anywhere;
}

/* The lead: the composite facts as one strip, then the answer in plain words. */
.project-lead {
  border-left: 3px solid var(--lamp-glow);
}

.project-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: var(--space-md) var(--space-lg);
  margin: 0 0 var(--space-md);
}

.project-fact dt {
  font-size: var(--text-body-md);
  color: var(--text-secondary);
}

.project-fact dd {
  margin: 0;
  font-size: var(--text-h2);
  font-weight: 600;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}

.project-figure {
  font-size: var(--text-display);
  font-weight: 700;
  line-height: 1.15;
}

.project-figure-of {
  font-size: var(--text-body-lg);
  font-weight: 400;
  color: var(--text-secondary);
}

.project-facts .badge {
  padding: 0;
  font-size: var(--text-h2);
  font-family: var(--font-ui);
}

.project-facts .badge-dot {
  width: 10px;
  height: 10px;
}

.project-facts .tier-pill {
  font-family: var(--font-ui);
}

.project-answer {
  max-width: 72ch;
}

.project-gate {
  margin: 0;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-control);
}

/* Tables: one style for every table in the view (pillars, personas, parameters, black-hole PRs). */
.project-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.project-table caption {
  margin-bottom: var(--space-xs);
  text-align: left;
  font-size: var(--text-body-md);
  color: var(--text-secondary);
}

.project-table th,
.project-table td {
  padding: var(--space-xs) var(--space-sm);
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border-subtle);
}

.project-table thead th {
  font-size: var(--text-body-md);
  font-weight: 600;
  color: var(--text-secondary);
  vertical-align: bottom;
}

.project-table tbody th {
  font-weight: 500;
}

.project-table .num {
  text-align: right;
  white-space: nowrap;
}

.project-table th:first-child,
.project-table td:first-child {
  padding-left: 0;
}

.project-table th:last-child,
.project-table td:last-child {
  padding-right: 0;
}

/* Parameters: the name carries its one-line meaning; source in mono. Fixed columns, so the five pillar tables
 * line up under each other. */
.param-table {
  table-layout: fixed;
}

.param-table th:nth-child(1) { width: 26%; }
.param-table th:nth-child(2) { width: 21%; }
.param-table th:nth-child(3) { width: 7%; }
.param-table th:nth-child(4) { width: 7%; }
.param-table th:nth-child(5) { width: 17%; }

.param-label {
  display: block;
}

.param-meaning {
  display: block;
  margin-top: 2px;
  font-size: var(--text-body-md);
  font-weight: 400;
  color: var(--text-secondary);
}

.param-value {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.param-source {
  font-size: var(--text-body-md);
  color: var(--text-secondary);
}

.param-source .project-mono {
  display: block;
}

.persona-table .tier-pill {
  font-size: var(--text-body-lg);
}

.similar-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-lg);
  margin: var(--space-sm) 0 0;
  padding: 0;
  list-style: none;
}

.project-dl {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: var(--space-2xs) var(--space-md);
  margin: 0 0 var(--space-xs);
}

.project-dl > div {
  display: contents;
}

.project-dl dt {
  color: var(--text-secondary);
}

.project-dl dd {
  margin: 0;
}

.project-hash {
  overflow-wrap: anywhere;
  word-break: break-all;
}

.project-view .black-hole-pr-scroll {
  max-height: 16rem;
}

.project-view .black-hole-pr-table th,
.project-view .black-hole-pr-table td {
  padding-left: var(--space-sm);
  font-size: var(--text-body-md);
}

/* Cards side by side when the view is wide (the page at 1280); one column in the panel and on a phone. */
.project-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: inherit;
}

.project-pair:empty {
  display: none;
}

@container project (min-width: 900px) {
  .project-pair {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---- Narrow: the panel (520 px) and a phone. Rows stack; every value keeps its label. ---- */
@container project (max-width: 699px) {
  .project-card {
    padding: var(--space-md);
  }

  .project-table thead {
    display: none;
  }

  .project-table caption {
    display: block;
  }

  /* A dash (no count, no window) carries nothing in a stacked row; the wide table still shows it. */
  .project-table td.is-empty {
    display: none;
  }

  .project-table,
  .project-table tbody {
    display: block;
  }

  .project-table tr {
    display: flex;
    flex-wrap: wrap;
    gap: 0 var(--space-md);
    padding: var(--space-xs) 0;
    border-bottom: 1px solid var(--border-subtle);
  }

  .project-table tbody th,
  .project-table tbody td {
    padding: 0;
    border: 0;
    text-align: left;
  }

  .project-table tbody th {
    flex: 1 1 100%;
  }

  .project-table td[data-label]::before {
    content: attr(data-label) " ";
    font-weight: 400;
    color: var(--text-secondary);
  }

  .project-table td.project-reason {
    flex: 1 1 100%;
  }

  .param-table {
    table-layout: auto;
  }

  .param-source,
  .param-window {
    flex: 1 1 100%;
  }

  .param-source .project-mono {
    display: inline;
    margin-left: var(--space-2xs);
  }
}

@media (max-width: 767px) {
  .project-view {
    gap: var(--space-md);
  }
}

/* The quadrant word in --text-primary, its glyph in the quadrant colour: --quad-crucible on the dark card is
 * 4.0:1 (measured), under AA for 18 px text; the glyph is a graphic and needs 3:1 (WCAG 1.4.11). */
.project-view [class^="quad-"] {
  color: var(--text-primary);
}

.project-view .quad-sweet-spot .quadrant-glyph { color: var(--quad-sweet-spot); }
.project-view .quad-crucible .quadrant-glyph { color: var(--quad-crucible); }
.project-view .quad-nursery .quadrant-glyph { color: var(--quad-nursery); }
.project-view .quad-graveyard .quadrant-glyph { color: var(--quad-graveyard); }

/* The actions at the reading size (the drawer's buttons are --text-caption, 11 px). */
.project-view .drawer-actions .btn,
.project-view .drawer-actions [data-drawer-close] {
  height: auto;
  min-height: 30px;
  font-size: var(--text-body-md);
}

/* Key facts: one small table of row headers right after the answer. */
.key-facts-card {
  padding: var(--space-md) var(--space-lg);
}

.key-facts th,
.key-facts td {
  padding-top: var(--space-2xs);
  padding-bottom: var(--space-2xs);
}

.key-facts tbody th {
  width: 14rem;
  font-weight: 400;
  color: var(--text-secondary);
}

.key-facts tbody tr:last-child th,
.key-facts tbody tr:last-child td {
  border-bottom: 0;
}

.project-cite {
  margin-top: var(--space-sm);
  color: var(--text-secondary);
  font-size: var(--text-body-md);
  overflow-wrap: anywhere;
}

/* Pillars: the radar, and under it the same five as a table. The labels are 13 px or more where the column is as
 * wide as the viewBox (280), which a phone's column is (294 px in the panel on a 375 px screen, measured). */
.radar-chart-container {
  display: flex;
  justify-content: center;
  margin: var(--space-xs) 0 var(--space-sm);
}

.radar-chart {
  width: 100%;
  max-width: 340px;
  height: auto;
}

.radar-grid {
  fill: none;
  stroke: var(--border-strong);
  stroke-width: 0.8;
}

.radar-spoke {
  stroke: var(--border-strong);
  stroke-width: 0.8;
  stroke-dasharray: 2, 2;
}

.radar-spoke-unmeasured {
  stroke-dasharray: 1, 3;
  opacity: 0.6;
}

.radar-area {
  fill: var(--spec-bar);
  fill-opacity: 0.25;
  stroke: var(--spec-bar);
  stroke-width: 1.5;
}

.radar-point {
  fill: var(--spec-bar);
}

.radar-point-unmeasured {
  fill: var(--bg-surface);
  stroke: var(--border-strong);
  stroke-width: 1.5;
  stroke-dasharray: 2, 1;
}

.radar-label {
  font-size: 13px;
  font-weight: 500;
  fill: var(--text-primary);
}

.pillar-table {
  max-width: 36rem;
  margin: 0 auto;
}

.pillar-table .num {
  width: 6rem;
}

@container project (max-width: 699px) {
  .key-facts tbody th {
    flex: 0 0 8.5rem;
  }

  .key-facts tbody td {
    flex: 1 1 0;
    min-width: 0;
  }
}

/* The home's first page as the export draws it (views/leaderboard.js renderPrerenderedBoard): both layouts are in
 * the page, because the export cannot know the width. Below 768px the cards show and the table hides; from 768px
 * the table shows and the cards and their sort bar hide: the breakpoint the app draws them at. The app takes the
 * board over and removes this class with the layout it does not use. */
@media (max-width: 767px) {
  .prerendered-board .leaderboard-table {
    display: none;
  }
}

@media (min-width: 768px) {
  .prerendered-board .leaderboard-cards,
  .prerendered-board .mobile-sort-bar {
    display: none;
  }
}
