/*
 * STEEL MILL — Israel Election Dashboard
 * Presentation layer. All static styling lives here; the JS view layer only
 * supplies data-driven values (party colours, bar widths) as inline styles.
 *
 * RTL is handled with CSS logical properties (margin-inline, inset-inline-*,
 * text-align:start, border-inline-*), so flipping `dir` on the root mirrors the
 * whole layout with no per-language overrides.
 */

:root {
  --ink: #23272B;
  --ink2: #41464B;
  --steel: #6B7177;
  --steel2: #9AA0A6;
  --line: #DADCDE;
  --line2: #C4C8CC;
  --paper: #F4F3F1;
  --orange: #DD7E2E;
  --orange-dk: #B5611F;
  --dark: #2B2F33;
  --green: #2E7D5B;
  --gold: #C9A227;
  --panel: #fff;
  --panel-alt: #FAFAF9;
  --row-off: #F7F6F4;
  --hairline: #EDEEEF;
  --track: #F0F0EE;
  --muted: #EDEEEF;

  --font-display: 'Zilla Slab', Georgia, serif;
  --font-body: 'IBM Plex Sans', 'IBM Plex Sans Hebrew', 'IBM Plex Sans Arabic', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
  --maxw: 1240px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
::selection { background: var(--orange); color: #fff; }

.sm-scroll::-webkit-scrollbar { height: 8px; width: 8px; }
.sm-scroll::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 0; }

/* ---------------------------------------------------------------- App shell */
.sm-app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-align: start;
  /* Lets the full-bleed home parallax break out to 100vw without spawning a
     horizontal scrollbar. `clip` (unlike `hidden`) doesn't create a scroll
     container, so the sticky nav keeps sticking to the viewport. */
  overflow-x: clip;
}

/* ------------------------------------------------------------------- Header */
.sm-header { background: var(--dark); color: #E3E5E7; border-bottom: 3px solid var(--orange); }
.sm-header-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 14px 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
}
.sm-brand { display: flex; align-items: center; gap: 16px; text-decoration: none; color: inherit; cursor: pointer; }
.sm-logo { display: flex; gap: 3px; align-items: flex-end; }
.sm-logo-bar { display: block; width: 13px; }
.sm-logo-bar--a { height: 26px; background: var(--steel2); }
.sm-logo-bar--b { height: 34px; background: var(--line2); }
.sm-logo-bar--c { height: 30px; background: var(--orange); }
.sm-wordmark {
  font-family: var(--font-display); font-weight: 700; font-size: 20px;
  letter-spacing: 0.13em; line-height: 1; text-transform: uppercase; white-space: nowrap;
}
.sm-wm-accent { color: var(--orange); }
.sm-wm-steel { color: var(--line2); }
.sm-subtitle {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--steel2); margin-top: 5px;
}
/* margin-inline-start:auto keeps the toggle right-aligned even when the header
   wraps on mobile (where it would otherwise fall to the left). */
.sm-lang-group { display: flex; border: 1px solid #4A4F54; margin-inline-start: auto; }
.sm-lang-btn {
  background: transparent; color: var(--steel2); border: none; cursor: pointer;
  font-family: var(--font-mono); font-size: 11px; font-weight: 600; letter-spacing: 0.08em;
  padding: 6px 12px; min-width: 40px;
}
.sm-lang-btn:not(:last-child) { border-inline-end: 1px solid #4A4F54; }
.sm-lang-btn.is-active { background: var(--orange); color: #fff; }

/* ---------------------------------------------------------------------- Nav */
.sm-nav { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.sm-nav-inner { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; position: relative; }
.sm-nav-tabs { display: flex; gap: 2px; overflow-x: auto; }
.sm-tab {
  display: inline-block; background: none; border: none; border-bottom: 3px solid transparent;
  color: var(--steel); text-decoration: none;
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase;
  font-weight: 400; padding: 15px 14px; cursor: pointer; white-space: nowrap;
}
.sm-tab.is-active { border-bottom-color: var(--orange); color: var(--ink); font-weight: 600; }

/* Hamburger toggle — hidden on desktop, revealed at the mobile breakpoint. */
.sm-nav-toggle { display: none; }
.sm-burger { display: inline-flex; flex-direction: column; justify-content: center; gap: 4px; width: 18px; flex: none; }
.sm-burger span { display: block; height: 2px; width: 100%; background: currentColor; transition: transform 0.2s ease, opacity 0.2s ease; }
.sm-nav-toggle[aria-expanded="true"] .sm-burger span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.sm-nav-toggle[aria-expanded="true"] .sm-burger span:nth-child(2) { opacity: 0; }
.sm-nav-toggle[aria-expanded="true"] .sm-burger span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
.sm-nav-current { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; font-weight: 600; color: var(--ink); }

/* --------------------------------------------------------------------- Main */
.sm-main { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 32px 28px 64px; flex: 1 0 auto; }

/* --------------------------------------------------------- Shared typography */
.sm-kicker {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--steel); margin-bottom: 10px;
}
.sm-kicker--accent { color: var(--orange); }
.sm-h1 { font-family: var(--font-display); font-weight: 700; font-size: 34px; line-height: 1.1; margin: 0 0 8px; }
.sm-h1--lg { font-size: 38px; line-height: 1.08; letter-spacing: -0.01em; }
.sm-dek { font-size: 15px; line-height: 1.55; color: var(--ink2); max-width: 60ch; margin: 0 0 22px; }
.sm-dek--wide { max-width: 72ch; margin-bottom: 24px; }
.sm-dek--mk { max-width: 64ch; margin-bottom: 6px; }
.sm-dek--learn { max-width: 74ch; margin-bottom: 24px; }

/* --------------------------------------------------------------------- Cards */
.sm-card { background: var(--panel); border: 1px solid var(--line); }
.sm-card--pad { padding: 22px 24px; }
.sm-card--pad-sm { padding: 18px 20px; }
.sm-card--pad-lg { padding: 24px 26px; }
.sm-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.sm-card-label { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--steel); }
.sm-card-head-right { display: flex; align-items: center; gap: 10px; position: relative; }
.sm-meta { font-family: var(--font-mono); font-size: 11px; color: var(--steel); }

/* Spacing utilities (kept tiny and explicit). */
.sm-mt-12 { margin-top: 12px; } .sm-mt-16 { margin-top: 16px; } .sm-mt-18 { margin-top: 18px; }
.sm-mt-20 { margin-top: 20px; } .sm-mt-24 { margin-top: 24px; } .sm-mt-28 { margin-top: 28px; }
.sm-mb-6 { margin-bottom: 6px; } .sm-mb-10 { margin-bottom: 10px; }
.sm-mb-12 { margin-bottom: 12px; } .sm-mb-16 { margin-bottom: 16px; }

/* --------------------------------------------------------------- Info popover */
.sm-info { position: relative; display: inline-flex; align-items: center; }
.sm-info-btn {
  width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--line2); background: #fff;
  color: var(--steel); font-family: var(--font-mono); font-size: 11px; font-weight: 600; line-height: 1;
  cursor: pointer; flex: none; padding: 0;
}
.sm-info-btn:hover { border-color: var(--orange); color: var(--orange); }
.sm-popover {
  position: absolute; top: calc(100% + 8px); inset-inline-end: 0; width: 250px; background: #fff;
  border: 1px solid var(--line); box-shadow: 0 8px 24px rgba(35, 39, 43, 0.12); padding: 13px 15px;
  font-size: 12.5px; line-height: 1.5; color: var(--ink2); z-index: 40; text-align: start;
}

/* -------------------------------------------------------------------- Charts */
.sm-chart { width: 100%; height: auto; display: block; }

/* -------------------------------------------------------------------- Home */
.sm-hm-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; align-items: stretch; }
.sm-hm-span { grid-column: 1 / -1; }
.sm-hm-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--hairline); }
.sm-hm-foot--end { justify-content: flex-end; }

