:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface-1: #fcfcfb;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #6f6e69;
  --axis-muted: #898781;
  --grid: #e1e0d9;
  --baseline: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --wash: rgba(11, 11, 11, 0.04);
  --accent: #2a78d6;

  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --series-6: #008300;
  --series-7: #6250d6;
  --series-8: #e34948;

  /* diverging: improves the public finances (cool) vs worsens them (warm) */
  --div-good: #2a78d6;
  --div-bad: #e34948;
  --div-mid: #f0efec;
  --total: #52514e;
  --seq-1: #b7d3f6; --seq-2: #86b6ef; --seq-3: #5598e7; --seq-4: #256abf; --seq-5: #104281;
  --nodata: #e1e0d9;
  --band: rgba(42, 120, 214, 0.14);
  --good: #0ca30c; --good-ink: #006300; --bad: #d03b3b;
  --panel: #f0f4f9;

  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface-1: #1a1a19;
    --text-primary: #f0efec;
    --text-secondary: #c3c2b7;
    --text-muted: #a3a29b;
    --grid: #2c2c2a;
    --baseline: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --wash: rgba(255, 255, 255, 0.05);
    --accent: #3987e5;
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --series-5: #d55181;
    --series-6: #008300;
    --series-7: #9085e9;
    --series-8: #e66767;
    --div-good: #3987e5;
    --div-bad: #e66767;
    --div-mid: #383835;
    --total: #a3a29b;
    --seq-1: #184f95; --seq-2: #256abf; --seq-3: #3987e5; --seq-4: #6da7ec; --seq-5: #9ec5f4;
    --nodata: #2c2c2a;
    --band: rgba(57, 135, 229, 0.22);
    --good-ink: #0ca30c;
    --panel: #1f232a;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface-1: #1a1a19;
  --text-primary: #f0efec;
  --text-secondary: #c3c2b7;
  --text-muted: #a3a29b;
  --grid: #2c2c2a;
  --baseline: #383835;
  --border: rgba(255, 255, 255, 0.10);
  --wash: rgba(255, 255, 255, 0.05);
  --accent: #3987e5;
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #d55181;
  --series-6: #008300;
  --series-7: #9085e9;
  --series-8: #e66767;
  --div-good: #3987e5;
  --div-bad: #e66767;
  --div-mid: #383835;
  --total: #a3a29b;
  --seq-1: #184f95; --seq-2: #256abf; --seq-3: #3987e5; --seq-4: #6da7ec; --seq-5: #9ec5f4;
  --nodata: #2c2c2a;
  --band: rgba(57, 135, 229, 0.22);
  --good-ink: #0ca30c;
  --panel: #1f232a;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--text-primary);
  font: 16px/1.5 var(--font);
}
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); letter-spacing: -0.01em; }
h2 { font-size: 1.125rem; }

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

