/* ============================================================
   Algorithmic Bias in Homeless Vulnerability Assessment
   Palette: validated categorical/ordinal steps (dataviz reference)
   ============================================================ */

:root {
  color-scheme: light;

  /* surfaces & ink */
  --plane:        #f9f9f7;
  --surface:      #fcfcfb;
  --surface-sunk: #f2f2ee;
  --ink:          #0b0b0b;
  --ink-2:        #52514e;
  --ink-muted:    #898781;
  --rule:         #e1e0d9;
  --rule-strong:  #c3c2b7;
  --ring:         rgba(11, 11, 11, 0.10);

  /* categorical series slots (fixed order, never cycled) */
  --series-1: #2a78d6;  /* blue   */
  --series-2: #eb6834;  /* orange */
  --series-3: #1baf7a;  /* aqua   */
  --series-4: #eda100;  /* yellow */
  --series-5: #e87ba4;  /* magenta */

  /* ordinal blue ramp for triage bands (light: darker = higher need) */
  --band-1: #86b6ef;
  --band-2: #2a78d6;
  --band-3: #104281;

  --font-display: "Newsreader", Georgia, "Times New Roman", serif;
  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  --wrap: 1120px;
  --prose: 68ch;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --plane:        #0d0d0d;
    --surface:      #1a1a19;
    --surface-sunk: #141413;
    --ink:          #ffffff;
    --ink-2:        #c3c2b7;
    --ink-muted:    #898781;
    --rule:         #2c2c2a;
    --rule-strong:  #383835;
    --ring:         rgba(255, 255, 255, 0.10);

    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --series-5: #d55181;

    /* dark: lighter = higher need, so the ramp reads against the surface */
    --band-1: #184f95;
    --band-2: #3987e5;
    --band-3: #9ec5f4;
  }
}

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

html { scroll-behavior: smooth; scroll-padding-top: 5rem; }

body {
  margin: 0;
  background: var(--plane);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---------- nav ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--plane) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(10px);
  border-bottom: 1px solid var(--rule);
}

.topbar-inner {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0.7rem 1.75rem;
  display: flex;
  align-items: baseline;
  gap: 1.5rem;
}

.topbar-mark {
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.topbar nav {
  display: flex;
  gap: 1.1rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.topbar nav::-webkit-scrollbar { display: none; }

.topbar nav a {
  color: var(--ink-muted);
  text-decoration: none;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  padding-bottom: 2px;
  border-bottom: 1.5px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.topbar nav a:hover { color: var(--ink); border-bottom-color: var(--series-1); }

/* ---------- hero ---------- */

.hero {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 4rem 1.75rem 2.5rem;
}

.eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 0 0 1.1rem;
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  line-height: 1.08;
  letter-spacing: -0.022em;
  margin: 0 0 0.9rem;
  max-width: 20ch;
}

.hero-sub {
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  color: var(--ink-2);
  max-width: 52ch;
  margin: 0 0 2rem;
  line-height: 1.5;
}

.hero-rule {
  border: 0;
  border-top: 3px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  height: 5px;
  margin: 0 0 1.1rem;
  max-width: 100%;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
  font-size: 0.8rem;
  color: var(--ink-muted);
  letter-spacing: 0.02em;
}
.hero-meta strong { color: var(--ink-2); font-weight: 500; }

/* ---------- sections ---------- */

main {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 1.75rem 5rem;
}

.section {
  padding-top: 3.5rem;
  margin-top: 3.5rem;
  border-top: 1px solid var(--rule);
}
.section:first-child { border-top: 0; margin-top: 0; }

.section-head {
  display: grid;
  grid-template-columns: 3.5rem 1fr;
  gap: 0 1rem;
  align-items: baseline;
  margin-bottom: 1.75rem;
}

.section-num {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--series-1);
  font-variant-numeric: tabular-nums;
}

.section-head h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.4rem, 2.6vw, 1.85rem);
  letter-spacing: -0.015em;
  line-height: 1.2;
  margin: 0;
}

.section-body { padding-left: 0; }
@media (min-width: 720px) {
  .section-body { padding-left: 4.5rem; }
}

.subhead {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 2.25rem 0 0.85rem;
}

.prose {
  font-family: var(--font-display);
  font-size: 1.05rem;
  line-height: 1.68;
  color: var(--ink-2);
  max-width: var(--prose);
}
.prose p { margin: 0 0 1.1rem; }
.prose p:last-child { margin-bottom: 0; }
.prose em { font-style: italic; }
.prose strong { color: var(--ink); font-weight: 600; }

/* ---------- pull quote (the research question) ---------- */

.pullquote {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 2.5vw, 1.6rem);
  line-height: 1.42;
  letter-spacing: -0.012em;
  color: var(--ink);
  border-left: 3px solid var(--series-1);
  padding: 0.15rem 0 0.15rem 1.5rem;
  margin: 0 0 1.75rem;
  max-width: 40ch;
}

.hypothesis {
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--surface);
  padding: 1rem 1.25rem;
  max-width: var(--prose);
  margin-top: 1.5rem;
}
.hypothesis .kicker {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 0.4rem;
}
.hypothesis p {
  font-family: var(--font-display);
  font-size: 1rem;
  line-height: 1.6;
  margin: 0;
  color: var(--ink);
}