/* Markets preview: a framed panel matching the coalition builder, with its two
   market cards flattened onto the shared background and a footer link that
   mirrors "Full builder". */
.sm-hm-markets { background: var(--panel); border: 1px solid var(--line); padding: 22px 24px; display: flex; flex-direction: column; }
.sm-hm-markets .sm-mk-grid { grid-template-columns: 1fr; gap: 0; margin-top: 0; }
.sm-hm-markets .sm-mk-grid .sm-card { border: none; background: transparent; padding: 14px 0; }
.sm-hm-markets .sm-mk-grid .sm-card:first-child { padding-top: 2px; }
.sm-hm-markets .sm-mk-grid .sm-card + .sm-card { border-top: 1px solid var(--hairline); }
.sm-hm-markets .sm-hm-foot { margin-top: auto; } /* pin link to the bottom to align with the builder */
.sm-more-link { font-family: var(--font-mono); font-size: 11.5px; font-weight: 600; letter-spacing: 0.02em; color: var(--orange-dk); text-decoration: none; white-space: nowrap; }
.sm-more-link:hover { color: var(--orange); text-decoration: underline; }

/* -------------------------------------------------- Home parallax primer
 * A full-bleed, scroll-driven explainer at the top of the home page. Motion is
 * applied by js/parallax.js: `[data-depth]` layers are translated per scroll,
 * and scenes gain `.is-in` (which reveals their text). All values degrade to a
 * static, legible dark explainer if JS is off (no `.sm-px-on` on <html>).
 */
