/* ================================================================
   election2026.nz — civic paper + electoral orange
   Display: Bricolage Grotesque · Body: IBM Plex Sans · Data: IBM Plex Mono
   ================================================================ */

:root {
  /* surfaces & ink (light) */
  --surface: #FAF9F6;
  --surface-raised: #FFFFFF;
  --surface-sunken: #F1EFE9;
  --ink: #1A1C20;
  --ink-2: #4B5058;
  --ink-3: #83888F;
  --hairline: #E3E0D8;
  --accent: #E4570B;          /* NZ electoral orange */
  --accent-ink: #C74A07;
  --focus: #0B5BAE;

  /* party palette — validated for light surface */
  --c-nat: #0B5BAE;
  --c-lab: #D93A2B;
  --c-grn: #26843B;
  --c-act: #AD8B00;
  --c-nzf: #000000;
  --c-tpm: #8F1D3C;
  --c-top: #0D9C8F;
  --c-oth: #9A968C;

  --radius: 14px;
  --wrap: 1100px;
  --shadow: 0 1px 2px rgba(26,28,32,.05), 0 8px 28px -12px rgba(26,28,32,.12);
}

[data-theme="dark"] {
  --surface: #16181D;
  --surface-raised: #1D2027;
  --surface-sunken: #101216;
  --ink: #ECEDEF;
  --ink-2: #AEB2BA;
  --ink-3: #767B84;
  --hairline: #2A2E36;
  --accent: #F0692B;
  --accent-ink: #F0692B;
  --focus: #5B9BE8;

  /* party palette — validated for dark surface */
  --c-nat: #2E6AB4;
  --c-lab: #E05146;
  --c-grn: #3E9B52;
  --c-act: #F7D347;
  --c-nzf: #A8ADB5;
  --c-tpm: #CE5470;
  --c-top: #6CEAE0;
  --c-oth: #6E7278;

  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 28px -12px rgba(0,0,0,.5);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --surface: #16181D; --surface-raised: #1D2027; --surface-sunken: #101216;
    --ink: #ECEDEF; --ink-2: #AEB2BA; --ink-3: #767B84; --hairline: #2A2E36;
    --accent: #F0692B; --accent-ink: #F0692B; --focus: #5B9BE8;
    --c-nat: #2E6AB4; --c-lab: #E05146; --c-grn: #3E9B52; --c-act: #F7D347;
    --c-nzf: #A8ADB5; --c-tpm: #CE5470; --c-top: #6CEAE0; --c-oth: #6E7278;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 28px -12px rgba(0,0,0,.5);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* author display rules (flex/grid on classes) must never beat the hidden attribute */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: "IBM Plex Mono", ui-monospace, monospace; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
a { color: var(--accent-ink); text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

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

/* ---------------- live-night banner ---------------- */

.live-banner {
  display: block; text-decoration: none; color: var(--ink);
  background: color-mix(in srgb, var(--accent) 9%, var(--surface));
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}
.live-banner:hover { background: color-mix(in srgb, var(--accent) 15%, var(--surface)); }
.live-banner-inner { display: flex; align-items: center; gap: 12px; min-height: 42px; padding-top: 8px; padding-bottom: 8px; font-size: 13.5px; line-height: 1.35; }
.live-banner-dot {
  flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}
.live-banner-text { flex: 1; min-width: 0; color: var(--ink-2); }
.live-banner-text b { color: var(--ink); font-weight: 600; }
.live-banner-text a { color: var(--accent-ink); font-weight: 600; }
.live-banner-cta { flex: none; font-weight: 600; color: var(--accent-ink); white-space: nowrap; text-decoration: none; }
.live-banner:hover .live-banner-cta { text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 640px) {
  .live-banner-text { font-size: 13px; }
  .live-banner-arrow, .live-banner-more { display: none; }
}

/* the voting-place banner: the same shape in civic blue, a pin for its mark */
.vote-banner {
  --banner: #1F5FBF;
  background: color-mix(in srgb, var(--banner) 7%, var(--surface));
  border-bottom: 1px solid color-mix(in srgb, var(--banner) 55%, transparent);
}
[data-theme="dark"] .vote-banner { --banner: #6EA3F0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .vote-banner { --banner: #6EA3F0; } }
.vote-banner:hover { background: color-mix(in srgb, var(--banner) 13%, var(--surface)); }
.vote-banner-pin { flex: none; color: var(--banner); filter: drop-shadow(0 0 3px color-mix(in srgb, var(--banner) 35%, transparent)); }
.vote-banner .live-banner-cta { color: var(--banner); }

/* ---------------- top bar ---------------- */

.topbar {
  border-bottom: 1px solid var(--hairline);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 40;
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 58px; }

.wordmark { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.wordmark-mark {
  width: 22px; height: 22px; border-radius: 6px; flex: none;
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M8.5 17.5l6 6 9.5-14' fill='none' stroke='%23FAF9F6' stroke-width='4.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 100% no-repeat;
}
.wordmark-text {
  font-family: "Bricolage Grotesque", sans-serif; font-weight: 500;
  font-size: 17px; letter-spacing: -.01em;
}
.wordmark-text b { font-weight: 800; }
.wordmark-text i { font-style: normal; color: var(--ink-3); font-weight: 500; }

.topbar-right { display: flex; align-items: center; gap: 14px; }
.updated { font-size: 11.5px; color: var(--ink-3); letter-spacing: .01em; }

.countdown {
  font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent-ink);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: 999px; padding: 4px 11px;
  white-space: nowrap;
}
.countdown b { font-weight: 600; }
@media (max-width: 640px) {
  .updated { display: none; }   /* keep the countdown; the footer restates the data stamp */
}

.theme-toggle {
  display: grid; place-items: center; width: 32px; height: 32px;
  border: 1px solid var(--hairline); border-radius: 9px;
  background: var(--surface-raised); color: var(--ink-2); cursor: pointer;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--ink-3); }
.theme-toggle .moon { display: none; }
[data-theme="dark"] .theme-toggle .moon { display: block; }
[data-theme="dark"] .theme-toggle .sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .moon { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .sun { display: none; }
}

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

.hero { padding: 56px 0 30px; border-bottom: 1px solid var(--hairline); }

.eyebrow {
  font-size: 12px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent-ink); margin-bottom: 14px;
}

.headline {
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 800;
  font-size: clamp(28px, 4.6vw, 52px);
  line-height: 1.06;
  letter-spacing: -.02em;
  max-width: 21ch;
  text-wrap: balance;
  margin-bottom: 8px;
  min-height: 2.1em;
}
.headline .hl { color: var(--accent-ink); }

.chamber-stage {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(300px, 720px) minmax(120px, 1fr);
  align-items: end;
  gap: 12px;
  margin-top: 18px;
}

.chamber-wrap { position: relative; }
#chamber { width: 100%; height: auto; display: block; }
#chamber circle { transition: transform .8s cubic-bezier(.6,.05,.2,1), fill .4s; }
@media (prefers-reduced-motion: reduce) {
  #chamber circle { transition: none; }
}

.majority-flag {
  position: absolute; top: -4px; left: 50%; transform: translateX(-50%);
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-3);
  padding-bottom: 2px;
}