/* ---------- design note ---------- */

.designnote {
  border-left: 2px solid var(--rule-strong);
  background: var(--surface-sunk);
  padding: 0.9rem 1.1rem;
  margin: 1.75rem 0 0;
  max-width: var(--prose);
  font-size: 0.86rem;
  line-height: 1.6;
  color: var(--ink-2);
}
.designnote .kicker {
  display: block;
  font-size: 0.66rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 0.35rem;
}
.designnote p { margin: 0 0 0.6rem; }
.designnote p:last-child { margin-bottom: 0; }

/* ---------- source record ---------- */

.record {
  border: 1px solid var(--rule);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 1.75rem;
  max-width: 640px;
  background: var(--surface);
}
.record-row {
  display: grid;
  grid-template-columns: 11rem 1fr;
  border-top: 1px solid var(--rule);
  font-size: 0.86rem;
}
.record-row:first-child { border-top: 0; }
.record-row dt {
  padding: 0.65rem 1rem;
  background: var(--surface-sunk);
  color: var(--ink-muted);
  font-size: 0.72rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  margin: 0;
}
.record-row dd {
  padding: 0.65rem 1rem;
  margin: 0;
  color: var(--ink);
}
@media (max-width: 560px) {
  .record-row { grid-template-columns: 1fr; }
  .record-row dd { padding-top: 0; }
}

/* ---------- category lists (genders / races) ---------- */

.catgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1.5rem;
  margin-top: 1.75rem;
}
.catgrid h3 {
  font-size: 0.72rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 0 0 0.7rem;
  font-weight: 600;
}
.catlist { list-style: none; margin: 0; padding: 0; }
.catlist li {
  font-size: 0.9rem;
  padding: 0.4rem 0;
  border-top: 1px solid var(--rule);
  color: var(--ink);
}
.catlist li:first-child { border-top: 0; }

/* ---------- stat row ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 2rem;
}
.stat {
  background: var(--surface);
  padding: 1.1rem 1.15rem;
}
.stat-value {
  font-family: var(--font-ui);
  font-size: 1.85rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--ink);
}
.stat-label {
  font-size: 0.76rem;
  color: var(--ink-muted);
  margin-top: 0.3rem;
  line-height: 1.4;
}

/* ---------- chart card ---------- */

.chart-card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 1.4rem 1.5rem 1.25rem;
  margin-top: 2rem;
}

.chart-title {
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  margin: 0 0 0.25rem;
  color: var(--ink);
}
.chart-sub {
  font-size: 0.82rem;
  color: var(--ink-muted);
  margin: 0 0 1.1rem;
  max-width: 62ch;
  line-height: 1.5;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.25rem;
  margin-bottom: 0.9rem;
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
  color: var(--ink-2);
}
.legend-swatch {
  width: 11px;
  height: 11px;
  border-radius: 2px;
  flex: none;
}
.legend-swatch.is-blank {
  background: transparent;
  border: 1.5px dashed var(--rule-strong);
}

.chart-scroll { overflow-x: auto; }
.chart-scroll svg { display: block; }

.chart-foot {
  font-size: 0.78rem;
  color: var(--ink-muted);
  line-height: 1.55;
  margin: 0.9rem 0 0;
  padding-top: 0.9rem;
  border-top: 1px solid var(--rule);
  max-width: 76ch;
}

/* chart internals */
.axis-label { font-size: 11px; fill: var(--ink-muted); font-family: var(--font-ui); }
.axis-title { font-size: 11px; fill: var(--ink-2); font-family: var(--font-ui); letter-spacing: 0.04em; }
.tick-text { font-size: 11px; fill: var(--ink-muted); font-family: var(--font-ui); font-variant-numeric: tabular-nums; }
.gridline { stroke: var(--rule); stroke-width: 1; shape-rendering: crispEdges; }
.baseline { stroke: var(--rule-strong); stroke-width: 1; shape-rendering: crispEdges; }
.blank-bar { fill: none; stroke: var(--rule-strong); stroke-width: 1.5; stroke-dasharray: 3 3; }
.blank-mark { font-size: 12px; fill: var(--ink-muted); font-family: var(--font-ui); text-anchor: middle; }
.awaiting {
  font-family: var(--font-ui);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  fill: var(--ink-muted);
  text-anchor: middle;
}

/* ---------- toggle button ---------- */

.btn {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: 3px;
  padding: 0.45rem 0.9rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.btn:hover { border-color: var(--series-1); color: var(--ink); }
.btn:focus-visible { outline: 2px solid var(--series-1); outline-offset: 2px; }

.toggle-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
  margin-top: 2rem;
}
.toggle-hint { font-size: 0.78rem; color: var(--ink-muted); }

/* ---------- filters ---------- */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}
.chip {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: 100px;
  padding: 0.3rem 0.8rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: border-color 0.15s, color 0.15s;
}
.chip:hover { border-color: var(--ink-muted); color: var(--ink); }
.chip[aria-pressed="true"] {
  border-color: var(--ink);
  color: var(--ink);
  background: var(--surface-sunk);
  font-weight: 500;
}
.chip .dot { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.chip-count { color: var(--ink-muted); font-variant-numeric: tabular-nums; }

/* ---------- data table ---------- */

.table-wrap {
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--surface);
  max-height: 620px;
  overflow: auto;
}