/* header */
.site-header { background: var(--surface-1); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.header-row { display: flex; align-items: center; gap: 4px 16px; min-height: 56px; }
.brand { font-weight: 700; color: var(--text-primary); text-decoration: none; }
.tabs { display: flex; gap: 4px; overflow-x: auto; min-width: 0; flex: 1; scrollbar-width: none; }
.brand { flex: none; }
.nb { white-space: nowrap; }
.tabs a { color: var(--text-secondary); text-decoration: none; padding: 8px 10px; border-radius: 8px; white-space: nowrap; }
.tabs a:hover { background: var(--wash); }
.tabs a[aria-current="page"] { color: var(--text-primary); font-weight: 600; background: var(--wash); }

main { padding: 32px 0 48px; }
.view { display: grid; gap: 20px; }
.view[hidden], .tiles[hidden], .card[hidden], .chart[hidden] { display: none; }
.intro { display: grid; gap: 8px; margin-bottom: 4px; }
.eyebrow { margin: 0; color: var(--text-secondary); font-size: 0.875rem; font-weight: 600; }
.lede { margin: 0; color: var(--text-secondary); font-size: 1.0625rem; max-width: 68ch; }

.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.figure { display: grid; gap: 12px; min-width: 0; }
.figure header { display: grid; gap: 4px; }
.sub { margin: 0; color: var(--text-secondary); font-size: 0.875rem; }
.source { margin: 0; color: var(--text-muted); font-size: 0.75rem; }
.grid-2 { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }

/* hero + tiles */
.hero-row { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 860px) { .hero-row { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); } }
.hero { display: grid; align-content: center; gap: 4px; }
.label { margin: 0; color: var(--text-secondary); font-size: 0.875rem; }
.hero-value { margin: 0; font-size: clamp(3rem, 8vw, 4rem); font-weight: 650; line-height: 1.05; letter-spacing: -0.02em; }
.delta { margin: 0; color: var(--text-secondary); font-size: 0.875rem; }
.tiles { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 520px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tile { display: grid; gap: 4px; align-content: start; }
.tile-value { margin: 0; font-size: 1.75rem; font-weight: 650; line-height: 1.1; }

/* segmented control */
.seg { display: inline-flex; background: var(--wash); border-radius: 8px; padding: 2px; justify-self: start; flex-wrap: wrap; }
.seg button { font: inherit; font-size: 0.875rem; border: 0; background: transparent; color: var(--text-secondary); padding: 6px 12px; border-radius: 6px; cursor: pointer; min-height: 32px; }
.seg button[aria-selected="true"], .seg button[aria-pressed="true"] { background: var(--surface-1); color: var(--text-primary); font-weight: 600; box-shadow: 0 0 0 1px var(--border); }

/* legend */
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.8125rem; color: var(--text-secondary); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.key { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.key.line { width: 16px; height: 2px; border-radius: 1px; }
.key.dot { width: 8px; height: 8px; border-radius: 50%; }

/* charts */
.chart { width: 100%; min-height: 120px; position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-family: var(--font); }
.tick { fill: var(--axis-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.grid line { stroke: var(--grid); stroke-width: 1; }
.base { stroke: var(--baseline); stroke-width: 1; }
.val { fill: var(--text-primary); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.lab { fill: var(--text-secondary); font-size: 12px; }
.forecast-wash { fill: var(--wash); }
.crosshair { stroke: var(--baseline); stroke-width: 1; }

.tooltip {
  position: fixed; z-index: 50; pointer-events: none;
  background: var(--surface-1); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  padding: 8px 10px; font-size: 0.8125rem; max-width: 280px;
}
.tooltip .tt-title { font-weight: 600; margin-bottom: 4px; }
.tooltip .tt-row { display: flex; align-items: center; gap: 6px; justify-content: space-between; }
.tooltip .tt-row span:first-child { display: inline-flex; align-items: center; gap: 6px; color: var(--text-secondary); }
.tooltip .tt-row b { font-variant-numeric: tabular-nums; font-weight: 600; }

/* measures */
.controls { display: grid; gap: 12px; }
.search input {
  width: 100%; font: inherit; padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--page); color: var(--text-primary);
}
.control-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.select { display: inline-flex; align-items: center; gap: 8px; font-size: 0.875rem; color: var(--text-secondary); }
.select select { font: inherit; color: var(--text-primary); background: var(--page); border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: inherit; font-size: 0.8125rem; cursor: pointer;
  border: 1px solid var(--border); background: transparent; color: var(--text-secondary);
  padding: 4px 10px; border-radius: 999px; min-height: 32px;
}
.chip[aria-pressed="true"] { background: var(--text-primary); color: var(--surface-1); border-color: var(--text-primary); }
.chip .n { opacity: 0.7; margin-left: 4px; font-variant-numeric: tabular-nums; }

.summary { display: flex; flex-wrap: wrap; gap: 8px 24px; font-size: 0.9375rem; color: var(--text-secondary); }
.summary b { color: var(--text-primary); font-variant-numeric: tabular-nums; }

.measure-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.measure { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); }
.measure > button {
  all: unset; box-sizing: border-box; cursor: pointer; width: 100%;
  display: grid; gap: 8px 16px; padding: 14px 16px;
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 720px) {
  .measure > button { grid-template-columns: minmax(0, 1.4fr) minmax(220px, 1fr); align-items: center; }
}
.measure > button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius); }
.m-name { font-weight: 600; }
.m-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.pill { font-size: 0.75rem; color: var(--text-secondary); background: var(--wash); border-radius: 999px; padding: 1px 8px; }
.pill.head { font-weight: 600; }

.dbar { display: grid; grid-template-columns: 1fr 1fr; align-items: center; height: 24px; position: relative; }
.dbar::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--baseline); }
.dbar .neg, .dbar .pos { height: 14px; display: flex; align-items: center; }
.dbar .neg { justify-content: flex-end; }
.dbar .bar { height: 14px; min-width: 2px; }
.dbar .neg .bar { background: var(--div-bad); border-radius: 4px 0 0 4px; }
.dbar .pos .bar { background: var(--div-good); border-radius: 0 4px 4px 0; }
.dval { font-size: 0.8125rem; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dbar-wrap { display: grid; gap: 2px; }
.dbar-wrap .dval { text-align: center; }

.m-detail { padding: 0 16px 16px; display: grid; gap: 12px; }
.m-detail p { margin: 0; color: var(--text-secondary); font-size: 0.9375rem; max-width: 72ch; }
.years { width: 100%; border-collapse: collapse; font-size: 0.8125rem; font-variant-numeric: tabular-nums; }
.years th, .years td { padding: 4px 6px; text-align: right; border-bottom: 1px solid var(--grid); white-space: nowrap; }
.years th { color: var(--text-muted); font-weight: 500; }
.years td.focus, .years th.focus { font-weight: 700; color: var(--text-primary); }
.table-scroll { overflow-x: auto; }

.empty { color: var(--text-secondary); padding: 24px; text-align: center; }

/* prose */
.prose { max-width: 72ch; gap: 12px; }
.prose > * { margin: 0; }
.prose > h2 { margin-top: 20px; }
.prose ul { padding-left: 1.2em; display: grid; gap: 6px; }
.prose p, .prose li { color: var(--text-secondary); }

.site-footer { border-top: 1px solid var(--border); padding: 20px 0 32px; color: var(--text-muted); font-size: 0.8125rem; }
.site-footer p { margin: 0; }
.m-desc { color: var(--text-secondary); font-size: 0.875rem; margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 480px) { .site-header { position: static; } }

/* topics */
.topic-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.topic-card { display: grid; gap: 8px; align-content: start; text-decoration: none; color: inherit; transition: border-color 0.15s; }
.topic-card:hover { border-color: var(--text-muted); }
.topic-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.topic-card h2 { font-size: 1.125rem; }
.topic-card p { margin: 0; color: var(--text-secondary); font-size: 0.9375rem; }
.topic-card .net { color: var(--text-primary); font-weight: 600; font-size: 0.875rem; }
.back { font-size: 0.875rem; text-decoration: none; justify-self: start; }
.draft { font-size: 0.6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px; margin-left: 6px; color: var(--text-secondary); }
@media (min-width: 720px) { .tiles-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.mini-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.mini-list li { display: grid; grid-template-columns: minmax(0, 1fr) minmax(120px, 40%); gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--grid); }
.mini-list .m-name { font-weight: 500; font-size: 0.9375rem; }
.more { font-size: 0.875rem; font-weight: 600; text-decoration: none; justify-self: start; }
.prose-card { display: grid; gap: 12px; }
.prose-card p { margin: 0; color: var(--text-secondary); max-width: 72ch; }
#t-body { display: grid; gap: 12px; }
.t-charts { display: grid; gap: 20px; }
.placeholder { border-style: dashed; display: grid; gap: 8px; }
.placeholder p { margin: 0; color: var(--text-secondary); }
.reading { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 6px; }
.reading .org { color: var(--text-secondary); }
.callout { margin: 0; font-size: 0.9375rem; color: var(--text-secondary); }
.callout b { color: var(--text-primary); }

/* maps */
.hex { cursor: pointer; }
.hex:hover { opacity: 0.8; }
.tile { cursor: pointer; }
.tile-name { font-weight: 600; }
.tile-val { font-weight: 700; font-variant-numeric: tabular-nums; }
.tile-ink-dark { fill: #0b0b0b; }
.tile-ink-light { fill: #ffffff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tile-ink-dark { fill: #f0efec; } :root:not([data-theme="light"]) .tile-ink-light { fill: #0b0b0b; } }
:root[data-theme="dark"] .tile-ink-dark { fill: #f0efec; }
:root[data-theme="dark"] .tile-ink-light { fill: #0b0b0b; }
.key.nodata { background: var(--nodata); outline: 1px solid var(--border); }

/* places */
.lookup { display: grid; gap: 8px; position: relative; }
.lookup label { font-weight: 600; }
.lookup-row { display: flex; gap: 8px; }
.lookup-row input { flex: 1; min-width: 0; font: inherit; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--page); color: var(--text-primary); }
.lookup-row button, .btn { font: inherit; font-weight: 600; border: 0; border-radius: 8px; padding: 10px 16px; background: var(--text-primary); color: var(--surface-1); cursor: pointer; }
.suggest { list-style: none; margin: 0; padding: 4px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-1); max-height: 260px; overflow: auto; }
.suggest[hidden] { display: none; }
.suggest li { padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.suggest li[aria-selected="true"], .suggest li:hover { background: var(--wash); }
.suggest .r { color: var(--text-muted); font-size: 0.8125rem; margin-left: 6px; }
.error { margin: 0; color: var(--div-bad); font-size: 0.875rem; }
.error[hidden] { display: none; }
.places-grid { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 900px) { .places-grid { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); } .place-card { position: sticky; top: 76px; } }
.place-card { display: grid; gap: 14px; }
.place-card h2 { font-size: 1.375rem; }
.place-card .region { margin: 0; color: var(--text-secondary); font-size: 0.875rem; }
.stat-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.stat-list li { display: grid; gap: 2px; padding-top: 12px; border-top: 1px solid var(--grid); }
.stat-list .v { font-size: 1.375rem; font-weight: 650; }
.stat-list .k { color: var(--text-secondary); font-size: 0.875rem; }
.stat-list .c { color: var(--text-muted); font-size: 0.8125rem; }
.stat-list .t { font-size: 0.8125rem; }
.place-card h3 { font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin-top: 4px; }

.section-head { margin-top: 16px; }
.h2-lg { font-size: 1.5rem; }

/* front page: stories */
.stories { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 860px) { .stories { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.story { display: grid; gap: 6px; align-content: start; }
.story .kicker { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 0.8125rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; }
.story-n { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--text-primary); color: var(--surface-1); font-size: 0.75rem; letter-spacing: 0; }
.story-number { margin: 6px 0 0; font-size: clamp(2.25rem, 5vw, 2.75rem); font-weight: 650; line-height: 1; letter-spacing: -0.02em; }
.story-number-label { margin: 0; color: var(--text-secondary); font-size: 0.875rem; }
.story h2 { margin-top: 10px; font-size: 1.1875rem; }
.story p:not([class]) { margin: 0; color: var(--text-secondary); font-size: 0.9375rem; }
.story .more { margin-top: 6px; }

/* fiscal rules: three tabs over one shaded panel */
.rules-tabs { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface-1); }
.rules-tabs[hidden] { display: none; }
.rule-tablist { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.rule-tab { all: unset; box-sizing: border-box; cursor: pointer; display: flex; flex-direction: column; gap: 6px;
  padding: 16px; background: var(--surface-1); border-bottom: 1px solid var(--border); min-width: 0; }
.rule-tab + .rule-tab { border-left: 1px solid var(--border); }
.rule-tab:hover { background: var(--wash); }
.rule-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; }
.rule-tab[aria-selected="true"] { background: var(--panel); border-bottom-color: var(--panel); box-shadow: inset 0 3px 0 var(--text-primary); }
.rule-head { display: flex; align-items: center; gap: 8px; }
.rule-n { flex: none; display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--text-primary); font-weight: 700; font-size: 0.75rem; }
.rule-name { font-weight: 650; font-size: 1.0625rem; line-height: 1.25; }
.rule-short { color: var(--text-secondary); font-size: 0.9375rem; }
.rule-verdict { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 2px; }
.chip-status { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8125rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.chip-status.good { color: var(--good-ink); background: color-mix(in srgb, var(--good) 14%, transparent); }
.chip-status.bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, transparent); }
.verdict-detail { color: var(--text-secondary); font-size: 0.8125rem; }
.rule-panel { background: var(--panel); padding: 24px; display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr); }
.rule-panel:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
@media (min-width: 900px) { .rule-panel { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); } }
.rule-dl { margin: 0; display: grid; gap: 4px; align-content: start; }
.rule-dl dt { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin-top: 10px; }
.rule-dl dt:first-child { margin-top: 0; }
.rule-dl dd { margin: 0; color: var(--text-secondary); }
.rule-result { display: grid; gap: 10px; align-content: start; min-width: 0; }
.rule-result h4 { margin: 8px 0 0; font-size: 0.9375rem; }
.rule-result h4:first-child { margin-top: 0; }
.story-line { margin: 0; color: var(--text-secondary); }
.story-line b { color: var(--text-primary); }
/* phones: compact tabs (number, name, verdict chip); the panel's story line still states the margin */
@media (max-width: 640px) {
  .rule-tab { padding: 12px 10px; }
  .rule-head { flex-direction: column; align-items: flex-start; gap: 6px; }
  .rule-name { font-size: 0.9375rem; }
  .rule-short, .verdict-detail { display: none; }
  .chip-status { font-size: 0.75rem; padding: 2px 8px; }
  .rule-panel { padding: 16px; }
}
.cap-bar { display: flex; height: 44px; border-radius: 6px; overflow: hidden; gap: 2px; }
.cap-bar > div { display: flex; align-items: center; padding: 0 10px; font-size: 0.8125rem; font-weight: 600; white-space: nowrap; min-width: 0; }
.cap-bar .cap { background: var(--series-1); color: #fff; }
.cap-bar .margin { background: var(--band); color: var(--text-primary); }

.theme-toggle { flex: none; margin-left: auto; font: inherit; font-size: 0.8125rem; color: var(--text-secondary); background: transparent;
  border: 1px solid var(--border); border-radius: 999px; padding: 5px 12px; cursor: pointer; }
.theme-toggle:hover { color: var(--text-primary); }
.theme-toggle { display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 720px) { .theme-label { display: none; } .theme-toggle { padding: 5px 9px; } }

/* logo: light and dark artwork, swapped by theme */
.brand { display: inline-flex; align-items: center; }
.logo { display: block; height: 28px; width: auto; }
.logo-dark { display: none; }
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: block; }
@media (max-width: 520px) { .logo { height: 22px; } }

