/* ==========================================================================
   WebDesignStack shared styles (assets/site.css)
   Plain CSS. Light page, one dark accent surface (.night).

   CLASS INDEX

   Layout      .wrap  .section  .section--first  .stack  .row  .cols  .split
               .gap-s  .gap-m  .gap-l  .right  .sr-only
   Chrome      .skip-link  .strip  .site-header  .logo  .site-nav  .site-footer
               (all built by WDSUI.mountChrome, never by hand)
   Type        .display  .title  .h-section  .h-panel  .h-sub  .lede  .eyebrow
               .mono  .muted  .meta-row  .prompt-text (+ .quoted)  .nowrap  .num
               .status (+ --open)  .link-arrow
   Heads       .hero (+ __text, __actions, __art)  .page-head
               .section-head (+ __text)
   Controls    .btn (+ --solid / --primary)  .chips  .chip (+ __count)
               .controls  .control (+ __label)  .seg (+ __btn)
               .toolbar  .tabs  .tab (+ __count)  .stepper
   Surfaces    .panel (+ --pad)  .bar (+ __main, __side)  .notice  .note-row
               .more  .pager  .disclosure  .night  .sticky-bar
   Art         .figure (+ --dots, --grid, --night, --flush)  .fig-grid
               .fig-card (+ __title, __text)
               .art  .art-line  .art-soft  .art-dash  .art-flow  .art-node
               .art-accent  .art-accent-fill  .art-fill  .art-paper
               .art-text  .art-pulse
   Numbers     .stat-row  .stat (+ --sm, __num, __label)
   Runs        .run-list  .run-block (+ __id, __matrix, __facts, __links)
               .run-num (+ __pad)  .run-date  .run-matrix
   Outputs     .out-grid (+ --fixed)  .out-card  .badge  .frame  .flag
   Library     .lib  .lib-head  .lib-row  .lib__id/__title/__cat/__run
   Data        .table-wrap  .table (+ --mono)  .stats (+ __row)
               .tag (+ --ok, --flag, --fail)
   Long form   .prose  .code (+ --scroll, --lines)  .embed  .entry

   Inner page skeleton:
     <main id="main"><div class="wrap section--first">
       <header class="page-head"> .eyebrow / h1.title / .lede or .meta-row </header>
       <div class="gap-m"> ... </div>
     </div></main>

   Controls that hold a state use aria-pressed="true|false". The pressed look
   comes from that attribute, never from a class.

   Every control has the same states: rest, :hover, :active, :focus-visible,
   and :disabled where it can be disabled.

   Inside .night and .figure--night the colour tokens are redefined, so every
   component placed there (buttons, tags, tables, stat tiles, art, the run
   matrix) follows the dark surface without extra classes.
   ========================================================================== */

/* ---------- Tokens ------------------------------------------------------- */