table.data {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.84rem;
}

table.data thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-sunk);
  color: var(--ink-muted);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: left;
  padding: 0.7rem 0.75rem;
  border-bottom: 1px solid var(--rule-strong);
  white-space: nowrap;
}
table.data thead th.num { text-align: right; }

table.data tbody td {
  padding: 0.7rem 0.75rem;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
  color: var(--ink-2);
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: var(--surface-sunk); }

td.num, th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
td.id {
  font-variant-numeric: tabular-nums;
  color: var(--ink-muted);
  font-size: 0.78rem;
  white-space: nowrap;
}
td.total { font-weight: 600; }

.p-label { color: var(--ink); font-weight: 500; display: block; margin-bottom: 0.15rem; }
.p-vignette {
  font-size: 0.79rem;
  color: var(--ink-muted);
  line-height: 1.5;
  display: block;
  max-width: 40ch;
}

/* composition bar (stacked, 2px surface gaps) */
.compo {
  display: flex;
  gap: 2px;
  width: 118px;
  height: 9px;
  background: var(--surface-sunk);
  border-radius: 2px;
  overflow: hidden;
}
.compo span { display: block; height: 100%; }
.compo .d1 { background: var(--series-1); }
.compo .d2 { background: var(--series-2); }
.compo .d3 { background: var(--series-3); }
.compo .d4 { background: var(--series-4); }

/* ---------- instrument reference table ---------- */

.instrument-wrap { max-height: 560px; }

table.instrument td { font-size: 0.82rem; }
table.instrument .ind-name { color: var(--ink); font-weight: 500; white-space: nowrap; }
table.instrument .ind-q {
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-size: 0.78rem;
}
table.instrument .ind-rule { color: var(--ink-2); max-width: 44ch; }

tr.domain-row th {
  position: static;
  background: var(--surface-sunk);
  border-top: 1px solid var(--rule-strong);
  border-bottom: 1px solid var(--rule);
  padding: 0.55rem 0.75rem;
  text-align: left;
  font-size: 0.72rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink);
  font-weight: 600;
}
tr.domain-row .domain-chip { margin-right: 0.5rem; }
tr.domain-row .domain-max {
  float: right;
  color: var(--ink-muted);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: none;
}

.domain-chip {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  vertical-align: baseline;
  flex: none;
}

/* ---------- run schedule ---------- */

.session-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 1rem;
}

.session-chip {
  font-family: var(--font-ui);
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
  min-width: 30px;
  padding: 0.25rem 0.4rem;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: 3px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.session-chip:hover { border-color: var(--ink-muted); color: var(--ink); }
.session-chip[aria-pressed="true"] {
  border-color: var(--series-1);
  background: var(--series-1);
  color: #fff;
  font-weight: 600;
}
.session-chip:focus-visible { outline: 2px solid var(--series-1); outline-offset: 2px; }

.session-wrap { max-height: 420px; }

table.schedule td { font-size: 0.82rem; white-space: nowrap; }
table.schedule td.pos { color: var(--ink-muted); width: 1%; }
td.disclosure { color: var(--ink-2); }
td.disclosure.partial { color: var(--ink); font-weight: 500; }

/* ---------- table controls ---------- */

.table-controls {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.table-controls .filters { margin-bottom: 0; }

.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.76rem; }

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

/* ---------- expandable profile rows ---------- */

td.toggle-cell { width: 1%; padding-right: 0; }

.row-toggle {
  width: 20px;
  height: 20px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  color: var(--ink-muted);
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: 3px;
  cursor: pointer;
  padding: 0;
}
.row-toggle:hover { border-color: var(--series-1); color: var(--ink); }
.row-toggle:focus-visible { outline: 2px solid var(--series-1); outline-offset: 2px; }

tr.profile-row.is-open td { background: var(--surface-sunk); }

tr.detail-row td {
  background: var(--surface-sunk);
  border-bottom: 1px solid var(--rule-strong);
  padding: 0 0.75rem 0.9rem 2.4rem;
}

.person-detail { padding: 0.9rem 0 1rem; }

.design-role {
  display: inline-block;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: 3px;
  padding: 0.2rem 0.5rem;
  margin: 0 0 0.85rem;
}

.attr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 0.85rem 1.6rem;
}
.attr-label {
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  font-weight: 600;
  margin-bottom: 0.2rem;
}
.attr-value {
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--ink-2);
}

.ind-detail {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: 0.9rem 1.4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
}

.p-age {
  display: block;
  font-size: 0.74rem;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  margin-bottom: 0.2rem;
}

.ind-block-head {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  font-weight: 600;
  margin-bottom: 0.45rem;
  white-space: nowrap;
}

