/* PlaceScope design system v1 (docs/DESIGN.md). Light is the default, dark is opt-in via html[data-theme="dark"] or the system
 * preference when no choice is stored. Tokens only: component rules never use hex (chart ramps live in app.js / explore.js).
 * The two dark blocks below must stay identical. Six type sizes (--t-1 .. --t-6), 4/8 spacing scale, two radii + pill. */
:root {
  --bg: #f7f7f5; --surface: #ffffff; --surface-2: #eeeeea; --border: #d9dad5;
  --text: #17191d; --text-2: #454a52; --muted: #5e636b;
  --brand: #1a5ca3; --brand-ink: #ffffff; --brand-soft: #e3ecf7;
  --accent-heat: #bf4714; --accent-heat-soft: #fdefe8; --accent-air: #1f7a48; --accent-air-soft: #e4f3ea;
  --accent-night: #5347a8; --accent-night-soft: #e9e6f7; --accent-risk: #8a6300; --accent-risk-soft: #faf1d8;
  --positive: #1a5ca3; --negative: #b3261e; --negative-soft: #fdecea; --focus: #1a5ca3; --nodata: #cfd0cb; --cmp: #b9bbb5;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, .06), 0 6px 20px rgba(16, 24, 40, .08);
  --r-1: 4px; --r-2: 8px; --r-pill: 999px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Inter Tight", "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --t-1: .75rem; --t-2: .875rem; --t-3: 1rem; --t-4: 1.125rem; --t-5: 1.375rem; --t-6: clamp(1.75rem, 2vw + 1.125rem, 2.375rem);
  --label: var(--t-1); --track: .08em;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15171b; --surface: #1d2025; --surface-2: #272a31; --border: #363a42;
    --text: #ecedee; --text-2: #c3c6cb; --muted: #9a9fa7;
    --brand: #8db7ea; --brand-ink: #0f1c2c; --brand-soft: #1e2a3b;
    --accent-heat: #f0905c; --accent-heat-soft: #3a261c; --accent-air: #64c690; --accent-air-soft: #1a3328;
    --accent-night: #b3a8f1; --accent-night-soft: #2a2740; --accent-risk: #e2bd5c; --accent-risk-soft: #38311a;
    --positive: #8db7ea; --negative: #f29a94; --negative-soft: #3a1f1e; --focus: #8db7ea; --nodata: #4a4f58; --cmp: #4a4f58;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .5), 0 8px 24px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15171b; --surface: #1d2025; --surface-2: #272a31; --border: #363a42;
  --text: #ecedee; --text-2: #c3c6cb; --muted: #9a9fa7;
  --brand: #8db7ea; --brand-ink: #0f1c2c; --brand-soft: #1e2a3b;
  --accent-heat: #f0905c; --accent-heat-soft: #3a261c; --accent-air: #64c690; --accent-air-soft: #1a3328;
  --accent-night: #b3a8f1; --accent-night-soft: #2a2740; --accent-risk: #e2bd5c; --accent-risk-soft: #38311a;
  --positive: #8db7ea; --negative: #f29a94; --negative-soft: #3a1f1e; --focus: #8db7ea; --nodata: #4a4f58; --cmp: #4a4f58;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .5), 0 8px 24px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

/* ---------------------------------------------------------------- base */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font: var(--t-3)/1.55 var(--font); color: var(--text); background: var(--bg); overflow-x: hidden; }
a { color: var(--brand); text-decoration: none; text-underline-offset: 2px; }
a:hover { text-decoration: underline; }
img, svg { max-width: 100%; }
code { font-family: var(--mono); font-size: .9em; background: var(--surface-2); padding: 1px 5px; border-radius: var(--r-1); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-1); }
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 var(--s5); }
.wrap.wide { max-width: 1280px; }
@media (max-width: 600px) { .wrap { padding: 0 var(--s4); } }
.sr, .skip { position: absolute; left: -9999px; }
.skip:focus { left: 8px; top: 8px; background: var(--surface); padding: 8px; z-index: 100; }
.muted { color: var(--muted); }
.small { font-size: var(--t-2); }
.r { text-align: right; font-variant-numeric: tabular-nums; }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.15; letter-spacing: -.02em; margin: 0 0 .5em; font-weight: 700; }
h1 { font-size: var(--t-6); line-height: 1.1; }
h2 { font-size: var(--t-5); line-height: 1.25; margin-top: var(--s7); padding-top: var(--s4); border-top: 1px solid var(--border); margin-bottom: var(--s4); }
.card h2, .sheet h2, .panel h2, .cmp-head h2, .ranklist h2, .stategroup h2, .finder h2, .block h2, .list h2, .prose h2:first-child, .xp-msg h2 { border-top: 0; padding-top: 0; margin-top: 0; }
h3 { font-size: var(--t-4); line-height: 1.4; }
section[id] { scroll-margin-top: 72px; }
p { margin: 0 0 1em; }
.ico { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.15em; flex: none; }
.row { display: flex; align-items: center; gap: var(--s2); }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.extlinks .row.wrap, .finder .row { padding: 0; max-width: none; }
/* kicker: mono uppercase t-1 muted, one or two words only */
.kicker, .glabel, .fact .k, .legend .ticks, table.data tr.grp th, .ad[data-filled]::before, .foot strong, .xp-kicker, .xp-lab { font-family: var(--mono); font-size: var(--t-1); text-transform: uppercase; letter-spacing: var(--track); color: var(--muted); font-weight: 500; line-height: 1.4; }
.mono { font-family: var(--mono); }
.num, .v, .r, .kpi .v, .stat .v, .fact .v { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- header / footer */
.top { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.top .row { height: 56px; gap: var(--s3); flex-wrap: nowrap; }
.brand { display: flex; align-items: center; gap: var(--s2); font-weight: 700; color: var(--text); font-size: var(--t-3); white-space: nowrap; flex: none; }
.brand:hover { text-decoration: none; }
.brand .mark { flex: none; }
.top nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1 1 auto; min-width: 0; }
.top nav::-webkit-scrollbar { display: none; }
.top nav a { padding: 9px 12px; border-radius: var(--r-1); color: var(--text-2); white-space: nowrap; font-size: var(--t-3); position: relative; line-height: 1.4; }
.top nav a::before { content: ""; position: absolute; inset: -3px 0; }
.top nav a:hover { background: var(--surface-2); text-decoration: none; }
.top nav a[aria-current] { color: var(--text); font-weight: 600; }
.top nav a[aria-current]::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; background: var(--brand); }
.theme { margin-left: auto; width: 36px; height: 36px; flex: none; border: 1px solid var(--border); border-radius: var(--r-1); background: var(--surface); color: var(--text-2); cursor: pointer; display: grid; place-items: center; position: relative; }
.theme::after { content: ""; position: absolute; inset: -4px; }
.theme:hover { border-color: var(--brand); color: var(--brand); }
.theme .ico { width: 18px; height: 18px; }
.theme .sun { display: none; }
:root[data-theme="dark"] .theme .moon { display: none; } :root[data-theme="dark"] .theme .sun { display: block; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .theme .moon { display: none; } :root:not([data-theme="light"]) .theme .sun { display: block; } }
@media (max-width: 600px) {
  .top nav { -webkit-mask-image: linear-gradient(90deg, black calc(100% - 24px), transparent); mask-image: linear-gradient(90deg, black calc(100% - 24px), transparent); padding-right: 24px; }
  .top nav a { padding: 8px 10px; }
}
.foot { margin-top: var(--s8); border-top: 1px solid var(--border); background: var(--surface); padding: var(--s6) 0 var(--s5); font-size: var(--t-2); color: var(--text-2); }
.foot .cols { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: var(--s5); margin-bottom: var(--s4); }
.foot .cols a { display: block; padding: 4px 0; color: var(--text-2); }
.foot .cols a:hover { color: var(--brand); }
.foot strong { display: block; margin-bottom: var(--s2); }
.foot .cols > div > strong:first-child { color: var(--muted); }
.foot .cols p { margin-bottom: var(--s2); }
.foot .small { font-size: var(--t-1); }
@media (max-width: 700px) { .foot .cols { grid-template-columns: 1fr; gap: var(--s5); } }