.center-figure {
  position: absolute; left: 50%; bottom: 24%;
  transform: translateX(-50%);
  text-align: center;
}
.center-figure-value {
  font-family: "Bricolage Grotesque", sans-serif; font-weight: 700;
  font-size: clamp(18px, 2.4vw, 28px); display: block; line-height: 1;
}
.center-figure-label { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }

.bloc-figure { text-align: center; padding-bottom: 8px; }
.bloc-figure-value {
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 800; font-size: clamp(40px, 6vw, 72px); line-height: 1;
  display: block; font-variant-numeric: normal;
}
.bloc-figure--left .bloc-figure-value { color: var(--c-lab); }
.bloc-figure--right .bloc-figure-value { color: var(--c-nat); }
.bloc-figure-label { font-size: 13px; font-weight: 600; color: var(--ink-2); display: block; margin-top: 6px; }
.bloc-figure-parties { display: block; font-weight: 400; font-size: 12px; color: var(--ink-3); margin-top: 2px; }

.bloc-figure-value.is-majority::after {
  content: "✓ majority";
  display: block; font-family: "IBM Plex Mono", monospace;
  font-size: 11px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent-ink); margin-top: 4px;
}

.hero-note { color: var(--ink-2); font-size: 14px; max-width: 62ch; margin: 10px auto 0; text-align: center; }