.ind-chip {
  display: inline-block;
  font-size: 0.74rem;
  line-height: 1.3;
  padding: 0.2rem 0.5rem;
  margin: 0 0.25rem 0.25rem 0;
  border-radius: 3px;
  border: 1px solid var(--rule);
  cursor: help;
}
.ind-chip.on {
  color: var(--ink);
  background: var(--surface);
  border-width: 1px;
  font-weight: 500;
}
.ind-chip.off {
  color: var(--ink-muted);
  background: transparent;
  border-style: dashed;
  text-decoration: line-through;
  text-decoration-color: var(--rule-strong);
}

td.num.zero { color: var(--ink-muted); }

/* threshold markers on the distribution chart */
.threshold {
  stroke: var(--ink-muted);
  stroke-width: 1;
  stroke-dasharray: 2 3;
  shape-rendering: crispEdges;
}
.threshold-label {
  font-size: 10px;
  fill: var(--ink-muted);
  font-family: var(--font-ui);
  letter-spacing: 0.06em;
}

.band-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.76rem;
  color: var(--ink-2);
  white-space: nowrap;
}
.band-tag .dot { width: 9px; height: 9px; border-radius: 2px; flex: none; }

.table-note {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: var(--ink-muted);
  margin-top: 0.7rem;
}
.table-note a { color: var(--series-1); }

/* ---------- results (blank) table ---------- */

table.results { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
table.results th, table.results td {
  padding: 0.6rem 0.7rem;
  border-bottom: 1px solid var(--rule);
  text-align: left;
}
table.results thead th {
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  font-weight: 600;
}
table.results thead tr.group th {
  border-bottom: 1px solid var(--rule-strong);
  color: var(--ink-2);
  letter-spacing: 0.08em;
}
table.results th.grp { text-align: center; border-left: 1px solid var(--rule); }
table.results td.blank {
  text-align: center;
  color: var(--rule-strong);
  font-variant-numeric: tabular-nums;
}
table.results td.set { text-align: center; font-variant-numeric: tabular-nums; color: var(--ink-2); }
table.results td.cmp { color: var(--ink); }
table.results td.sep, table.results th.sep { border-left: 1px solid var(--rule); }
table.results tbody tr:last-child td { border-bottom: 0; }

/* ---------- questions list ---------- */

.qlist { list-style: none; margin: 1.75rem 0 0; padding: 0; max-width: var(--prose); counter-reset: q; }
.qlist li {
  position: relative;
  padding: 0.85rem 0 0.85rem 2.5rem;
  border-top: 1px solid var(--rule);
  font-family: var(--font-display);
  font-size: 0.98rem;
  line-height: 1.6;
  color: var(--ink-2);
  counter-increment: q;
}
.qlist li::before {
  content: counter(q, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 0.95rem;
  font-family: var(--font-ui);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--series-1);
}

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--rule);
  background: var(--surface);
}
.footer-inner {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 2.5rem 1.75rem 3.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 2rem;
}
.footer-inner h3 {
  font-size: 0.7rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 0 0 0.7rem;
  font-weight: 600;
}
.footer-inner p, .footer-inner li {
  font-size: 0.83rem;
  color: var(--ink-2);
  line-height: 1.6;
  margin: 0 0 0.5rem;
}
.footer-inner ul { list-style: none; margin: 0; padding: 0; }
.footer-inner a { color: var(--series-1); text-decoration: none; }
.footer-inner a:hover { text-decoration: underline; }

/* ---------- tooltip ---------- */

.tooltip {
  position: fixed;
  pointer-events: none;
  z-index: 100;
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: 3px;
  box-shadow: 0 4px 14px var(--ring);
  padding: 0.5rem 0.65rem;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--ink);
  max-width: 240px;
  opacity: 0;
  transition: opacity 0.12s;
}
.tooltip.visible { opacity: 1; }
.tooltip .tt-title { font-weight: 600; margin-bottom: 0.25rem; display: block; }
.tooltip .tt-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.tooltip .tt-dot { width: 9px; height: 9px; border-radius: 2px; flex: none; }

[hidden] { display: none !important; }

/* ---------- result callout ---------- */

.finding {
  border: 1px solid var(--rule-strong);
  border-left: 3px solid var(--series-1);
  border-radius: 3px;
  background: var(--surface);
  padding: 1.1rem 1.35rem;
  margin: 1.75rem 0 0;
  max-width: var(--prose);
}
.finding .kicker {
  display: block;
  font-size: 0.66rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--series-1);
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.finding p {
  font-size: 0.92rem;
  line-height: 1.62;
  color: var(--ink-2);
  margin: 0 0 0.75rem;
}
.finding p:last-child { margin-bottom: 0; }
.finding strong { color: var(--ink); font-weight: 600; }

/* filled result cells */
table.results td.filled {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  text-align: center;
}
table.results td.filled.sig { font-weight: 600; }