:root {
  color-scheme: light;

  /* surfaces and text */
  --page: #fafafa;
  --paper: #ffffff;
  --ink: #111315;
  --body: #4a4f57;
  --muted: #6a7078;
  --faint: #8d9299;          /* disabled text */
  --line: #e7e8ea;
  --line-strong: #d6d8dc;
  --line-control: #c6c9ce;   /* control outlines */
  --wash: #f3f4f6;           /* hover, tracks */
  --press: #e8eaed;          /* held down */

  /* accent and states */
  --green: #18a058;
  --green-text: #0e7a41;
  --green-deep: #0a5f33;
  --amber: #a85b00;          /* deviation mark */
  --red: #c2362b;            /* failed mark */
  --focus: #0a5f33;
  --hatch: repeating-linear-gradient(135deg, #f3f4f6 0 6px, #fafafa 6px 12px);

  /* dark accent surface */
  --night: #0f1113;
  --night-paper: #15181b;
  --night-line: #262a2f;
  --night-text: #f3f4f5;
  --night-body: #c5c9cf;
  --night-muted: #8a9099;

  /* radii */
  --r-1: 6px;                /* tags, small controls */
  --r-2: 10px;               /* buttons, inputs, cards, output frames */
  --r-3: 14px;               /* panels, figures */
  --r-pill: 999px;           /* primary buttons, chips */

  --font-sans: "Geist", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --max: 1312px;             /* page max width (1248px of content) */
  --gutter: 32px;            /* page side padding */
  --pad: 24px;               /* panel and card inner padding */
  --section: 128px;          /* space above a section */
  --ease: 0.14s ease;        /* colour changes on hover and press */
  --art-stroke: 1.25px;      /* line weight of every illustration */

  /* Elevation. Each shadow stacks a contact edge, a tight key shadow and a soft ambient
     spread, so raised things read as lit from above rather than outlined. */
  --shadow-xs:                                       /* resting buttons, chips, badges */
    0 1px 0 rgba(17, 19, 21, 0.03),
    0 1px 2px rgba(17, 19, 21, 0.06);
  --shadow-sm:                                       /* panels, frames, cards at rest */
    0 1px 1px rgba(17, 19, 21, 0.03),
    0 2px 4px -1px rgba(17, 19, 21, 0.05),
    0 6px 16px -6px rgba(17, 19, 21, 0.08);
  --shadow-md:                                       /* cards and frames on hover */
    0 1px 2px rgba(17, 19, 21, 0.04),
    0 4px 8px -2px rgba(17, 19, 21, 0.07),
    0 14px 28px -10px rgba(17, 19, 21, 0.14);
  --shadow-thumb:                                    /* the selected segment or tab */
    0 0 0 0.5px rgba(17, 19, 21, 0.08),
    0 1px 1px rgba(17, 19, 21, 0.06),
    0 2px 4px -1px rgba(17, 19, 21, 0.08),
    0 6px 12px -6px rgba(17, 19, 21, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  --shadow-track:                                    /* the recessed track behind segments and tabs */
    inset 0 0 0 1px var(--line),
    inset 0 1px 2px rgba(17, 19, 21, 0.05);
  --shadow-ink:                                      /* ink pills: a lit top edge and a cast shadow */
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 -1px 0 rgba(0, 0, 0, 0.25),
    0 1px 2px rgba(17, 19, 21, 0.18),
    0 4px 10px -4px rgba(17, 19, 21, 0.32);
  --shadow-ink-hover:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -1px 0 rgba(0, 0, 0, 0.25),
    0 2px 4px rgba(17, 19, 21, 0.16),
    0 10px 20px -8px rgba(17, 19, 21, 0.38);
  --shadow-pressed: inset 0 1px 2px rgba(17, 19, 21, 0.12);   /* held down */
  --shadow-bar:                                      /* under sticky bars */
    0 1px 0 rgba(17, 19, 21, 0.04),
    0 8px 16px -12px rgba(17, 19, 21, 0.18),
    0 18px 32px -24px rgba(17, 19, 21, 0.22);
  --lift: translateY(-1px);                          /* hover lift of interactive cards */
}

@media (max-width: 640px) {
  :root {
    --gutter: 16px;
    --pad: 16px;
    --section: 80px;
  }
}

/* Dark surface: the same token names, dark values. */
.night, .figure--night {
  --page: var(--night);
  --paper: var(--night-paper);
  --ink: var(--night-text);
  --body: var(--night-body);
  --muted: var(--night-muted);
  --faint: #636971;
  --line: var(--night-line);
  --line-strong: #363b42;
  --line-control: #474d55;
  --wash: #1b1e22;
  --press: #272b30;
  --green-text: #4fd69a;
  --green-deep: #7be3b4;
  --amber: #f0a53a;
  --red: #f2726b;
  --focus: #7be3b4;
  --hatch: repeating-linear-gradient(135deg, #1b1e22 0 6px, #15181b 6px 12px);
  /* On a dark surface a shadow needs more weight, and a faint light edge on top does the lifting */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-sm:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 1px 2px rgba(0, 0, 0, 0.4),
    0 8px 20px -8px rgba(0, 0, 0, 0.6);
  --shadow-md:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 2px 4px rgba(0, 0, 0, 0.45),
    0 16px 32px -12px rgba(0, 0, 0, 0.7);
  --shadow-thumb:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 0 0 0.5px rgba(0, 0, 0, 0.6),
    0 2px 6px -1px rgba(0, 0, 0, 0.6);
  --shadow-track: inset 0 0 0 1px var(--line), inset 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-pressed: inset 0 1px 2px rgba(0, 0, 0, 0.5);
  color: var(--ink);
}

/* ---------- Base --------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}

main {
  display: block;
  flex: 1 0 auto;
  width: 100%;
  padding-bottom: var(--section);
}

h1, h2, h3, h4, p, figure { margin: 0; }
h1, h2, h3, h4 { font-weight: 500; }

a { color: var(--ink); text-decoration: none; transition: color var(--ease); }
a:hover { color: var(--green-text); }
a:active { color: var(--green-deep); }

button {
  font: inherit;
  color: inherit;
  border-radius: 0;
  -webkit-appearance: none;
  appearance: none;
}
button:not(:disabled) { cursor: pointer; }

img, svg, iframe { max-width: 100%; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
/* keep the ring above neighbouring segments in joined controls */
.seg__btn:focus-visible, .tab:focus-visible, .stepper__btn:focus-visible, .chip:focus-visible, .btn:focus-visible {
  position: relative;
  z-index: 2;
}

::selection { background: var(--ink); color: var(--paper); }

[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  :root { --lift: none; }
}

/* High-contrast modes drop shadows, so the selected segment or tab needs a real outline */
@media (forced-colors: active) {
  .seg__btn[aria-pressed="true"], .tab[aria-pressed="true"] { outline: 2px solid CanvasText; outline-offset: -2px; }
}

/* ---------- Layout ------------------------------------------------------- */

.wrap {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}

.section { padding-top: var(--section); }
.section--first { padding-top: clamp(48px, 6.4vw, 96px); }

.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; }

/* Equal columns that stack when narrow */
.cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 32px 64px;
}
/* Narrow side column + main column (stacks under 900px) */
.split {
  display: grid;
  grid-template-columns: minmax(0, 240px) minmax(0, 1fr);
  gap: 32px 64px;
  align-items: start;
}
@media (max-width: 900px) {
  .split { grid-template-columns: minmax(0, 1fr); }
}

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- Type --------------------------------------------------------- */

.mono { font-family: var(--font-mono); }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

/* Homepage headline */
.display {
  font-size: clamp(44px, 6.4vw, 88px);
  line-height: 0.98;
  letter-spacing: -0.04em;
  font-weight: 500;
}

/* Page title on inner pages */
.title {
  font-size: clamp(36px, 4.8vw, 64px);
  line-height: 1.02;
  letter-spacing: -0.038em;
  font-weight: 500;
  text-wrap: balance;
}

/* Section heading */
.h-section {
  font-size: clamp(30px, 3.8vw, 52px);
  line-height: 1.04;
  letter-spacing: -0.035em;
  font-weight: 500;
  text-wrap: balance;
}

/* Heading inside a panel (smaller than a section heading) */
.h-panel {
  font-size: clamp(24px, 2.6vw, 32px);
  line-height: 1.12;
  letter-spacing: -0.028em;
  font-weight: 500;
  text-wrap: balance;
}

/* Small heading (card titles, sub-sections) */
.h-sub {
  font-size: 18px;
  line-height: 1.3;
  letter-spacing: -0.012em;
  font-weight: 500;
}

.lede {
  font-size: clamp(18px, 1.45vw, 20px);
  line-height: 1.5;
  color: var(--body);
  max-width: 34em;
  text-wrap: pretty;
}

/* Small mono label above a heading, led by a square node like the ones in the illustrations */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
}
.eyebrow::before {
  content: "";
  flex: none;
  width: 7px; height: 7px;
  border: 1.25px solid var(--ink);
  background: var(--paper);
}

