/* 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. The 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. Four panels on one DOM: the weights against a machine's memory, one
   sequence's cache against the memory left, the bytes one token reads, and the decode ceiling. On the tall frame three tabs show
   them in turn; on the wide frame all four are on screen in two columns.
   Bars are real buttons sized by custom properties the engine sets (--x and --w are fractions of the track).
   Bars start at zero: the zero line is drawn. Two series colours: cyan for weights, orange for cache. Rose marks what does not fit. */
:root { --c-w: #06b6d4; --c-bfp: #94a3b8; --c-ca: #fb923c; --c-ce: #8da3c7; --c-over: #fb7185; --pbg: #0b1726; --lab: 0rem; --bh: 1.3rem; }
.tip { bottom: auto; }
@media not all and (min-aspect-ratio: 21/20) { .tip { max-height: 80%; } }

/* ---------- controls ---------- */
.pick { display: flex; flex-direction: column; gap: 0.4rem; flex: none; }
.prow2 { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.pl { font-size: 0.875rem; line-height: 1.2; color: var(--mute); }
.pgroup { display: grid; gap: 0.35rem; min-width: 0; }
.mgroup { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fgroup { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pbtn { min-width: 0; padding: 0 0.3rem; line-height: 1.15; }
.pbtn[aria-pressed="true"], .vbtn[aria-pressed="true"] { background: var(--indigo); border-color: #fff; color: #fff; }
.frow { gap: 0.4rem; }
.frow .scrub { margin-top: 0.05rem; }
.tabs { display: flex; gap: 0.35rem; flex: none; }
.vbtn { flex: 1 1 0; min-width: 0; padding: 0 0.3rem; }

/* ---------- panels ---------- */
.chart { display: flex; flex-direction: column; gap: 0.4rem; flex: none; }
.col { display: contents; }
.panel { border-top: 1px solid var(--line2); padding: 0.3rem 0 0; min-width: 0; }
.ph { margin: 0; font-size: 1rem; line-height: 1.2; font-weight: 700; }
.pu { margin: 0.05rem 0 0; font-size: 0.875rem; line-height: 1.3; color: var(--mute); }
.cap { margin: 0.3rem 0 0; font-size: 0.875rem; line-height: 1.3; color: #fff; }
.key { display: flex; flex-wrap: wrap; gap: 0 0.8rem; margin-top: 0.05rem; font-size: 0.875rem; line-height: 1.3; color: var(--mute); }
.key li { display: flex; align-items: center; gap: 0.3rem; }
.sw { display: inline-block; flex: none; width: 0.85rem; height: 0.85rem; border-radius: 2px; }
.sw.w { background: var(--c-w); }
.sw.bfp { background: var(--c-bfp); }
.sw.ca { background: var(--c-ca); }
.sw.cp { background: repeating-linear-gradient(135deg, var(--c-ca) 0 3px, rgba(251, 146, 60, 0.38) 3px 6px); border: 1px solid var(--c-ca); }
.stage[data-view="fit"] .vreads, .stage[data-view="fit"] .vspeed,
.stage[data-view="reads"] .vfit, .stage[data-view="reads"] .vspeed,
.stage[data-view="speed"] .vfit, .stage[data-view="speed"] .vreads { display: none; }

/* ---------- axis, rows and bars ---------- */
.ticks { position: relative; height: 1.15rem; margin: 0.15rem 0 0 var(--lab); }
.tk { position: absolute; top: 0; left: calc(var(--k, 0) * 100%); transform: translateX(-50%); font-size: 0.875rem; line-height: 1.2; color: var(--mute); white-space: nowrap; }
.tk.end { transform: translateX(-100%); }
.tk[hidden], .gl[hidden], .row[hidden], .dnote[hidden] { display: none; }
.row { display: block; margin-top: 0.25rem; }
.rl { display: flex; justify-content: space-between; gap: 0.5rem; font-size: 0.875rem; line-height: 1.2; }
.rn { font-weight: 600; }
.rs { color: var(--mute); text-align: right; }
.track { position: relative; height: var(--bh); margin-top: 0.1rem; }
.gl { position: absolute; top: -0.15rem; bottom: -0.15rem; left: calc(var(--k, 0) * 100%); width: 0; border-left: 1px dashed var(--line2); pointer-events: none; }
.gl.zero { border-left: 2px solid var(--mute); }
.seg { position: absolute; top: 0; left: calc(var(--x, 0) * 100%); width: calc(var(--w, 0) * 100%); height: 100%; margin: 0; padding: 0; border: 0; border-radius: 0; background: var(--c-w); text-align: left; z-index: 1; }
.seg::after { content: ""; position: absolute; inset: -0.3rem -0.5rem; }
.seg:hover, .seg.pin { box-shadow: 0 0 0 2px #fff; z-index: 3; }
.seg.bfp { background: var(--c-bfp); }
.seg.bfp::after { inset: -0.3rem -0.5rem -0.3rem 0; }
.seg.ca { background: var(--c-ca); }
.seg.cp { --hc: var(--c-ca); background: repeating-linear-gradient(135deg, var(--hc) 0 4px, rgba(251, 146, 60, 0.38) 4px 8px); border: 1px solid var(--hc); }
.seg.ce { background: var(--c-ce); }
.seg.ce.cp { --hc: var(--c-ce); background: repeating-linear-gradient(135deg, var(--hc) 0 4px, rgba(141, 163, 199, 0.4) 4px 8px); }
.seg.free { background: rgba(199, 215, 240, 0.16); border: 1px dashed #c7d7f0; }
.seg.mem { background: rgba(199, 215, 240, 0.28); border: 1px solid #c7d7f0; }
.seg.ghost { background: transparent; border: 2px dashed #fff; }
.seg.dim { background: #0b6677; }
.seg.dim.bfp { background: #6b7a8f; }
.ex { display: none; position: absolute; top: 0; bottom: 0; left: calc(var(--cut, 1) * 100%); right: 0; background: repeating-linear-gradient(135deg, rgba(251, 113, 133, 0.97) 0 4px, rgba(251, 113, 133, 0.5) 4px 8px); pointer-events: none; }
.seg.over > .ex { display: block; }
.vl { position: absolute; top: 50%; transform: translateY(-50%); left: calc(var(--e, 0) * 100% + 0.25rem); padding: 0.12rem 0.25rem; border-radius: 0.2rem; background: rgba(11, 23, 38, 0.88); font-size: 0.875rem; font-weight: 700; line-height: 1; white-space: nowrap; color: #fff; pointer-events: none; z-index: 5; }
.vl.in { left: 0.2rem; }
.lim { position: absolute; top: 0; bottom: 0; left: calc(var(--k, 0) * 100%); width: 0; border-left: 2px dashed #fff; z-index: 3; pointer-events: none; }
.dnote { margin: 0.4rem 0 0; font-size: 0.875rem; line-height: 1.3; font-weight: 700; color: var(--c-over); }
.tip[data-tone="amber"] { border-left-color: var(--c-ca); }

h1 { font-size: 1.05rem; }

/* ---------- 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; }
html:not(.js) .pick, html:not(.js) .tabs { display: none; }

/* ---------- very narrow screens: the title leaves the frame (it stays for screen readers) so the panels 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; }
  .pbtn, .vbtn { padding: 0 0.2rem; }
}

/* ---------- wide frame: 53rem by 42.4rem composition, two columns ---------- */
@media (min-aspect-ratio: 21/20) {
  :root { --lab: 9rem; --bh: 1.1rem; }
  .src, .tipping .src, .btn, .tk-close, .tip, .scrub-l, .when { font-size: 0.875rem; }
  h1 { font-size: 1.2rem; }
  .tabs { display: none; }
  .pick { gap: 0.3rem; }
  .prow2 { flex-direction: row; align-items: center; gap: 0.6rem; }
  .pl { width: 4.2rem; flex: none; }
  .mgroup { flex: 1; display: flex; gap: 0.35rem; }
  .mgroup .pbtn { flex: 1 1 auto; padding: 0 0.5rem; }
  .fgroup { flex: none; width: 11rem; }
  .frow { gap: 0.6rem; }
  .frow .scrub { flex: 1; margin: 0; grid-template-columns: auto minmax(0, 16rem) 1fr; }
  .chart { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0.5rem; align-items: start; }
  .col { display: flex; flex-direction: column; gap: 0.5rem; min-width: 0; }
  .panel { border: 1px solid var(--line); border-radius: 0.6rem; background: #0d1a2d; padding: 0.35rem 0.6rem 0.45rem; }
  .stage[data-view] .panel { display: block; }
  .ph { font-size: 0.95rem; }
  .row { display: grid; grid-template-columns: var(--lab) minmax(0, 1fr); align-items: center; min-height: 1.7rem; margin-top: 0.15rem; }
  .row.two { min-height: 2.15rem; }
  .rl { flex-direction: column; justify-content: center; gap: 0; padding-right: 0.3rem; }
  .rs { text-align: left; }
  .track { margin-top: 0; }
  .ticks { margin-top: 0.1rem; }
  .cap { margin-top: 0.25rem; }
  .tip { width: 26rem; }
}
