/* midterms2026.truthtide.tv: one stylesheet for every page.
   Map colors validated with the dataviz validate_palette.js on 2026-11-10:
   amber (ordinal, light):  #e5a83a #c27410 #87490a   light end 2.05:1 on #fcfcfb
   amber (ordinal, dark):   #7d5410 #c4850f #f4bf52   light end 2.61:1 on #1a1a19
   arrows (light): #2a78d6 / #e34948  CVD dE 21.6, normal dE 32.3, both >= 3:1
   arrows (dark):  #3987e5 / #e66767  CVD dE 19.2, normal dE 29.0, both >= 3:1 */
:root {
  --ui: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --bg: #fcfcfb; --panel: #f3f2ee; --rule: #e2e1db; --grid: #ebeae5;
  --text: #0b0b0b; --text-2: #52514e; --muted: #6f6e68;
  --accent: #4a3aa7; --accent-soft: #ece9fb;
  --under: #d9d7d0; --a1: #e5a83a; --a2: #c27410; --a3: #87490a;
  --land: #ebeae5; --nodata: #f3f2ee; --hatch: #c9c7bf;
  --dem: #2a78d6; --rep: #e34948;
  --flash: #fbe7b8;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a1a19; --panel: #232321; --rule: #3a3a36; --grid: #2c2c29;
    --text: #ffffff; --text-2: #c3c2b7; --muted: #a09f95;
    --accent: #9085e9; --accent-soft: #2a2645;
    --under: #3d3d39; --a1: #7d5410; --a2: #c4850f; --a3: #f4bf52;
    --land: #2c2c29; --nodata: #232321; --hatch: #4a4a45;
    --dem: #3987e5; --rep: #e66767;
    --flash: #4a3a12;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1a1a19; --panel: #232321; --rule: #3a3a36; --grid: #2c2c29;
  --text: #ffffff; --text-2: #c3c2b7; --muted: #a09f95;
  --accent: #9085e9; --accent-soft: #2a2645;
  --under: #3d3d39; --a1: #7d5410; --a2: #c4850f; --a3: #f4bf52;
  --land: #2c2c29; --nodata: #232321; --hatch: #4a4a45;
  --dem: #3987e5; --rep: #e66767;
  --flash: #4a3a12;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 16px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 18px/1.62 var(--serif); }
main { max-width: 1040px; margin: 0 auto;
  padding: 0 max(16px, env(safe-area-inset-right, 0px)) 80px max(16px, env(safe-area-inset-left, 0px)); }
.prose { max-width: 680px; }
h1, h2, h3, h4, .ui, figcaption, table, .notice, .legend, .meta, .kicker, footer, .tiles, .status, .crumb,
.blurb dl, .map-head, .pending, details summary, .dot-when, .dot-src { font-family: var(--ui); }
header { padding: 40px 0 8px; }
.crumb { font-size: 14px; margin: 0 0 20px; }
.crumb a { text-decoration: none; }
.kicker { font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); margin: 0 0 12px; }
h1 { font-size: 40px; line-height: 1.1; letter-spacing: -.02em; font-weight: 700; margin: 0 0 16px; max-width: 860px; }
.dek { font-size: 20px; line-height: 1.5; color: var(--text-2); margin: 0 0 16px; max-width: 680px; }
.meta { font-size: 13px; color: var(--muted); margin: 0; max-width: 760px; }
h2 { font-size: 26px; line-height: 1.2; letter-spacing: -.01em; margin: 56px 0 12px; padding-top: 24px; border-top: 1px solid var(--rule); }
h3 { font-size: 19px; line-height: 1.3; margin: 32px 0 8px; }
p { margin: 0 0 16px; }
a { color: var(--accent); text-underline-offset: 2px; overflow-wrap: anywhere; }
strong { font-weight: 600; }
code { font-family: var(--mono); font-size: .85em; }
ul { padding-left: 1.3em; margin: 0 0 16px; }
li { margin-bottom: 8px; }
ul.why > li > p { margin: 0 0 6px; }
ul.why ul { margin: 0 0 12px; }
.muted { color: var(--muted); }
a:focus-visible, button:focus-visible, th button:focus-visible, details summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 28px 0 0; }
.tile { background: var(--panel); border-radius: 8px; padding: 14px 16px 12px; min-width: 0; }
.tile .k { font-size: 12.5px; font-weight: 600; color: var(--text-2); margin: 0 0 4px; line-height: 1.35; }
.tile .v { font-size: 30px; font-weight: 700; line-height: 1.15; letter-spacing: -.01em; margin: 0 0 4px;
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tile .v.small { font-size: 21px; }
.tile .s { font-size: 13px; color: var(--muted); line-height: 1.45; margin: 0; }
.status { font-size: 14px; line-height: 1.5; color: var(--text-2); background: transparent; border-left: 3px solid var(--rule);
  padding: 4px 0 4px 14px; margin: 20px 0 0; max-width: 760px; }
.status p { margin: 0 0 4px; }
.notice { font-size: 15px; line-height: 1.5; background: var(--accent-soft); border-left: 3px solid var(--accent);
  padding: 12px 16px; border-radius: 4px; margin: 20px 0 0; max-width: 760px; }

/* figures */
figure.chart { margin: 20px 0 28px; }
figcaption { margin-bottom: 10px; }
.chart-title { display: block; font-size: 16px; font-weight: 600; line-height: 1.35; }
.chart-sub { display: block; font-size: 14px; color: var(--text-2); line-height: 1.45; margin-top: 2px; max-width: 760px; }
.plot { width: 100%; position: relative; min-height: 120px; }
.plot svg { display: block; overflow: visible; touch-action: manipulation; }
.plot text { fill: var(--text-2); font: 12px var(--ui); font-variant-numeric: tabular-nums; }
.plot .axis .domain { display: none; }
.plot .axis .tick line { stroke: var(--grid); stroke-width: 1; }
.plot .ref { stroke: var(--text-2); stroke-width: 1.25; stroke-dasharray: 4 3; }
.plot .axis-label { fill: var(--text-2); font-size: 12px; font-weight: 600; }
.plot .unit { cursor: pointer; }
.map-head { font-size: 14px; color: var(--text-2); margin: 0 0 8px; }
.map-head strong { color: var(--text); }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; font-size: 13px; color: var(--text-2); margin: 0 0 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 14px; height: 10px; border-radius: 2px; display: inline-block; flex: none; }
.sw.nodata { background: repeating-linear-gradient(45deg, var(--hatch) 0 1.5px, var(--nodata) 1.5px 4px); }
.legend svg { display: block; overflow: visible; }
.pending { font-size: 15px; line-height: 1.5; background: var(--panel); border-radius: 8px; padding: 16px 18px; margin: 16px 0 24px; max-width: 760px; }
.pending strong { color: var(--text); }