/* Row of mono facts: WDS-L-003 · Run 002 */
.meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.meta-row a { color: inherit; text-decoration: underline; text-decoration-color: var(--line-control); text-underline-offset: 3px; }
.meta-row a:hover { color: var(--green-text); }

/* State with a dot: solid = published, ring (--open) = in progress.
   Takes its size and colour from where it sits. */
.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  white-space: nowrap;
}
.status::before {
  content: "";
  flex: none;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green);
}
.status--open::before {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--green);
}

/* Verbatim prompt text. Add .quoted for typographic quotes that are not part
   of the text itself (so copying gives the prompt exactly). */
.prompt-text {
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.6;
  max-width: 780px;
  text-wrap: pretty;
}
.quoted::before { content: "\201C"; }
.quoted::after { content: "\201D"; }

/* Secondary action: a plain text link whose text ends in an arrow */
.link-arrow {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 15px;
  line-height: 1.3;
  font-weight: 500;
  white-space: nowrap;
}
.link-arrow:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }

/* ---------- Chrome ------------------------------------------------------- */

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -80px;
  z-index: 20;
  padding: 10px 16px;
  border-radius: var(--r-pill);
  background: var(--ink);
  color: var(--paper);
  font-size: 14px;
  font-weight: 500;
}
.skip-link:hover, .skip-link:focus { color: var(--paper); }
.skip-link:focus { top: 8px; }

/* Status strip: the latest run on the left, site counts on the right */
.strip {
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.strip__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px 24px;
  padding-block: 9px;
}
.strip__status {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  color: var(--ink);
  white-space: nowrap;
}
.strip__dot {
  flex: none;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green);
}
/* run still in progress: ring instead of a solid dot */
.strip__dot--open {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--green);
}
.strip__counts { white-space: nowrap; }

.site-header { border-bottom: 1px solid var(--line); }
.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 24px;
  padding-block: 18px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 17px;
  line-height: 1.2;
  letter-spacing: -0.015em;
}
.logo:hover { color: var(--ink); }
.logo__mark {
  display: grid;
  grid-template-columns: repeat(2, 7px);
  gap: 2px;
  flex: none;
}
.logo__mark span { width: 7px; height: 7px; border-radius: 1.5px; background: var(--ink); }
.logo__mark span:last-child { background: var(--green); }

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 28px;
  font-size: 14.5px;
  line-height: 1.4;
}
.site-nav a { margin-block: -8px; padding-block: 8px; color: var(--body); }      /* taller target, same header height */
.site-nav a:hover { color: var(--ink); }
.site-nav a[aria-current] { color: var(--ink); font-weight: 500; }

.site-footer {
  flex: none;
  border-top: 1px solid var(--line);
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}
.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px 24px;
  padding-block: 28px;
}
.site-footer__links { display: flex; flex-wrap: wrap; gap: 8px 28px; }
.site-footer__note { flex-basis: 100%; max-width: 72ch; margin: 0; font-size: 13px; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--ink); }

/* ---------- Heads -------------------------------------------------------- */

/* Homepage hero: text on the left, illustration on the right (stacks when narrow) */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.16fr) minmax(0, 1fr);
  gap: 40px clamp(32px, 4vw, 64px);
  align-items: center;
}
.hero__text { display: flex; flex-direction: column; align-items: flex-start; gap: 24px; min-width: 0; }
.hero__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 28px; }
.hero__art { min-width: 0; }
@media (max-width: 900px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
}

/* Inner page head: eyebrow / .title / lede or meta */
.page-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 18px;
  padding-bottom: clamp(32px, 4vw, 48px);
}
.page-head .lede { max-width: 38em; }

/* Section head: eyebrow + heading, optional controls on the right */
.section-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px 32px;
  padding-bottom: clamp(28px, 3.2vw, 44px);
}
.section-head__text { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; min-width: 0; }
.section-head__text .lede { margin-top: 2px; }

/* ---------- Controls ----------------------------------------------------- */

