/* Validated design system.
   Tokens first, then base, layout, components, page sections, utilities.
   Contrast (WCAG 2.2 AA) is checked for every text/background pair below:
   body text >= 4.5:1, UI boundaries and focus rings >= 3:1. */

/* ---------- Tokens ---------- */
:root {
  color-scheme: light dark;

  /* Colour: light theme */
  --bg: #ffffff;
  --surface: #f6f7f9;          /* raised sections, table heads */
  --fg: #14171a;               /* 18:1 on bg */
  --muted: #525c66;            /* 6.8:1 on bg, 6.4:1 on surface */
  --line: #d5dae0;             /* decorative dividers only */
  --line-strong: #78828c;      /* form-field borders, >= 3:1 */
  --accent: #0a6b4d;           /* links, primary buttons: 6.5:1 */
  --accent-fg: #ffffff;
  --accent-soft: #e3f3ec;
  --signal: #8a5a00;           /* 5.3:1 on signal-soft */
  --signal-soft: #fdf1d8;
  --review: #a3261b;
  --review-soft: #fbe7e5;
  --ga: #3a4ec2;
  --ga-soft: #e8ebfb;
  --sponsor: #6b4ba8;
  --sponsor-soft: #f1ecfa;
  --danger: #b3261e;
  --focus: #1a5fd0;            /* 5.9:1 on bg */

  /* Spacing: 4px scale */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px;
  --s-6: 32px; --s-7: 48px; --s-8: 64px;

  /* Radius */
  --r-sm: 6px; --r-md: 10px; --r-lg: 16px; --r-pill: 999px;

  /* Type scale (1.2 ratio, fluid at the top) */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --t-xs: 0.78rem; --t-sm: 0.875rem; --t-base: 1rem; --t-md: 1.125rem;
  --t-lg: 1.35rem; --t-xl: clamp(1.5rem, 1.2rem + 1.2vw, 1.85rem);
  --t-2xl: clamp(2rem, 1.4rem + 2.8vw, 3.1rem);

  /* Shadow */
  --shadow-1: 0 1px 2px rgb(16 24 32 / 0.06), 0 1px 1px rgb(16 24 32 / 0.04);
  --shadow-2: 0 6px 20px rgb(16 24 32 / 0.08), 0 2px 4px rgb(16 24 32 / 0.05);

  --container: 1120px;
  --header-h: 64px;
}

/* Dark tokens apply when the visitor picks Dark, or picks Auto (no
   data-theme) and the OS is dark. Picking Light always wins. The two blocks
   must stay identical; there's no preprocessor to share them. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1214;
    --surface: #171b1f;
    --fg: #e8ecef;
    --muted: #a3adb6;
    --line: #2c3339;
    --line-strong: #69747e;
    --accent: #4cc790;
    --accent-fg: #06130d;
    --accent-soft: #12301f;
    --signal: #f0b54a;
    --signal-soft: #33260b;
    --review: #ff9c92;
    --review-soft: #3a1714;
    --ga: #9eacff;
    --ga-soft: #1d2347;
    --sponsor: #c4a8f5;
    --sponsor-soft: #2a2140;
    --danger: #ff9c92;
    --focus: #7eb0ff;
    --shadow-1: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow-2: 0 8px 24px rgb(0 0 0 / 0.45);
  }
}
:root[data-theme="dark"] {
    --bg: #0f1214;
    --surface: #171b1f;
    --fg: #e8ecef;
    --muted: #a3adb6;
    --line: #2c3339;
    --line-strong: #69747e;
    --accent: #4cc790;
    --accent-fg: #06130d;
    --accent-soft: #12301f;
    --signal: #f0b54a;
    --signal-soft: #33260b;
    --review: #ff9c92;
    --review-soft: #3a1714;
    --ga: #9eacff;
    --ga-soft: #1d2347;
    --sponsor: #c4a8f5;
    --sponsor-soft: #2a2140;
    --danger: #ff9c92;
    --focus: #7eb0ff;
    --shadow-1: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow-2: 0 8px 24px rgb(0 0 0 / 0.45);
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  /* WCAG 2.4.11: the sticky header never hides a focused element. */
  scroll-padding-top: calc(var(--header-h) + var(--s-4));
}
body {
  margin: 0;
  font: var(--t-base)/1.6 var(--font);
  color: var(--fg);
  background: var(--bg);
  overflow-wrap: anywhere;
}
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.01em; margin: 0 0 var(--s-3); }
h1 { font-size: var(--t-xl); }
h2 { font-size: var(--t-lg); }
h3 { font-size: var(--t-md); }
p { margin: 0 0 var(--s-4); }
img, svg { max-width: 100%; }
/* Inline icons from the ui.icon macro size to the text around them. */
.icon { width: 1em; height: 1em; flex: none; vertical-align: -0.125em; }
a { color: var(--accent); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
code, pre { font-family: var(--mono); font-size: 0.9em; }
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ---------- Layout ---------- */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--s-4); }
.container .container { padding-inline: 0; }
main:focus { outline: none; }
.skip-link {
  position: absolute; left: var(--s-4); top: -100px; z-index: 20;
  padding: var(--s-2) var(--s-3); background: var(--bg); color: var(--fg);
  border: 2px solid var(--focus); border-radius: var(--r-sm);
}
.skip-link:focus { top: var(--s-2); }