.sm-px {
  position: relative;
  width: 100vw;
  margin-inline-start: calc(50% - 50vw); /* break out of the centred column */
  margin-top: -32px;                     /* sit flush under the sticky nav */
  margin-bottom: 44px;
  background: var(--dark);
  color: #E7E9EB;
  overflow: hidden;                      /* clip the drifting parallax layers */
}
.sm-px-scene {
  position: relative;
  min-height: clamp(560px, 90vh, 940px);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  padding: 64px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.sm-px-scene:last-child { border-bottom: none; }
/* Intro sized to the first screenful minus the header + sticky nav above it, so
   its bottom-left table of contents lands above the fold on most devices. */
.sm-px-scene--intro { min-height: clamp(520px, calc(100vh - 118px), 920px); }

/* Parallax planes: over-sized vertically so drift never exposes an edge. */
.sm-px-layer { position: absolute; inset: -12% 0; display: flex; align-items: center; justify-content: center; pointer-events: none; z-index: 0; will-change: transform; }
.sm-px-ghost {
  font-family: var(--font-display); font-weight: 700; line-height: 1; letter-spacing: -0.02em;
  font-size: clamp(170px, 34vw, 520px); color: rgba(255, 255, 255, 0.05);
  white-space: nowrap; user-select: none;
}

/* Foreground, constrained to the same column as the dashboard below. */
.sm-px-fore { position: relative; z-index: 2; width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 28px; }
.sm-px-fore--center { text-align: center; }
.sm-px-duo { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px; align-items: center; }

.sm-px-text { max-width: 560px; }
.sm-px-fore--center .sm-px-text { max-width: 760px; margin: 0 auto; }
.sm-px-text--wide { max-width: 820px; }
.sm-px-kicker, .sm-px-tag {
  font-family: var(--font-mono); text-transform: uppercase; color: var(--orange);
  letter-spacing: 0.18em; font-size: 12px; margin-bottom: 16px;
}
.sm-px-title { font-family: var(--font-display); font-weight: 700; line-height: 1.05; letter-spacing: -0.01em; font-size: clamp(30px, 4.4vw, 52px); margin: 0 0 18px; color: #F4F3F1; }
.sm-px-title--hero { font-size: clamp(38px, 6.4vw, 76px); }
.sm-px-lede { font-size: clamp(16px, 1.7vw, 20px); line-height: 1.6; color: #B9BEC3; margin: 0 auto; max-width: 640px; }
.sm-px-body { font-size: clamp(15px, 1.4vw, 18px); line-height: 1.65; color: #B9BEC3; margin: 0; }

.sm-px-cue { display: inline-flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 40px; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--steel2); }
.sm-px-cue-arrow { font-size: 18px; animation: sm-px-bob 1.8s ease-in-out infinite; }
@keyframes sm-px-bob { 0%, 100% { transform: translateY(0); opacity: 0.5; } 50% { transform: translateY(6px); opacity: 1; } }

/* Mini table of contents, pinned near the bottom-left edge of the intro.
   Hidden for now (kept in the DOM so it's a one-line re-enable). */
.sm-px-toc-wrap { display: none; position: absolute; inset-inline: 0; bottom: 36px; z-index: 3; padding-inline: clamp(18px, 3.5vw, 52px); pointer-events: none; }
.sm-px-toc { display: inline-flex; flex-direction: column; gap: 0; pointer-events: auto; text-align: start; }
.sm-px-toc-item { display: flex; align-items: baseline; gap: 9px; background: none; border: none; padding: 2px 0; cursor: pointer; color: #8B9096; font-family: var(--font-mono); text-align: start; transition: color 0.2s ease; }
.sm-px-toc-item:hover { color: #C7CCD1; }
.sm-px-toc-n { font-size: 8.5px; color: var(--steel); letter-spacing: 0.06em; }
.sm-px-toc-item:hover .sm-px-toc-n { color: #C7CCD1; }
.sm-px-toc-label { font-size: 11px; letter-spacing: 0.02em; }
/* The scene you're currently on. */
.sm-px-toc-item.is-active, .sm-px-toc-item.is-active .sm-px-toc-n { color: var(--orange); }
.sm-px-toc-item.is-active .sm-px-toc-label { font-weight: 600; }
/* Fade each scene's rail in as that scene enters view. */
.sm-px-on .sm-px-toc { opacity: 0; transform: translateY(10px); transition: opacity 0.8s ease 0.2s, transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) 0.2s; }
.sm-px-on .sm-px-scene.is-in .sm-px-toc { opacity: 1; transform: none; }
/* Offset jump targets so the sticky nav doesn't cover their heading. */
#sm-hm-polls, #sm-hm-coalition, #sm-hm-markets { scroll-margin-top: 76px; }
#sm-px-vote, #sm-px-thresh, #sm-px-seats, #sm-px-who { scroll-margin-top: 54px; }

/* Reveal: text starts hidden only when JS is live (`.sm-px-on`), then eases in
   once its scene is marked `.is-in`. */
.sm-px-on .sm-px-fore { opacity: 0; transform: translateY(30px); transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1); }
.sm-px-on .sm-px-scene.is-in .sm-px-fore { opacity: 1; transform: none; }
/* Set by parallax.js on a scene the moment a re-render (e.g. the mobile
   hamburger) rebuilds it after its fade had already finished: restore the
   revealed state instantly instead of replaying it. Keep the durations above in
   sync with FADE_MS there. */
.sm-px-snap .sm-px-fore, .sm-px-snap .sm-px-toc { transition: none !important; }

/* --- Scene art --- */
.sm-px-art { display: flex; align-items: center; justify-content: center; will-change: transform; }

/* Step 1 — a ballot slip */
.sm-px-ballot {
  width: min(240px, 66%); aspect-ratio: 3 / 4; background: #F4F3F1; color: var(--ink);
  transform: rotate(-5deg); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.42); border-top: 8px solid var(--orange);
  padding: 26px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px;
}
.sm-px-ballot-head { width: 60%; height: 10px; background: var(--line2); }
.sm-px-ballot-glyph { font-size: clamp(64px, 9vw, 96px); line-height: 1; color: var(--orange); font-weight: 700; }
.sm-px-ballot-lines { width: 72%; display: flex; flex-direction: column; gap: 9px; }
.sm-px-ballot-lines span { height: 8px; background: var(--line); }
.sm-px-ballot-lines span:last-child { width: 62%; }

/* Step 2 — the threshold "cliff" */
.sm-px-cliff { width: min(420px, 100%); }
.sm-px-cliff-plot { position: relative; }
.sm-px-cliff-bars { display: flex; align-items: flex-end; gap: 12px; height: 220px; }
.sm-px-bar { flex: 1; background: var(--orange); min-height: 6px; }
.sm-px-bar.is-edge { background: var(--gold); }
.sm-px-bar.is-out { background: #464B50; }
.sm-px-cliff-line { position: absolute; inset-inline: -8px; bottom: 30%; border-top: 2px dashed rgba(244, 243, 241, 0.65); }
.sm-px-cliff-tag { position: absolute; inset-inline-end: 0; top: -18px; font-family: var(--font-mono); font-size: 11px; font-weight: 600; color: var(--paper); }
.sm-px-cliff-legend { display: flex; gap: 20px; margin-top: 18px; }
.sm-px-cliff-key { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--steel2); }
.sm-px-cliff-sw { width: 13px; height: 13px; background: var(--orange); flex: none; }
.sm-px-cliff-sw--out { background: #464B50; }

/* Step 3 — the 120-seat / 61-majority grid */
.sm-px-seats { width: min(460px, 100%); }
.sm-px-dots { display: grid; grid-template-columns: repeat(20, 1fr); gap: 6px; }
.sm-px-dot { aspect-ratio: 1; border-radius: 50%; background: #464B50; }
.sm-px-dot.is-maj { background: var(--orange); }
.sm-px-seats-cap { margin-top: 18px; display: inline-flex; align-items: center; gap: 9px; font-family: var(--font-mono); font-size: 12px; color: var(--steel2); }
.sm-px-seats-swatch { width: 12px; height: 12px; border-radius: 50%; background: var(--orange); flex: none; }

/* Step 4 — the candidates, grouped by bloc */
.sm-px-blocs { display: flex; flex-direction: column; gap: 34px; margin-top: 40px; }
.sm-px-bloc-head { display: flex; align-items: center; gap: 13px; padding-bottom: 12px; margin-bottom: 18px; border-bottom: 1px solid rgba(255, 255, 255, 0.12); }
.sm-px-bloc-bar { width: 30px; height: 12px; flex: none; }
.sm-px-bloc-name { font-family: var(--font-display); font-weight: 600; font-size: 21px; color: #F4F3F1; }
.sm-px-bloc-seats { margin-inline-start: auto; font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.04em; color: var(--steel2); }
.sm-px-bloc-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(238px, 1fr)); gap: 14px; }
.sm-px-card { background: rgba(255, 255, 255, 0.045); border: 1px solid rgba(255, 255, 255, 0.11); padding: 16px 18px; display: flex; gap: 14px; align-items: flex-start; transition: border-color 0.2s ease, background 0.2s ease; }
.sm-px-card:hover { border-color: rgba(221, 126, 46, 0.55); background: rgba(255, 255, 255, 0.07); }
.sm-px-card-body { min-width: 0; }
.sm-px-ava { width: 46px; height: 46px; flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-family: var(--font-display); font-weight: 700; font-size: 16px; }
.sm-px-card-leader { font-family: var(--font-display); font-weight: 600; font-size: 16.5px; color: #F4F3F1; line-height: 1.15; }
.sm-px-card-party { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: #B9BEC3; margin-top: 5px; }
.sm-px-card-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.sm-px-card-tag { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.04em; color: var(--steel2); margin-top: 9px; line-height: 1.4; }
.sm-px-card-seats { font-family: var(--font-mono); font-size: 11px; font-weight: 600; letter-spacing: 0.04em; color: var(--orange); margin-top: 10px; }
.sm-px-card-seats--out { color: var(--steel2); text-transform: uppercase; }
.sm-px-ready { margin-top: 34px; font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--orange); }

@media (prefers-reduced-motion: reduce) {
  .sm-px-on .sm-px-fore, .sm-px-on .sm-px-toc { opacity: 1; transform: none; transition: none; }
  .sm-px-layer, .sm-px-art, .sm-px-cards { transform: none !important; }
  .sm-px-cue-arrow { animation: none; }
}

/* ---------------------------------------------------------------- Forecast */
.sm-ov-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 28px; align-items: start; }

.sm-narr-list { display: flex; flex-direction: column; gap: 14px; }
.sm-narr-card { background: #fff; border: 1px solid var(--line); border-inline-start: 3px solid var(--orange); padding: 16px 18px; }
.sm-narr-tag { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.16em; text-transform: uppercase; margin-bottom: 7px; }
.sm-narr-title { font-family: var(--font-display); font-weight: 600; font-size: 18px; line-height: 1.15; margin-bottom: 6px; }
.sm-narr-body { font-size: 13.5px; line-height: 1.5; color: var(--ink2); }

.sm-trend-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 6px; flex-wrap: wrap; gap: 8px; }
.sm-trend-title { font-family: var(--font-display); font-weight: 600; font-size: 21px; margin-top: 3px; }
.sm-trend-head-right { display: flex; align-items: center; gap: 12px; position: relative; }
.sm-legend { display: flex; flex-wrap: wrap; gap: 12px; }
.sm-legend-item { display: flex; align-items: center; gap: 6px; }
.sm-legend-swatch { width: 14px; height: 3px; display: inline-block; }
.sm-legend-swatch--thick { width: 20px; height: 5px; } /* the two coalition lines */
.sm-legend-name { font-family: var(--font-mono); font-size: 11px; color: var(--ink2); }

/* Timeline: SVG lines + an HTML overlay of per-poll hover columns.
   Hovering a column reveals a crosshair and a shared tooltip listing every
   plotted party's seats at that date (full names, solid background). */
.sm-trend { position: relative; }
.sm-tl-cols { position: absolute; inset: 0; pointer-events: none; }
.sm-tl-col { position: absolute; top: 0; bottom: 11%; width: 40px; transform: translateX(-50%); pointer-events: auto; cursor: crosshair; }
.sm-tl-cross { position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--line2); transform: translateX(-50%); opacity: 0; transition: opacity 0.08s ease; }
.sm-tl-col:hover .sm-tl-cross { opacity: 1; }
.sm-tl-tip {
  /* Offset down-left of the crosshair so it doesn't sit on the line/points. */
  position: absolute; top: 26px; right: calc(50% + 12px); left: auto; transform: none;
  width: max-content; max-width: 260px; background: #fff; border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(35, 39, 43, 0.16); padding: 8px 11px; z-index: 6;
  opacity: 0; pointer-events: none; transition: opacity 0.08s ease;
}
.sm-tl-col:hover .sm-tl-tip { opacity: 1; }
/* Near the left edge, flip to the right of the crosshair so it stays on-screen. */
.sm-tl-col.is-left .sm-tl-tip { left: calc(50% + 12px); right: auto; }
.sm-tl-date { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--steel); margin-bottom: 6px; white-space: nowrap; }
.sm-tl-row { display: flex; align-items: center; gap: 8px; margin: 3px 0; white-space: nowrap; }
.sm-tl-sw { width: 9px; height: 9px; flex: none; }
.sm-tl-name { font-size: 12px; color: var(--ink2); }
.sm-tl-val { font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--ink); margin-inline-start: auto; padding-inline-start: 14px; }
/* Coalition-total rows lead the tooltip, above a hairline divider. */
.sm-tl-row--coal .sm-tl-name { font-weight: 600; color: var(--ink); }
.sm-tl-row--coal .sm-tl-sw { width: 11px; height: 4px; }
.sm-tl-div { height: 1px; background: var(--hairline); margin: 6px 0; }

/* --------------------------------------------------------------- Coalition */
.sm-co-grid { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 26px; align-items: start; }

.sm-th-head { padding: 16px 18px; border-bottom: 1px solid var(--line); background: var(--panel-alt); }
.sm-th-head-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sm-th-title { font-family: var(--font-display); font-weight: 600; font-size: 17px; }
.sm-th-total { font-family: var(--font-mono); font-size: 11px; font-weight: 600; }
.sm-th-help { font-size: 12.5px; color: var(--steel); line-height: 1.45; margin-top: 4px; }
.sm-reset-seats {
  margin-top: 8px; background: none; border: 1px solid var(--line); color: var(--steel);
  font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 4px 9px; cursor: pointer;
}
.sm-reset-seats:hover { border-color: var(--steel2); }

.sm-th-row {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 14px; background: #fff; border-bottom: 1px solid var(--hairline); text-align: start;
}
.sm-th-row.is-off { background: var(--row-off); opacity: 0.8; }
.sm-th-id { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.sm-dot { width: 11px; height: 11px; flex: none; }
.sm-th-row.is-off .sm-dot { opacity: 0.4; }
.sm-th-text { min-width: 0; }
.sm-th-name { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.sm-th-row.is-off .sm-th-name { color: var(--steel); }
.sm-th-vs { display: block; font-family: var(--font-mono); font-size: 10px; color: var(--steel2); }
.sm-th-controls { display: flex; align-items: center; gap: 5px; flex: none; }
.sm-step {
  width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); background: #fff; color: var(--ink2);
  font-family: var(--font-mono); font-size: 14px; line-height: 1; cursor: pointer; padding: 0; flex: none;
}
.sm-step:disabled { cursor: not-allowed; opacity: 0.45; color: var(--steel2); }
.sm-seat-box { min-width: 20px; text-align: center; font-family: var(--font-mono); font-size: 13.5px; font-weight: 600; color: var(--ink); }
.sm-th-row.is-off .sm-seat-box { color: var(--steel2); }
.sm-toggle {
  width: 34px; height: 19px; border-radius: 10px; background: var(--line2); position: relative;
  transition: background 0.15s; flex: none; border: none; padding: 0; cursor: pointer; margin-inline-start: 4px;
}
.sm-toggle.is-on { background: var(--green); }
.sm-toggle-knob {
  position: absolute; top: 2px; inset-inline-start: 2px; width: 15px; height: 15px; border-radius: 50%;
  background: #fff; transition: inset-inline-start 0.15s;
}
.sm-toggle.is-on .sm-toggle-knob { inset-inline-start: 17px; }

.sm-tally-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.sm-tally-figure { display: flex; align-items: baseline; gap: 12px; margin-top: 6px; }
.sm-tally-seats { font-family: var(--font-display); font-weight: 700; font-size: 46px; line-height: 0.9; }
.sm-tally-of { font-family: var(--font-mono); font-size: 13px; color: var(--steel); }
.sm-tally-status { text-align: end; position: relative; }
.sm-tally-status-row { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.sm-badge { display: inline-block; padding: 6px 12px; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 600; }
.sm-tally-clear { margin-top: 8px; }
.sm-text-btn {
  background: none; border: 1px solid var(--line); color: var(--steel); font-family: var(--font-mono);
  font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; padding: 5px 10px; cursor: pointer;
}
.sm-text-btn:hover { border-color: var(--steel2); }

.sm-conflicts { margin-top: 14px; background: #FBEEE7; border: 1px solid #E8C3A8; padding: 10px 14px; }
.sm-conflicts-label { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--orange-dk); margin-bottom: 5px; }
.sm-conflict { font-size: 13px; color: #8C3A2B; line-height: 1.4; }

.sm-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.sm-chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 11px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); font-size: 12.5px; font-weight: 500; font-family: var(--font-body); cursor: pointer;
}
.sm-chip.is-off { opacity: 0.5; }
.sm-chip.is-off:not(.is-picked) { color: var(--steel2); }
.sm-chip.is-picked { border-color: var(--ink); background: var(--ink); color: #fff; }
.sm-chip-dot { width: 9px; height: 9px; display: inline-block; }
.sm-chip-seats { font-family: var(--font-mono); opacity: 0.7; }

.sm-scenarios { display: flex; flex-direction: column; gap: 12px; }
.sm-scenario { background: #fff; border: 1px solid var(--line); padding: 16px 18px; }
.sm-scenario-main { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.sm-scenario-head { display: flex; align-items: center; gap: 9px; }
.sm-scenario-name { font-family: var(--font-display); font-weight: 600; font-size: 17px; }
.sm-verdict { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; padding: 2px 7px; }
.sm-scenario-reason { font-size: 13px; color: var(--ink2); line-height: 1.45; margin-top: 6px; }
.sm-scenario-end { text-align: end; flex: none; }
.sm-scenario-seats { font-family: var(--font-display); font-weight: 700; font-size: 30px; line-height: 0.9; }
.sm-load-btn {
  margin-top: 6px; background: var(--dark); color: #fff; border: none; font-family: var(--font-mono);
  font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; padding: 6px 12px; cursor: pointer;
}
.sm-load-btn:hover { background: var(--orange); }

.sm-snake-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; position: relative; margin-bottom: 6px; }
.sm-snake-help { font-size: 13px; color: var(--ink2); line-height: 1.45; margin-bottom: 14px; }
.sm-snake { position: relative; padding-top: 18px; direction: ltr; }
.sm-snake-label { position: absolute; top: 0; transform: translateX(-50%); font-family: var(--font-mono); font-size: 10px; color: var(--ink); font-weight: 600; white-space: nowrap; }
.sm-snake-marker { position: absolute; top: 14px; bottom: 0; width: 2px; background: var(--ink); z-index: 2; }
.sm-snake-strip { display: flex; width: 100%; }
.sm-snake-cell { flex: 1 1 0; height: 26px; border-right: 1px solid rgba(255, 255, 255, 0.35); }
/* Shared seat legend (snake + forecast hemicycle). Forced LTR so it reads in
   the same left-to-right ideological order as the chart above it. Each entry is
   a button so it can drive the hemicycle spotlight (js/hemicycle.js). */
.sm-seat-legend { direction: ltr; display: flex; flex-wrap: wrap; gap: 6px 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--hairline); }
.sm-seat-legend-item {
  display: inline-flex; align-items: center; gap: 7px;
  font: inherit; color: inherit; text-align: start; cursor: pointer;
  background: none; border: 1px solid transparent; padding: 4px 9px 4px 7px;
  transition: background 0.16s ease, border-color 0.16s ease, opacity 0.16s ease, transform 0.16s ease;
}
.sm-seat-legend-item:hover,
.sm-seat-legend-item:focus-visible { background: var(--panel-alt); border-color: var(--line); outline: none; }
.sm-seat-legend-item:focus-visible { border-color: var(--orange); }
.sm-seat-legend-swatch { width: 11px; height: 11px; flex: none; transition: transform 0.16s ease, box-shadow 0.16s ease; }
.sm-seat-legend-name { font-size: 12.5px; color: var(--ink2); }
.sm-seat-legend-seats { font-family: var(--font-mono); font-size: 11px; color: var(--steel2); transition: color 0.16s ease; }

/* Forecast hemicycle "Projected seats" — hover/focus spotlight a party across
   both the seats and the legend, dimming everything else. Toggled by classes
   from js/hemicycle.js; transitions live here so nothing animates on mount. */
.sm-hemicycle { position: relative; }
.sm-hemi-svg { overflow: visible; }
.sm-seat { transform-box: fill-box; transform-origin: center; transition: opacity 0.18s ease, transform 0.18s ease; }
.sm-seat-group { cursor: pointer; transition: opacity 0.18s ease; }

.sm-hemicycle.is-active .sm-seat-group { opacity: 0.32; }
.sm-hemicycle.is-active .sm-seat-group.is-hl { opacity: 1; }
.sm-seat-group.is-hl .sm-seat { transform: scale(1.06); stroke-width: 1.8; }
.sm-seat-group.is-hl .sm-seat:hover { transform: scale(1.18); }

.sm-hemicycle.is-active .sm-seat-legend-item { opacity: 0.5; }
.sm-hemicycle.is-active .sm-seat-legend-item.is-hl {
  opacity: 1; background: var(--panel-alt); border-color: var(--line2);
}
.sm-seat-legend-item.is-hl .sm-seat-legend-swatch { transform: scale(1.15); box-shadow: 0 0 0 2px rgba(221, 126, 46, 0.16); }
.sm-seat-legend-item.is-hl .sm-seat-legend-seats { color: var(--ink); }

/* Floating party tooltip — lives on <body> so it survives #app re-renders. */
.sm-hemi-tip {
  position: fixed; z-index: 60; display: none; pointer-events: none;
  transform: translate(-50%, -100%); white-space: nowrap;
  background: var(--ink); color: #fff; padding: 6px 11px;
  font-family: var(--font-body); font-size: 12.5px; line-height: 1;
  box-shadow: 0 6px 20px rgba(35, 39, 43, 0.24);
}
.sm-hemi-tip::after {
  content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 5px solid transparent; border-top-color: var(--ink);
}
.sm-hemi-tip strong { font-weight: 600; }
.sm-hemi-tip .sm-hemi-tip-seats { font-family: var(--font-mono); font-weight: 600; color: var(--orange); margin-inline-start: 9px; }

@media (prefers-reduced-motion: reduce) {
  .sm-seat, .sm-seat-group, .sm-seat-legend-item, .sm-seat-legend-swatch { transition: none; }
  .sm-seat-group.is-hl .sm-seat { transform: none; }
}

/* ---------------------------------------------------- Polls history table */
.sm-polls-scroll { overflow-x: auto; }
.sm-polls { border-collapse: collapse; width: 100%; font-family: var(--font-mono); font-size: 12px; white-space: nowrap; }
.sm-polls th, .sm-polls td { padding: 6px 9px; text-align: center; border-bottom: 1px solid var(--hairline); }
.sm-polls thead th {
  position: sticky; top: 0; background: #fff; color: var(--steel); font-weight: 600;
  font-size: 10px; letter-spacing: 0.04em; text-transform: uppercase; border-bottom: 2px solid var(--line);
}
.sm-polls .sm-pl-start { text-align: start; }
.sm-polls .sm-pl-firm { font-family: var(--font-body); }
.sm-polls .sm-pl-muted { color: var(--steel2); }
.sm-polls .sm-pl-gov { font-weight: 600; color: var(--ink); }
.sm-polls tbody tr:hover { background: var(--panel-alt); }
.sm-polls tbody tr:first-child { background: #FCF4EC; } /* highlight the most recent poll */
.sm-polls-pager { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; justify-content: flex-end; }
.sm-page-btn {
  min-width: 30px; height: 30px; padding: 0 8px; background: #fff; border: 1px solid var(--line);
  color: var(--ink2); font-family: var(--font-mono); font-size: 12px; cursor: pointer;
}
.sm-page-btn:hover:not(:disabled):not(.is-active) { border-color: var(--orange); color: var(--orange); }
.sm-page-btn.is-active { background: var(--dark); color: #fff; border-color: var(--dark); }
.sm-page-btn:disabled { opacity: 0.4; cursor: default; }

/* ---------------------------------------------------------------- History */
.sm-hist-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; position: relative; margin-bottom: 18px; }
.sm-hist-rows { display: flex; flex-direction: column; gap: 11px; }
.sm-hist-row { display: flex; align-items: center; gap: 14px; }
.sm-hist-name { width: 190px; flex: none; font-size: 13.5px; font-weight: 600; text-align: end; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sm-hist-track { flex: 1; height: 24px; background: var(--track); }
.sm-hist-fill { height: 100%; }
.sm-hist-seats { width: 34px; flex: none; font-family: var(--font-mono); font-weight: 600; font-size: 14px; color: var(--ink); }
.sm-hist-note { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--hairline); font-family: var(--font-mono); font-size: 11px; line-height: 1.6; color: var(--steel2); }

/* "Then vs now" bloc comparison */
.sm-cmp-legend { display: flex; gap: 18px; margin-bottom: 16px; }
.sm-cmp-key { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--steel); }
.sm-cmp-swatch { width: 14px; height: 12px; background: var(--steel2); flex: none; }
.sm-cmp-swatch--now { background: repeating-linear-gradient(45deg, var(--steel2) 0 3px, #fff 3px 6px); border: 1px solid var(--line2); }
.sm-cmp-rows { display: flex; flex-direction: column; gap: 16px; }
.sm-cmp-row { display: flex; align-items: center; gap: 14px; }
.sm-cmp-name { width: 150px; flex: none; display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; }
.sm-cmp-bars { flex: 1; display: flex; flex-direction: column; gap: 5px; }
.sm-cmp-bar { display: flex; align-items: center; gap: 10px; }
.sm-cmp-track { flex: 1; height: 16px; background: var(--track); }
.sm-cmp-fill { height: 100%; }
.sm-cmp-fill--now { opacity: 0.55; }
.sm-cmp-val { width: 26px; flex: none; font-family: var(--font-mono); font-weight: 600; font-size: 13px; color: var(--ink); }
.sm-cmp-delta { width: 58px; flex: none; text-align: end; font-family: var(--font-mono); font-weight: 600; font-size: 13px; color: var(--steel); }
.sm-cmp-delta.is-up { color: var(--green); }
.sm-cmp-delta.is-down { color: #B5482F; }

/* Small-multiples grid: one card per election */
.sm-hist-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.sm-hist-el { display: flex; flex-direction: column; }
.sm-hist-el-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.sm-hist-el-knesset { font-family: var(--font-display, var(--font-mono)); font-weight: 700; font-size: 17px; color: var(--ink); }
.sm-hist-el-date { font-family: var(--font-mono); font-size: 12px; color: var(--steel); }
.sm-hist-el .sm-hist-name { width: 150px; }
.sm-hist-el-meta { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--hairline); display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--ink2, var(--ink)); }
.sm-hist-el-stat { line-height: 1.5; }
.sm-hist-el-k { color: var(--steel); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; font-size: 10.5px; }

/* Featured (most recent) election — larger bars and type. */
.sm-hist-el--lg .sm-hist-el-knesset { font-size: 22px; }
.sm-hist-el--lg .sm-hist-el-date { font-size: 13.5px; }
.sm-hist-el--lg .sm-hist-rows { gap: 14px; }
.sm-hist-el--lg .sm-hist-track { height: 34px; }
.sm-hist-el--lg .sm-hist-name { width: 220px; font-size: 15px; }
.sm-hist-el--lg .sm-hist-seats { width: 40px; font-size: 16px; }
.sm-hist-el--lg .sm-hist-el-meta { flex-direction: row; flex-wrap: wrap; gap: 6px 28px; font-size: 13px; }

/* ---------------------------------------------------------------- Markets */
.sm-mk-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; position: relative; }
.sm-mk-head .sm-info-btn { margin-top: 4px; }
/* Live-data toolbar: refresh control + status + source. */
.sm-mk-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; margin: 4px 0 18px; }
.sm-refresh {
  display: inline-flex; align-items: center; gap: 7px; background: none; border: 1px solid var(--line);
  color: var(--ink2); font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em;
  text-transform: uppercase; padding: 6px 12px; cursor: pointer;
}
.sm-refresh:hover:not(:disabled) { border-color: var(--orange); color: var(--orange); }
.sm-refresh:disabled { cursor: default; opacity: 0.6; }
.sm-refresh-icon { font-size: 13px; line-height: 1; display: inline-block; }
.sm-refresh-icon.is-spinning { animation: sm-spin 0.8s linear infinite; }
@keyframes sm-spin { to { transform: rotate(360deg); } }
.sm-mk-meta { font-family: var(--font-mono); font-size: 11px; color: var(--steel); }
.sm-mk-source { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--steel2); margin-inline-start: auto; }
.sm-mk-state { padding: 40px 8px; font-family: var(--font-mono); font-size: 13px; color: var(--steel); text-align: center; }
.sm-mk-state--error { color: var(--orange-dk); }
.sm-mk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; margin-top: 18px; }
.sm-mk-q { display: block; font-family: var(--font-display); font-weight: 600; font-size: 18px; line-height: 1.2; margin-bottom: 14px; color: var(--ink); text-decoration: none; }
.sm-embed-link { cursor: pointer; }
.sm-embed-link:hover, .sm-embed-link:focus-visible { text-decoration: underline; text-decoration-color: var(--orange); text-underline-offset: 2px; }