/* Buttons. Plain .btn is the small utility button (Copy, Wrap).
   .btn--solid (or .btn--primary) is the primary action: an ink pill. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-2);
  padding: 7px 14px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.3;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: var(--shadow-xs);
  transition: background-color var(--ease), border-color var(--ease), color var(--ease), box-shadow var(--ease), transform var(--ease);
}
.btn:hover { border-color: var(--ink); color: var(--ink); box-shadow: var(--shadow-sm); }
.btn:active { background: var(--press); color: var(--ink); box-shadow: var(--shadow-pressed); transform: translateY(0.5px); }
.btn[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--paper); box-shadow: var(--shadow-ink); }
.btn--solid, .btn--primary {
  min-height: 46px;
  border-color: var(--ink);
  border-radius: var(--r-pill);
  padding: 11px 22px;
  background: var(--ink) linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0) 60%);
  color: var(--paper);
  font-size: 15px;
  box-shadow: var(--shadow-ink);
}
.btn--solid:hover, .btn--primary:hover {
  border-color: var(--body);
  background-color: var(--body);
  color: var(--paper);
  box-shadow: var(--shadow-ink-hover);
  transform: var(--lift);
}
.btn--solid:active, .btn--primary:active {
  border-color: var(--ink);
  background-color: var(--ink);
  color: var(--paper);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.35);
  transform: translateY(0.5px);
}
.btn:disabled, .btn[aria-disabled="true"] {
  border-color: var(--line);
  background: transparent;
  color: var(--faint);
  box-shadow: none;
  transform: none;
}

/* Filter chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  padding: 7px 14px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.3;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: var(--shadow-xs);
  transition: background-color var(--ease), border-color var(--ease), color var(--ease), box-shadow var(--ease);
}
.chip:hover { border-color: var(--ink); box-shadow: var(--shadow-sm); }
.chip:active { background: var(--press); box-shadow: var(--shadow-pressed); }
.chip[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--paper); box-shadow: var(--shadow-ink); }
.chip:disabled { border-color: var(--line); background: transparent; color: var(--faint); box-shadow: none; }
/* count inside a chip (WDSUI.chips options[i].count) */
.chip__count {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  opacity: 0.86;
  font-variant-numeric: tabular-nums;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
}

/* A labelled control: label on the left, the control beside it */
.control { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.control__label {
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
  white-space: nowrap;
}

/* Segmented control: one rounded track, the pressed segment filled */
.seg {
  display: inline-flex;
  gap: 2px;
  border-radius: var(--r-2);
  padding: 3px;
  background: var(--wash);
  box-shadow: var(--shadow-track);
}
.seg__btn {
  min-height: 30px;
  border: 0;
  border-radius: 7px;
  padding: 5px 12px;
  background: transparent;
  color: var(--body);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.4;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  transition: background-color var(--ease), color var(--ease), box-shadow var(--ease);
}
.seg__btn:hover { color: var(--ink); background: var(--press); }
.seg__btn:active { background: var(--line-strong); }
/* the selected segment: a raised paper thumb on the recessed track */
.seg__btn[aria-pressed="true"] { background: var(--paper); color: var(--ink); box-shadow: var(--shadow-thumb); }
.seg__btn:disabled { background: transparent; color: var(--faint); box-shadow: none; }

/* Row that holds a tab track and whatever sits at its far end (a stepper) */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
}

/* Tabs: one rounded track, the pressed tab filled. Wraps to more rows when narrow. */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  border-radius: 12px;
  padding: 4px;
  background: var(--wash);
  box-shadow: var(--shadow-track);
}
.tab {
  flex: 1 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  border: 0;
  border-radius: 8px;
  padding: 7px 16px;
  background: transparent;
  color: var(--body);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.4;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color var(--ease), color var(--ease), box-shadow var(--ease);
}
.tab:hover { color: var(--ink); background: var(--press); }
.tab:active { background: var(--line-strong); }
.tab[aria-pressed="true"] { background: var(--paper); color: var(--ink); box-shadow: var(--shadow-thumb); }
.tab[aria-pressed="true"] .tab__count { color: var(--muted); }
.tab:disabled { background: transparent; color: var(--faint); box-shadow: none; }
.tab__count {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  opacity: 0.86;
  font-variant-numeric: tabular-nums;
}

/* Previous / "1 / 4" / next */
.stepper {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border-radius: 12px;
  padding: 4px;
  box-shadow: inset 0 0 0 1px var(--line-strong), var(--shadow-xs);
  background: var(--paper);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.4;
}
.stepper__btn {
  min-width: 36px;
  min-height: 36px;
  border: 0;
  border-radius: 8px;
  padding: 6px 10px;
  background: transparent;
  color: var(--ink);
  transition: background-color var(--ease), color var(--ease);
}
.stepper__btn:hover:not(:disabled) { background: var(--wash); }
.stepper__btn:active:not(:disabled) { background: var(--press); box-shadow: var(--shadow-pressed); }
.stepper__btn:disabled { color: var(--faint); }
.stepper__count {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  padding: 0 8px;
  color: var(--body);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ---------- Surfaces ----------------------------------------------------- */

/* Paper box with a hairline */
.panel {
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  background: var(--paper);
  box-shadow: var(--shadow-sm);
}
.panel--pad { padding: var(--pad); }

/* Text on the left, controls on the right (stacks when narrow) */
.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 20px 32px;
}
.bar__main {
  flex: 1 1 520px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.bar__side {
  flex: 0 1 auto;
  margin-left: auto;
  justify-content: flex-end;
}

/* Message box (unknown id, nothing to show) */
.notice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  padding: var(--pad);
  background: var(--paper);
  color: var(--body);
  box-shadow: var(--shadow-xs);
}

/* Line under a panel: a short note on the left, a link on the right */
.note-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px 24px;
  padding: 18px 0 0;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--muted);
}
.note-row > * { min-width: 0; }      /* a long unbroken word wraps inside its side */
.note-row a { font-weight: 500; }
.note-row span a, .note-row p a { font-weight: 400; color: inherit; text-decoration: underline; text-decoration-color: var(--line-control); text-underline-offset: 3px; }
.note-row span a:hover, .note-row p a:hover { color: var(--green-text); }

/* "See more" link row under a list */
.more {
  padding: 18px 0 0;
  font-size: 14.5px;
  line-height: 1.5;
  font-weight: 500;
}

/* Previous / next between pages: two cards side by side, one column on a phone.
   <nav class="pager"> W.pagerLink(...) W.pagerLink(...) </nav>   An empty <span> holds a missing side. */