/* ---------------------------------------------------------------- building blocks */
.crumbs { font-size: var(--t-2); color: var(--muted); margin: var(--s4) 0 var(--s2); display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; }
.crumbs > span:last-child { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.crumbs span:not(:last-child) { color: var(--border); }
.crumbs a { color: var(--muted); flex: none; }
.crumbs a:hover { color: var(--brand); }
.hero { margin: var(--s5) 0 var(--s5); }
main > .hero:first-child { margin-top: 46px; }
.hero .search { max-width: 520px; margin: 0 0 var(--s4); }
.crumbs + .hero, .crumbs + article > .hero { margin-top: var(--s2); }
.lede { font-size: var(--t-4); line-height: 1.5; color: var(--text-2); max-width: 68ch; }
.actions { display: flex; gap: var(--s2); flex-wrap: wrap; }
@media (max-width: 480px) { .actions .btn { flex: 1 1 100%; justify-content: center; } }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 10px 16px; border-radius: var(--r-1); background: var(--brand); color: var(--brand-ink); font-weight: 600; border: 1px solid var(--brand); font: inherit; font-weight: 600; cursor: pointer; line-height: 1.3; transition: background .15s, border-color .15s, color .15s; }
.btn:hover { text-decoration: none; filter: brightness(.92); }
.btn:active { filter: brightness(.86); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .4; pointer-events: none; }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border); font-weight: 500; }
.btn.secondary:hover { border-color: var(--brand); color: var(--brand); filter: none; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--brand); min-height: 0; padding: 4px 6px; }
.btn.ghost:hover { text-decoration: underline; filter: none; }
.btn.small { font-size: var(--t-2); padding: 6px 10px; min-height: 36px; }
.btn.explore::after { content: "\2197"; font-family: var(--mono); margin-left: 2px; }
.linkbtn { background: none; border: 0; color: var(--brand); font: inherit; cursor: pointer; padding: 6px 0; position: relative; }
.linkbtn::after { content: ""; position: absolute; inset: -6px 0; }
.linkbtn:hover { text-decoration: underline; }
.prose { max-width: 68ch; }
.prose p, .prose li, .prose dd { font-size: var(--t-4); line-height: 1.6; }
.prose h2 { margin-top: 2em; }
.prose h3 { font-weight: 600; margin-top: 1.4em; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose figure { margin: var(--s6) 0; }
.prose .tablefig, .prose .tablewrap { max-width: none; }
.prose dl dt { font-weight: 600; margin-top: .8em; }
.prose dl dd { margin: 0; }
.prose table { font-size: var(--t-2); }
.prose table td, .prose table th { white-space: normal; }
figure { margin: 0 0 var(--s5); }
figcaption { font-size: var(--t-1); color: var(--muted); margin-top: 6px; line-height: 1.4; text-align: left; }
/* the one card pattern: link tiles and floating surfaces only */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-2); padding: var(--s4); }
.card h2, .card h3 { font-size: var(--t-4); margin: 0 0 var(--s2); }
.card.link { display: block; color: inherit; transition: border-color .15s; }
.card.link:hover { text-decoration: none; border-color: var(--brand); }
.card.link p { margin: 0 0 6px; }
.card.link .tag { display: inline-block; font-family: var(--mono); font-size: var(--t-1); text-transform: uppercase; letter-spacing: var(--track); color: var(--brand); background: var(--brand-soft); border-radius: var(--r-1); padding: 1px 6px; margin-left: 8px; vertical-align: 1px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--s4); align-items: stretch; }
@media (max-width: 600px) { .cards { grid-template-columns: 1fr; gap: var(--s3); } }
/* the one block pattern: in-flow content, rule on top */
.block, .kpi, .fact, .stat, .sparkfig, .insetfig, .extlinks, .lists .list, .sources, .cite, .note { border-top: 1px solid var(--border); padding-top: var(--s3); }
/* KPI tile v2 */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--s4) var(--s5); margin: var(--s2) 0 var(--s5); }
.kpi { min-width: 0; padding-bottom: var(--s1); }
.kpi .k { font-size: var(--t-2); color: var(--muted); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kpi .v { font-family: var(--font-head); font-size: var(--t-5); line-height: 1.25; font-weight: 700; margin: 4px 0 2px; letter-spacing: -.02em; }
.kpi .v.small { font-size: var(--t-4); }
.kpi .rank { font-size: var(--t-1); color: var(--muted); line-height: 1.4; }
@media (max-width: 600px) { .kpis { grid-template-columns: 1fr 1fr; gap: var(--s3) var(--s4); } }
.help { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--surface-2); color: var(--muted); font-size: var(--t-1); line-height: 1; font-weight: 700; margin-left: 2px; position: relative; vertical-align: 1px; }
.help::after { content: ""; position: absolute; inset: -14px; }
.help:hover { background: var(--brand-soft); color: var(--brand); text-decoration: none; }
.badge { display: inline-block; font-size: var(--t-1); font-weight: 600; padding: 2px 6px; border-radius: var(--r-1); background: var(--brand-soft); color: var(--brand); white-space: nowrap; }
/* charts (inline SVG) */
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--s4) var(--s5); }
.chart, .range, .quart { width: 100%; max-width: 420px; height: auto; font-family: var(--font); }
.prose .chart { max-width: 520px; }
.charts figure { max-width: 520px; min-width: 0; }
.chart .lbl, .range .lbl, .quart .lbl, .spark .lbl { font-size: 12px; fill: var(--muted); }
.chart .val, .range .val, .quart .val, .spark .val { font-size: 12px; fill: var(--text); font-weight: 600; }
.chart .val.onbar { fill: var(--brand-ink); }
.chart .muted { fill: var(--muted); font-weight: 400; }
.chart .bar { fill: var(--brand); }
.chart .bar.cmp, .chart .bar.c2, .chart .bar.c3 { fill: var(--cmp); }
.chart .bar.brand, .chart .bar.c1 { fill: var(--brand); }
.chart .bar.heat, .chart .bar.c4 { fill: var(--accent-heat); }
.chart .bar.risk, .chart .bar.c5 { fill: var(--accent-risk); }
.chart .bar.night { fill: var(--accent-night); }
.chart .bar.air { fill: var(--accent-air); }
.chart .lgd { font-size: 12px; fill: var(--text-2); }
.range .axis, .quart .axis { stroke: var(--border); stroke-width: 3; stroke-linecap: round; }
.range .hist { stroke: var(--muted); stroke-width: 2; }
.range .band { fill: var(--accent-heat-soft); stroke: var(--accent-heat); stroke-width: 1; }
.range .mean { fill: var(--accent-heat); }
.range.night .band { fill: var(--accent-night-soft); stroke: var(--accent-night); }
.range.night .mean { fill: var(--accent-night); }
.quart .band { fill: var(--brand-soft); stroke: var(--brand); stroke-width: 1; }
.quart .mid { stroke: var(--brand); stroke-width: 2; }
.sparks { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--s4) var(--s5); margin: 0 0 var(--s4); }
.sparkfig { margin: 0; max-width: 420px; }
.spark { width: 100%; height: auto; display: block; }
.spark .line { fill: none; stroke: var(--brand); stroke-width: 2; stroke-linejoin: round; }
.spark .area { fill: var(--brand-soft); }
.spark .dot { fill: var(--brand); }
/* tables */
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 calc(-1 * var(--s4)); padding: 0 var(--s4); -webkit-mask-image: linear-gradient(90deg, black calc(100% - 24px), transparent); mask-image: linear-gradient(90deg, black calc(100% - 24px), transparent); }
@media (min-width: 901px) { .tablewrap { overflow: visible; margin: 0; padding: 0; -webkit-mask-image: none; mask-image: none; } }
table.data, table.rank, table.scores { border-collapse: separate; border-spacing: 0; width: 100%; font-size: var(--t-2); }
table.data th, table.data td, table.rank th, table.rank td { padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; text-align: left; vertical-align: top; }
table.data th, table.rank th { font-weight: 600; color: var(--text-2); background: var(--surface); position: sticky; top: 56px; z-index: 2; white-space: normal; vertical-align: bottom; line-height: 1.3; }
.prose table.data td, .prose table.data th, table.schema td, table.schema th { white-space: normal; }
table.data th.r, table.rank th.r, table.data td.r, table.rank td.r { text-align: right; font-variant-numeric: tabular-nums; }
table.data td:first-child, table.data th:first-child, table.rank td:first-child, table.rank th:first-child { position: sticky; left: 0; background: var(--bg); z-index: 1; }
table.data th:first-child, table.rank th:first-child { z-index: 3; background: var(--surface); }
table.data tbody tr:hover td { background: var(--surface-2); }
table.data tr.grp th { background: var(--surface-2); color: var(--muted); padding-top: 10px; position: static; }
table.data td.win { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
table.data td.win::before { content: "\25B2 "; font-size: 9px; vertical-align: 1px; }
table.cmp { table-layout: fixed; }
table.cmp th, table.cmp td { white-space: normal; }
table.cmp th:first-child, table.cmp td:first-child { width: 44%; position: static; }
table.cmp tr.grp th { width: auto; }
table.schema td, table.schema th { white-space: normal; }
table.sortable th { cursor: pointer; user-select: none; }
table.sortable th:hover { color: var(--text); }
table.sortable th::after { content: " \2195"; color: var(--muted); font-size: var(--t-1); }
table.sortable th[aria-sort="ascending"]::after { content: " \2191"; color: var(--brand); }
table.sortable th[aria-sort="descending"]::after { content: " \2193"; color: var(--brand); }
table.sortable th[aria-sort] { color: var(--text); }
table.data .more, table.data.cols-more .more { display: none; }
table.data.cols-more .more { display: table-cell; }
.morecols { margin: var(--s3) 0 0; }
.tablenote { font-size: var(--t-2); color: var(--muted); margin: var(--s3) 0; }
table.scores { max-width: 72ch; }
table.scores th { text-align: left; padding: 10px 10px 10px 0; width: 120px; font-weight: 600; border-bottom: 1px solid var(--border); }
table.scores td { padding: 10px 10px; border-bottom: 1px solid var(--border); color: var(--text-2); vertical-align: middle; }
table.scores td.r { width: 3em; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
table.scores td.meter { width: 30%; }
table.scores td.meter span { display: block; height: 8px; background: var(--brand); border-radius: var(--r-pill); }
table.scores td.meter { background: linear-gradient(var(--surface-2), var(--surface-2)) no-repeat center / 100% 8px; background-clip: content-box; }
table.scores td.small { font-size: var(--t-2); }
@media (max-width: 600px) {
  table.scores, table.scores tbody { display: block; }
  table.scores tr { display: grid; grid-template-columns: 1fr auto; padding: 10px 0; border-bottom: 1px solid var(--border); }
  table.scores th, table.scores td { border: 0; padding: 0; width: auto; }
  table.scores td.meter { grid-column: 1 / -1; margin: 6px 0; background-size: 100% 8px; }
  table.scores td.small { grid-column: 1 / -1; }
}
.sources ul { padding-left: 1.2em; font-size: var(--t-2); }
.sources h2 { border-top: 0; padding-top: 0; margin-top: var(--s2); }
.split { display: grid; grid-template-columns: 1fr 340px; gap: var(--s5); align-items: start; }
.split2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s5); align-items: start; }
@media (max-width: 800px) { .split, .split2 { grid-template-columns: 1fr; } }
.insetfig { margin: var(--s2) 0 0; }
.inset { width: 100%; height: auto; }
.inset path { stroke: var(--surface); stroke-width: .8; }
.inset path.nodata { fill: var(--nodata); }
.inset a:hover path { stroke: var(--text); stroke-width: 1.5; }
.inset a:focus-visible path { stroke: var(--focus); stroke-width: 2; }
.lists { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--s4) var(--s5); margin: var(--s4) 0; }
.lists .list h2 { font-size: var(--t-2); font-weight: 600; margin: 0 0 var(--s2); color: var(--text-2); }
.lists .list ol { margin: 0; padding-left: 1.4em; font-size: var(--t-2); }
.lists .list li { display: flex; justify-content: space-between; gap: var(--s2); padding: 4px 0; }
.lists .list li .r { color: var(--text-2); }
.links a { display: inline-block; margin: 0 12px 0 0; padding: 10px 0; line-height: 1.5; }
.stategroup { margin-top: var(--s5); }
.stategroup h2 { font-size: var(--t-4); margin: 0 0 6px; }
/* best rankings */
.ranklist { list-style: none; padding: 0; margin: 0 0 var(--s5); max-width: 72ch; }
.ranklist li { display: flex; gap: var(--s4); padding: var(--s4) 0; border-top: 1px solid var(--border); }
.ranklist .pos { flex: none; width: 36px; height: 36px; border-radius: var(--r-1); background: var(--surface-2); color: var(--text); font-family: var(--mono); font-weight: 600; display: grid; place-items: center; font-variant-numeric: tabular-nums; }
.ranklist .body { min-width: 0; }
.ranklist h2 { font-size: var(--t-4); margin: 6px 0 4px; }
.ranklist .metric { margin: 0 0 4px; font-size: var(--t-4); }
.ranklist p { margin-bottom: 4px; color: var(--text-2); font-size: var(--t-2); }
/* article stat strip (headline tiles) */
.statstrip { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s4) var(--s5); margin: 0 0 var(--s5); }
.stat { border-top: 2px solid var(--brand); padding-bottom: var(--s2); min-width: 0; }
.stat .k { font-size: var(--t-2); color: var(--muted); line-height: 1.4; }
.stat .v { font-family: var(--font-head); font-size: var(--t-5); font-weight: 700; letter-spacing: -.02em; margin: 2px 0; }
.stat .sub { font-size: var(--t-2); color: var(--text-2); }
@media (max-width: 700px) { .statstrip { grid-template-columns: 1fr 1fr; } }
.byline { font-size: var(--t-2); color: var(--muted); margin: 0 0 var(--s4); }
.byline strong { font-weight: 600; color: var(--text-2); }
.post .kicker { display: block; margin: 0 0 var(--s2); }
.post .prose img { border-radius: var(--r-2); }
.articles h2.section { font-size: var(--t-4); margin: var(--s6) 0 var(--s4); }
.pager { display: flex; justify-content: center; align-items: center; gap: var(--s4); margin: var(--s6) 0; }
.pager span { color: var(--muted); font-size: var(--t-2); }
/* chips: one component */
.chips { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; min-height: 36px; border: 1px solid var(--border); border-radius: var(--r-1); background: var(--surface); font: inherit; font-size: var(--t-2); line-height: 1.4; color: var(--text); cursor: pointer; position: relative; transition: border-color .15s, background .15s, color .15s; }
.chip::after { content: ""; position: absolute; inset: -4px; }
.chip:hover { border-color: var(--brand); text-decoration: none; color: var(--brand); }
.chip[aria-pressed="true"], .chip[aria-checked="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }
.chip.ext .ico { opacity: .6; }
.extlinks { margin: var(--s4) 0; padding-bottom: var(--s2); }
.extlinks h3 { margin: 0; font-size: var(--t-3); font-weight: 600; }
.extlinks .row { margin-bottom: var(--s2); }
.extlinks p { margin: var(--s2) 0 0; }
.postfoot { margin-top: var(--s6); border-top: 1px solid var(--border); padding-top: var(--s3); }
.ad { min-height: 0; margin: var(--s6) 0; text-align: center; }
.ad:empty { margin: 0; }
.ad[data-filled] { min-height: 90px; }
.ad[data-filled]::before { content: "Advertisement"; display: block; }

/* ---------------------------------------------------------------- county page */
.headline { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--s4) var(--s5); margin: 0 0 var(--s5); }
.fact { border-top: 2px solid var(--brand); padding-bottom: var(--s2); min-width: 0; }
.fact .v { font-family: var(--font-head); font-size: var(--t-6); font-weight: 700; margin: 2px 0; letter-spacing: -.025em; line-height: 1.1; }
.fact .sub { font-size: var(--t-2); color: var(--text-2); line-height: 1.4; }
.fact.heat { border-top-color: var(--accent-heat); } .fact.air { border-top-color: var(--accent-air); } .fact.risk { border-top-color: var(--accent-risk); } .fact.commute { border-top-color: var(--accent-night); }
.fact.heat .k { color: var(--accent-heat); } .fact.air .k { color: var(--accent-air); } .fact.risk .k { color: var(--accent-risk); } .fact.commute .k { color: var(--accent-night); }
.callout { display: flex; gap: var(--s3); align-items: flex-start; background: var(--accent-heat-soft); border: 1px solid color-mix(in srgb, var(--accent-heat) 35%, transparent); border-radius: var(--r-2); padding: var(--s4); margin: 0 0 var(--s5); }
.callout .ico { width: 24px; height: 24px; color: var(--accent-heat); margin-top: 2px; }
.callout .big { font-size: var(--t-4); font-weight: 600; margin: 0 0 4px; }
.callout p:last-child { margin: 0; }
.callout .small { color: var(--text-2); }
.note { margin: var(--s4) 0; font-size: var(--t-2); color: var(--text-2); line-height: 1.5; }
.note .kicker { display: block; margin-bottom: 4px; }
.note p { margin: 0; }
.error { background: var(--negative-soft); color: var(--negative); border-radius: var(--r-2); padding: var(--s3) var(--s4); }
.summary p { max-width: 68ch; }
.pctbars { display: grid; gap: var(--s4); max-width: 760px; }
.pct .k { font-size: var(--t-2); margin-bottom: 4px; color: var(--text-2); }
.pct .k strong { color: var(--text); }
.pct .bar { display: grid; grid-template-columns: 32px 1fr; align-items: center; gap: var(--s2); margin: 4px 0; }
.pct .bar em { font-style: normal; font-size: var(--t-1); color: var(--muted); font-variant-numeric: tabular-nums; }
.pct .bar span { display: block; height: 10px; background: var(--surface-2); border-radius: var(--r-pill); overflow: hidden; }
.pct .bar span i { display: block; height: 100%; background: var(--brand); border-radius: var(--r-pill); }
.pct .bar.st span i { background: var(--text-2); }
.toc { margin: 0 0 var(--s5); }
.glossary dt { font-size: var(--t-4); scroll-margin-top: 72px; }
.glossary .anchor { color: var(--muted); font-weight: 400; margin-left: 4px; display: inline-block; padding: 8px; margin: -8px 0 -8px -4px; }
.glossary dt:hover .anchor, .glossary .anchor:focus-visible { color: var(--brand); }
.cite { background: transparent; padding: var(--s3) 0 0; font-family: var(--mono); font-size: var(--t-2) !important; word-break: break-word; color: var(--text-2); }
.card.dl h2 { font-size: var(--t-4); margin-bottom: 2px; }
.card.dl .file { font-family: var(--mono); font-size: var(--t-2); color: var(--text-2); margin: 0 0 var(--s2); word-break: break-all; }