.stamp {
  display: inline-block;
  margin-left: 0.5rem;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.bar-value {
  font-size: 11px;
  fill: var(--ink-2);
  font-family: var(--font-ui);
  font-variant-numeric: tabular-nums;
  text-anchor: middle;
}

.level-line {
  stroke: var(--ink-muted);
  stroke-width: 1;
  stroke-dasharray: 2 3;
  opacity: 0.7;
}

/* ---------- locations & session stepper ---------- */

.cat-note { color: var(--ink-muted); font-size: 0.74rem; margin-left: 0.35rem; }

.session-stepper {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.select {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: 3px;
  padding: 0.3rem 0.5rem;
}
.select:focus-visible { outline: 2px solid var(--series-1); outline-offset: 2px; }

/* ---------- model roster ---------- */

:root {
  /* status steps are reserved for state and always ship with a text label */
  --status-good: #0ca30c;
  --status-warning: #fab219;
}

.models-wrap { margin-top: 1.5rem; max-height: none; }
table.models td { font-size: 0.82rem; }
.mono {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.78rem;
  color: var(--ink-2);
}

.status-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.76rem;
  color: var(--ink-2);
  white-space: nowrap;
}
.status-tag::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid var(--rule-strong);
  flex: none;
}
.status-tag.complete::before { background: var(--status-good); border-color: var(--status-good); }
.status-tag.partial::before { background: var(--status-warning); border-color: var(--status-warning); }

/* ---------- results controls ---------- */

.results-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.75rem;
  align-items: center;
  margin-top: 2rem;
}
.control-group { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.control-label {
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  font-weight: 600;
  margin-right: 0.25rem;
}
.chip.is-empty { color: var(--ink-muted); border-style: dashed; }

/* ---------- results tables ---------- */

.results-scroll { overflow-x: auto; }
table.results th.model-col { text-align: center; white-space: nowrap; border-left: 1px solid var(--rule); }
table.results td.cell {
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  white-space: nowrap;
}
table.results td.cell.sep { border-left: 1px solid var(--rule); }
table.results td.cell.empty { color: var(--rule-strong); }
table.results td.cell.sig { font-weight: 600; }
table.results td.cell .sig-mark { color: var(--ink-muted); font-weight: 400; margin-left: 2px; }
table.results tr.ref-row td { background: var(--surface-sunk); }
table.results td.cmp .sub { display: block; font-size: 0.74rem; color: var(--ink-muted); }

.truth-line { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 5 3; opacity: 0.5; }
.legend-line { width: 16px; height: 0; border-top: 1.5px dashed var(--ink-2); opacity: 0.8; flex: none; }
.control-group .filters { margin-bottom: 0; }

/* labels drawn over the reference line keep a surface halo so the dash never strikes them */
#chart-means .bar-value,
#chart-means .truth-label {
  paint-order: stroke;
  stroke: var(--surface);
  stroke-width: 4px;
  stroke-linejoin: round;
}
.truth-label { font-size: 10px; fill: var(--ink-2); font-family: var(--font-ui); }

/* ---------- results: structure ---------- */

:root {
  /* diverging pair: blue (lower) <-> red (higher), neutral gray midpoint */
  --div-neg: #2a78d6;
  --div-mid: #f0efec;
  --div-pos: #e34948;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --div-neg: #3987e5;
    --div-mid: #383835;
    --div-pos: #e66767;
  }
}

.results-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  margin: 1.75rem 0 0;
  padding: 0.75rem 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.results-nav a {
  font-size: 0.78rem;
  color: var(--ink-2);
  text-decoration: none;
  padding: 0.2rem 0.55rem;
  border-radius: 3px;
  white-space: nowrap;
}
.results-nav a:hover { background: var(--surface-sunk); color: var(--ink); }
.results-nav a span { color: var(--series-1); font-weight: 600; font-variant-numeric: tabular-nums; margin-right: 0.2rem; }

.model-bar {
  position: sticky;
  top: 2.9rem;
  z-index: 20;
  background: color-mix(in srgb, var(--plane) 92%, transparent);
  backdrop-filter: blur(8px);
  padding: 0.6rem 0;
  margin-top: 0.5rem;
  border-bottom: 1px solid var(--rule);
}

.subsection { margin-top: 3.25rem; scroll-margin-top: 7rem; }
.subsection-head {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding-bottom: 0.55rem;
  margin-bottom: 1.1rem;
  border-bottom: 1px solid var(--rule-strong);
}
.subsection-num {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--series-1);
  font-variant-numeric: tabular-nums;
}
.subsection-head h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.3rem;
  letter-spacing: -0.01em;
  margin: 0;
}

.chip-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.9rem; }
.table-note-inline { font-size: 0.76rem; color: var(--ink-muted); font-variant-numeric: tabular-nums; }

/* ---------- navigation and accessibility ---------- */

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 200;
  background: var(--ink);
  color: var(--plane);
  padding: 0.5rem 0.9rem;
  border-radius: 3px;
  font-size: 0.85rem;
  text-decoration: none;
}
.skip-link:focus { top: 0.6rem; }

.to-top {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 60;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: 100px;
  padding: 0.45rem 0.9rem;
  text-decoration: none;
  box-shadow: 0 2px 10px var(--ring);
}
.to-top:hover { border-color: var(--series-1); }

a:focus-visible, button:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--series-1);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}

/* collapsible subsections: the header is the toggle */
details.subsection > summary { list-style: none; cursor: pointer; }
details.subsection > summary::-webkit-details-marker { display: none; }
details.subsection > summary::after {
  content: "Show";
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--series-1);
  border: 1px solid var(--rule-strong);
  border-radius: 100px;
  padding: 0.15rem 0.65rem;
}
details.subsection[open] > summary::after { content: "Hide"; }
details.subsection > summary:hover h3 { color: var(--series-1); }
details.subsection:not([open]) { margin-top: 1.25rem; }
details.subsection:not([open]) > summary { margin-bottom: 0; }