.assume-row {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  flex-wrap: wrap; margin-top: 16px;
}
.assume-label {
  font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-3);
}
.assume-chips { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.assume-chip {
  display: inline-flex; align-items: center; gap: 7px;
  appearance: none; cursor: pointer;
  font: 500 12.5px "IBM Plex Sans", sans-serif;
  padding: 6px 12px 6px 9px; border-radius: 999px;
  border: 1px solid var(--hairline);
  background: var(--surface-raised); color: var(--ink-2);
  transition: border-color .15s, color .15s, opacity .15s;
}
.assume-chip .a-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.assume-chip .assume-check {
  width: 15px; height: 15px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  font: 600 10px "IBM Plex Mono", monospace;
  background: var(--surface-sunken); color: var(--ink-3);
}
.assume-chip:hover { border-color: var(--ink-3); color: var(--ink); }
.assume-chip.is-on { border-color: var(--ink); color: var(--ink); }
.assume-chip.is-on .assume-check { background: var(--ink); color: var(--surface); }
.assume-chip:not(.is-on):not(.is-two) .a-dot { opacity: .35; }
/* two-way either/or chip (Māori seats): always an assertion, dashed to read as a switch */
.assume-chip.is-two { border-style: dashed; color: var(--ink); }
.assume-chip.is-two:hover { border-style: solid; }
.assume-chip .assume-swap {
  width: 15px; height: 15px; flex: none; display: grid; place-items: center;
  font: 600 11px "IBM Plex Mono", monospace; color: var(--ink-3);
}

/* the "Showing" picker: the polling average, or one recent poll alone — a chip
   that opens a list. Solid ink (like an active preset) whenever the page is
   off the average, so the state reads at a glance */
.poll-pick { position: relative; display: inline-flex; align-items: center; max-width: 100%; }
.poll-pick select {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  font: 500 12.5px "IBM Plex Sans", sans-serif;
  padding: 6px 30px 6px 13px; border-radius: 999px;
  border: 1px solid var(--hairline);
  background: var(--surface-raised); color: var(--ink-2);
  max-width: min(100%, 400px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: border-color .15s, color .15s, background .15s;
}
.poll-pick select:hover { border-color: var(--ink-3); color: var(--ink); }
.poll-pick select:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.poll-pick.is-off select { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.poll-pick-chev { position: absolute; right: 11px; pointer-events: none; color: var(--ink-3); }
.poll-pick.is-off .poll-pick-chev { color: var(--surface); }
.poll-pick option, .poll-pick optgroup { font: 13px "IBM Plex Sans", sans-serif; background: var(--surface-raised); color: var(--ink); }
[data-theme="dark"] .poll-pick select { color-scheme: dark; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .poll-pick select { color-scheme: dark; }
}

.scenario-actions { display: inline-flex; gap: 8px; align-items: center; }
.scenario-btn {
  display: inline-flex; align-items: center; gap: 7px;
  appearance: none; cursor: pointer;
  font: 500 12.5px "IBM Plex Sans", sans-serif;
  padding: 6px 13px; border-radius: 999px;
  border: 1px dashed color-mix(in srgb, var(--accent) 45%, transparent);
  background: transparent; color: var(--accent-ink);
}
.scenario-btn:hover {
  border-style: solid;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
/* "Share this scenario" wears the site's share blue (see .share-btn), still dashed like its neighbours */
#share-btn { --share: #1B66E0; border-color: color-mix(in srgb, var(--share) 55%, transparent); color: var(--share); }
#share-btn:hover { background: color-mix(in srgb, var(--share) 8%, transparent); }
[data-theme="dark"] #share-btn { --share: #3B7EF0; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) #share-btn { --share: #3B7EF0; }
}

@media (max-width: 760px) {
  .chamber-stage { grid-template-columns: 1fr 1fr; grid-template-areas: "chamber chamber" "left right"; }
  .chamber-wrap { grid-area: chamber; }
  .bloc-figure--left { grid-area: left; }
  .bloc-figure--right { grid-area: right; }
}

.preset-chip {
  appearance: none; cursor: pointer;
  font: 500 12.5px "IBM Plex Sans", sans-serif;
  padding: 6px 13px; border-radius: 999px;
  border: 1px solid var(--hairline);
  background: var(--surface-raised); color: var(--ink-2);
}
.preset-chip:hover { border-color: var(--ink-3); color: var(--ink); }
.preset-chip.is-on { background: var(--ink); border-color: var(--ink); color: var(--surface); }
/* explains what a sandbox preset changed, while the sandbox still matches it */
.preset-note {
  color: var(--ink-2); font-size: 13px; line-height: 1.55; max-width: 66ch;
  margin: 12px auto 0; text-align: center;
}
.preset-note strong { color: var(--ink); }

/* ---------------- key dates strip ---------------- */

.dates { border-bottom: 1px solid var(--hairline); background: var(--surface-sunken); }
.dates-strip {
  display: flex; gap: 6px; align-items: stretch;
  overflow-x: auto; padding-top: 12px; padding-bottom: 12px;
}
.date-item {
  flex: 1 0 auto; display: flex; flex-direction: column; gap: 1px;
  padding: 6px 14px; border-left: 2px solid var(--hairline);
  white-space: nowrap;
}
.date-d { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.date-l { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.date-item.is-past { opacity: .45; }
.date-item.is-next { border-left-color: var(--accent); }
.date-item.is-next .date-d { color: var(--accent-ink); }
.date-item.is-next .date-l { color: var(--ink); }

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

.section { padding: 52px 0 8px; }
/* width cap sits on the heading and subtitle, not the container,
   so the mono eyebrow above them can run the full row */
.section-head { margin-bottom: 22px; }
.section-head h2 {
  font-family: "Bricolage Grotesque", sans-serif; font-weight: 700;
  font-size: clamp(21px, 2.6vw, 28px); letter-spacing: -.015em; margin-bottom: 8px;
  max-width: 70ch;
}
.section-sub { color: var(--ink-2); font-size: 15px; max-width: 70ch; }

.card {
  background: var(--surface-raised);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------------- party cards ---------------- */

.party-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

.party-card {
  background: var(--surface-raised);
  border: 1px solid var(--hairline);
  border-top: 4px solid var(--party, var(--hairline));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px 12px;
  display: flex; flex-direction: column; gap: 8px;
}

.party-card-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.party-abbr {
  font-family: "Bricolage Grotesque", sans-serif; font-weight: 800; font-size: 19px;
  letter-spacing: -.01em;
}
.party-name { font-size: 12px; color: var(--ink-3); line-height: 1.3; }

.party-figures { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.party-share { font-family: "Bricolage Grotesque", sans-serif; font-weight: 700; font-size: 26px; line-height: 1; }
.party-share small { font-size: 13px; font-weight: 500; color: var(--ink-3); }
.party-seats { font-size: 13px; color: var(--ink-2); text-align: right; }
.party-seats b { font-size: 17px; color: var(--ink); }

.party-meter {
  height: 5px; border-radius: 3px; background: var(--surface-sunken);
  position: relative; overflow: visible;
}
.party-meter-fill {
  position: absolute; inset: 0 auto 0 0; border-radius: 3px;
  background: var(--party); min-width: 2px;
  transition: width .6s cubic-bezier(.6,.05,.2,1);
}
.party-meter-threshold {
  position: absolute; top: -3px; bottom: -3px; width: 1px;
  background: var(--ink-3);
}

.party-flags { font-size: 11px; color: var(--ink-3); min-height: 15px; }
.party-flags .warn { color: var(--accent-ink); }

.align-toggle {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  border: 1px solid var(--hairline); border-radius: 9px; overflow: hidden;
  background: var(--surface-sunken);
}
.align-toggle button {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  font-family: "IBM Plex Mono", monospace; font-size: 11px; font-weight: 500;
  letter-spacing: .06em; text-transform: uppercase;
  padding: 7px 0; color: var(--ink-3);
}
.align-toggle button:hover { color: var(--ink); }
.align-toggle button.is-on { background: var(--ink); color: var(--surface); }
.align-toggle button:focus-visible { outline-offset: -2px; }
.align-toggle.is-locked button { cursor: default; }
.align-toggle.is-locked button:not(.is-on) { opacity: .35; }
.align-toggle button.is-blocked {
  cursor: not-allowed; color: var(--ink-3); opacity: .45;
  text-decoration: line-through; text-decoration-thickness: 1px;
}

/* coalition-watch notes: publicly stated positions, rendered from data/positions.json */
.coalition-note {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  border-radius: 10px; padding: 9px 14px; margin-bottom: 16px;
  font-size: 13px; color: var(--ink-2);
}
.coalition-note.is-off { opacity: .6; }
/* a position withdrawn in the last 90 days: shown, not applied */
.coalition-note.is-ended { border-style: dashed; background: transparent; }
.coalition-note.is-ended .cn-date { background: var(--ink-3); }
.cn-date {
  flex: none; font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--surface); background: var(--accent); border-radius: 999px; padding: 3px 9px;
}
.cn-text { flex: 1; min-width: 240px; }
.cn-text strong { color: var(--ink); }
.cn-text a { margin-left: 4px; }
.cn-apply {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--ink-2); cursor: pointer; white-space: nowrap;
}
.cn-apply input { accent-color: var(--accent); width: 15px; height: 15px; }

/* ---------------- custom vote-share entry ---------------- */

.custom-row { margin-bottom: 16px; }
.custom-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  font-size: 13px; color: var(--ink-2);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  border-radius: 10px; padding: 8px 14px;
}
.custom-bar.is-error {
  border-color: color-mix(in srgb, var(--c-lab) 55%, transparent);
  background: color-mix(in srgb, var(--c-lab) 8%, transparent);
}
.custom-bar.is-error #custom-total { color: var(--ink); font-weight: 600; }
.sandbox-flag {
  font-size: 10px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent-ink); font-weight: 500;
}
.custom-bar .scenario-btn { margin-left: auto; }

/* poll view ↔ custom (calculator) view */
.pf-custom { display: none; }
.party-grid.is-custom .pf-poll { display: none; }
.party-grid.is-custom .pf-custom { display: block; }
.party-grid.is-custom .party-flags { display: none; }   /* breakdown carries it */

.pc-fields { display: flex; gap: 10px; }
.pc-field { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; cursor: text; }
.pc-lab { font-size: 9px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.pc-inwrap { display: inline-flex; align-items: baseline; gap: 3px; }
.pc-inwrap input {
  width: 100%; min-width: 0;
  font: 700 20px "Bricolage Grotesque", sans-serif;
  color: var(--ink); background: var(--surface-sunken);
  border: 1px solid var(--hairline); border-radius: 8px; padding: 3px 8px;
}
.pc-inwrap small { font-size: 12px; font-weight: 500; color: var(--ink-3); }
.pc-inwrap input:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; }
.pc-result { margin-top: 9px; font-size: 13px; color: var(--ink-2); }
.pc-result .pc-total {
  font-family: "Bricolage Grotesque", sans-serif; font-weight: 800; font-size: 21px;
  color: var(--ink); margin-right: 3px;
}
.pc-break { display: block; font-size: 11px; color: var(--ink-3); margin-top: 2px; }

/* in sandbox mode the chips/presets are superseded by the per-card electorate inputs */
/* in the sandbox the electorate seats come from the party-card inputs, so only the
   assumption chips go quiet — Share, Reset and the Try presets stay live */
body.is-sandbox #assume-row { opacity: .4; pointer-events: none; }

/* ---------------- chances ---------------- */

.section-head .eyebrow { margin-bottom: 8px; }

.chances-card { padding: 22px 24px 18px; }
.chances-bars { display: flex; flex-direction: column; gap: 4px; }
.chance-row { display: grid; grid-template-columns: minmax(190px, 300px) 1fr 52px; align-items: center; gap: 14px; padding: 6px 0; }
.chance-label { font-size: 14px; font-weight: 500; display: inline-flex; align-items: center; gap: 8px; }
.chance-label .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.likeliest {
  font-size: 9px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent-ink);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  border-radius: 999px; padding: 1px 7px; white-space: nowrap;
}
.chance-track { height: 20px; border-radius: 5px; background: var(--surface-sunken); position: relative; }
.chance-fill {
  position: absolute; inset: 0 auto 0 0; border-radius: 5px;
  background: var(--bar); min-width: 3px;
  transition: width .6s cubic-bezier(.6,.05,.2,1);
}
.chance-val {
  font-family: "IBM Plex Mono", monospace; font-size: 14px; font-weight: 500;
  text-align: right; font-variant-numeric: tabular-nums;
}
@media (max-width: 640px) {
  .chance-row { grid-template-columns: 1fr 60px; grid-template-areas: "label val" "track track"; row-gap: 4px; }
  .chance-label { grid-area: label; font-size: 13px; }
  .chance-track { grid-area: track; }
  .chance-val { grid-area: val; }
}

.chances-chips {
  display: flex; flex-wrap: wrap; gap: 8px;
  border-top: 1px solid var(--hairline); margin-top: 16px; padding-top: 16px;
}
.prob-chip {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--ink-2);
  border: 1px solid var(--hairline); border-radius: 999px;
  padding: 7px 14px; background: var(--surface);
}
.prob-chip b { font-family: "IBM Plex Mono", monospace; font-size: 13px; color: var(--ink); font-weight: 500; }
.prob-chip .a-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.prob-chip--none { border-style: dashed; color: var(--ink-3); }

.party-range { display: block; font-size: 11px; color: var(--ink-3); margin-top: 1px; }

.wildcard {
  border-top: 1px solid var(--hairline);
  margin-top: 16px; padding-top: 14px;
}
.wildcard-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.wildcard-title {
  font-family: "Bricolage Grotesque", sans-serif; font-weight: 700; font-size: 13.5px;
}
.wildcard-badge {
  font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent-ink); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  border-radius: 999px; padding: 2px 8px; cursor: help;
}
.wildcard-row { display: flex; align-items: baseline; gap: 10px; }
.wildcard-dots { display: inline-flex; gap: 3px; flex: none; align-self: center; }
.wildcard-dots .a-dot { width: 9px; height: 9px; border-radius: 50%; }
.wildcard-label { font-size: 14px; font-weight: 500; }
.wildcard-val {
  font-family: "IBM Plex Mono", monospace; font-size: 15px; font-weight: 500;
  margin-left: auto; flex: none;
}
.wildcard-note { font-size: 12px; color: var(--ink-3); margin-top: 7px; max-width: 90ch; }