/* ---------------------------------------------------------------- compare */
.pickers { display: grid; grid-template-columns: 1fr auto 1fr; gap: var(--s3); align-items: end; margin: 0 0 var(--s3); }
.picker { display: grid; gap: 4px; position: relative; font-size: var(--t-2); color: var(--text-2); }
.picker input, .field select, .search input { font: inherit; font-size: var(--t-3); padding: 10px 12px; min-height: 44px; border: 1px solid var(--border); border-radius: var(--r-1); background: var(--surface); color: var(--text); width: 100%; }
.picker input:focus, .search input:focus, .field select:focus { border-color: var(--brand); outline: 2px solid var(--focus); outline-offset: 2px; }
.swap { width: 44px; height: 44px; border-radius: var(--r-1); border: 1px solid var(--border); background: var(--surface); color: var(--text-2); cursor: pointer; display: grid; place-items: center; font-size: var(--t-4); }
.swap:hover { border-color: var(--brand); color: var(--brand); }
@media (max-width: 600px) { .pickers { grid-template-columns: 1fr; } .swap { justify-self: center; } }
.vs { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); margin: 0 0 var(--s4); }
@media (max-width: 600px) { .vs { grid-template-columns: 1fr; } }
.cmp-out { margin: var(--s4) 0; }
.cmp-empty { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.cmp-head { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); margin-bottom: var(--s4); }
.cmp-head .card h2 { font-size: var(--t-4); }
.cmp-head .tally { font-size: var(--t-2); color: var(--text-2); }
@media (max-width: 600px) { .cmp-head { grid-template-columns: 1fr; } }
.verdict p { max-width: 68ch; font-size: var(--t-4); line-height: 1.6; color: var(--text-2); }