/* collapsible blocks inside Method and Base profiles */
details.fold {
  margin-top: 2rem;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--surface);
}
details.fold > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
}
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after {
  content: "Show";
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--series-1);
}
details.fold[open] > summary::after { content: "Hide"; }
details.fold[open] > summary { border-bottom: 1px solid var(--rule); }
.fold-body { padding: 0 1.1rem 1.25rem; }
.fold-body > .subhead:first-child { margin-top: 1.25rem; }
.muted-inline { color: var(--ink-muted); }

.two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 0 1.25rem;
}

/* ---------- results: KPI row ---------- */

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: 3px;
  overflow: hidden;
}
.kpi { background: var(--surface); padding: 1rem 1.1rem 0.95rem; }
.kpi-label {
  font-size: 0.68rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-muted);
  font-weight: 600;
}
.kpi-values { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0.2rem 0.6rem; margin-top: 0.4rem; }
.kpi-main { font-size: 1.65rem; font-weight: 600; letter-spacing: -0.02em; color: var(--ink); line-height: 1.1; }
.kpi-ref { font-size: 0.78rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.kpi-note { font-size: 0.72rem; color: var(--ink-muted); margin-top: 0.35rem; line-height: 1.4; }

/* ---------- results: charts ---------- */

.legend-item svg { flex: none; overflow: visible; }
.identity-line { stroke: var(--ink-muted); stroke-width: 1; stroke-dasharray: 4 4; }
.guide-line { stroke: var(--ink-muted); stroke-width: 1; }
.zero-line { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 3 3; }
.family-rule { stroke: var(--rule); stroke-width: 1; }
.row-label { font-size: 11.5px; fill: var(--ink-2); font-family: var(--font-ui); }
.row-label .id { fill: var(--ink-muted); font-variant-numeric: tabular-nums; }
.hover-row { fill: transparent; }
.hover-row:hover { fill: var(--surface-sunk); }
.heat-head { font-size: 11px; fill: var(--ink-2); font-family: var(--font-ui); font-weight: 600; letter-spacing: 0.03em; }
.heat-value { font-size: 12px; font-family: var(--font-ui); font-variant-numeric: tabular-nums; font-weight: 500; pointer-events: none; }
.grad-legend-wrap { align-items: center; margin-top: 0.4rem; }
.grad-caption { font-size: 0.76rem; color: var(--ink-muted); }

/* ---------- results: map ---------- */

.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(250px, 1fr);
  gap: 1.25rem;
  align-items: start;
}
@media (max-width: 820px) { .map-layout { grid-template-columns: 1fr; } }
.map svg { display: block; width: 100%; height: auto; }
.state { fill: var(--surface-sunk); stroke: var(--rule-strong); stroke-width: 0.7; }
.nation { fill: none; stroke: var(--ink-muted); stroke-width: 1; }
.city { cursor: pointer; outline: none; }
.city-dot { stroke: var(--surface); stroke-width: 3; }
.city-sig { fill: none; stroke: var(--ink); stroke-width: 2.5; }
.city:focus-visible .city-dot { stroke: var(--series-1); }
.city-num { font-size: 15px; font-weight: 600; font-family: var(--font-ui); font-variant-numeric: tabular-nums; pointer-events: none; }
.city-label {
  font-size: 21px;
  font-weight: 500;
  font-family: var(--font-ui);
  fill: var(--ink);
  paint-order: stroke;
  stroke: var(--surface);
  stroke-width: 6px;
  stroke-linejoin: round;
  pointer-events: none;
}
table.results.compact th, table.results.compact td { padding: 0.5rem 0.55rem; }
table.results tr.is-active td { background: var(--surface-sunk); }

/* underdisclosure replacement text in an expanded profile row */
.override { margin-top: 1rem; padding-top: 0.85rem; border-top: 1px dashed var(--rule-strong); }
.override-head {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
  font-weight: 600;
  margin: 0 0 0.6rem;
}


/* ============================================================
   Dashboard shell: sidebar, sticky header, one view at a time
   ============================================================ */