/* related sites + devolution rows */
.related { display: grid; gap: 8px; }
.related-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.related-list li { display: grid; gap: 2px; }
.devo-list .k b { color: var(--text-primary); font-weight: 600; }
.site-footer p + p { margin-top: 6px; }

/* pre-Budget preview mode */
.preview .data-only { display: none !important; }
.event-bar { background: var(--panel); border-bottom: 1px solid var(--border); }
.event-bar[hidden] { display: none; }
.event-bar p { margin: 0; padding: 10px 0; font-size: 0.9375rem; color: var(--text-secondary); }
.event-bar a { font-weight: 600; }
.stories.watch { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.watch-card h2 { margin-top: 4px; }
.chip-status.pending { color: var(--text-secondary); background: var(--wash); font-weight: 600; }
.controls[hidden] { display: none; }

/* feature card: a prominent link out to the sister site */
.feature { display: flex; align-items: center; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 24px; }
.feature[hidden] { display: none; }
.feature-text { display: grid; gap: 4px; max-width: 60ch; }
.feature-text h2 { font-size: 1.375rem; }
.feature-text p:not(.eyebrow) { margin: 0; color: var(--text-secondary); }
.btn-feature { display: inline-flex; align-items: center; gap: 8px; flex: none; font-weight: 650; text-decoration: none;
  background: var(--text-primary); color: var(--surface-1); padding: 12px 20px; border-radius: 999px; }
.btn-feature:hover { opacity: 0.9; }
.btn-feature:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (max-width: 520px) { .btn-feature { width: 100%; justify-content: center; } }

/* decorative illustrations (inline SVG, theme-aware) */
.il { display: block; width: 100%; height: auto; overflow: visible; }
.il .k { stroke: var(--text-primary); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.il .p { fill: var(--surface-1); }
.il .s { fill: var(--panel); }
.il .a { fill: var(--accent); }
.il .w { fill: var(--series-2); }
.il .r { fill: var(--series-8); }
.il .i { fill: var(--text-primary); }
.il .n { fill: none; }

/* where the illustrations sit */
.hero-split { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: center; }
.hero-art { display: none; }
@media (min-width: 720px) {
  .hero-split { grid-template-columns: minmax(0, 1fr) 200px; }
  .hero-art { display: block; background: var(--panel); border-radius: 16px; padding: 14px 18px; }
}
.card-art { display: block; width: 84px; padding: 6px 8px; margin-bottom: 6px; background: var(--panel); border-radius: 10px; }
.card-art:empty { display: none; }
.topic-card .card-art { width: 76px; }
/* phones: keep a small illustration on topic pages only */
@media (max-width: 719px) { #topic .hero-art { display: block; width: 88px; order: -1; } }

/* glossary terms */
.term { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: help;
  text-decoration: underline dotted var(--text-muted); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.term:hover, .term[aria-expanded="true"] { text-decoration-color: var(--accent); color: var(--text-primary); }
.term:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.term-pop { position: absolute; z-index: 60; background: var(--surface-1); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,0.16); padding: 12px 14px; font-size: 0.9375rem; }
.term-pop[hidden] { display: none; }
.term-pop b { display: block; }
.term-pop b::first-letter { text-transform: uppercase; }
.term-pop p { margin: 4px 0 0; color: var(--text-secondary); }

/* ---------- for you ---------- */
.fy-pick .chips { gap: 10px; }
.fy-pick .chip { font-size: 0.9375rem; padding: 6px 14px; }
.pill.you { font-weight: 600; color: var(--text-primary); }
.measure > .m-row { display: grid; gap: 8px 16px; padding: 14px 16px; color: inherit; text-decoration: none; border-radius: var(--radius); }
@media (min-width: 720px) { .measure > .m-row { grid-template-columns: minmax(0, 1.4fr) minmax(220px, 1fr); align-items: center; } }
.measure > .m-row:hover { background: var(--wash); }
.measure > .m-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- share ---------- */
.share { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; }
.share:empty { display: none; }
.share-label { font-size: 0.8125rem; font-weight: 600; color: var(--text-secondary); margin-right: 2px; }
.share button, .share a {
  font: inherit; font-size: 0.8125rem; cursor: pointer; text-decoration: none; color: var(--text-primary);
  border: 1px solid var(--border); background: var(--surface-1); padding: 3px 10px; border-radius: 999px; min-height: 28px;
  display: inline-flex; align-items: center;
}
.share button:hover, .share a:hover { border-color: var(--text-muted); }
.share :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- embeds ---------- */
.embed-row { display: flex; justify-content: flex-end; }
.embed-btn { font: inherit; font-size: 0.8125rem; color: var(--text-secondary); background: none; border: 0; padding: 4px 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.embed-btn:hover { color: var(--text-primary); }
body.embed { background: var(--surface-1); }
body.embed main.wrap { padding: 0; max-width: none; }
body.embed [data-embed] { border: 0; box-shadow: none; margin: 0; }
.embed-credit { margin: 4px 0 0; font-size: 0.8125rem; }
.embed-credit a { color: var(--text-secondary); }

/* ---------- AI disclosure ---------- */
.ai-note { margin: 12px 0 0; font-size: 0.875rem; color: var(--text-secondary); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.ai-badge { font-size: 0.6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--accent); border: 1px solid currentColor; border-radius: 4px; padding: 1px 6px; }

/* ---------- feedback form ---------- */
.feedback { display: grid; gap: 14px; max-width: 560px; }
.feedback .field { display: grid; gap: 6px; }
.feedback label, .feedback legend { font-weight: 600; color: var(--text-primary); font-size: 0.9375rem; }
.feedback .opt { font-weight: 400; color: var(--text-muted); }
.feedback input[type=text], .feedback input[type=email], .feedback textarea {
  font: inherit; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--page); color: var(--text-primary); width: 100%; box-sizing: border-box;
}
.feedback textarea { min-height: 120px; resize: vertical; }
.feedback input:focus-visible, .feedback textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.feedback fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; }
.feedback .seg { justify-self: start; }
.feedback .hp { position: absolute; left: -9999px; }
.feedback .btn { justify-self: start; }
.feedback .btn[disabled] { opacity: 0.6; cursor: wait; }
.form-status { margin: 0; font-weight: 600; }
.form-status.err { color: var(--bad); }
.small { font-size: 0.8125rem; color: var(--text-muted); }
.feedback .seg label { font-weight: 400; cursor: pointer; }
.feedback .seg span { display: inline-flex; align-items: center; font-size: 0.875rem; color: var(--text-secondary); padding: 6px 12px; border-radius: 6px; min-height: 32px; box-sizing: border-box; }
.feedback .seg input:checked + span { background: var(--surface-1); color: var(--text-primary); font-weight: 600; box-shadow: 0 0 0 1px var(--border); }
.feedback .seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

.fy-pick { display: grid; gap: 12px; }
.fy-presets { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.fy-presets-label, .fy-or { font-size: 0.875rem; font-weight: 600; color: var(--text-secondary); margin: 0; }
.preset { font: inherit; font-size: 0.9375rem; font-weight: 600; cursor: pointer; border: 1px solid var(--accent); color: var(--accent); background: transparent; padding: 6px 14px; border-radius: 999px; min-height: 36px; }
.preset:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.preset[aria-pressed="true"] { background: var(--accent); color: var(--surface-1); }
.preset:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fy-verdict { display: grid; gap: 12px; }
.fy-verdict h2 { font-size: 1.375rem; line-height: 1.25; text-wrap: balance; margin: 0; }
.fy-split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.fy-side { display: grid; gap: 2px; align-content: start; padding: 14px 16px; border-radius: 10px; background: var(--wash); color: inherit; text-decoration: none; border: 1px solid transparent; }
.fy-side:hover { border-color: var(--border); }
.fy-side:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fy-n { font-size: 2.25rem; font-weight: 700; line-height: 1.05; font-variant-numeric: tabular-nums; }
.fy-k { font-weight: 600; }
.fy-top { font-size: 0.8125rem; color: var(--text-secondary); margin-top: 4px; }
.fy-groups { display: grid; gap: 28px; }
.fy-group { display: grid; gap: 8px; scroll-margin-top: 80px; }
.fy-group h3 { margin: 0; font-size: 1.125rem; display: flex; align-items: baseline; gap: 8px; }
.fy-group h3 .n { font-size: 0.875rem; color: var(--text-muted); font-weight: 600; }
.fy-group .sub { margin: 0 0 4px; }
@media (max-width: 420px) { .fy-n { font-size: 1.875rem; } }
.share-result { margin-top: 4px; padding-top: 14px; border-top: 1px solid var(--border); gap: 8px; }
.share-result .btn { min-height: 40px; margin-right: 4px; background: var(--text-primary); color: var(--surface-1); border: 0; border-radius: 8px; padding: 10px 18px; font-size: 0.9375rem; font-weight: 600; justify-content: center; }
.share-result .btn:hover { opacity: 0.9; }
@media (max-width: 520px) { .share-result .btn { width: 100%; margin: 0 0 4px; } }
.share[hidden] { display: none; }