.site-header { background: var(--bg); border-bottom: 1px solid var(--line); }
.site-header .container {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: var(--s-2) var(--s-4); padding-block: var(--s-3);
}
.brand { display: inline-flex; align-items: center; gap: var(--s-2); font-weight: 750; font-size: var(--t-md); color: var(--fg); text-decoration: none; }
.brand-mark { color: var(--accent); }
.site-nav { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-1) var(--s-4); font-size: var(--t-sm); }
.site-nav a { color: var(--fg); text-decoration: none; padding: var(--s-2) 0; }
.site-nav a:hover { color: var(--accent); }
.site-nav a[aria-current="page"] { color: var(--accent); font-weight: 650; }
.site-nav a.btn, .site-nav a.btn:hover { color: var(--accent-fg); padding: 0 var(--s-4); }
@media (min-width: 720px) {
  .site-header { position: sticky; top: 0; z-index: 10; }
  .site-header .container { min-height: var(--header-h); padding-block: 0; }
}

main { display: block; padding-block: var(--s-6) var(--s-8); }
main.home { padding-top: 0; }
.home .section { padding-top: var(--s-6); }
.page-head { margin-bottom: var(--s-5); }
.page-head p { color: var(--muted); max-width: 68ch; }

.site-footer { border-top: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: var(--t-sm); }
.site-footer .container { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-4); padding-block: var(--s-6); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--fg); }

.section { padding-block: var(--s-7) 0; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--s-2) var(--s-4); margin-bottom: var(--s-4); }
.section-head h2 { margin: 0; }
.section-head p { margin: 0; color: var(--muted); font-size: var(--t-sm); }

.grid { display: grid; gap: var(--s-4); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 600px) { .grid-2, .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 960px) { .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.stack > * + * { margin-top: var(--s-4); }
.plain-list { list-style: none; padding: 0; margin: 0; }

/* ---------- Theme switch ---------- */
.theme-switch { display: inline-flex; gap: 2px; padding: 2px; margin: 0; border: 1px solid var(--line-strong); border-radius: var(--r-pill); }
.theme-switch button {
  min-height: 32px; width: 32px; padding: 0; border-radius: 50%;
  border: 1px solid transparent; background: transparent; color: var(--muted);
}
.theme-switch button:hover { color: var(--fg); filter: none; }
.theme-switch button[aria-pressed="true"] { background: var(--surface); color: var(--fg); border-color: var(--line-strong); }
.theme-switch .icon { width: 16px; height: 16px; }

/* ---------- Buttons ---------- */
.btn, .button, button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 44px; padding: 0 var(--s-4);
  font: 600 var(--t-sm)/1 var(--font); text-decoration: none; cursor: pointer;
  border: 1px solid var(--accent); border-radius: var(--r-sm);
  background: var(--accent); color: var(--accent-fg);
}
.btn:hover, .button:hover, button:hover { filter: brightness(1.08); text-decoration: none; }
.btn-secondary { background: var(--bg); color: var(--fg); border-color: var(--line-strong); }
.btn-secondary:hover { border-color: var(--fg); filter: none; }
.btn-lg { min-height: 48px; padding: 0 var(--s-5); font-size: var(--t-base); }
.btn-block { width: 100%; }
button.danger, .btn-danger { background: var(--bg); color: var(--danger); border-color: var(--danger); }
button.link {
  min-height: 0; padding: var(--s-2) 0; border: 0; background: none;
  color: var(--fg); font-weight: 400; font-size: inherit;
}
button.link:hover { color: var(--accent); filter: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--s-3); }
@media (max-width: 479px) { .btn-row > .btn { width: 100%; } }
form.inline { display: inline; }