/* ---------------- filter row ---------------- */

.filter-row { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.filter-label { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); margin-right: 4px; }
.range-btn {
  appearance: none; cursor: pointer;
  border: 1px solid var(--hairline); background: var(--surface-raised); color: var(--ink-2);
  font: 500 12.5px "IBM Plex Sans", sans-serif;
  padding: 6px 14px; border-radius: 999px;
}
.range-btn:hover { color: var(--ink); border-color: var(--ink-3); }
.range-btn.is-active { background: var(--ink); border-color: var(--ink); color: var(--surface); }

/* ---------------- trend chart ---------------- */

.chart-card { padding: 18px 14px 10px; }
.chart-holder { position: relative; }
#trend { width: 100%; display: block; }

#trend .grid-line { stroke: var(--hairline); stroke-width: 1; }
#trend .axis-text { font: 11px "IBM Plex Mono", monospace; fill: var(--ink-3); }
#trend .threshold-line { stroke: var(--ink-3); stroke-width: 1; }
#trend .threshold-text { font: 10px "IBM Plex Mono", monospace; fill: var(--ink-3); letter-spacing: .08em; }
#trend .poll-dot { opacity: .22; }
#trend .poll-dot.is-picked { opacity: 1; stroke: var(--ink); stroke-width: 1.5; }   /* the poll shown alone in the hero */
#trend .avg-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
#trend .end-label { font: 600 11.5px "IBM Plex Sans", sans-serif; fill: var(--ink); }
#trend .end-label .pct { font-family: "IBM Plex Mono", monospace; font-weight: 500; fill: var(--ink-2); }
#trend .election-mark { stroke: var(--ink-3); stroke-width: 1; }
#trend .crosshair { stroke: var(--ink-3); stroke-width: 1; }