.pager {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.pager__link {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  border-radius: var(--r-2);
  padding: 16px 20px 18px;
  background: var(--paper);
  box-shadow: inset 0 0 0 1px var(--line), var(--shadow-xs);
  transition: box-shadow var(--ease), background-color var(--ease), transform var(--ease);
}
.pager__link:hover { box-shadow: inset 0 0 0 1px var(--line-control), var(--shadow-md); transform: var(--lift); }
.pager__link:active { background: var(--wash); box-shadow: inset 0 0 0 1px var(--line-control), var(--shadow-pressed); transform: none; }
/* direction on the outer edge, the id on the inner one */
.pager__meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--muted);
}
.pager__dir { display: inline-flex; gap: 8px; white-space: nowrap; }
.pager__arrow { transition: transform var(--ease); }
.pager__link:hover .pager__arrow { transform: translateX(-3px); }
.pager__link--next:hover .pager__arrow { transform: translateX(3px); }
.pager__id { min-width: 0; overflow-wrap: anywhere; }
/* a long title breaks instead of widening the page */
.pager__title { font-size: 16px; line-height: 1.35; font-weight: 500; color: var(--ink); overflow-wrap: anywhere; }
.pager__link--next .pager__meta { flex-direction: row-reverse; }
.pager__link--next .pager__title { text-align: right; }
@media (max-width: 640px) {
  .pager { grid-template-columns: minmax(0, 1fr); }
  .pager > span:empty { display: none; }
}

/* Collapsed block: <details class="disclosure"><summary>Show the wrapper text</summary> ... </details> */
.disclosure > summary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  cursor: pointer;
  font-size: 14.5px;
  line-height: 1.4;
  font-weight: 500;
  list-style: none;
  transition: color var(--ease);
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary::before {
  content: "";
  flex: none;
  width: 7px; height: 7px;
  margin: 0 3px 2px 2px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  transition: transform var(--ease);
}
.disclosure[open] > summary::before { transform: rotate(45deg); }
.disclosure > summary:hover { color: var(--green-text); }
.disclosure > summary + * { margin-top: 12px; }

/* A bar that sticks to the top of the page */
.sticky-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--page);
  box-shadow: var(--shadow-bar);
}

/* Dark accent band, full width, plain. Put a .wrap inside it. */
.night {
  position: relative;
  isolation: isolate;
  margin-top: var(--section);
  padding-block: clamp(72px, 9vw, 128px);
  background: var(--night);
}
.night ::selection { background: var(--night-text); color: var(--night); }

/* ---------- Art: figure panels and line illustrations --------------------- */

/* The panel an illustration sits in */
.figure {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  padding: clamp(16px, 2.4vw, 28px);
  background: var(--paper);
  overflow: hidden;
}
.figure--flush { padding: 0; }
/* .figure--dots and .figure--grid are kept as names only: figure panels are plain. */
/* dark figure panel */
.figure--night { border-color: var(--night-line); background: var(--night); }

/* Illustration + title + one caption */
.fig-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(32px, 4vw, 56px) clamp(20px, 2.4vw, 32px);
}
@media (max-width: 960px) { .fig-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .fig-grid { grid-template-columns: minmax(0, 1fr); } }
.fig-card { display: flex; flex-direction: column; min-width: 0; }
.fig-card__title {
  margin-top: 20px;
  font-size: 18px;
  line-height: 1.3;
  letter-spacing: -0.012em;
  font-weight: 500;
}
.fig-card__text {
  margin-top: 6px;
  max-width: 34em;
  font-size: 15.5px;
  line-height: 1.5;
  color: var(--body);
  text-wrap: pretty;
}

/* Inline SVG illustration. Sized by its viewBox, coloured by the classes below.
   Strokes keep their weight at any size. */
.art {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  fill: none;
  stroke: none;
}
.art-line, .art-soft, .art-dash, .art-flow, .art-node, .art-accent {
  fill: none;
  stroke-width: var(--art-stroke);
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.art-line { stroke: var(--ink); stroke-opacity: 0.85; }          /* primary line */
.art-soft { stroke: var(--line-strong); }                        /* secondary line */
.art-dash { stroke: var(--line-control); stroke-dasharray: 2 4; }  /* dashed construction line */
.art-flow {                                                      /* dashes travelling along a connector */
  stroke: var(--ink);
  stroke-opacity: 0.85;
  stroke-dasharray: 3 9;
  animation: art-flow 2.4s linear infinite;
}
.art-node { fill: var(--paper); stroke: var(--ink); stroke-linejoin: miter; }   /* small square anchor node */
.art-accent { stroke: var(--green); stroke-opacity: 1; }         /* the one green line */
.art-accent-fill { fill: var(--green); stroke: none; }           /* the one green shape */
.art-fill { fill: var(--wash); }                                 /* quiet filled block */
.art-paper { fill: var(--paper); }                               /* paper fill, hides lines behind */
.art-text {                                                      /* small mono label */
  fill: var(--muted);
  stroke: none;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}
.art-pulse { animation: art-pulse 3.2s ease-in-out infinite; }     /* soft pulse, for one node */

@keyframes art-flow { to { stroke-dashoffset: -24; } }
@keyframes art-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) {
  .art-flow, .art-pulse { animation: none; }
}

/* ---------- Numbers: stat tiles ------------------------------------------- */