/* ---------- Badges (trust, docs/PLAN.md G1) ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 0.3em;
  padding: 2px var(--s-2); border-radius: var(--r-pill); border: 1px solid transparent;
  font-size: var(--t-xs); font-weight: 650; line-height: 1.5; white-space: nowrap;
}
.badge svg { width: 0.95em; height: 0.95em; flex: none; }
.badge-verified, .badge-cross_checked { color: var(--accent); background: var(--accent-soft); border-color: currentColor; }
.badge-via_ga { color: var(--ga); background: var(--ga-soft); border-color: currentColor; }
.badge-under_review { color: var(--review); background: var(--review-soft); border-color: currentColor; }
/* Icon-only badge on cards: a 24px circle (WCAG 2.5.8 target size). */
.badge-icon { justify-content: center; width: 24px; height: 24px; padding: 0; flex: none; }
.badge-icon svg { width: 13px; height: 13px; }
.badge-sponsored { color: var(--sponsor); background: var(--sponsor-soft); border-color: currentColor; text-transform: uppercase; letter-spacing: 0.04em; }

/* ---------- Status pills (docs/PLAN.md G3) ---------- */
.status {
  display: inline-flex; align-items: center; gap: 0.4em;
  padding: 2px var(--s-2); border-radius: var(--r-pill);
  font-size: var(--t-xs); font-weight: 650; line-height: 1.5; white-space: nowrap;
  border: 1px solid var(--line-strong); color: var(--muted);
}
.status::before { content: ""; width: 0.55em; height: 0.55em; border-radius: 50%; background: currentColor; }
.status-signal { color: var(--signal); background: var(--signal-soft); border-color: currentColor; }
.status-validated { color: var(--accent); background: var(--accent-soft); border-color: currentColor; }
/* Validated gets a filled dot plus a ring, so colour isn't the only cue. */
.status-validated::before { box-shadow: 0 0 0 2px var(--accent-soft), 0 0 0 3px currentColor; }

/* Benchmark notes and neutral tags */
.pill { display: inline-block; margin: 2px 6px 2px 0; padding: 1px var(--s-2); border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--line); font-size: var(--t-sm); }