.legend {
  display: flex; flex-wrap: wrap; gap: 4px 16px;
  padding: 10px 8px 8px; border-top: 1px solid var(--hairline); margin-top: 8px;
}
.legend-item { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-2); }
.legend-swatch { width: 14px; height: 3px; border-radius: 2px; background: var(--sw); }

.tooltip {
  position: absolute; pointer-events: none; z-index: 10;
  background: var(--surface-raised);
  border: 1px solid var(--hairline); border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 9px 12px; font-size: 12px; min-width: 150px;
}
.tooltip-date { font-family: "IBM Plex Mono", monospace; font-size: 10.5px; letter-spacing: .06em; color: var(--ink-3); margin-bottom: 5px; text-transform: uppercase; }
.tooltip-row { display: flex; align-items: center; gap: 7px; line-height: 1.75; }
.tooltip-row .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.tooltip-row .val { margin-left: auto; font-family: "IBM Plex Mono", monospace; color: var(--ink); }

/* ---------------- polls table ---------------- */

.table-card { overflow: hidden; }
.table-scroll { overflow-x: auto; }

.polls-table { border-collapse: collapse; width: 100%; font-size: 13px; min-width: 720px; }
.polls-table th, .polls-table td { padding: 9px 12px; text-align: right; white-space: nowrap; }
.polls-table th:first-child, .polls-table td:first-child,
.polls-table th:nth-child(2), .polls-table td:nth-child(2) { text-align: left; }
.polls-table thead th {
  font: 500 10.5px "IBM Plex Mono", monospace; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-3); border-bottom: 1px solid var(--hairline);
  position: sticky; top: 0; background: var(--surface-raised);
}
.polls-table thead .party-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; }
.polls-table tbody td { border-bottom: 1px solid color-mix(in srgb, var(--hairline) 55%, transparent); font-variant-numeric: tabular-nums; color: var(--ink-2); }
.polls-table tbody td.num-top { color: var(--ink); font-weight: 600; }
.polls-table td.pollster { color: var(--ink); font-weight: 500; }
.polls-table td.date { color: var(--ink-3); font-family: "IBM Plex Mono", monospace; font-size: 11.5px; }
.polls-table tr.election-row td { background: color-mix(in srgb, var(--accent) 7%, transparent); color: var(--ink); }
.polls-table tr.is-picked td { background: color-mix(in srgb, var(--accent) 7%, transparent); color: var(--ink); }
.polls-table tr.is-picked td:first-child { box-shadow: inset 3px 0 var(--accent); }
.polls-table .lead-chip {
  display: inline-block; min-width: 44px; text-align: center;
  font-family: "IBM Plex Mono", monospace; font-size: 11px;
  padding: 2px 7px; border-radius: 999px;
  background: color-mix(in srgb, var(--lead) 14%, transparent);
  color: var(--ink);
}

