/* Machine Learning Winds — Forecasts. One family (Schibsted Grotesk), party colors carry identity. */
:root {
  color-scheme: light;
  --page: #f3f5f7; --surface: #ffffff; --ink: #1a2430; --muted: #5e6a78; --rule: #d5dbe2; --soft: #e6eaee;
  --dem: #2f62c9; --rep: #d23c3f; --ind: #8a5cc4;
  --dem-wash: rgba(47, 98, 201, .12); --rep-wash: rgba(210, 60, 63, .12);
  --focus: #1a2430;
  --measure: 68ch; --wide: 1080px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #12171d; --surface: #182029; --ink: #e8ecf0; --muted: #9aa5b1; --rule: #2a333d; --soft: #222b35;
    --dem: #5b8ef0; --rep: #ec5f5f; --ind: #9b78d8;
    --dem-wash: rgba(91, 142, 240, .16); --rep-wash: rgba(236, 95, 95, .16); --focus: #e8ecf0;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #12171d; --surface: #182029; --ink: #e8ecf0; --muted: #9aa5b1; --rule: #2a333d; --soft: #222b35;
  --dem: #5b8ef0; --rep: #ec5f5f; --ind: #9b78d8;
  --dem-wash: rgba(91, 142, 240, .16); --rep-wash: rgba(236, 95, 95, .16); --focus: #e8ecf0;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--ink);
  font-family: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
  font-size: 17px; line-height: 1.55; font-variant-numeric: tabular-nums;
}
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 2px; }

.wrap { max-width: var(--wide); margin: 0 auto; padding: 0 20px; }
.prose { max-width: var(--measure); }
.prose p, .prose li { color: var(--ink); }

/* Header: the wordmark draws three wind streamlines. */
.site-head { border-bottom: 1px solid var(--rule); background: var(--page); }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.mark { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; font-size: 18px; letter-spacing: -.01em; }
.mark svg { width: 30px; height: 20px; }
.mark svg path { stroke: var(--ink); stroke-width: 2; fill: none; stroke-linecap: round; }
.mark span { font-weight: 400; color: var(--muted); }
.site-nav { display: flex; gap: 22px; font-size: 15px; }
.site-nav a { text-decoration: none; color: var(--muted); padding: 4px 0; white-space: nowrap; }
.site-nav a[aria-current="page"], .site-nav a:hover { color: var(--ink); box-shadow: inset 0 -2px 0 var(--ink); }

main { padding: 40px 0 72px; }
h1 { font-size: clamp(32px, 5vw, 52px); line-height: 1.05; letter-spacing: -.025em; margin: 0 0 16px; font-weight: 800; }
h2 { font-size: 26px; line-height: 1.2; letter-spacing: -.015em; margin: 56px 0 12px; font-weight: 700; }
h3 { font-size: 19px; margin: 32px 0 8px; font-weight: 700; }
.lede { font-size: 20px; line-height: 1.5; color: var(--muted); max-width: 60ch; margin: 0 0 28px; }
.small { font-size: 14px; color: var(--muted); }

/* Notice for backtests and frozen forecasts: a left rule, not a colored box. */
.notice { border-left: 3px solid var(--ink); padding: 4px 0 4px 16px; margin: 0 0 32px; max-width: 70ch; font-size: 15px; }
.notice strong { display: block; }

/* Topline: the chances read like a weather forecast. */
.topline { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px 40px; margin: 8px 0 20px; }
.chance { border-top: 4px solid var(--c); padding-top: 10px; }
.chance .n { font-size: clamp(40px, 6vw, 64px); font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.chance .l { font-size: 15px; color: var(--muted); margin-top: 6px; }
.split { display: flex; gap: 2px; height: 14px; margin: 0 0 6px; }
.split div { height: 100%; }
.split div:first-child { border-radius: 4px 0 0 4px; } .split div:last-child { border-radius: 0 4px 4px 0; }

/* Charts */
figure.chart { margin: 24px 0 8px; position: relative; }
figure.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
figure.chart figcaption { font-size: 14px; color: var(--muted); margin-top: 6px; max-width: 70ch; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 14px; color: var(--muted); margin: 0 0 4px; padding: 0; list-style: none; }
.legend li { display: flex; align-items: center; gap: 8px; }
.legend i { width: 14px; height: 3px; border-radius: 2px; background: var(--c); display: inline-block; }
.axis text { fill: var(--muted); font-size: 12px; }
.grid line { stroke: var(--soft); stroke-width: 1; }
.ref line { stroke: var(--muted); stroke-dasharray: 3 4; stroke-width: 1; }
.series path { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.endlab { font-size: 13px; font-weight: 700; }
.crosshair { stroke: var(--muted); stroke-width: 1; }
.tip {
  position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--rule);
  border-radius: 6px; padding: 8px 10px; font-size: 13px; line-height: 1.4; min-width: 150px;
  box-shadow: 0 4px 16px rgba(10, 20, 30, .12); opacity: 0; transition: opacity .12s;
}
.tip.on { opacity: 1; }
.tip b { display: block; margin-bottom: 2px; }
.tip span { display: flex; justify-content: space-between; gap: 12px; }
.tip span::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); align-self: center; }
.tip span em { flex: 1; font-style: normal; color: var(--muted); }