/* A row of big numbers, each hanging off a hairline */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 28px 0;
  margin: 0;
}
.stat {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  margin: 0;
  border-left: 1px solid var(--line);
  padding: 2px 16px 2px 20px;
}
.stat__num {
  order: 0;
  margin: 0;
  font-size: clamp(40px, 4.6vw, 64px);
  line-height: 1;
  letter-spacing: -0.045em;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.stat__label {
  order: 1;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
  white-space: nowrap;
}
/* compact tile: for facts inside a block */
.stat--sm { gap: 4px; padding: 2px 8px 2px 16px; }
.stat--sm .stat__num { font-size: clamp(26px, 2.6vw, 34px); letter-spacing: -0.035em; }
/* a value that is words, not a number (a date) */
.stat__num--text { font-size: clamp(24px, 2.4vw, 32px); letter-spacing: -0.03em; line-height: 1.2; }

/* ---------- Runs ---------------------------------------------------------- */

/* The run number, set very large. The padding zeros are dimmed. */
.run-num {
  margin: 0;
  font-size: clamp(96px, 13.5vw, 184px);
  line-height: 0.8;
  letter-spacing: -0.055em;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.run-num__pad { color: #8a8f96; }
.night .run-num__pad, .figure--night .run-num__pad { color: #646a72; }

/* Date of a run, with its state dot */
.run-date {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.4;
  color: var(--body);
  white-space: nowrap;
}
.run-date::before {
  content: "";
  flex: none;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green);
}
.run-date--open::before { background: transparent; box-shadow: inset 0 0 0 1.5px var(--green); }

/* One block per run: number and date, the matrix, the facts */
.run-list { list-style: none; margin: 0; padding: 0; }
.run-block {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 5fr) minmax(0, 2fr);
  gap: 40px 48px;
  align-items: end;
  padding-block: clamp(40px, 5vw, 64px);
  border-top: 1px solid var(--line);
}
.run-block:last-child { padding-bottom: 0; }
/* square anchor nodes where a block's rule meets the edges of the content */
.run-block { position: relative; }
.run-block::before, .run-block::after {
  content: "";
  position: absolute;
  top: -4px;
  width: 7px; height: 7px;
  border: 1.25px solid var(--muted);
  background: var(--page);
}
.run-block::before { left: -3px; }
.run-block::after { right: -3px; }
.run-block__id { display: flex; flex-direction: column; align-items: flex-start; gap: 28px; min-width: 0; }
.run-block .run-date { font-size: 17px; color: var(--ink); }           /* the date reads large inside a block */
.run-block__matrix { min-width: 0; }
.run-block__matrix .run-matrix { width: 100%; max-width: 480px; }    /* the matrix fills its column here */
.run-block__facts { display: grid; gap: 20px 0; margin: 0; }
.run-block__links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
  font-size: 15px;
  line-height: 1.4;
  font-weight: 500;
}
@media (max-width: 1040px) {
  .run-block { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .run-block__facts { grid-column: 1 / -1; grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .run-block { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .run-block__facts { grid-column: auto; }
}

/* Run matrix (built by WDSUI.runMatrix): one row per prompt, one column per model */
.run-matrix { display: block; max-width: 100%; height: auto; overflow: visible; }
.run-matrix text {
  fill: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.run-matrix .rm-head { fill: var(--body); }
.run-matrix .rm-cell { vector-effect: non-scaling-stroke; }
.run-matrix .rm-ok { fill: var(--ink); fill-opacity: 0.86; }
.run-matrix .rm-dev { fill: var(--amber); fill-opacity: 0.14; stroke: var(--amber); stroke-width: 1.25; }
.run-matrix .rm-pending { fill: none; stroke: var(--line-control); stroke-width: 1.25; stroke-dasharray: 2 3; }
.run-matrix .rm-failed { fill: none; stroke: var(--red); stroke-width: 1.25; }
.run-matrix .rm-none { fill: var(--line-strong); }
.run-matrix .rm-mark--dev { fill: var(--amber); }
.run-matrix .rm-mark--failed { fill: none; stroke: var(--red); stroke-width: 1.5; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.run-matrix .rm-hit { fill: transparent; }

/* ---------- Output grid, card, frame ------------------------------------- */

/* Grid of output cards. Default: as many 280px+ columns as fit.
   WDSUI.balanceGrid() or .out-grid--fixed + --cols pins the count. */
.out-grid {
  --col-min: 280px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--col-min)), 1fr));
  gap: 32px 20px;
}
.out-grid--fixed { grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); }
@media (max-width: 720px) {
  .out-grid--fixed { grid-template-columns: minmax(0, 1fr); }
}

.out-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.out-card__head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 4px 12px;
  min-height: 24px;
}
.out-card__id { display: flex; align-items: center; gap: 10px; min-width: 0; }
.out-card__name { font-size: 15px; line-height: 1.4; font-weight: 500; letter-spacing: -0.005em; }
.out-card__stats {
  margin-left: auto;            /* stays right-aligned if it has to drop under the name */
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.out-card__frame { min-width: 0; }
.out-card__links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  margin-top: auto;
  font-size: 13px;
  line-height: 1.5;
}
.out-card__links a { font-weight: 500; white-space: nowrap; }
.out-card__links .muted { font-weight: 400; }
.out-card__links > :last-child:not(:first-child) { margin-left: auto; }   /* "View source" keeps to the right edge */
.out-card__links a.muted:hover { color: var(--green-text); }

/* Letter badge: A, B, C */
.badge {
  flex: none;
  display: grid;
  place-items: center;
  width: 24px; height: 24px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-1);
  background: var(--paper);
  box-shadow: var(--shadow-xs), inset 0 -1px 0 var(--wash);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1;
  font-weight: 500;
}

