/* Eye on Elections — gazetted-results dashboard.
   Page-specific layout only; all colours/spacing from core.css tokens.
   Shared pieces (.tabs, .tab-panel, .stat-grid, .data-table, .card, .badge,
   .prov-ribbon, .src-cite, .filter-bar) live in components.css. */

.elections-hub { padding-block: var(--space-5) var(--space-7); }

/* ---- Hero ----
   The hero now lives in the shared `.page-band` (body gets `has-brand-hero`),
   so it sits on the red tricolour band like every other page instead of the
   bespoke white one this page used to build for itself. The retired rules
   (.elections-hero, .elections-eyebrow, .elections-title, .elections-intro)
   are gone with the markup that used them; `.hero-kicker` and `.page-heading`
   from components.css replace the first three. One of them was also broken:
   .elections-intro set `font-size: var(--text-md)`, and `--text-md` is not a
   token in core.css, so that declaration was silently dropped. */
.has-brand-hero .page-band .elections-hero__lead {
  margin: var(--space-3) 0 0;
  max-width: var(--measure-lead);
  color: hsl(0 0% 100% / 0.85);
  line-height: var(--leading-normal);
}
.has-brand-hero .page-band .elections-hero__filters {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
  margin: var(--space-5) 0 0;
}
.has-brand-hero .page-band .elections-hero__filters label {
  font-size: var(--text-xs); font-weight: var(--fw-bold);
  text-transform: uppercase; letter-spacing: .08em;
  color: hsl(0 0% 100% / 0.72);
}

/* ---- KPI row ---- */
.elections-kpis { margin: var(--space-5) 0; }

/* ---- Honest "missing offices" note ---- */
.elections-missing {
  display: flex; align-items: center; gap: var(--space-2);
  font-size: var(--text-sm); color: var(--colour-text-muted);
  margin: var(--space-4) 0 var(--space-3);
}
.elections-missing i { color: var(--colour-primary); }

/* ---- Office coverage strip: every office as a loaded/pending chip ---- */
.elections-coverage { margin: var(--space-5) 0; }
.elections-coverage__head { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-3); }
.elections-coverage__caption { color: var(--colour-text-muted); font-size: var(--text-sm); font-weight: var(--fw-medium); }
.office-coverage {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: var(--space-3);
}
.office-chip {
  display: inline-flex; align-items: baseline; gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--colour-border); border-radius: var(--radius-pill);
  font-size: var(--text-sm); line-height: var(--leading-tight);
}
.office-chip__label { font-weight: var(--fw-semibold); }
.office-chip__count { font-variant-numeric: tabular-nums; }
/* Loaded — a confident green chip carrying its seat count. */
.office-chip--on {
  background: var(--colour-secondary-alpha-10);
  border-color: var(--colour-secondary-alpha-20);
  color: var(--colour-secondary-dark);
}
.office-chip--on .office-chip__count { font-weight: var(--fw-bold); }
/* Pending — a quiet dashed ghost: clearly intentional, not broken. */
.office-chip--off {
  background: var(--colour-bg-subtle);
  border-style: dashed; color: var(--colour-text-muted);
}
.office-chip__count--pending { font-style: italic; font-size: var(--text-xs); }

/* ---- Filters: party + cascading county/constituency/ward ---- */
.elections-filters { flex-wrap: wrap; gap: var(--space-4); margin: var(--space-5) 0 var(--space-2); }
/* One width for four controls that ask the same kind of question. They were
   four raw native selects sized by their longest option — 163/192/195/211px —
   which made a cascading Party > County > Constituency > Ward filter read as
   four unrelated boxes. The `.field` class on each gives them the site's input
   treatment; this gives them a common measure. */
/* `width`, not `min-width`: a floor still lets each control size to its own
   longest option (192/192/195/211px measured), which is the raggedness being
   fixed. A fixed width ellipsises a long option in the closed state, which is
   the normal behaviour for a filter select and the price of a tidy row. */
.elections-filters select { width: 13.5rem; }
.elections-filters select:disabled { opacity: .5; cursor: not-allowed; }
.elections-filters__reset { display: flex; align-items: flex-end; }
.elections-match { margin: 0 0 var(--space-3); font-weight: var(--fw-medium); color: var(--colour-text); }

/* ---- Office tabs ---- */
.elections-tabs { margin-top: var(--space-5); }

/* ---- Per-office summary: chart card + stat column ---- */
.elections-office-summary {
  display: grid; grid-template-columns: 2fr 1fr; gap: var(--space-5);
  margin: var(--space-5) 0;
}
@media (max-width: 720px) { .elections-office-summary { grid-template-columns: 1fr; } }
.elections-office-stats { align-content: start; }

/* Give ECharts islands room to render so mounting does not shift the page.
   Unconditional on purpose. This was briefly made conditional on the fallback
   having 3+ rows (`:has(.bar-fallback li:nth-child(3))`) to stop a
   single-party office reserving 300px for one row — but the selector stops
   matching the instant Vue mounts, because mounting destroys the fallback
   <li> elements it tests for. Measured: the President island then went 47px ->
   280px on mount, a 233px jump. The dead space it was trying to remove also
   comes back regardless, since ECharts renders at its own 280px height
   (`.mz-achart`). A static reserve beats a jump. */
.elections-office-summary .island,
.section .island { min-height: 300px; }

/* ---- Chart fallback (JS off / pre-mount) ---- */
.bar-fallback { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
/* MUST stay a grid with a `1fr` name track. mz-islands.css draws the bar as
   `width: var(--w)` on this row's first <span>, so that span IS the bar's
   baseline. Overriding it to `display: flex; justify-content: space-between`
   shrank the span to its own party-name text, which made every row a different
   baseline and inverted the encoding: JP (108 seats, short name) drew a 5px bar
   while WDM (68 seats, longer name) drew 6px. A bar chart that reports 108 as
   smaller than 68 is a misstatement of the data, not a cosmetic bug. */
.bar-fallback li {
  display: grid; grid-template-columns: 1fr auto; align-items: center;
  gap: var(--space-4);
  padding: var(--space-2) 0; border-bottom: 1px solid var(--colour-border);
  font-size: var(--text-sm);
}
.bar-fallback__name { color: var(--colour-text); font-weight: var(--fw-medium); }

/* ---- County choropleth (2022 senate winners by party) ---- */
.elections-map-section { margin: var(--space-5) 0 var(--space-6); }
/* Kenya is taller than it is wide, so a full-width 1320x460 letterbox can only
   ever be mostly empty either side of it. Cap the frame on desktop and centre
   it, so the map is a map rather than a wide band with a country in the middle.
   Full width still on narrow screens, where the aspect already suits it. */
#elections-map { height: 460px; max-width: 46rem; margin-inline: auto; border-radius: var(--radius-md); overflow: hidden; border: 1px solid var(--colour-border); background: var(--colour-bg-subtle); }
.cmap-loading { padding: var(--space-6); text-align: center; color: var(--colour-text-muted); }
.elections-map-legend { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); margin: var(--space-3) 0 0; font-size: var(--text-sm); }
.elections-map-legend__item { display: inline-flex; align-items: center; gap: var(--space-1); }
.elections-map-legend__item i { display: inline-block; width: 14px; height: 14px; border-radius: 3px; border: 1px solid var(--colour-border); flex: none; }

/* ---- Table head row ---- */
.elections-table-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-3); margin: var(--space-4) 0 var(--space-2);
}
.result-count { font-size: var(--text-sm); color: var(--colour-text-muted); }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