/* ---------- Cards ---------- */
.card {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: var(--s-4); box-shadow: var(--shadow-1);
}
.card h2 { font-size: var(--t-md); margin: var(--s-2) 0 var(--s-1); }
.cards { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--s-4); }
@media (min-width: 720px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.card-surface { background: var(--surface); box-shadow: none; }

/* Showcase slot: fixed shape so a sponsored card can replace a founder card
   without shifting the layout. */
.slot {
  position: relative; display: flex; flex-direction: column; gap: var(--s-3);
  min-height: 136px; height: 100%;
}
.slot:hover { box-shadow: var(--shadow-2); }
.slot-head { display: flex; align-items: center; gap: var(--s-3); min-width: 0; }
.slot-title { margin: 0; font-size: var(--t-md); }
.slot-title a { color: var(--fg); text-decoration: none; }
/* The whole card is clickable through the title link's pseudo-element. */
.slot-title a::after { content: ""; position: absolute; inset: 0; border-radius: var(--r-md); }
.slot-title a:focus-visible { outline: none; }
.slot:has(.slot-title a:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.slot-meta { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }
.slot-foot { margin-top: auto; display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-3); }
.slot-foot .spark { max-width: 110px; }
.slot-head > .badge { margin-left: auto; align-self: flex-start; }
.card-figure { margin: 0; color: var(--muted); font-size: var(--t-sm); }
.card-figure strong { color: var(--fg); font-size: var(--t-lg); font-variant-numeric: tabular-nums; margin-right: 2px; }
.card-figure .status { margin-left: var(--s-1); vertical-align: 2px; }
.slot-sponsored { border-color: var(--sponsor); }
.slot-sponsored .badge-sponsored { position: absolute; top: var(--s-3); right: var(--s-3); }

.avatar {
  flex: none; display: inline-grid; place-items: center;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-weight: 750;
  border: 1px solid var(--line);
}
.avatar-sm { width: 28px; height: 28px; font-size: var(--t-xs); }
.handle { color: var(--muted); font-size: var(--t-sm); }
.who { min-width: 0; line-height: 1.35; }
.who .handle { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Stat tiles ---------- */
.stats-grid { display: grid; gap: var(--s-3); grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0 0 var(--s-5); padding: 0; list-style: none; }
@media (min-width: 720px) { .stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s-3) var(--s-4); }
.stat-label { display: block; color: var(--muted); font-size: var(--t-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.stat-value { display: block; font-size: var(--t-lg); font-weight: 750; font-variant-numeric: tabular-nums; }
.stat-note { display: block; color: var(--muted); font-size: var(--t-xs); }

/* ---------- Sparkline ---------- */
.spark { display: block; width: 100%; max-width: 160px; height: 32px; color: var(--accent); overflow: visible; }
.spark-wide { max-width: none; height: 64px; }
.trend { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; min-width: 0; flex: 1; }
.trend-note { color: var(--muted); font-size: var(--t-xs); font-variant-numeric: tabular-nums; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-md); }
table.portfolio, table.table { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
table.portfolio th, table.portfolio td, table.table th, table.table td {
  text-align: left; padding: var(--s-3); border-bottom: 1px solid var(--line); vertical-align: top;
}
table.portfolio thead th, table.table thead th { white-space: nowrap; background: var(--surface); color: var(--muted); font-size: var(--t-xs); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 650; }
table.portfolio tbody tr:last-child td, table.table tbody tr:last-child td { border-bottom: 0; }
table.portfolio tr.sub td { padding-top: 0; font-size: var(--t-sm); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.rank { color: var(--muted); font-weight: 700; width: 3ch; }
.cell-title { display: flex; align-items: center; gap: var(--s-2); font-weight: 650; }
.cell-meta { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-2); margin-top: var(--s-1); align-items: center; color: var(--muted); font-size: var(--t-xs); }

/* Tables collapse to cards below 900px. Each cell carries data-label. */
@media (max-width: 899px) {
  .table-stack { border: 0; overflow: visible; }
  .table-stack table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .table-stack table, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tbody tr {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-2) var(--s-4);
    border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s-3) var(--s-4); margin-bottom: var(--s-3);
    background: var(--bg);
  }
  .table-stack td { border: 0 !important; padding: 0 !important; }
  .table-stack td[data-label]::before { content: attr(data-label); display: block; color: var(--muted); font-size: var(--t-xs); text-transform: uppercase; letter-spacing: 0.04em; }
  .table-stack td.cell-wide { grid-column: 1 / -1; }
  .table-stack td.rank { position: absolute; width: auto; }
  .table-stack tbody tr:has(td.rank) { position: relative; padding-left: calc(var(--s-4) + 3ch); }
  .table-stack td.rank { left: var(--s-4); top: var(--s-3); }
  .table-stack tr.sub { margin-top: calc(-1 * var(--s-3) - 1px); border-top-left-radius: 0; border-top-right-radius: 0; background: var(--surface); }
}

/* ---------- Tabs and chips ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: var(--s-1); margin: 0 0 var(--s-3); padding: var(--s-1); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); width: fit-content; max-width: 100%; }
.tabs a { padding: var(--s-2) var(--s-3); border-radius: var(--r-sm); color: var(--fg); text-decoration: none; font-size: var(--t-sm); font-weight: 600; }
.tabs a:hover { background: var(--bg); }
.tabs a[aria-current="page"] { background: var(--bg); color: var(--accent); box-shadow: var(--shadow-1); }
.chips { display: flex; flex-wrap: wrap; gap: var(--s-2); margin: 0 0 var(--s-4); padding: 0; list-style: none; }
.chips a, .chips strong { display: inline-block; padding: var(--s-1) var(--s-3); border: 1px solid var(--line-strong); border-radius: var(--r-pill); font-size: var(--t-sm); color: var(--fg); text-decoration: none; }
.chips a:hover { border-color: var(--fg); }
.chips a[aria-current="page"], .chips strong { background: var(--fg); border-color: var(--fg); color: var(--bg); font-weight: 600; }
.filters { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-3); }

/* ---------- Forms ---------- */
label { display: block; margin: var(--s-4) 0 var(--s-1); font-weight: 600; font-size: var(--t-sm); }
label.check { display: flex; align-items: center; gap: var(--s-2); font-weight: 400; font-size: var(--t-base); }
input[type=url], input[type=text], input[type=email], input[type=search], select, textarea {
  width: 100%; min-height: 44px; padding: var(--s-2) var(--s-3);
  font: inherit; color: var(--fg); background: var(--bg);
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
}
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--focus); }
form button[type=submit] { margin-top: var(--s-4); }
form.inline button[type=submit], .site-nav button[type=submit] { margin-top: 0; }
.field-help { color: var(--muted); font-size: var(--t-sm); margin-top: var(--s-1); }
[role=alert] { color: var(--review); }
p[role=alert], .alert { padding: var(--s-3) var(--s-4); border: 1px solid currentColor; border-radius: var(--r-sm); background: var(--review-soft); }
.flash { padding: var(--s-3) var(--s-4); border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: var(--s-7) var(--s-4); border: 1px dashed var(--line-strong); border-radius: var(--r-md); background: var(--surface); }
.empty h3 { margin-bottom: var(--s-2); }
.empty p { color: var(--muted); max-width: 52ch; margin-inline: auto; }