.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
/* grid items default to their content's width; let the menu scroll instead of widening the page */
.app > * { min-width: 0; }
.view .chart-card + .chart-card { margin-top: 1.25rem; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  padding: 1.25rem 0.85rem;
  background: var(--surface);
  border-right: 1px solid var(--rule);
}
.brand {
  display: block;
  padding: 0 0.6rem;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
  text-decoration: none;
}
.brand small {
  display: block;
  margin-top: 0.3rem;
  font-family: var(--font-ui);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.side-nav { display: flex; flex-direction: column; gap: 1.1rem; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-label {
  padding: 0 0.6rem 0.3rem;
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.side-nav a {
  display: block;
  padding: 0.45rem 0.6rem;
  border-radius: 4px;
  font-size: 0.86rem;
  color: var(--ink-2);
  text-decoration: none;
}
.side-nav a:hover { background: var(--surface-sunk); color: var(--ink); }
.side-nav a[aria-current="page"] { background: var(--series-1); color: #fff; font-weight: 600; }
.side-foot { margin-top: auto; padding: 0 0.6rem; font-size: 0.7rem; line-height: 1.5; color: var(--ink-muted); }

.app-main { display: flex; flex-direction: column; min-width: 0; }
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem 1.5rem;
  padding: 0.85rem 1.75rem;
  background: color-mix(in srgb, var(--plane) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}
.app-title { margin: 0; font-family: var(--font-display); font-size: 1.45rem; font-weight: 500; letter-spacing: -0.01em; }
.app-sub { margin: 0.1rem 0 0; font-size: 0.74rem; color: var(--ink-muted); }
.model-switch { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.6rem; }
.model-switch .filters { margin-bottom: 0; }

main#main { max-width: 1320px; width: 100%; margin: 0; padding: 1.4rem 1.75rem 3rem; }
.site-footer { margin-top: auto; }

.view > :first-child { margin-top: 0; }
.view .chart-card:first-child { margin-top: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(440px, 1fr)); gap: 0 1.25rem; align-items: start; }
.kpis + .chart-card { margin-top: 1.25rem; }

/* sections moved into views: no long-page chrome */
.view .section { border-top: 0; margin-top: 0; padding-top: 0; }
.view .section + .section { border-top: 1px solid var(--rule); margin-top: 2.5rem; padding-top: 2.5rem; }
.view .section-head { grid-template-columns: 1fr; margin-bottom: 1rem; }
.view .section-num, .view .subsection-num { display: none; }
.view .section-body { padding-left: 0; }
.view .subsection:first-child { margin-top: 0; }
.view .subsection { margin-top: 2.5rem; }

.about-intro { max-width: var(--prose); margin-bottom: 2.5rem; }
.about-title { margin: 0 0 0.6rem; font-family: var(--font-display); font-size: 1.9rem; font-weight: 500; line-height: 1.15; letter-spacing: -0.015em; }
.about-sub { margin: 0 0 1rem; font-family: var(--font-display); font-size: 1.1rem; line-height: 1.5; color: var(--ink-2); }

@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    max-width: 100vw;
    z-index: 50;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
    overflow-x: auto;
    padding: 0.55rem 1rem;
    border-right: 0;
    border-bottom: 1px solid var(--rule);
  }
  .brand { white-space: nowrap; font-size: 0.95rem; }
  .brand small, .nav-label, .side-foot { display: none; }
  .side-nav, .nav-group { flex-direction: row; gap: 0.2rem; }
  .side-nav a { white-space: nowrap; }
  .app-header { position: static; padding: 0.75rem 1rem; }
  main#main { padding: 1rem 1rem 2.5rem; }
  .grid-2 { grid-template-columns: 1fr; }
}

/* Group headings inside results tables */
table.results tr.group-row td {
  background: var(--surface-sunk);
  border-top: 1px solid var(--rule-strong);
  padding-top: 0.55rem;
  padding-bottom: 0.55rem;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}

/* ============================================================
   Overview: intro, findings, small-multiple maps
   ============================================================ */

.intro-band {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--series-1);
  border-radius: 10px;
  padding: 1.1rem 1.35rem;
  margin-bottom: 1.75rem;
}
.intro-lede {
  margin: 0;
  max-width: 78ch;
  font-size: 1.02rem;
  line-height: 1.6;
  color: var(--ink-2);
}
.block-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.45rem;
  margin: 0 0 0.9rem;
}
.findings {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}
@media (max-width: 1180px) { .findings { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .findings { grid-template-columns: 1fr; } }
.fcard {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 1.1rem 1.2rem 1.2rem;
  display: flex;
  flex-direction: column;
}
.fcard-kicker {
  margin: 0 0 0.55rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.fcard-stat {
  margin: 0;
  font-size: 1.85rem;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.fcard-note {
  margin: 0.3rem 0 0.8rem;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--ink-2);
}
.fcard-body {
  margin: auto 0 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--rule);
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--ink-2);
}

