/* Delimitation Vote: this app's own classes. style.css is the shared NYT default and stays untouched (Rule 14). */

:root {
  --for: #F28C00;          /* the dial's government orange */
  --for-text: #C8650A;
  --against: #2F6DB5;      /* the dial's opposition blue */
  --away: #8F8C84;
  --vacant: #C9C6BB;
  --purple: #7F63A0;       /* DIU purple: may switch sides */
  --spare: #2E7D5B;
  --short: #B3261E;
}

.draft-flag {
  font-family: var(--sans); font-size: 12px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase;
  color: var(--short); margin: 0 auto 12px;
}

/* ---- Story body ---------------------------------------------------------------------------------------- */
.story-body p, .story-body li { font-family: var(--serif); font-size: 18px; line-height: 1.55; color: var(--ink); }
@media (min-width: 740px) { .story-body p, .story-body li { font-size: 20px; } }
.story-body h2 {
  font-family: var(--sans); font-size: 15px; font-weight: 800; letter-spacing: 0.6px; color: var(--ink);
  margin: 44px 0 10px;
}
.story-body ul, .story-body ol { padding-left: 22px; }
.story-body li { margin-bottom: 10px; }
.story-body a { color: var(--ink); text-decoration: underline; text-decoration-color: #BDBDBD; text-underline-offset: 3px; }
.story-body a:hover { text-decoration-color: var(--ink); }
.story-body p:has(> a:only-child) { margin: 0; }

/* Figures run a little wider than the text */
.figure { margin: 28px auto 32px; max-width: 540px; }
.figure img, .figure video { width: 100%; height: auto; display: block; border: 1px solid var(--rule); }
.figure figcaption { font-family: var(--sans); font-size: 13px; line-height: 1.4; color: var(--meta); margin-top: 8px; }
.figure figcaption a { color: var(--meta); }

/* ---- Simulator ------------------------------------------------------------------------------------------ */
.sim { max-width: 780px; margin: 28px auto 40px; font-family: var(--sans); }
.story-body .sim p { font-family: var(--sans); font-size: 14px; line-height: 1.45; }
@media (min-width: 820px) { .sim { margin-left: -90px; margin-right: -90px; } }

.sim-result {
  position: sticky; top: 0; z-index: 5; background: rgba(255, 255, 255, 0.95);
  padding: 12px 0 10px; border-bottom: 1px solid var(--rule);
}
.sim-sides { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.sim-side { display: flex; flex-direction: column; }
.sim-against { text-align: right; }
.sim-label { font-size: 14px; font-weight: 700; }
.sim-for .sim-label { color: var(--for-text); }
.sim-against .sim-label { color: var(--against); }
.sim-number { font-size: 44px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.sim-for .sim-number { color: var(--for-text); }
.sim-against .sim-number { color: var(--against); }
@media (min-width: 740px) { .sim-number { font-size: 56px; } }
.sim-verdict { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.sim-pill {
  font-size: 20px; font-weight: 800; letter-spacing: 1px; padding: 4px 14px; border-radius: 10px;
}
.sim-pill.is-pass { color: var(--spare); background: rgba(46, 125, 91, 0.14); }
.sim-pill.is-block { color: var(--short); background: rgba(179, 38, 30, 0.13); }
.sim-status { font-size: 14px; font-weight: 700; }
.sim-status.is-pass { color: var(--spare); }
.sim-status.is-block { color: var(--short); }

.sim-bar { position: relative; height: 26px; background: #EEECE6; margin: 26px 0 6px; }
.sim-bar-for { position: absolute; left: 0; top: 0; bottom: 0; background: var(--for); transition: width 0.35s ease; }
.sim-bar-against { position: absolute; right: 0; top: 0; bottom: 0; background: var(--against); transition: width 0.35s ease; }
.sim-bar-need {
  position: absolute; top: -20px; bottom: -4px; width: 0; border-left: 2px dotted var(--ink);
  transition: left 0.35s ease;
}
.sim-bar-need span {
  position: absolute; top: -2px; left: 0; transform: translateX(-50%); font-size: 13px; font-weight: 800;
  white-space: nowrap; background: rgba(255, 255, 255, 0.95); padding: 0 3px;
}
.sim-sum { font-size: 13px; color: var(--meta); margin: 6px 0 0; line-height: 1.4; }

.sim-presets { margin: 18px 0 6px; }
.sim-presets-title { font-size: 12px; font-weight: 800; letter-spacing: 0.5px; text-transform: uppercase; margin: 0 0 8px; }
.sim-preset-list { display: flex; flex-wrap: wrap; gap: 6px; }
.sim-preset-list button {
  font-family: var(--sans); font-size: 13px; font-weight: 600; border: 1px solid #CCCCCC; background: #FFFFFF;
  border-radius: 16px; padding: 5px 11px; cursor: pointer; color: var(--ink);
}
.sim-preset-list button.is-active { background: var(--ink); border-color: var(--ink); color: #FFFFFF; }
.sim-preset-list button .num {
  display: inline-block; width: 18px; height: 18px; line-height: 18px; border-radius: 50%; text-align: center;
  font-size: 11px; font-weight: 800; background: #E4E1D6; color: var(--ink); margin-right: 5px;
}
.sim-preset-list button.is-active .num { background: #FFFFFF; }
.sim-preset-list button.is-new { border-color: var(--purple); }
.sim-scenario-detail { font-size: 14px; color: var(--ink-2); margin: 8px 0 0; min-height: 20px; }

.sim-chamber { width: 100%; height: auto; display: block; margin: 6px 0 0; }
.sim-chamber text { font-family: var(--sans); }
.sim-key { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; font-size: 13px; margin: 2px 0 18px; }
.sim-key span { display: inline-flex; align-items: center; gap: 5px; }
.dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.dot-for { background: var(--for); }
.dot-against { background: var(--against); }
.dot-away { background: #FFFFFF; border: 1.5px solid var(--away); width: 9px; height: 9px; }
.dot-vacant { background: var(--vacant); }
.dot-purple { background: var(--purple); }

.sim-group { margin: 18px 0 0; }
.sim-group-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  border-bottom: 2px solid var(--ink); padding-bottom: 5px;
}
.sim-group-head h3 { font-size: 15px; font-weight: 800; margin: 0; }
.sim-group-head h3 small { font-weight: 500; color: var(--meta); margin-left: 6px; }
.sim-group.is-purple .sim-group-head { border-bottom-color: var(--purple); }
.sim-group.is-purple .sim-group-head h3 { color: var(--purple); }
.sim-all { display: flex; gap: 4px; font-size: 12px; color: var(--meta); align-items: center; }
.sim-all button {
  font-family: var(--sans); font-size: 12px; border: none; background: none; color: var(--ink-2);
  text-decoration: underline; text-underline-offset: 2px; cursor: pointer; padding: 2px 3px;
}

.sim-row {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--rule);
}
.sim-name { font-size: 15px; font-weight: 600; line-height: 1.3; }
.sim-name .mps { font-weight: 400; color: var(--meta); margin-left: 4px; white-space: nowrap; }
.sim-note { font-size: 12.5px; color: var(--meta); line-height: 1.35; margin-top: 2px; }
.sim-row.is-purple .sim-name::before {
  content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--purple);
  margin-right: 6px; vertical-align: 1px;
}
.sim-toggle { display: inline-flex; border: 1px solid #CCCCCC; border-radius: 4px; overflow: hidden; }
.sim-toggle button {
  font-family: var(--sans); font-size: 12.5px; font-weight: 600; border: none; background: #FFFFFF; color: var(--ink-2);
  padding: 6px 9px; cursor: pointer; border-left: 1px solid #CCCCCC;
}
.sim-toggle button:first-child { border-left: none; }
.sim-toggle button.is-for { background: var(--for); color: #FFFFFF; }
.sim-toggle button.is-against { background: var(--against); color: #FFFFFF; }
.sim-toggle button.is-away { background: #5F5D57; color: #FFFFFF; }
.sim-toggle button:disabled { cursor: not-allowed; opacity: 0.55; }
.sim-split { font-size: 12px; font-weight: 700; color: var(--purple); margin-right: 6px; }

@media (max-width: 520px) {
  .sim-row { grid-template-columns: 1fr; }
  .sim-toggle { justify-self: start; }
}

/* ---- Hero: the dial, drawn live ------------------------------------------------------------------------- */
/* style.css caps every child of .story at the 600 px reading column; the hero runs at the graphics width */
.story > .hero { max-width: 780px !important; margin: 8px auto 36px; font-family: var(--sans); }
.hero figcaption { font-family: var(--sans); font-size: 13px; line-height: 1.45; color: var(--meta); margin-top: 6px; }
.hero figcaption a { color: var(--meta); }

.hero-steps { position: relative; display: flex; align-items: flex-start; justify-content: space-between; gap: 4px; margin: 4px 0 14px; }
.hero-step-line { position: absolute; left: 18px; right: 104px; top: 18px; height: 2px; background: #D6D3C8; z-index: 0; }
.hero-step {
  position: relative; z-index: 1; width: 36px; height: 36px; border-radius: 50%; border: none; cursor: pointer;
  font-family: var(--sans); font-size: 15px; font-weight: 800; background: #E4E1D6; color: #6B6862;
  transition: background 0.3s, color 0.3s;
}
.hero-step.is-done { background: #B9B6AC; color: #FFFFFF; }
.hero-step.is-active { background: var(--ink); color: #FFFFFF; }
.hero-play {
  position: relative; z-index: 1; font-family: var(--sans); font-size: 12px; font-weight: 700; letter-spacing: 0.4px;
  text-transform: uppercase; border: 1px solid #CCCCCC; background: #FFFFFF; border-radius: 14px; padding: 6px 12px; cursor: pointer;
}
.hero-scenario { min-height: 64px; }
.hero-title { font-size: 24px; font-weight: 800; line-height: 1.2; margin: 0; color: var(--ink); }
.hero-detail { font-size: 17px; color: var(--ink-2); margin: 4px 0 0; min-height: 22px; }
@media (min-width: 740px) { .hero-title { font-size: 28px; } .hero-detail { font-size: 19px; } }

.hero-sides { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 14px; }
.hero-side { display: flex; flex-direction: column; }
.hero-against { text-align: right; }
.hero-label { font-size: 16px; font-weight: 700; }
.hero-for .hero-label { color: var(--for-text); }
.hero-against .hero-label { color: var(--against); }
.hero-number-row { display: flex; align-items: baseline; gap: 10px; }
.hero-number { font-size: 64px; font-weight: 800; line-height: 0.95; font-variant-numeric: tabular-nums; }
@media (min-width: 740px) { .hero-number { font-size: 88px; } }
.hero-for .hero-number { color: var(--for-text); }
.hero-against .hero-number { color: var(--against); }
.hero-status { font-size: 18px; font-weight: 800; opacity: 0; transition: opacity 0.4s; }
.hero-status.is-on { opacity: 1; }
.hero-status.is-pass { color: var(--spare); }
.hero-status.is-block { color: var(--short); }
.hero-pill {
  align-self: center; font-size: 26px; font-weight: 800; letter-spacing: 1px; padding: 6px 18px; border-radius: 12px;
  opacity: 0; transition: opacity 0.4s;
}
.hero-pill.is-on { opacity: 1; animation: hero-blink 0.5s ease-in-out 3; }
.hero-pill.is-pass { color: var(--spare); background: rgba(46, 125, 91, 0.16); }
.hero-pill.is-block { color: var(--short); background: rgba(179, 38, 30, 0.16); }
@keyframes hero-blink { 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) { .hero-pill.is-on { animation: none; } }

.hero-bar { position: relative; height: 44px; background: #EEECE6; margin: 34px 0 4px; }
.hero-bar-for { position: absolute; left: 0; top: 0; bottom: 0; background: #E07A10; transition: width 1.6s cubic-bezier(0.65, 0, 0.35, 1); }
.hero-bar-against { position: absolute; right: 0; top: 0; bottom: 0; background: var(--against); transition: width 1.6s cubic-bezier(0.65, 0, 0.35, 1); }
.hero-face { position: absolute; top: 50%; transform: translateY(-50%); display: flex; align-items: center; gap: 6px;
  color: #FFFFFF; font-size: 13px; font-weight: 800; line-height: 1.05; z-index: 2; pointer-events: none; }
.hero-face img { width: 50px; height: 50px; border-radius: 50%; border: 3px solid #FFFFFF; object-fit: cover; background: #FFFFFF; }
.hero-face-left { left: 4px; }
.hero-face-right { right: 4px; text-align: right; }
.hero-need { position: absolute; top: -26px; bottom: -6px; width: 0; border-left: 3px dotted var(--ink); z-index: 3;
  transition: left 1.6s cubic-bezier(0.65, 0, 0.35, 1); }
.hero-need-label { position: absolute; top: -4px; left: 0; transform: translateX(-50%); font-size: 16px; font-weight: 800;
  background: #FFFFFF; padding: 0 3px; white-space: nowrap; }
.hero-foot { font-size: 13px; color: var(--ink-2); margin: 6px 0 0; }
.hero-chamber { width: 100%; height: auto; display: block; margin-top: 6px; }
.hero-seat { transition: fill 0.8s ease, stroke 0.8s ease; }
.hero-chamber-label { font-family: var(--sans); font-size: 18px; font-weight: 800; }
.hero-tip { font-family: var(--sans); font-size: 16px; fill: var(--ink-2); }
.hero-key { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 18px; font-size: 14px; margin: 4px 0 0; }
.hero-key span { display: inline-flex; align-items: center; gap: 6px; }

/* ---- Live charts in the story --------------------------------------------------------------------------- */
.figure-live { max-width: 600px; font-family: var(--sans); }
.chart-title { font-family: var(--sans) !important; font-size: 22px !important; font-weight: 800; line-height: 1.2 !important; margin: 0 0 4px; }
.chart-sub { font-family: var(--sans) !important; font-size: 15px !important; color: var(--ink-2); line-height: 1.4 !important; margin: 0 0 12px; }
.chart-toggle { margin: 0 0 14px; }
.chart-download { font-family: var(--sans) !important; font-size: 13px !important; margin: 8px 0 0; }
.chart-download a { color: var(--meta) !important; }

.ae-bar-wrap { position: relative; margin: 34px 0 10px; }
.ae-bar { display: flex; height: 46px; }
.ae-seg { display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 800; cursor: default;
  border-right: 1px solid #FFFFFF; transition: filter 0.2s; }
.ae-seg:hover { filter: brightness(1.12); }
.ae-need { position: absolute; top: -24px; bottom: -6px; width: 0; border-left: 3px dotted var(--ink); z-index: 2; transition: left 0.6s ease; }
.ae-need span { position: absolute; top: -4px; transform: translateX(-60%); font-size: 13px; font-weight: 800; white-space: nowrap;
  background: #FFFFFF; padding: 0 3px; }
.ae-verdict { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 12px 0 6px; }
.ae-big { font-size: 34px; font-weight: 800; }
.ae-big.is-pass { color: var(--spare); }
.ae-big.is-block { color: var(--short); }
.ae-words { font-size: 15px; color: var(--ink-2); }
.ae-key, .house-key { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; margin: 8px 0 0; }
.ae-key span, .house-key span { display: inline-flex; align-items: center; gap: 5px; cursor: default; }
.chip { width: 14px; height: 10px; display: inline-block; }

.house-chamber { width: 100%; height: auto; display: block; }
.house-seat { transition: opacity 0.2s; cursor: pointer; }
.house-seat.is-dim { opacity: 0.18; }
.house-seat.is-faded { opacity: 0.35; }
.house-label { font-family: var(--sans); font-size: 17px; font-weight: 800; }
.house-tick { font-family: var(--sans); font-size: 15px; font-weight: 800; fill: var(--ink); }

.tooltip {
  position: fixed; z-index: 50; display: none; max-width: 260px; pointer-events: none;
  background: #FFFFFF; border: 1px solid #CCCCCC; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  font-family: var(--sans); font-size: 13px; line-height: 1.4; color: var(--ink); padding: 8px 10px;
}
.tooltip .tip-note { color: var(--meta); }
.ae-purple { position: relative; display: flex; }
.ae-purple .ae-seg { border-right: 1px solid rgba(255, 255, 255, 0.5); }
.ae-purple-label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #FFFFFF; font-size: 15px; font-weight: 800; pointer-events: none; }
.hero-number-row { flex-wrap: wrap; }
.hero-status { white-space: nowrap; }
/* A short label under each numbered circle, so readers can follow each move (the same labels as the video) */
.hero-stepwrap { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1 1 0; min-width: 0; }
.hero-step-label { font-size: 12px; line-height: 1.15; color: #6B6862; white-space: pre-line; text-align: center; }
.hero-step-label.is-active { color: var(--ink); font-weight: 700; }
.hero-play { align-self: flex-start; }

/* The DIU logo, bottom right of the hero chart (as on the static charts); on a phone it takes its own line */
.hero-logo { display: block; height: 40px; width: auto; margin: -30px 0 0 auto; }
@media (max-width: 600px) { .hero-logo { height: 34px; margin: 8px 0 0 auto; } }

/* Phones (Dec 1, web team): the hero's three parts must fit 320-414 px without sideways scroll, and the chamber's
   words, drawn in an SVG that shrinks to about half, are drawn larger so they read at about 13-15 px */
@media (max-width: 520px) {
  .hero-sides { gap: 6px; }
  .hero-side { min-width: 0; }
  .hero-number { font-size: 46px; }
  .hero-label { font-size: 14px; }
  .hero-pill { font-size: 20px; padding: 6px 10px; }
  .hero-status { font-size: 15px; }
  .hero-chamber-label { font-size: 30px; }
  .hero-tip { font-size: 28px; }
}
@media (max-width: 360px) {
  .hero-number { font-size: 40px; }
  .hero-pill { font-size: 17px; padding: 5px 8px; letter-spacing: 0.5px; }
  .hero-status { font-size: 13px; }
  .hero-label { font-size: 13px; }
}
@media (max-width: 520px) {
  /* the bar's camp names stay clear of the dotted two-thirds line on a narrow phone */
  .hero .hero-face img { width: 36px; height: 36px; border-width: 2px; }
  .hero .hero-face span { font-size: 11px; line-height: 1.15; }
}