/* Tables */
.tablewrap { overflow-x: auto; margin: 16px 0; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 13px; padding: 8px 10px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--soft); vertical-align: middle; }
td.num, th.num { text-align: right; }
tr.race:hover td { background: var(--surface); }
.racebar { display: flex; gap: 2px; height: 10px; min-width: 160px; }
.racebar div:first-child { border-radius: 3px 0 0 3px; } .racebar div:last-child { border-radius: 0 3px 3px 0; }
.who { display: block; }
.who small { color: var(--muted); font-size: 13px; }
details { margin: 12px 0; }
summary { cursor: pointer; color: var(--muted); font-size: 15px; }

/* Home */
.feature { display: grid; grid-template-columns: 1.2fr 1fr; gap: 48px; align-items: end; padding-bottom: 40px; border-bottom: 1px solid var(--rule); }
.feature .when { font-size: 15px; color: var(--muted); }
.archive { display: grid; grid-template-columns: 1fr 1.4fr; gap: 40px; align-items: center; padding-top: 32px; }
.btn { display: inline-block; padding: 10px 16px; border: 1.5px solid var(--ink); border-radius: 6px; text-decoration: none; font-weight: 600; font-size: 15px; }
.btn:hover { background: var(--ink); color: var(--page); }

.site-foot { border-top: 1px solid var(--rule); padding: 28px 0 40px; font-size: 14px; color: var(--muted); }
.site-foot .wrap { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }
.site-foot nav { display: flex; gap: 18px; flex-wrap: wrap; }

@media (max-width: 760px) {
  body { font-size: 16px; }
  .feature, .archive { grid-template-columns: 1fr; gap: 24px; }
  h2 { margin-top: 44px; }
  .site-head .wrap { padding-top: 12px; padding-bottom: 4px; gap: 6px; }
  .site-nav { gap: 18px; width: 100%; overflow-x: auto; padding-bottom: 6px; font-size: 14px; }
  td, th { padding: 8px 6px; }
  .hide-sm { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Each chart ships a wide and a phone-sized version. */
.v-narrow { display: none; }
@media (max-width: 600px) { .v-wide { display: none; } .v-narrow { display: block; } }

/* Spain party colors. The four parties charted over time (PP, PSOE, Vox, Broad Front) are validated
   for colorblind separation in both themes; smaller parties are always labeled by name. */
:root {
  --pp: #1f6fd1; --psoe: #c0222b; --vox: #86c44a; --fa: #a93fa0; --fv: #e07b22; --podemos: #6e3b8f;
  --salf: #7a7f87; --erc: #e8a317; --junts: #1aa39a; --bildu: #9bbf3a; --pnv: #1d7a45; --bng: #5aa9d6;
  --cc: #e6c229; --aa: #3f9a6a;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --pp: #4a86e0; --psoe: #b52c2c; --vox: #66a133; --fa: #b55aae; }
}
:root[data-theme="dark"] { --pp: #4a86e0; --psoe: #b52c2c; --vox: #66a133; --fa: #b55aae; }

/* Seat bar: 350 seats left to right from left-wing to right-wing lists, with the 176 line. */
.seatbar { position: relative; margin: 28px 0 8px; }
.seatbar .bar { display: flex; gap: 2px; height: 40px; }
.seatbar .bar div { height: 100%; position: relative; }
.seatbar .bar div:first-child { border-radius: 4px 0 0 4px; } .seatbar .bar div:last-child { border-radius: 0 4px 4px 0; }
.seatbar .maj { position: absolute; top: -10px; bottom: -6px; left: 50.29%; border-left: 2px solid var(--ink); }
.seatbar .maj span { position: absolute; top: -20px; left: -40px; width: 80px; text-align: center; font-size: 12px; font-weight: 600; }
.seatkey { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 14px; margin: 10px 0 0; padding: 0; list-style: none; }
.seatkey li { display: flex; align-items: center; gap: 6px; }
.seatkey i { width: 10px; height: 10px; border-radius: 2px; background: var(--c); display: inline-block; }
.seatkey b { font-weight: 700; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: var(--c); margin-right: 8px; vertical-align: baseline; }
.range { color: var(--muted); font-size: 13px; }
.pills { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.pills span { white-space: nowrap; }
@media (max-width: 760px) { td .range { display: block; } }