.show-more {
  display: block; width: 100%; appearance: none; cursor: pointer;
  border: 0; border-top: 1px solid var(--hairline);
  background: transparent; color: var(--accent-ink);
  font: 600 13px "IBM Plex Sans", sans-serif; padding: 12px;
}
.show-more:hover { background: var(--surface-sunken); }

/* ---------------- preferred PM ---------------- */

.pm-card { padding: 20px 22px 16px; }
.pm-row { display: grid; grid-template-columns: 150px 1fr 52px; align-items: center; gap: 12px; padding: 7px 0; }
.pm-name { font-weight: 600; font-size: 14px; }
.pm-name small { display: block; font-weight: 400; font-size: 11px; color: var(--ink-3); }
.pm-bar-track { height: 18px; border-radius: 4px; background: var(--surface-sunken); position: relative; }
.pm-bar-fill { position: absolute; inset: 0 auto 0 0; border-radius: 4px 4px 4px 4px; background: var(--bar); transition: width .6s cubic-bezier(.6,.05,.2,1); }
.pm-val { font-family: "IBM Plex Mono", monospace; font-size: 13px; text-align: right; }
.pm-note { margin-top: 12px; font-size: 12px; color: var(--ink-3); }
.pm-trend-head {
  font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3);
  border-top: 1px solid var(--hairline); margin-top: 16px; padding-top: 14px;
}
#pm-trend, #odds-chart, #gc-chart { width: 100%; display: block; margin-top: 4px; }
#pm-trend .grid-line, #odds-chart .grid-line, #gc-chart .grid-line { stroke: var(--hairline); stroke-width: 1; }
#pm-trend .axis-text, #odds-chart .axis-text, #gc-chart .axis-text { font: 11px "IBM Plex Mono", monospace; fill: var(--ink-3); }
#pm-trend .poll-dot { opacity: .22; }
#pm-trend .avg-line, #odds-chart .avg-line, #gc-chart .avg-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
#pm-trend .end-label, #odds-chart .end-label, #gc-chart .end-label { font: 600 11.5px "IBM Plex Sans", sans-serif; fill: var(--ink); }
#pm-trend .end-label .pct, #odds-chart .end-label .pct, #gc-chart .end-label .pct { font-family: "IBM Plex Mono", monospace; font-weight: 500; fill: var(--ink-2); }
#pm-trend .crosshair, #odds-chart .crosshair, #gc-chart .crosshair { stroke: var(--ink-3); stroke-width: 1; }
.odds-history { border-top: 1px solid var(--hairline); margin-top: 16px; }
.odds-history .pm-trend-head { border-top: 0; }