/* ---------- Home ---------- */
/* One markup order, two arrangements. Narrow: a single column in reading
   order. >= 1440px: the showcase fills two side columns around the centre. */
.home-layout {
  display: grid; gap: var(--s-6) var(--s-5); grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "hero" "rails" "left" "right" "board" "info";
  max-width: var(--container); margin-inline: auto; padding-inline: var(--s-4);
}
.home-hero { grid-area: hero; }
.home-rails { grid-area: rails; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-5); min-width: 0; }
.rail-section { min-width: 0; }
.home-side-left { grid-area: left; }
.home-side-right { grid-area: right; }
.home-board { grid-area: board; min-width: 0; padding: var(--s-5); }
.home-info { grid-area: info; min-width: 0; }
.home-info > .section:first-child { padding-top: 0; }
.home-side { min-width: 0; }
.side-list { display: grid; gap: var(--s-4); grid-template-columns: minmax(0, 1fr); }
.home-side-right .side-list { margin-top: calc(-1 * var(--s-6) + var(--s-4)); }
/* Fewer slots where they'd push the leaderboard far down. */
/* Each column fills whole rows: 2 cards (1 col), 2 (2 cols), 3 (3 cols). */
@media (max-width: 959px) { .side-list > li:nth-child(n+3) { display: none; } }
@media (min-width: 600px) and (max-width: 959px) { .side-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 960px) and (max-width: 1439px) {
  .side-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .side-list > li:nth-child(n+4) { display: none; }
}
/* The account menu only shows beside the page; narrower, the header has it. */
.home-account { display: none; }
/* Signed out there's no showcase (it returns as the ad slot), so no empty
   rows that would add stray gaps. */
.home-layout:not(.is-authed) { grid-template-areas: "hero" "rails" "board" "info"; }
@media (min-width: 1440px) {
  /* Signed in: account menu on the left, showcase in the centre column, and
     an empty right column so the centre stays centred. */
  .home-layout.is-authed {
    max-width: 1640px; align-items: start;
    grid-template-columns: 272px minmax(0, 1fr) 272px;
    grid-template-areas: "account hero ." "account rails ." "account left ." "account right ." "account board ." "account info .";
  }
  /* Header and footer line up with the wider three-column page. */
  body:has(.is-authed) .site-header .container, body:has(.is-authed) .site-footer .container { max-width: 1640px; }
  .home-account {
    grid-area: account; grid-row: 1 / -1; position: sticky; top: calc(var(--header-h) + var(--s-4));
    display: flex; flex-direction: column; align-items: flex-start; gap: var(--s-2); padding-top: var(--s-6);
  }
  .home-account .btn { width: 200px; justify-content: flex-start; }
  .account-me { min-height: 52px; gap: var(--s-2); }
  .account-me .handle { display: block; font-weight: 400; font-size: var(--t-xs); }
  .is-authed .side-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .is-authed .side-list > li:nth-child(n+4) { display: none; }
}

.home-hero { text-align: center; padding-block: var(--s-6) 0; }
.home-hero h1 { font-size: var(--t-2xl); max-width: 20ch; margin: 0 auto var(--s-4); letter-spacing: -0.02em; }
.hero-lede { font-size: var(--t-md); color: var(--muted); max-width: 56ch; margin: 0 auto var(--s-5); }
/* Source name + its icon: the text keeps the line's baseline, the icon
   centres on it. */