/* ---------------------------------------------------------------- map app (home) */
body.mapapp { overflow: hidden; height: 100dvh; display: flex; flex-direction: column; }
body.mapapp .foot { display: none; }
.mapmain { flex: 1; min-height: 0; }
.app { display: grid; grid-template-columns: 380px 1fr; height: 100%; }
.panel { background: var(--surface); border-right: 1px solid var(--border); overflow-y: auto; padding: var(--s4) var(--s4) var(--s5); display: flex; flex-direction: column; gap: var(--s4); }
.panel > * { flex: none; }
.hero-line h1 { font-size: var(--t-5); line-height: 1.25; margin: 0 0 4px; }
.hero-line p { margin: 0; color: var(--text-2); font-size: var(--t-2); }
.search { position: relative; display: block; }
.search .ico { position: absolute; left: 12px; top: 22px; transform: translateY(-50%); color: var(--muted); width: 18px; height: 18px; }
.search input { padding-left: 38px; }
.qlist { position: absolute; z-index: 30; top: 100%; left: 0; right: 0; margin: 4px 0 0; padding: 4px; list-style: none; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-2); box-shadow: var(--shadow-1); max-height: 260px; overflow-y: auto; }
.qlist li { padding: 8px 10px; border-radius: var(--r-1); cursor: pointer; font-size: var(--t-2); display: flex; justify-content: space-between; gap: 8px; min-height: 36px; align-items: center; }
.qlist li:hover, .qlist li[aria-selected="true"] { background: var(--surface-2); }
.qlist li small { color: var(--muted); font-variant-numeric: tabular-nums; }
.layer-groups { display: grid; gap: var(--s2); }
.lgroup { display: grid; grid-template-columns: 84px 1fr; gap: var(--s2); align-items: start; }
.glabel { display: inline-flex; align-items: center; gap: 5px; padding-top: 10px; color: var(--text-2); }
.glabel .ico { width: 14px; height: 14px; }
.lgroup[data-group="heat"] .glabel { color: var(--accent-heat); } .lgroup[data-group="nights"] .glabel { color: var(--accent-night); } .lgroup[data-group="air"] .glabel { color: var(--accent-air); } .lgroup[data-group="risk"] .glabel { color: var(--accent-risk); }
.lgroup[data-group="heat"] .chip[aria-pressed="true"] { background: var(--accent-heat); border-color: var(--accent-heat); color: var(--brand-ink); }
.lgroup[data-group="nights"] .chip[aria-pressed="true"] { background: var(--accent-night); border-color: var(--accent-night); color: var(--brand-ink); }
.lgroup[data-group="air"] .chip[aria-pressed="true"] { background: var(--accent-air); border-color: var(--accent-air); color: var(--brand-ink); }
.lgroup[data-group="risk"] .chip[aria-pressed="true"] { background: var(--accent-risk); border-color: var(--accent-risk); color: var(--brand-ink); }
:root[data-theme="dark"] .lgroup .chip[aria-pressed="true"] { color: var(--bg); }
.legend { font-size: var(--t-1); margin-top: var(--s4); border-top: 1px solid var(--border); padding: var(--s3) 0 0; }
.legend .title { font-weight: 600; margin-bottom: 6px; color: var(--text); font-size: var(--t-2); }
.legend .swatches { display: flex; height: 10px; border-radius: var(--r-1); overflow: hidden; }
.legend .swatches span { flex: 1; }
.legend .ticks { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); color: var(--muted); font-variant-numeric: tabular-nums; margin-top: 3px; text-transform: none; letter-spacing: 0; height: 30px; align-items: start; }
.legend .ticks span { text-align: center; white-space: nowrap; position: relative; }
.legend .ticks span::before { content: ""; position: absolute; left: 50%; top: -3px; width: 1px; height: 4px; background: var(--border); }
.legend .ticks span:nth-child(even) { padding-top: 14px; }
.legend .ticks span:nth-child(even)::before { height: 18px; }
.legend .ends { display: flex; justify-content: space-between; margin-top: 4px; font-weight: 500; color: var(--text-2); font-size: var(--t-2); }
.legend .nd { display: inline-block; width: 12px; height: 12px; background: var(--nodata); vertical-align: -2px; border-radius: var(--r-1); margin-right: 4px; }
.legend .muted { margin-top: 6px; }
.whatmeans { position: relative; margin-top: 6px; font-size: var(--t-2); }
.popover { position: relative; margin-top: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-2); padding: var(--s3) 40px var(--s3) var(--s4); font-size: var(--t-2); line-height: 1.5; box-shadow: var(--shadow-1); max-width: 36ch; }
.popover p { margin: 0 0 6px; }
.popover p:last-child { margin: 0; }
.popover .close { position: absolute; top: 4px; right: 4px; width: 32px; height: 32px; border: 0; background: transparent; color: var(--muted); cursor: pointer; border-radius: var(--r-1); display: grid; place-items: center; }
.popover .close:hover { background: var(--surface-2); color: var(--text); }
.finder { border-top: 1px solid var(--border); padding-top: var(--s4); }
.finder h2 { font-size: var(--t-4); margin: 0; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin: var(--s2) 0; }
.sliders-wrap summary { cursor: pointer; font-size: var(--t-2); color: var(--text-2); font-weight: 600; padding: 10px 0; }
.sliders { display: grid; gap: var(--s3); margin: var(--s2) 0; }
.sliders label { display: grid; gap: 2px; font-size: var(--t-2); color: var(--text-2); }
.sliders label span { display: flex; justify-content: space-between; }
.sliders output { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.sliders input { width: 100%; accent-color: var(--brand); height: 28px; margin: 0; }
.results { list-style: none; margin: var(--s2) 0 0; padding: 0; display: grid; gap: var(--s2); }
.results li { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-2); padding: var(--s3) var(--s4); display: grid; grid-template-columns: 24px 1fr; grid-template-areas: "pos name" "pos facts" "pos go"; gap: 4px var(--s2); align-items: start; transition: border-color .15s; }
.results li:hover { border-color: var(--brand); }
.results .pos { grid-area: pos; color: var(--muted); font-size: var(--t-1); font-variant-numeric: tabular-nums; padding-top: 4px; }
.results .name { grid-area: name; background: none; border: 0; font: inherit; font-size: var(--t-3); font-weight: 600; color: var(--text); cursor: pointer; text-align: left; padding: 0; min-height: 24px; }
.results .name:hover { color: var(--brand); }
.results .facts { grid-area: facts; font-size: var(--t-1); color: var(--muted); line-height: 1.4; }
.results .go { grid-area: go; justify-self: start; margin-top: 4px; }
.intro p { margin-bottom: 6px; }
.field { display: grid; gap: 4px; font-size: var(--t-2); color: var(--text-2); }
.mapwrap { position: relative; min-height: 0; background: var(--bg); }
#map { position: absolute; inset: 0; }
.nowebgl { position: absolute; inset: 0; padding: var(--s5); overflow: auto; background: var(--bg); }
.tooltip { position: absolute; pointer-events: none; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--r-2); padding: 8px 10px; font-size: var(--t-2); line-height: 1.4; box-shadow: var(--shadow-1); z-index: 5; max-width: 240px; }
.tooltip strong { display: block; }
.card.sheet { position: absolute; top: 12px; right: 12px; width: 340px; max-height: calc(100% - 60px); overflow-y: auto; box-shadow: var(--shadow-1); z-index: 6; padding: var(--s4); }
.card.sheet .close { position: absolute; top: 8px; right: 8px; background: var(--surface-2); border: 0; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; color: var(--text-2); display: grid; place-items: center; }
.card.sheet .close:hover { color: var(--text); }
.card.sheet h2 { margin: 0 40px 2px 0; font-size: var(--t-5); line-height: 1.25; }
.card.sheet .sub { color: var(--muted); font-size: var(--t-2); margin-bottom: var(--s2); line-height: 1.4; }
.card.sheet .actions { margin-bottom: var(--s2); }
.card.sheet .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--s4); margin-bottom: var(--s2); }
.card.sheet .grid div { border-top: 1px solid var(--border); padding: 5px 0 4px; min-width: 0; }
.card.sheet p { margin: 0; }
.card.sheet .grid .k { font-size: var(--t-1); color: var(--muted); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card.sheet .grid .v { font-weight: 700; font-size: var(--t-3); line-height: 1.3; font-variant-numeric: tabular-nums; }
.card.sheet .grid .v small { display: block; font-weight: 400; color: var(--muted); font-size: var(--t-1); line-height: 1.3; }
.card.sheet .cmp { font-size: var(--t-1); color: var(--muted); margin: 0; }
.card.sheet .ext { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: var(--t-2); margin: 0 0 8px; }
/* MapLibre controls on the shared tokens (t-1 / t-2 text, r-1 corners, text-2 on surface in both themes) */
.maplibregl-ctrl-group { background: var(--surface) !important; border: 1px solid var(--border) !important; box-shadow: none !important; border-radius: var(--r-1) !important; }
.maplibregl-ctrl-group button + button { border-top-color: var(--border) !important; }
.maplibregl-ctrl button { font-size: var(--t-2) !important; }
.maplibregl-ctrl-attrib.maplibregl-compact, .maplibregl-ctrl-attrib { background: color-mix(in srgb, var(--surface) 88%, transparent) !important; color: var(--text-2) !important; border-radius: var(--r-1) !important; font-size: var(--t-1) !important; font-family: var(--font) !important; }
.maplibregl-ctrl-attrib a, .maplibregl-ctrl-attrib-inner { color: var(--text-2) !important; }
.maplibregl-ctrl-attrib-button { border-radius: var(--r-1) !important; }
:root[data-theme="dark"] .maplibregl-ctrl-attrib-button { filter: invert(.85); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .maplibregl-ctrl-attrib-button { filter: invert(.85); } }
:root[data-theme="dark"] .maplibregl-ctrl button .maplibregl-ctrl-icon { filter: invert(.9); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .maplibregl-ctrl button .maplibregl-ctrl-icon { filter: invert(.9); } }
@media (max-width: 800px) {
  body.mapapp { height: auto; overflow: auto; display: block; }
  body.mapapp .foot { display: block; }
  .app { grid-template-columns: 1fr; height: auto; }
  .mapwrap { height: 60dvh; min-height: 360px; order: -1; }
  .panel { border-right: 0; border-top: 1px solid var(--border); overflow: visible; }
  .lgroup { grid-template-columns: 1fr; gap: 2px; }
  .glabel { padding-top: 0; }
  .card.sheet { top: auto; right: 0; left: 0; bottom: 0; width: auto; max-height: 55%; border-radius: var(--r-2) var(--r-2) 0 0; padding-top: 22px; padding-bottom: var(--s5); }
  .card.sheet::before { content: ""; position: absolute; top: 8px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: var(--r-pill); background: var(--border); }
  .card.sheet .close { width: 44px; height: 44px; top: 10px; right: 10px; }
  .card.sheet h2 { margin-right: 48px; }
  .mapwrap.sheet-open .maplibregl-ctrl-bottom-right { bottom: auto; top: 0; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; animation-duration: .01ms !important; } }
@media print { .top, .foot, .ad { display: none; } }

/* small helpers */
.card .count { font-size: var(--t-1); margin-bottom: 6px; }
.lists .list { min-width: 0; }