/* wildcard: grand-coalition possibility chart */
#gc-chart .threshold-line { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 5 4; }
#gc-chart .threshold-text { font: 10px "IBM Plex Mono", monospace; fill: var(--ink-3); letter-spacing: .08em; }
#gc-chart .dead-zone { fill: var(--ink-3); opacity: .06; }
#gc-chart .scenario-line { stroke: var(--accent); stroke-dasharray: 2 4; }

.new-chip {
  font-size: 9px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent-ink); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  border-radius: 999px; padding: 1px 6px; margin-left: 5px; vertical-align: 1px;
}
@media (max-width: 560px) { .pm-row { grid-template-columns: 110px 1fr 46px; } }

/* ---------------- donations ---------------- */

.money-card { padding: 20px 22px 0; overflow: hidden; }
.money-bars { display: flex; flex-direction: column; gap: 2px; padding-bottom: 16px; border-bottom: 1px solid var(--hairline); }
.money-row { display: grid; grid-template-columns: 170px 1fr 76px; align-items: center; gap: 12px; padding: 6px 0; }
.money-name { font-weight: 600; font-size: 14px; line-height: 1.2; }
.money-name small { display: block; font-weight: 400; font-size: 11px; color: var(--ink-3); }
.money-val { font-family: "IBM Plex Mono", monospace; font-size: 13.5px; text-align: right; }
@media (max-width: 560px) { .money-row { grid-template-columns: 120px 1fr 64px; } }

.money-table { min-width: 560px; }
.money-table td.donor { text-align: left; white-space: normal; color: var(--ink); }
.money-table th:nth-child(3), .money-table td:nth-child(3) { text-align: left; }
.money-table .party-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }
.money-card .show-more { margin: 0 -22px; width: calc(100% + 44px); }

.money-note { font-size: 12px; color: var(--ink-3); margin-top: 10px; }

/* ---------------- method ---------------- */

.section--method { padding-bottom: 40px; }
.method-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
@media (max-width: 760px) { .method-grid { grid-template-columns: 1fr; } }
.method-col h3 {
  font-family: "Bricolage Grotesque", sans-serif; font-size: 15px; font-weight: 700;
  margin: 18px 0 6px;
}
.method-col h3:first-child { margin-top: 0; }
.method-col p { font-size: 14px; color: var(--ink-2); margin-bottom: 8px; }

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