/* Deviation flag: a small diamond before the word, the same mark the run matrix uses */
.flag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--amber);
}
.flag::before {
  content: "";
  flex: none;
  width: 7px; height: 7px;
  border-radius: 1px;
  background: currentColor;
  transform: rotate(45deg);
}
a.flag:hover { color: var(--amber); text-decoration: underline; text-underline-offset: 3px; }

/* The output frame (built only by WDSUI.outputFrame).
   .frame            rounded box, centred, max-width set inline, clips its content
   .frame__viewport  exact logical aspect ratio, clips the scaled iframe
   .frame__doc       the iframe at its logical size, scaled from the top left */
.frame {
  position: relative;
  display: block;
  width: 100%;
  margin-inline: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-2);
  background: var(--paper);
  overflow: hidden;
  overflow: clip;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--ease), box-shadow var(--ease), transform var(--ease);
}
.frame__viewport {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1440 / 900;
  overflow: hidden;
  overflow: clip;
  background: var(--hatch);
}
.frame__doc {
  position: absolute;
  top: 0; left: 0;
  display: block;
  max-width: none;
  border: 0;
  background: #fff;             /* what a browser tab shows behind a page */
  transform-origin: 0 0;
  transition: opacity 0.2s ease-out;
}
.frame--preview .frame__doc { pointer-events: none; }
/* Loading: the hatch shows until the file has loaded, then the page fades in over it.
   data-loading is set and removed by WDSUI.outputFrame. The box never changes size. */
