/* Layout: one reading column (max 1120px) of report sections; tables scroll inside their own frames. */
:root {
  --bg: #f6f7f5; --panel: #ffffff; --fg: #17201f; --muted: #5a6663; --line: #dde2de; --grid: #e9ece9;
  --accent: #215a5c; --ok: #2d7a4f; --warn: #a3670d; --bad: #b3372b;
  --s0: #215a5c; --s1: #c08a2b; --s2: #7a4f8c; --s3: #9aa3a0;
  --display: "Source Serif 4", Georgia, "Times New Roman", serif;
  --body: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 8px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101615; --panel: #172020; --fg: #e7ece9; --muted: #9ba7a3; --line: #29332f; --grid: #1f2826;
    --accent: #6fbdb6; --ok: #5cbf86; --warn: #e0a84a; --bad: #ec7b6f;
    --s0: #5fb3ad; --s1: #d9a646; --s2: #b48bd0; --s3: #6b7673;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #101615; --panel: #172020; --fg: #e7ece9; --muted: #9ba7a3; --line: #29332f; --grid: #1f2826;
  --accent: #6fbdb6; --ok: #5cbf86; --warn: #e0a84a; --bad: #ec7b6f;
  --s0: #5fb3ad; --s1: #d9a646; --s2: #b48bd0; --s3: #6b7673;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.5 var(--body); }
a { color: var(--accent); text-underline-offset: 2px; }
.page {
  max-width: 1120px; margin: 0 auto;
  padding-block: 48px 72px;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
  display: flex; flex-direction: column; gap: 56px;
}
.num { font-variant-numeric: tabular-nums; }
h1, h2 { font-family: var(--display); font-weight: 600; text-wrap: balance; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: clamp(30px, 5vw, 46px); line-height: 1.08; max-width: 22ch; }
h2 { font-size: clamp(22px, 3vw, 28px); line-height: 1.2; }
h3 { font-size: 15px; font-weight: 600; margin: 0; }
p { margin: 0; }
.intro { display: flex; flex-direction: column; gap: 16px; }
.eyebrow { font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.lede { font-family: var(--display); font-size: clamp(18px, 2.2vw, 21px); line-height: 1.45; max-width: 62ch; }
.lede b { font-weight: 600; color: var(--accent); }
.source, .note { color: var(--muted); font-size: 13px; max-width: 75ch; }
section { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-top: -24px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kpi .label { font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.kpi .big { font-family: var(--display); font-size: 34px; line-height: 1.1; }
.kpi .sub { font-size: 13px; color: var(--muted); }

.head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px 24px; }
.head-text { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1 1 360px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.seg button { font: inherit; font-size: 13px; padding: 7px 14px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--bg); font-weight: 500; }
.seg button:focus-visible, select:focus-visible, input:focus-visible, th[data-sort]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.sw { width: 11px; height: 11px; border-radius: 2px; display: inline-block; }
.s0 { background: var(--s0); } .s1 { background: var(--s1); } .s2 { background: var(--s2); } .s3 { background: var(--s3); }

.chart { position: relative; min-height: 320px; min-width: 0; }
.chart.small { min-height: 220px; }
.chart svg { display: block; overflow: visible; }
.axis text, .chart text.lbl { fill: var(--muted); font: 12px var(--body); font-variant-numeric: tabular-nums; }
.axis path, .axis line { stroke: var(--line); }
.grid line { stroke: var(--grid); }
.grid path { display: none; }
.tip { position: absolute; pointer-events: none; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 6px 20px rgb(0 0 0 / 0.12); border-radius: var(--radius); padding: 9px 11px; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; z-index: 3; }
.tip .k { color: var(--muted); }
.tip .t { font-weight: 600; }
.panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 28px; }
.panel { display: flex; flex-direction: column; gap: 6px; min-width: 0; }

.tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
select, input[type="search"] { font: inherit; font-size: 13px; padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--fg); max-width: 100%; }
input[type="search"] { width: 240px; }
.wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.wrap.tall { max-height: 620px; overflow-y: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 8px 11px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; background: var(--panel); position: sticky; top: 0; z-index: 1; white-space: nowrap; box-shadow: inset 0 -1px 0 var(--line); }
th[data-sort] { cursor: pointer; user-select: none; }
th[aria-sort="descending"]::after { content: " ↓"; }
th[aria-sort="ascending"]::after { content: " ↑"; }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.mono { font-variant-numeric: tabular-nums; white-space: nowrap; }
td.apn { white-space: pre-line; }
#cert-table td:nth-child(2), #cert-table td:nth-child(3) { min-width: 170px; }
#cert-table td:nth-child(4) { min-width: 150px; }
#corr-table td:first-child, #corr-table td:last-child { min-width: 200px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.neg { color: var(--bad); }
.pill { display: inline-block; padding: 0 8px; border-radius: 999px; font-size: 11px; line-height: 18px; border: 1px solid currentColor; white-space: nowrap; }
.pill.high { color: var(--ok); } .pill.medium { color: var(--warn); } .pill.low, .pill.unresolved { color: var(--bad); } .pill.none { color: var(--muted); }

.notes { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.card p { font-size: 13px; color: var(--muted); }
.prose { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; max-width: 75ch; }
.downloads { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 10px; }
.downloads li { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); min-width: 0; }
.downloads a { font-weight: 500; word-break: break-all; }
.downloads span { font-size: 13px; color: var(--muted); }
.err { color: var(--bad); font-size: 13px; }
@media (max-width: 480px) { .page { gap: 44px; padding-block: 32px 56px; } .kpis { margin-top: -16px; } input[type="search"] { width: 100%; } }

.map { height: clamp(380px, 62vh, 600px); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); position: relative; }
.map .err { padding: 20px; }
.map-filters { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--muted); }
.map-filters label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.map-filters input { margin: 0; accent-color: var(--accent); }
.mapboxgl-popup-content { background: var(--panel); color: var(--fg); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 6px 20px rgb(0 0 0 / 0.18); padding: 12px 14px; font: 13px/1.45 var(--body); min-width: 220px; }
.mapboxgl-popup-tip { border-top-color: var(--panel) !important; border-bottom-color: var(--panel) !important; }
.mapboxgl-popup-close-button { color: var(--muted); font-size: 18px; padding: 2px 8px; }
.pop h4 { margin: 0 18px 2px 0; font-size: 14px; }
.pop .k { color: var(--muted); }
.pop .amt { font-family: var(--display); font-size: 22px; font-variant-numeric: tabular-nums; margin-top: 4px; }
.pop table { font-size: 12px; margin-top: 6px; width: auto; }
.pop td { padding: 1px 12px 1px 0; border: 0; background: none !important; }
#data .downloads { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

.map-3d { height: clamp(420px, 72vh, 700px); background: #0e1112; }
.ramp { display: flex; flex-direction: column; gap: 4px; max-width: 420px; font-size: 12px; color: var(--muted); }
.ramp .bar { height: 10px; border-radius: 3px; background: linear-gradient(90deg, #3b4cc0 0%, #5a8fd6 8%, #9bd0c8 20%, #f3e27a 40%, #f59e3b 60%, #e3462c 80%, #b0125b 100%); }
.ramp .ticks { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; }

.map-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.year-pick { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.year-pick select { font-weight: 500; color: var(--fg); }
.pop tr.on td { font-weight: 600; color: var(--fg); }