/* tables */
.table-wrap { overflow-x: auto; margin: 0 0 20px; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; font-size: 14px; line-height: 1.4; font-variant-numeric: tabular-nums; min-width: 100%; }
th { text-align: left; font-weight: 600; color: var(--text-2); font-size: 12.5px; padding: 8px 12px 8px 0; border-bottom: 1px solid var(--text-2); vertical-align: bottom; }
td { padding: 8px 12px 8px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
td:first-child { font-weight: 600; }
td.num, th.num { text-align: right; }
th button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: inherit; }
th[aria-sort] button::after { content: ""; display: inline-block; margin-left: 4px; border: 4px solid transparent; vertical-align: middle; }
th[aria-sort="ascending"] button::after { border-bottom-color: currentColor; margin-top: -4px; }
th[aria-sort="descending"] button::after { border-top-color: currentColor; margin-top: 4px; }
table.sources td:first-child { font-weight: 500; }
table.sources td { font-size: 13px; }

/* blurbs */
.blurbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; margin: 16px 0 0; }
.blurb { background: var(--panel); border-radius: 8px; padding: 14px 16px 10px; min-width: 0; transition: background-color .6s; }
.blurb h3 { margin: 0 0 8px; font-size: 17px; }
.blurb dl { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 3px 12px; margin: 0 0 8px; font-size: 13.5px; line-height: 1.4; font-variant-numeric: tabular-nums; }
.blurb dt { color: var(--text-2); }
.blurb dd { margin: 0; text-align: right; overflow-wrap: break-word; }
.blurb .src { font: 12.5px/1.45 var(--ui); color: var(--muted); margin: 0; }
.blurb.flash { background: var(--flash); }
.blurb .over { font-weight: 600; }

aside.dot { background: var(--panel); border-left: 3px solid var(--accent); border-radius: 4px; padding: 16px 18px 4px; margin: 24px 0; max-width: 680px; }
aside.dot h3 { margin: 0 0 8px; font-size: 17px; }
aside.dot p { font-size: 16px; line-height: 1.55; }
.dot-when { font-size: 12px !important; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--accent); margin: 0 0 4px !important; }
.dot-src { font-size: 13px !important; color: var(--muted); }

#tip { position: fixed; z-index: 10; pointer-events: none; background: var(--bg); color: var(--text); border: 1px solid var(--rule);
  box-shadow: 0 4px 16px rgba(0,0,0,.12); border-radius: 6px; padding: 8px 10px; font: 13px/1.45 var(--ui);
  font-variant-numeric: tabular-nums; max-width: 300px; }
#tip strong { font-weight: 600; }
#tip .muted { color: var(--muted); }
#tip .hint { color: var(--accent); font-size: 12px; }
footer { margin-top: 64px; padding-top: 16px; border-top: 1px solid var(--rule); font-size: 13px; line-height: 1.5; color: var(--muted); }
footer .sign { font: 600 17px/1.4 var(--ui); color: var(--text); margin: 0 0 6px; }

@media (max-width: 640px) {
  body { font-size: 17px; }
  header { padding-top: 24px; }
  h1 { font-size: 29px; }
  .dek { font-size: 18px; }
  h2 { font-size: 22px; margin-top: 44px; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 8px; }
  .tile { padding: 12px; }
  .tile .v { font-size: 24px; }
  .tile .v.small { font-size: 17px; }
  .blurbs { grid-template-columns: 1fr; }
}
@media (max-width: 360px) { .tiles { grid-template-columns: 1fr; } }
@media (forced-colors: active) { .blurb.flash { outline: 2px solid CanvasText; } }

details.tv { margin: 0 0 24px; }
details.tv summary { font-size: 14px; font-weight: 600; color: var(--accent); cursor: pointer; padding: 6px 0; }
details.tv[open] summary { margin-bottom: 8px; }