.footer { border-top: 1px solid var(--hairline); margin-top: 28px; background: var(--surface-sunken); }
.footer-inner { padding: 28px 24px 36px; }
.footer p { font-size: 13px; color: var(--ink-2); max-width: 82ch; margin-bottom: 8px; }
.footer-stamp { font-size: 11px; color: var(--ink-3); margin-top: 14px; }
.footer-telemetry {
  display: inline-flex; align-items: center; gap: 9px;
  margin-top: 12px; text-decoration: none;
  color: var(--ink-2); font-size: 13px; font-weight: 500;
}
.footer-telemetry img {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--surface-raised);
  border: 1px solid var(--hairline);
  object-fit: cover;
}
.footer-telemetry:hover { color: var(--ink); }
.footer-telemetry:hover span { text-decoration: underline; text-underline-offset: 2px; }
.footer-telemetry:hover img { border-color: var(--ink-3); }

/* ---------------- daily report ---------------- */

.daily-pad { padding: 20px 24px 22px; }
.daily-date { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.daily-headline {
  font-family: "Bricolage Grotesque", sans-serif; font-weight: 800;
  font-size: clamp(19px, 2.6vw, 24px); line-height: 1.15; margin: 6px 0 8px;
}
.daily-summary { font-size: 14px; color: var(--ink-2); max-width: 88ch; margin-bottom: 6px; }
.daily-item {
  display: grid; grid-template-columns: 86px 1fr; gap: 14px;
  padding: 14px 0 12px; border-top: 1px solid var(--hairline); margin-top: 12px;
}
@media (max-width: 620px) { .daily-item { grid-template-columns: 1fr; gap: 6px; } }
.daily-cat {
  font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3);
  align-self: start; justify-self: start; padding: 3px 8px; border-radius: 999px;
  border: 1px solid var(--hairline); background: var(--surface-sunken); margin-top: 2px;
}
.daily-item-body h3 { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.daily-item-body p { font-size: 13.5px; color: var(--ink-2); max-width: 88ch; margin-bottom: 4px; }
.daily-why b { color: var(--ink); }
.daily-src { font-size: 11.5px; }
.daily-src a { color: var(--ink-3); text-underline-offset: 2px; }
.daily-src a:hover { color: var(--ink); }

/* ---------------- share (top bar) ---------------- */
.share { position: relative; }
.share-btn {
  --share: #1B66E0;                           /* a utility blue, brighter than National's party blue */
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px 0 10px;
  border: 1px solid var(--share); border-radius: 9px; background: var(--share); color: #fff;
  font: 600 12.5px/1 "IBM Plex Sans", system-ui, sans-serif; letter-spacing: .01em; cursor: pointer;
  box-shadow: 0 1px 2px rgba(27, 102, 224, .25);
}
.share-btn:hover, .share-btn[aria-expanded="true"] { --share: #1456C4; }
.share-btn:focus-visible { outline: 2px solid var(--focus, #5B9BE8); outline-offset: 2px; }
[data-theme="dark"] .share-btn { --share: #3B7EF0; }
[data-theme="dark"] .share-btn:hover, [data-theme="dark"] .share-btn[aria-expanded="true"] { --share: #5A93F5; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .share-btn { --share: #3B7EF0; }
  :root:not([data-theme="light"]) .share-btn:hover, :root:not([data-theme="light"]) .share-btn[aria-expanded="true"] { --share: #5A93F5; }
}
.share-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; min-width: 196px; padding: 6px;
  display: grid; gap: 1px;
  background: var(--surface-raised); border: 1px solid var(--hairline); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .14), 0 2px 6px rgba(0, 0, 0, .08);
}
.share-menu[hidden] { display: none; }
.share-menu [role="menuitem"] {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px;
  background: none; color: var(--ink); text-decoration: none; font: 500 13.5px/1.2 "IBM Plex Sans", system-ui, sans-serif; text-align: left; cursor: pointer;
}
.share-menu [role="menuitem"]:hover, .share-menu [role="menuitem"]:focus-visible { background: var(--surface); outline: none; }
.share-menu [role="menuitem"].is-done { color: var(--accent); }
.sh-ic {
  display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; flex: none;
  background: var(--surface); border: 1px solid var(--hairline); color: var(--ink-2);
  font: 700 11px/1 "Bricolage Grotesque", "IBM Plex Sans", sans-serif; font-style: normal;
}
@media (max-width: 640px) {
  .share-btn { width: 32px; padding: 0; justify-content: center; }
  .share-label { display: none; }
  .topbar-right { gap: 8px; }
  .share-menu { right: -40px; }
}