.lede-source { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.lede-source > span { display: inline-flex; }
.hero-actions { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: var(--s-3); }
.home-board .section-head .chips { margin: 0; }

/* Signed-out hero CTA: URL box + button. */
.hero-cta { display: flex; gap: var(--s-2); width: 100%; max-width: 540px; }
.hero-cta input { min-height: 48px; font-size: var(--t-md); }
.hero-cta button[type=submit] { margin-top: 0; flex: none; }
@media (max-width: 479px) { .hero-cta { flex-direction: column; } .hero-cta button[type=submit] { width: 100%; } }
.hero-note { margin: var(--s-3) 0 0; color: var(--muted); font-size: var(--t-sm); }

/* Search */
.search { position: relative; display: flex; gap: var(--s-2); flex: 1 1 320px; max-width: 480px; }
.search input { padding-left: 38px; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; display: inline-flex; }
.search button[type=submit] { margin-top: 0; flex: none; }
@media (max-width: 479px) { .hero-actions > .btn, .hero-actions > .search { width: 100%; max-width: none; flex-basis: 100%; } }

/* Card rails: one row that fits the screen, no sideways scrolling.
   Phones: 3 stacked. Tablets: 2 x 2. Desktop: 4 across. "View all" has the rest. */
.rail { display: grid; gap: var(--s-3); grid-template-columns: minmax(0, 1fr); }
.rail > li:nth-child(n+4) { display: none; }
@media (min-width: 600px) {
  .rail { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rail > li:nth-child(4) { display: block; }
}
@media (min-width: 960px) { .rail { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.rail-empty { margin: 0; }
.mini { position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: var(--s-3); height: 100%; padding: var(--s-3) var(--s-4); }
.mini:hover { box-shadow: var(--shadow-2); }
.mini:has(.slot-title a:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.mini .slot-title { font-size: var(--t-base); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Top-3 ranks: dark text on light medal colours passes AA in both themes. */
.rank-n { display: inline-grid; place-items: center; min-width: 26px; height: 26px; border-radius: 50%; }
.table tbody tr:nth-child(1) .rank-n { background: #f6d77a; color: #3d2e00; }
.table tbody tr:nth-child(2) .rank-n { background: #dfe3e8; color: #1f2933; }
.table tbody tr:nth-child(3) .rank-n { background: #f0c9a4; color: #4a2a0c; }
.steps { list-style: none; padding: 0; margin: 0; counter-reset: step; }
.step { counter-increment: step; }
.step::before { content: counter(step); display: inline-grid; place-items: center; width: 32px; height: 32px; margin-bottom: var(--s-3); border-radius: 50%; background: var(--accent); color: var(--accent-fg); font-weight: 750; }
.step h3 { margin-bottom: var(--s-2); }
.step p { color: var(--muted); margin: 0; }
.thresholds { list-style: none; padding: 0; margin: 0; }
.thresholds li { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s-2); }
.thresholds p { margin: 0; color: var(--muted); font-size: var(--t-sm); }
.more { margin-top: var(--s-4); }

/* ---------- Listing / founder pages ---------- */
.listing-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); margin-bottom: var(--s-2); }
.listing-head h1 { margin: 0; }
.favicon { vertical-align: middle; border-radius: 4px; }
.shot { width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--r-md); }
.provenance { display: flex; gap: var(--s-3); align-items: flex-start; }
.provenance p { margin: 0; }
.prose { max-width: 72ch; }
.prose h2 { margin-top: var(--s-6); }
.prose li + li { margin-top: var(--s-2); }
.code { overflow-x: auto; padding: var(--s-3); border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); font-size: var(--t-sm); white-space: pre-wrap; word-break: break-all; }
details summary { cursor: pointer; font-weight: 600; padding: var(--s-2) 0; }
.share-card { width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--r-md); }
.auth-card { max-width: 440px; margin: var(--s-6) auto 0; padding: var(--s-6) var(--s-5); text-align: center; }
.auth-card .btn { margin-block: var(--s-3); }
.panel-row { margin-top: var(--s-5); }
.panel h2 { margin-bottom: var(--s-3); }
.panel h3 { margin-top: var(--s-4); }
.danger-zone { border-color: var(--danger); }

/* ---------- Utilities ---------- */
.muted { color: var(--muted); font-size: var(--t-sm); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.source-verified { color: var(--accent); font-weight: 600; }
.stats { list-style: none; padding: 0; }
.stats li { padding: var(--s-1) 0; }
