/* kit.css: the look every motion visual shares (newsroom/visual-kit/kit.css). build.py puts it first in styles.css and the
   visual's own CSS after it.
   Palette: dark card, white text, indigo and cyan for marks, rose only for "not confirmed / not stated", amber only for a note.
   Two frames on one DOM: tall (the fixed 1060px frame below 900px wide) is the base; wide (the block's aspect ratio, 5:4 or
   16:10 on screens 900px and wider) overrides it in the media query near the end. The wide query must match WIDE_QUERY in kit.js.
   Wide sizes are in rem and the root font size scales with the frame, so the wide design is one fixed composition. */
:root {
  --bg: #0b1726; --panel: #102039; --panel2: #16294a; --line: #2f4668; --line2: #4a6590;
  --mute: #b9c7dc; --ink: #0b1726;
  --indigo: #635bff; --indigo-t: #b3afff; --cyan: #06b6d4; --cyan-t: #3fd9f0; --rose: #fb7185; --amber: #fbbf24;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html { background: var(--bg); color-scheme: dark; font-size: 16px; }
body { margin: 0; background: var(--bg); color: #fff; font-family: var(--font); line-height: 1.35; min-height: 100vh; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
ol, ul { margin: 0; padding: 0; list-style: none; }
.lw { display: none; }
.lt { display: inline; }

/* ---------- the frame ---------- */
.stage { position: relative; display: flex; flex-direction: column; height: 100vh; padding: 0.6rem 0.7rem 0.5rem; gap: 0.4rem; max-width: 46rem; margin: 0 auto; }
.top { display: flex; flex-direction: column; gap: 0.4rem; }
h1 { margin: 0; font-size: 1.1rem; line-height: 1.2; font-weight: 700; }
.ctl { display: flex; gap: 0.5rem; }
.btn { min-height: 2.5rem; min-width: 5.5rem; padding: 0 1rem; border: 1px solid #5b7399; background: var(--panel2); border-radius: 0.5rem; font-size: 0.875rem; font-weight: 600; }
.btn:hover:not(:disabled) { border-color: #fff; }
.btn:disabled { color: #a8b6cc; border-color: var(--line); background: transparent; cursor: default; }
.btn[hidden] { display: none; }

/* ---------- slider row: label, range input, readout ---------- */
.scrub { display: grid; grid-template-columns: auto 1fr; column-gap: 0.7rem; align-items: center; flex: none; }
.scrub-l { font-size: 0.875rem; color: var(--mute); white-space: nowrap; }
.scrub input[type="range"] { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 2.2rem; margin: 0; background: transparent; cursor: pointer; }
.scrub input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: #3a5278; }
.scrub input[type="range"]::-moz-range-track { height: 6px; border-radius: 3px; background: #3a5278; }
.scrub input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 26px; height: 26px; margin-top: -10px; border-radius: 50%; background: #fff; border: 5px solid var(--indigo); }
.scrub input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 5px solid var(--indigo); }
.when { grid-column: 1 / span 2; margin: 0; font-size: 0.875rem; color: var(--mute); min-height: 1.35em; }

/* ---------- tooltip: a sheet over the free edge of the frame (tall), floating beside the target (wide) ---------- */
.dock { flex: none; }
.tip { position: absolute; left: 0.5rem; right: 0.5rem; bottom: 0.5rem; z-index: 30; max-height: 58%; overflow: auto; padding: 0.5rem 0.8rem 0.6rem; background: #09111f; border: 1px solid #5b7399; border-left-width: 5px; border-radius: 0.5rem; font-size: 0.875rem; box-shadow: 0 0.6rem 1.6rem rgba(0, 0, 0, 0.6); pointer-events: none; }
.tip.pinned { pointer-events: auto; }
.tip[hidden] { display: none; }
.tip p { margin: 0; }
.tip[data-tone="plain"], .tip[data-tone="stage"] { border-left-color: var(--indigo); }
.tip[data-tone="rose"] { border-left-color: var(--rose); }
.tip[data-tone="amber"] { border-left-color: var(--amber); }
.tip[data-tone="cyan"] { border-left-color: var(--cyan); }
.tk-kick { color: var(--mute); }
.tk-title { font-weight: 700; font-size: 1rem; margin-top: 0.1rem !important; }
.tk-plain { margin-top: 0.25rem !important; }
.vb { margin-top: 0.35rem; }
.vh { color: var(--cyan-t); font-weight: 700; }
.q { margin: 0.1rem 0 0; padding: 0 0 0 0.6rem; border-left: 2px solid #5b7399; font-style: italic; }
.vn { color: var(--mute); margin-top: 0.15rem !important; }
.tk-der { margin-top: 0.4rem !important; color: var(--cyan-t); font-weight: 600; }
.tk-mid { margin-top: 0.4rem !important; }
.tk-ns { margin-top: 0.4rem !important; color: var(--rose); font-weight: 600; }
.tk-close { display: none; position: sticky; bottom: 0; margin-top: 0.5rem; min-height: 2.6rem; padding: 0 1.2rem; background: var(--panel2); border: 1px solid #5b7399; border-radius: 0.4rem; font-weight: 600; font-size: 0.875rem; pointer-events: auto; }
.tip.pinned .tk-close { display: inline-block; }
.src { margin: 0; flex: none; font-size: 0.875rem; color: var(--mute); }
.tipping .src { display: none; }

/* ---------- wide frame ---------- */
@media (min-aspect-ratio: 21/20) {
  .lw { display: inline; }
  .lt { display: none; }
  html { font-size: min(calc(100vw / 53), calc(100vh / 42.4)); }
  body { overflow: hidden; }
  .stage { max-width: calc(100vh * 1.25); padding: 0.5rem 1rem 0.35rem; gap: 0.3rem; }
  .top { flex-direction: row; align-items: center; justify-content: space-between; gap: 1rem; }
  h1 { font-size: 1.2rem; }
  .btn { min-height: 1.9rem; min-width: 4.6rem; padding: 0 0.8rem; font-size: 0.85rem; }
  .scrub { grid-template-columns: auto minmax(0, 20rem) 1fr; column-gap: 0.7rem; }
  .scrub-l { font-size: 0.85rem; }
  .scrub input[type="range"] { height: 1.6rem; }
  .scrub input[type="range"]::-webkit-slider-thumb { width: 20px; height: 20px; margin-top: -7px; border-width: 4px; }
  .when { grid-column: auto; font-size: 0.85rem; }
  .dock { position: static; height: 0; }
  .tip { right: auto; bottom: auto; width: 28rem; max-width: calc(100% - 1rem); max-height: calc(100% - 1rem); font-size: 0.85rem; padding: 0.5rem 0.7rem; }
  .tk-title { font-size: 0.95rem; }
  .tk-close { margin-top: 0.4rem; min-height: 1.9rem; font-size: 0.85rem; }
  .src, .tipping .src { display: block; font-size: 0.8rem; }
}

/* ---------- without script ----------
   A module script runs a moment after first paint, so the plain list waits 1.4 seconds before it appears. A reader with script
   never sees it flash, a reader without script still gets it. */
html:not(.js) .plain { opacity: 0; animation: nojs 0.01s 1.4s forwards; }
@keyframes nojs { to { opacity: 1; } }
html:not(.js) body { overflow: auto; }
html:not(.js) .stage { height: auto; min-height: 100vh; }
html:not(.js) .scrub, html:not(.js) .dock, html:not(.js) .ctl, html:not(.js) .chart { display: none; }
html.js .plain { display: none; }

/* ---------- reduced motion, and the freeze while a tooltip is open ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
.frozen *, .frozen *::before, .frozen *::after { transition: none !important; animation: none !important; }

/* Chart styles. Come after kit.css in styles.css. Tall frame is the base (the fixed 1060px frame below 900px wide);
   the wide frame (5:4) overrides it in the media query near the end. Bars are real buttons sized by custom properties that
   the engine sets (--w a fraction of the track, --e where the bar ends). Bars start at zero: the zero line is drawn.
   Tall panels are flat (a rule above each) so the eleven quarters fit the 1060px frame; wide panels are boxes. */
.chart { display: flex; flex-direction: column; gap: 0.45rem; flex: none; }
.panel { border-top: 1px solid var(--line2); padding: 0.35rem 0 0; min-width: 0; }
.ph { margin: 0; font-size: 1rem; line-height: 1.2; font-weight: 700; }
.pu { margin: 0.1rem 0 0; font-size: 0.875rem; line-height: 1.3; color: var(--mute); }
.pu.lw { display: none; }

/* ---------- bars ---------- */
.seg { position: relative; display: block; flex: none; width: calc(var(--w, 0) * 100%); height: 100%; margin: 0; padding: 0; border: 0; border-radius: 0; background: var(--indigo); overflow: hidden; text-align: left; }
.seg:hover, .seg.pin { box-shadow: 0 0 0 2px #fff; z-index: 2; }
.seg.cap { background: var(--indigo-t); overflow: visible; }
.seg.cap::after { content: ""; position: absolute; inset: 0 -0.5rem; }

/* ---------- panel A: the headline split ---------- */
.tot { position: relative; display: block; width: calc(var(--g, 0) * 100%); height: 1.6rem; margin: 0.35rem 0 0; padding: 0 0 0.45rem; border: 0; background: none; text-align: left; white-space: nowrap; overflow: visible; font-size: 0.95rem; font-weight: 700; line-height: 1.2; color: #fff; }
.tot::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 0.4rem; border: 2px solid var(--mute); border-top: 0; }
.tot:hover, .tot.pin { background: rgba(255, 255, 255, 0.1); }
.abar { position: relative; display: flex; height: 2rem; border-left: 2px solid var(--mute); }
.seg.conf::before, .seg.claim::before { content: ""; position: absolute; inset: 0; opacity: var(--split, 0); }
.seg.conf::before { background: var(--cyan); }
.seg.claim::before { background: var(--rose); }
.alabs { display: flex; flex-direction: column; gap: 0.1rem; margin-top: 0.35rem; }
.al { margin: 0; font-size: 0.875rem; line-height: 1.3; cursor: default; }
.al .sw { display: inline-block; width: 0.8rem; height: 0.8rem; margin-right: 0.4rem; vertical-align: -1px; border-radius: 2px; }
.al.conf .sw { background: var(--cyan); }
.al.claim .sw { background: var(--rose); }
.al .an { font-weight: 700; }
.al.conf .an { color: var(--cyan-t); }
.al.claim .an { color: var(--rose); }
.al .ap { color: var(--mute); }

/* ---------- panel C: the rise on Q2 (the words sit inside the bars) ---------- */
.crow { display: flex; height: 1.75rem; margin-top: 0.3rem; border-left: 2px solid var(--mute); }
.seg.rise { font-size: 0.875rem; line-height: 1; color: #fff; }
.seg.rise .cl { position: absolute; left: 0.5rem; top: 50%; transform: translateY(-50%); font-weight: 600; white-space: nowrap; }
.seg.rise .cv { position: absolute; right: 0.5rem; top: 50%; transform: translateY(-50%); font-weight: 700; white-space: nowrap; }

/* ---------- panel B: the quarters (rows in the tall frame, columns in the wide one) ---------- */
.pb .scrub { margin-top: 0.1rem; }
.pb .when { min-height: 2.7em; }
.bplot { --lab: 4rem; --rowh: 1.65rem; --bh: 1.25rem; --tick: 1.1rem; position: relative; padding-top: var(--tick); }
.baxis { position: absolute; left: calc(var(--lab) + 2px); right: 0; top: 0; bottom: 0; pointer-events: none; }
.gl { position: absolute; top: var(--tick); bottom: 0; left: calc(var(--k) * 100%); width: 0; border-left: 1px dashed var(--line2); }
.tk { position: absolute; top: 0; left: calc(var(--k) * 100%); transform: translateX(-50%); font-size: 0.875rem; line-height: 1.2; color: var(--mute); }
.tk:last-of-type { transform: translateX(-100%); }
.bcols { display: flex; flex-direction: column; }
.qrow { display: grid; grid-template-columns: var(--lab) minmax(0, 1fr); align-items: center; height: var(--rowh); border-radius: 0.3rem; }
.qrow.cur, .qrow:focus-within { background: rgba(99, 91, 255, 0.2); }
.qlab { font-size: 0.875rem; font-weight: 600; white-space: nowrap; }
.qbars { position: relative; display: flex; align-items: center; height: var(--bh); border-left: 2px solid var(--mute); }
.seg.base .v { position: absolute; right: 0.35rem; top: 50%; transform: translateY(-50%); font-size: 0.875rem; font-weight: 700; line-height: 1; color: #fff; white-space: nowrap; }
.qd { position: absolute; left: calc(var(--e, 0) * 100% + 0.35rem); top: 50%; transform: translateY(-50%); font-size: 0.875rem; font-weight: 700; line-height: 1; color: var(--indigo-t); white-space: nowrap; }
.qval { display: none; }
.legend { display: flex; flex-wrap: wrap; gap: 0.1rem 0.9rem; margin: 0.4rem 0 0; font-size: 0.875rem; line-height: 1.3; color: var(--mute); }
.legend li { display: flex; align-items: center; gap: 0.35rem; }
.legend .sw { display: inline-block; flex: none; width: 0.9rem; height: 0.9rem; border-radius: 2px; }
.sw.now { background: var(--indigo); }
.sw.add { background: var(--indigo-t); }
.note { margin: 0.35rem 0 0; padding: 0.25rem 0.5rem; border: 1px dashed var(--amber); border-radius: 0.4rem; background: rgba(251, 191, 36, 0.08); font-size: 0.875rem; line-height: 1.3; color: #fff; }
.tip[data-tone="cap"] { border-left-color: var(--indigo-t); }
@media (min-aspect-ratio: 21/20) { .tip { width: 30rem; } }

/* ---------- the plain tables, shown without script ---------- */
.plain { padding: 0.2rem 0; font-size: 0.95rem; }
.plain table { width: 100%; border-collapse: collapse; margin: 0.3rem 0 0.8rem; }
.plain caption { padding: 0.3rem 0; text-align: left; font-weight: 700; }
.plain th, .plain td { padding: 0.3rem 0.4rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.plain th { color: var(--mute); font-weight: 600; }
.plain p { margin: 0.3rem 0; }

/* ---------- very narrow screens: the title leaves the frame (it stays for screen readers) so the quarters fit ---------- */
@media (max-width: 329px) {
  h1 { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
  .stage { padding: 0.45rem 0.55rem 0.4rem; gap: 0.3rem; }
}
@media (max-width: 359px) {
  .bplot { --lab: 3.9rem; }
}

/* ---------- wide frame: A and C side by side, B across the full width, bars as columns ---------- */
@media (min-aspect-ratio: 21/20) {
  .chart { display: grid; grid-template-columns: 29.5fr 20.5fr; grid-template-areas: "pa pc" "pb pb"; gap: 0.5rem; }
  .pa { grid-area: pa; }
  .pc { grid-area: pc; }
  .pb { grid-area: pb; }
  .panel { border: 1px solid var(--line); border-radius: 0.6rem; background: #0d1a2d; padding: 0.4rem 0.6rem 0.45rem; }
  .ph { font-size: 0.95rem; }
  .pu { font-size: 0.85rem; }
  .pu.lw { display: block; }
  .tot { height: 1.5rem; margin-top: 0.3rem; font-size: 0.95rem; }
  .abar { height: 2.2rem; }
  .alabs { margin-top: 0.3rem; gap: 0.1rem; }
  .al { font-size: 0.85rem; }
  .crow { height: 1.9rem; margin-top: 0.35rem; }
  .seg.rise { font-size: 0.85rem; }

  .bplot { --lab: 2.9rem; --ph: 14.2rem; --tick: 0rem; padding: 0 0 0 var(--lab); margin-top: 0.2rem; }
  .baxis { left: var(--lab); right: 0; top: 0; bottom: auto; height: calc(var(--ph) - 2px); }
  .gl { top: auto; bottom: calc(var(--k) * 100%); left: 0; right: 0; width: auto; border-left: 0; border-top: 1px dashed var(--line2); }
  .tk, .tk:last-of-type { top: auto; left: auto; right: calc(100% + 0.35rem); bottom: calc(var(--k) * 100%); transform: translateY(50%); font-size: 0.85rem; }
  .bcols { flex-direction: row; }
  .qrow { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; height: auto; }
  .qlab { order: 2; width: 100%; margin-top: 0.3rem; padding: 0 0 0.1rem; text-align: center; font-size: 0.85rem; }
  .qbars { order: 1; width: 100%; height: var(--ph); flex-direction: column-reverse; justify-content: flex-start; align-items: center; border-left: 0; border-bottom: 2px solid var(--mute); }
  .qbars .seg { width: 2.6rem; height: calc(var(--w, 0) * 100%); }
  .seg.cap::after { inset: -0.5rem 0; }
  .seg.base .v { display: none; }
  .qval { display: block; position: absolute; left: 0; right: 0; bottom: calc(var(--e, 0) * 100% + 0.15rem); text-align: center; font-size: 0.85rem; font-weight: 700; line-height: 1.1; }
  .qd { left: 0; right: 0; top: auto; bottom: calc(var(--e, 0) * 100% + 1.4rem); transform: none; text-align: center; font-size: 0.85rem; }
  .legend { margin-top: 0.4rem; font-size: 0.85rem; }
  .note { margin-top: 0.35rem; font-size: 0.85rem; }
}