.map-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 1.5rem;
  margin: 0.75rem 0 0.25rem;
}
@media (max-width: 680px) { .map-grid, .map-grid.is-compact { grid-template-columns: 1fr; } }
.map-panel {
  margin: 0;
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 0.75rem 0.85rem 0.5rem;
  background: var(--plane);
}
.map-panel-head { display: flex; flex-direction: column; gap: 0.1rem; margin-bottom: 0.35rem; }
.map-panel-title { font-weight: 600; font-size: 0.92rem; color: var(--ink); }
.map-panel-sub { font-size: 0.76rem; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.map-small .state { stroke-width: 0.9; }
.map-small .city-num { font-size: 26px; }
.map-small .city-label { font-size: 30px; stroke-width: 8px; }
.map-small .city-dot { stroke-width: 4; }
.map-small .city-sig { stroke-width: 4; }
.map-small .city-dot { stroke: var(--rule-strong); stroke-width: 2; }
.two-col > .chart-card + .chart-card { margin-top: 0; }
.two-col { align-items: start; }

/* narrow screens: the header's model switch and status line wrap instead of widening the page */
.app-main { min-width: 0; }
.model-switch .filters { flex-wrap: wrap; }
@media (max-width: 900px) {
  .app-header { position: static; padding: 0.85rem 1rem; }
  main#main { padding: 1.1rem 1rem 2.5rem; }
  .table-note-inline { flex-basis: 100%; }
  .findings, .map-grid { min-width: 0; }
}

.hypothesis.is-result { border-left: 3px solid var(--ink); margin-top: 0.85rem; }

/* map callouts: exact city pin, leader line, value box */
.map-small .state { fill: var(--surface-sunk); stroke: var(--surface); stroke-width: 1.2; }
.map-small .nation { stroke: var(--rule-strong); stroke-width: 1.2; }
.city-pin { fill: var(--ink); stroke: var(--surface); stroke-width: 2.5; }
.city-leader { stroke: var(--ink-2); stroke-width: 1.6; }
.city-box { stroke: var(--rule-strong); stroke-width: 1.5; }
.city.is-sig .city-box { stroke: var(--ink); stroke-width: 4; }
.city-name { font: 500 22px var(--font-ui); pointer-events: none; }
.city-val { font: 650 32px var(--font-ui); font-variant-numeric: tabular-nums; pointer-events: none; }
.city:focus-visible .city-box { stroke: var(--series-1); stroke-width: 4; }
.map-panel { background: var(--surface); }

/* model comparison */
.compare-lede { margin: 0; max-width: 82ch; font-size: 1rem; line-height: 1.6; color: var(--ink-2); }
.compare-lede strong { color: var(--ink); }
table.results td.cmp-best { background: color-mix(in srgb, var(--series-1) 12%, var(--surface)); box-shadow: inset 3px 0 0 var(--series-1); }
.cmp-ci { color: var(--ink-muted); font-size: 0.86em; white-space: nowrap; }
.cmp-group { display: block; color: var(--ink-muted); font-size: 0.8em; }
.cmp-panel-title { font: 600 13px var(--font-ui); fill: var(--ink); }
.cmp-run { font: 400 12px var(--font-ui); fill: var(--ink-2); }
.cmp-run.is-best { font-weight: 600; fill: var(--ink); }
.cmp-mark line { stroke: var(--ink-muted); stroke-width: 2; }
.cmp-mark circle { fill: var(--surface); stroke: var(--ink-2); stroke-width: 2; }
.cmp-mark circle.is-sig { fill: var(--ink-2); }
.cmp-mark.is-best line { stroke: var(--series-1); }
.cmp-mark.is-best circle { stroke: var(--series-1); }
.cmp-mark.is-best circle.is-sig { fill: var(--series-1); }
.zero-line { stroke: var(--ink-muted); stroke-width: 1; stroke-dasharray: 4 3; }

/* research question, top of the Overview */
.rq-block { margin: 0 0 1.5rem; padding: 0.25rem 0 1.5rem; border-bottom: 1px solid var(--rule); }
.rq-kicker { margin: 0 0 0.5rem; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--series-1); }
.rq-text { margin: 0 0 1.1rem; max-width: 34ch; font-family: var(--font-display); font-size: clamp(1.5rem, 2.8vw, 2.05rem); line-height: 1.28; letter-spacing: -0.012em; color: var(--ink); }
.rq-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 2rem; margin: 0; max-width: 1000px; }
@media (max-width: 760px) { .rq-meta { grid-template-columns: 1fr; } }
.rq-meta dt { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-muted); margin-bottom: 0.25rem; }
.rq-meta dd { margin: 0; font-size: 0.95rem; line-height: 1.55; color: var(--ink-2); }

/* key results as small charts */
.kc-group { font: 600 0.72rem var(--font-ui); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-muted); margin: 1.4rem 0 0.6rem; }
.kc-group:first-child { margin-top: 0.4rem; }
.kc-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.9rem; }
@media (max-width: 1100px) { .kc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .kc-grid { grid-template-columns: 1fr; } }
.kc-panel { margin: 0; border: 1px solid var(--rule); border-radius: 8px; padding: 0.75rem 0.85rem 0.6rem; background: var(--surface); }
.kc-panel figcaption { display: flex; flex-direction: column; gap: 0.1rem; margin-bottom: 0.45rem; }
.kc-title { font-weight: 600; font-size: 0.9rem; color: var(--ink); }
.kc-sub { font-size: 0.74rem; line-height: 1.35; color: var(--ink-muted); }
.kc-panel svg { display: block; overflow: visible; }
.kc-label { font: 400 11px var(--font-ui); fill: var(--ink-2); }
.kc-value { font: 500 11px var(--font-ui); fill: var(--ink-2); font-variant-numeric: tabular-nums; }
.kc-value.is-best { font-weight: 700; fill: var(--ink); }
.kc-axis { stroke: var(--rule-strong); stroke-width: 1; }
.kc-ref { stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 4 3; }
details.kc-table { margin-top: 1.25rem; border-top: 1px solid var(--rule); padding-top: 0.75rem; }
details.kc-table summary { cursor: pointer; font-size: 0.86rem; font-weight: 500; color: var(--series-1); }
.kc-value { paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