.frame[data-loading] .frame__doc { opacity: 0; }
.frame__label--loading { opacity: 0; animation: frame-label-in 0.2s ease-out 0.4s forwards; }   /* only if loading takes a moment */
@keyframes frame-label-in { to { opacity: 1; } }
.frame__label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 8px;
}
.frame__label span {
  border-radius: var(--r-1);
  padding: 4px 9px;
  background: var(--paper);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
}
/* Caption on the frame's lower edge: logical viewport on the left, scale on the right */
.frame__caption {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0 12px;
  min-height: 28px;
  padding: 6px 10px;
  border-top: 1px solid var(--line);
  background: var(--paper);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.frame__caption:focus { outline: 2px solid var(--ink); outline-offset: -2px; }
/* The interactive frame that holds keyboard focus (data-focus is set by WDSUI: CSS cannot see
   focus inside an iframe) */
.frame[data-focus] { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink), var(--shadow-md); }
.frame[data-focus] .frame__caption { color: var(--ink); }
/* Whole-frame link laid over a preview */
.frame__hit { position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.frame__hit:focus-visible { outline-offset: -2px; }
.frame--link:hover { border-color: var(--ink); box-shadow: var(--shadow-md); transform: var(--lift); }
.frame--link:active { box-shadow: 0 0 0 1px var(--ink), var(--shadow-xs); transform: none; }
/* Keyboard users can step over a live output instead of tabbing through everything inside it */
.frame__skip {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  border: 0;
  border-radius: var(--r-pill);
  padding: 8px 14px;
  background: var(--ink);
  color: var(--paper);
  font-size: 13px;
  line-height: 1.4;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
}
.frame__skip:focus, .frame__skip:focus-visible { opacity: 1; pointer-events: auto; }
.frame__after { position: absolute; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Library rows ------------------------------------------------- */

/* One linked row per prompt: id, title, category, run */
.lib { display: block; }
.lib__list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.lib-head, .lib-row {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) 152px;
  gap: 4px 24px;
  align-items: baseline;
}
.lib--run .lib-head, .lib--run .lib-row { grid-template-columns: 112px minmax(0, 1fr) 152px 76px; }
.lib-head {
  padding: 0 0 12px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--muted);
}
.lib-row {
  position: relative;
  isolation: isolate;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
/* The hover wash reaches 12px into the gutter on both sides. The rules stay where they are. */
.lib-row::before {
  content: "";
  position: absolute;
  inset: 0 -12px;
  z-index: -1;
  background: var(--wash);
  opacity: 0;
  transition: opacity var(--ease), background-color var(--ease);
}
.lib-row:hover::before, .lib-row:focus-visible::before { opacity: 1; }
.lib-row:active::before { opacity: 1; background: var(--press); }
.lib-row:hover, .lib-row:active { color: var(--ink); }
.lib-row:focus-visible { outline-offset: -2px; }
.lib-row .lib__id, .lib-row .lib__cat, .lib-row .lib__run {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.lib-row .lib__title { font-size: 16.5px; line-height: 1.4; font-weight: 500; letter-spacing: -0.008em; }
.lib-row .lib__run { color: var(--ink); white-space: nowrap; }
.lib__run { text-align: right; }
.lib__empty {
  padding: 18px 0;
  border-block: 1px solid var(--line);
  font-size: 14.5px;
  color: var(--muted);
}

@media (max-width: 720px) {
  .lib-head { display: none; }
  .lib-row, .lib--run .lib-row { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; padding: 16px 0; }
  .lib__id { grid-area: 1 / 1; }
  .lib__run { grid-area: 1 / 2; }
  .lib__title { grid-area: 2 / 1 / 3 / 3; }
  .lib__cat { grid-area: 3 / 1 / 4 / 3; }
}

/* ---------- Tables and stat lists ---------------------------------------- */

/* Wrap any table that may be wider than a phone */
.table-wrap { position: relative; overflow-x: auto; -webkit-overflow-scrolling: touch; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
  line-height: 1.5;
  text-align: left;
}
.table th, .table td {
  padding: 13px 24px 13px 0;
  border-bottom: 1px solid var(--line);
  vertical-align: baseline;      /* cells of different type sizes share the first line's baseline */
}
.table th:last-child, .table td:last-child { padding-right: 0; }
.table thead th {
  padding-block: 0 10px;
  border-bottom-color: var(--line-strong);
  vertical-align: bottom;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.4;
  font-weight: 400;
  color: var(--muted);
}
.table tbody th { font-weight: 500; white-space: nowrap; }
.table td { color: var(--body); }
.table .num, .table--mono td, .table--mono tbody th {
  font-family: var(--font-mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.table .num { color: var(--ink); white-space: nowrap; }
.table--mono tbody th { font-weight: 400; color: var(--muted); }
.table caption {
  caption-side: bottom;
  padding-top: 12px;
  text-align: left;
  font-size: 13.5px;
  color: var(--muted);
}

/* Label / value list: <dl class="stats"><div class="stats__row"><dt><dd></div></dl> */
.stats {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
}
.stats__row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.stats__row:last-child { border-bottom: 0; }
.stats dt { flex: none; color: var(--muted); }
.stats dd {
  margin: 0;
  min-width: 0;
  text-align: right;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

/* Small mono label: status, category, run */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-1);
  padding: 2px 7px;
  background: var(--paper);
  color: var(--body);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.45;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.tag--ok::before, .tag--flag::before, .tag--fail::before { content: ""; flex: none; width: 6px; height: 6px; background: currentColor; }
.tag--ok { color: var(--green-text); }
.tag--ok::before { border-radius: 50%; }
.tag--flag { color: var(--amber); }
.tag--flag::before { border-radius: 1px; transform: rotate(45deg); }
.tag--fail { color: var(--red); }

/* ---------- Long form ---------------------------------------------------- */

.prose {
  max-width: 720px;
  font-size: 16px;
  line-height: 1.65;
  color: var(--body);
}
.prose > * + * { margin-top: 1em; }
.prose h2 {
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-size: clamp(22px, 2.4vw, 28px);
  line-height: 1.15;
  letter-spacing: -0.025em;
  font-weight: 500;
}
.prose > h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.prose h3 {
  margin-top: 32px;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.3;
  font-weight: 500;
}
.prose a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--line-control);
  text-underline-offset: 3px;
}
.prose strong { color: var(--ink); font-weight: 500; }
.prose ul, .prose ol { margin-bottom: 0; padding-left: 1.25em; }
.prose li + li { margin-top: 0.4em; }
.prose code {
  border-radius: 4px;
  padding: 1px 5px;
  background: var(--wash);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.875em;
}
.prose dl { margin-bottom: 0; }
.prose dt {
  margin-top: 24px;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 13px;
}
.prose dd { margin: 6px 0 0; }
.prose .table, .prose .code { color: var(--ink); }
.prose .table-wrap, .prose .code { margin-top: 20px; }

/* Verbatim block (wrapper text, source). Wraps by default. */
.code {
  display: block;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  padding: 20px var(--pad);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  tab-size: 2;
}
/* no wrapping, scroll sideways inside the block */
.code--scroll { white-space: pre; overflow-wrap: normal; overflow-x: auto; }
/* numbered lines: one child element per source line */
.code--lines { counter-reset: line; padding-left: 0; }
.code--lines > * {
  display: block;
  counter-increment: line;
  min-height: 1.6em;
  padding-left: 72px;
  text-indent: 0;
  position: relative;
}
.code--lines > *::before {
  content: counter(line);
  position: absolute;
  left: 0;
  width: 56px;
  text-align: right;
  color: var(--muted);
  opacity: 0.7;
  -webkit-user-select: none;
  user-select: none;
}

/* Plain bordered iframe (the .txt source fallback) */
.embed {
  display: block;
  width: 100%;
  height: 70vh;
  min-height: 320px;
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  background: var(--paper);
}

/* Prompt entry: meta column + body column */
.entry {
  display: grid;
  grid-template-columns: minmax(0, 220px) minmax(0, 1fr);
  gap: 16px 32px;
  padding: 28px 0;
  border-bottom: 1px solid var(--line);
}
.entry__meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}
.entry__body { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.entry__title { font-size: 20px; line-height: 1.25; letter-spacing: -0.015em; font-weight: 500; }
.entry__foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  font-size: 14px;
  line-height: 1.5;
}
@media (max-width: 720px) {
  .entry { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .entry__meta { flex-direction: row; flex-wrap: wrap; gap: 4px 16px; }
}

/* ---------- Narrow screens ----------------------------------------------- */

@media (max-width: 900px) {
  /* .bar has wrapped by now: controls sit under the text, left aligned */
  .bar__side { margin-left: 0; justify-content: flex-start; }
}

@media (max-width: 640px) {
  .strip { font-size: 12px; }
  .strip__inner { column-gap: 12px; }
  .site-header__inner { padding-block: 14px; }
  .site-nav { column-gap: 20px; }
  /* phone tab track: two even columns */
  .toolbar > .tabs { flex: 1 1 100%; }
  .tab { flex: 1 1 calc(50% - 2px); justify-content: space-between; padding-inline: 14px; }
  .toolbar > .stepper { flex: 1 1 100%; justify-content: space-between; }
  .prompt-text { font-size: 14px; }
  .code { font-size: 12.5px; }
  .code--lines > * { padding-left: 52px; }
  .code--lines > *::before { width: 40px; }
  .stat { padding-left: 16px; }
}
@media (max-width: 480px) {
  /* the strip keeps to one line: the first count steps aside */
  .strip__opt { display: none; }
}

/* ---------- Utilities (last, so they win over component margins) ---------- */

/* Vertical rhythm between blocks inside a page */
.gap-s { margin-top: 16px; }
.gap-m { margin-top: 32px; }
.gap-l { margin-top: 64px; }

.right { text-align: right; }