/* Polymarket embed popover (rendered on <body>, above the link). */
.sm-embed-layer {
  position: fixed; z-index: 200; display: none; background: #fff;
  border: 1px solid var(--line); box-shadow: 0 12px 32px rgba(35, 39, 43, 0.18);
}
.sm-embed-layer .polymarket-embed { position: relative; display: block; margin: 0; }
.sm-embed-layer iframe { display: block; width: min(400px, 86vw); height: 300px; border: 0; background: #fff; }
.sm-embed-corner { position: absolute; top: 16px; right: 20px; width: 120px; height: 24px; z-index: 10; }
.sm-embed-cap { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.sm-mk-row { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.sm-mk-label { width: 96px; flex: none; font-size: 12.5px; color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sm-mk-track { flex: 1; height: 18px; background: var(--track); }
.sm-mk-fill { height: 100%; }
.sm-mk-pct { width: 40px; flex: none; text-align: end; font-family: var(--font-mono); font-weight: 600; font-size: 12.5px; color: var(--ink); }

/* ------------------------------------------------------------------- Learn
 * The Learn tab is a scroll-driven explainer built on the home primer's band:
 * it reuses `.sm-px*` wholesale (scenes, type, reveal, ballot/cliff/dot art) so
 * js/parallax.js drives it unchanged, and only adds `.sm-lx*` for the chapter
 * art the primer has no equivalent of — the district comparison, the ranked
 * list, the vote-count summary, the divisor table and the surplus rows.
 *
 * Colour carries exactly one meaning across all of them: orange = took a seat /
 * still counted, grey = did not. The demo lists are labelled A/B/C rather than
 * coloured, so this page introduces no new party-colour system.
 */
.sm-lx-scene--end .sm-px-fore { display: flex; flex-direction: column; align-items: center; }

/* Intro agenda — the eight chapters, in two columns on wider screens. Blocky
   and shrink-wrapped so it centres under the lede without the scroll cue
   riding up alongside it. */
.sm-lx-toc { display: block; width: fit-content; margin: 34px auto 0; text-align: start; }
.sm-lx-toc-head {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--steel); margin-bottom: 12px;
}
.sm-lx-toc-list {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 34px;
}
.sm-lx-toc-item { display: flex; align-items: baseline; gap: 10px; }
.sm-lx-toc-n { font-family: var(--font-mono); font-size: 10px; color: var(--orange); flex: none; }
.sm-lx-toc-label { font-size: 14px; color: #B9BEC3; }

/* 02 — one national pool vs. many single-member districts. */
.sm-lx-cmp {
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 26px; align-items: center; margin-top: 44px; will-change: transform;
}
.sm-lx-cmp-side { min-width: 0; }
.sm-lx-cmp-head {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--paper); margin-bottom: 14px;
}
.sm-lx-cmp-box { border: 1px solid rgba(255, 255, 255, 0.22); padding: 16px; }
.sm-lx-cmp-cells { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.sm-lx-cell {
  border: 1px solid rgba(255, 255, 255, 0.22); aspect-ratio: 3 / 2;
  display: flex; align-items: center; justify-content: center;
}
.sm-lx-cell .sm-px-dot { width: 7px; height: 7px; flex: none; }
.sm-lx-cmp-vs { font-family: var(--font-mono); font-size: 13px; color: var(--steel); }
.sm-lx-cmp-foot { margin-top: 14px; font-size: 12.5px; line-height: 1.5; color: var(--steel2); }

/* 03 — a ranked candidate list, cut where the party's seats run out. */
.sm-lx-list { width: min(380px, 100%); }
.sm-lx-list-head {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--orange); padding-bottom: 12px; margin-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}
.sm-lx-row { display: flex; align-items: baseline; gap: 12px; padding: 9px 2px; }
.sm-lx-row-n { font-family: var(--font-mono); font-size: 11px; color: var(--orange); width: 14px; flex: none; }
.sm-lx-row-name { font-size: 14.5px; color: #F4F3F1; }
.sm-lx-row.is-out .sm-lx-row-n, .sm-lx-row.is-out .sm-lx-row-name { color: #6E747A; }
.sm-lx-row-mark {
  margin-inline-start: auto; font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--steel);
}
/* The cut: a dashed rule labelled where the list stops electing. */
.sm-lx-cut { position: relative; border-top: 2px dashed var(--orange); margin: 12px 0 18px; }
.sm-lx-cut-tag {
  position: absolute; top: -9px; inset-inline-start: 0; padding-inline-end: 10px;
  background: var(--dark); font-family: var(--font-mono); font-size: 10.5px;
  letter-spacing: 0.06em; color: var(--orange);
}

/* 05 — the count shrinks, so the same votes buy a bigger share. */
.sm-lx-waste { width: min(430px, 100%); }
.sm-lx-waste-bar { display: flex; height: 30px; margin-bottom: 22px; }
.sm-lx-waste-in { background: var(--orange); }
.sm-lx-waste-out {
  background: #464B50;
  background-image: repeating-linear-gradient(135deg, rgba(0, 0, 0, 0.35) 0 3px, transparent 3px 6px);
}
.sm-lx-sum { border-top: 1px solid rgba(255, 255, 255, 0.12); }
.sm-lx-sum-row {
  display: flex; justify-content: space-between; gap: 16px; padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.sm-lx-sum-label { font-size: 13px; color: #B9BEC3; }
.sm-lx-sum-val { font-family: var(--font-mono); font-size: 13px; color: #F4F3F1; }
.sm-lx-sum-row.is-out .sm-lx-sum-label, .sm-lx-sum-row.is-out .sm-lx-sum-val { color: #6E747A; }
.sm-lx-sum-row.is-total { border-bottom: none; }
.sm-lx-sum-row.is-total .sm-lx-sum-val { color: var(--orange); font-weight: 600; }
.sm-lx-punch { margin-top: 22px; border: 1px solid rgba(255, 255, 255, 0.14); padding: 16px 18px; }
.sm-lx-punch-head { font-size: 13px; color: #B9BEC3; margin-bottom: 12px; }
.sm-lx-punch-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 14px;
  padding: 7px 0; font-size: 13.5px; color: #8B9096;
}
.sm-lx-punch-seats { font-family: var(--font-mono); font-size: 13px; flex: none; }
.sm-lx-punch-row.is-win { color: #F4F3F1; }
.sm-lx-punch-row.is-win .sm-lx-punch-seats { color: var(--orange); font-weight: 600; }

/* 06 — the Bader–Ofer divisor table. Wide by nature: it scrolls inside its own
   container on small screens rather than squeezing the quotients. */
.sm-lx-table-wrap { max-width: 760px; margin: 40px auto 0; will-change: transform; }
.sm-lx-table-cap {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--steel); margin-bottom: 14px;
}
.sm-lx-table-scroll { overflow-x: auto; }
.sm-lx-table { width: 100%; border-collapse: collapse; }
.sm-lx-table th, .sm-lx-table td { padding: 11px 10px; text-align: end; white-space: nowrap; }
.sm-lx-table thead th {
  font-family: var(--font-mono); font-weight: 500; font-size: 11.5px; color: var(--steel);
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}
.sm-lx-corner { border-bottom: 1px solid rgba(255, 255, 255, 0.18); }
.sm-lx-th {
  font-family: var(--font-display); font-weight: 700; font-size: 16px; color: #F4F3F1;
  text-align: start; width: 1%;
}
.sm-lx-td {
  position: relative; font-family: var(--font-mono); font-size: 13px; color: #6E747A;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.sm-lx-td.is-win { color: #F4F3F1; }
/* The rank rides above the quotient that won that seat. */
.sm-lx-rank {
  display: inline-block; margin-inline-start: 5px; min-width: 15px; padding: 1px 3px;
  background: var(--orange); color: #23272B; border-radius: 2px;
  font-size: 9.5px; font-weight: 700; text-align: center; vertical-align: 3px;
}
.sm-lx-table-note { margin-top: 14px; font-size: 12.5px; line-height: 1.55; color: var(--steel2); }
.sm-lx-results {
  margin-top: 20px; padding-top: 18px; border-top: 1px solid rgba(255, 255, 255, 0.14);
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px 26px;
}
.sm-lx-res-label {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--steel);
}
.sm-lx-res { font-family: var(--font-mono); font-size: 14px; color: var(--orange); }
.sm-lx-res b { font-family: var(--font-display); font-size: 16px; color: #F4F3F1; margin-inline-end: 4px; }

/* 07 — votes ÷ (seats + 1), pair against pair, then partner against partner. */
.sm-lx-pairs { width: min(470px, 100%); }
.sm-lx-step {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--steel); margin: 22px 0 12px;
}
.sm-lx-step:first-child { margin-top: 0; }
.sm-lx-pair {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  padding: 12px 14px; margin-bottom: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12); border-inline-start: 3px solid transparent;
}
.sm-lx-pair-id { font-family: var(--font-display); font-weight: 700; font-size: 16px; color: #8B9096; width: 52px; flex: none; }
.sm-lx-pair-sum { font-family: var(--font-mono); font-size: 12px; color: var(--steel); }
.sm-lx-pair-ind { margin-inline-start: auto; font-family: var(--font-mono); font-size: 14px; color: #8B9096; }
.sm-lx-pair.is-win { border-inline-start-color: var(--orange); background: rgba(221, 126, 46, 0.07); }
.sm-lx-pair.is-win .sm-lx-pair-id { color: #F4F3F1; }
.sm-lx-pair.is-win .sm-lx-pair-ind { color: var(--orange); font-weight: 600; }
.sm-lx-pair-flag {
  width: 100%; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--orange);
}

/* 08 — the closing call to action. */
.sm-lx-end-art { margin: 38px 0 34px; will-change: transform; }
.sm-lx-cta { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.sm-lx-btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 13px 22px;
  background: var(--orange); color: #23272B; text-decoration: none;
  font-family: var(--font-mono); font-size: 12px; font-weight: 600; letter-spacing: 0.04em;
  border: 1px solid var(--orange); transition: background 0.2s ease, color 0.2s ease;
}
.sm-lx-btn:hover { background: #E9903F; border-color: #E9903F; }
.sm-lx-btn--ghost { background: none; color: var(--orange); }
.sm-lx-btn--ghost:hover { background: rgba(221, 126, 46, 0.12); color: var(--orange); }

/* -------------------------------------------------------------------- Live */
/* Static red indicator, shared by the nav tab, the page badge and the
   empty-state placeholder. */
.sm-live-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #D63B2F;
  flex: none; vertical-align: middle;
}
.sm-tab--live { display: inline-flex; align-items: center; gap: 7px; }

.sm-live-badge {
  display: inline-flex; align-items: center; gap: 7px; vertical-align: middle;
  margin-inline-start: 10px; padding: 4px 10px; border: 1px solid #E8C3A8; background: #F6E0D6;
  color: #B5482F; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.12em;
  text-transform: uppercase; font-weight: 600;
}

.sm-live-empty { margin-top: 24px; text-align: center; }
.sm-live-empty-pulse { display: flex; justify-content: center; margin-bottom: 18px; }
.sm-live-dot--lg { width: 16px; height: 16px; }
.sm-live-empty-title { font-family: var(--font-display); font-weight: 600; font-size: 20px; color: var(--ink); margin-bottom: 8px; }
.sm-live-empty-body { font-size: 14px; line-height: 1.6; color: var(--steel); max-width: 420px; margin: 0 auto; }

/* ------------------------------------------------------------------ Footer */
.sm-footer { border-top: 1px solid var(--line); background: #fff; }
.sm-footer-inner { max-width: var(--maxw); margin: 0 auto; padding: 20px 28px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.sm-footer-note { font-family: var(--font-mono); font-size: 10.5px; color: var(--steel2); line-height: 1.5; max-width: 70ch; }
.sm-footer-brand, .sm-footer-built { font-family: var(--font-mono); font-size: 10.5px; color: var(--line2); text-decoration: none; }
.sm-footer-brand:hover, .sm-footer-built:hover { color: var(--orange); }

/* -------------------------------------------------------------- Responsive */
@media (max-width: 900px) {
  .sm-ov-grid, .sm-co-grid, .sm-hm-grid { grid-template-columns: minmax(0, 1fr); }
  .sm-h1--lg { font-size: 32px; }
}

/* Parallax primer: stack the text/art scenes on narrower screens. */
@media (max-width: 760px) {
  .sm-px-duo { grid-template-columns: 1fr; gap: 30px; }
  .sm-px-text { order: 1; }
  .sm-px-art { order: 2; }
  .sm-px-scene { min-height: clamp(460px, 78vh, 720px); padding: 48px 0; }
  .sm-px-scene--intro { min-height: 88vh; }
  .sm-px-toc-wrap { display: none; } /* avoid crowding the stacked mobile hero */

  /* Learn: stack the district comparison, and let the agenda run in one column
     so the chapter names don't wrap mid-phrase. */
  .sm-lx-cmp { grid-template-columns: minmax(0, 1fr); gap: 22px; margin-top: 32px; }
  .sm-lx-cmp-vs { text-align: center; }
  .sm-lx-toc-list { grid-template-columns: minmax(0, 1fr); }
  .sm-lx-table-wrap { margin-top: 30px; }
}

/* Mobile navigation: collapse the tab row behind a hamburger menu. */
@media (max-width: 700px) {
  .sm-nav-toggle {
    display: flex; align-items: center; gap: 12px; width: 100%;
    background: none; border: none; cursor: pointer; padding: 14px 0; color: var(--ink);
  }
  .sm-nav-tabs {
    display: none; flex-direction: column; gap: 0; overflow: visible;
    position: absolute; inset-inline: 0; top: 100%; background: #fff;
    border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
    box-shadow: 0 10px 24px rgba(35, 39, 43, 0.10); z-index: 30;
  }
  .sm-nav-tabs.is-open { display: flex; }
  .sm-nav-tabs .sm-tab {
    width: 100%; text-align: start; padding: 14px 20px;
    border-bottom: 1px solid var(--hairline); border-inline-start: 3px solid transparent;
  }
  .sm-nav-tabs .sm-tab:last-child { border-bottom: none; }
  .sm-nav-tabs .sm-tab.is-active { border-bottom-color: var(--hairline); border-inline-start-color: var(--orange); }
}
@media (max-width: 560px) {
  .sm-header-inner, .sm-main, .sm-footer-inner { padding-left: 18px; padding-right: 18px; }
  .sm-main { padding-top: 24px; }
  .sm-px { margin-top: -24px; } /* match the reduced main top padding */
  .sm-px-fore { padding-inline: 18px; }
  .sm-hist-name { width: 120px; }
  .sm-hist-el .sm-hist-name { width: 110px; }
  .sm-hist-el--lg .sm-hist-name { width: 130px; }
  .sm-hist-grid { grid-template-columns: 1fr; }
  .sm-cmp-name { width: 96px; }
  .sm-h1 { font-size: 28px; }
}
