/* Newsprint: base styles and components shared by every application. Load tokens.css first.
   Source of truth: packages/ui/newsprint.css. Applications hold a copy made by scripts/sync-ui.sh; edit this file, not the copy.

   Everything sits in the `newsprint` cascade layer, so any unlayered rule in an application's own stylesheet wins
   regardless of specificity. An application overrides a component by restyling it, never by fighting selectors.
   Every component is drawn in the gallery (gallery/index.html, `npm run preview`). */

@layer newsprint {
  /* Each face is split so a page downloads only the characters it shows: Latin (with the arrows, ticks and stars the
     applications print) and the rest. scripts/build-fonts.py makes the files; keep these ranges in step with it. */
  @font-face { font-family: 'Playfair Display'; font-style: normal; font-weight: 400; font-display: swap; src: url('fonts/playfair-400-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2190-21FF, U+2212, U+2215, U+25A0-25FF, U+2600-27BF, U+FEFF, U+FFFD; }
  @font-face { font-family: 'Playfair Display'; font-style: normal; font-weight: 400; font-display: swap; src: url('fonts/playfair-400-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
  @font-face { font-family: 'Playfair Display'; font-style: normal; font-weight: 700; font-display: swap; src: url('fonts/playfair-700-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2190-21FF, U+2212, U+2215, U+25A0-25FF, U+2600-27BF, U+FEFF, U+FFFD; }
  @font-face { font-family: 'Playfair Display'; font-style: normal; font-weight: 700; font-display: swap; src: url('fonts/playfair-700-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
  @font-face { font-family: 'Playfair Display'; font-style: italic; font-weight: 400; font-display: swap; src: url('fonts/playfair-400-italic-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2190-21FF, U+2212, U+2215, U+25A0-25FF, U+2600-27BF, U+FEFF, U+FFFD; }
  @font-face { font-family: 'Playfair Display'; font-style: italic; font-weight: 400; font-display: swap; src: url('fonts/playfair-400-italic-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
  @font-face { font-family: 'Space Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url('fonts/space-mono-400-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2190-21FF, U+2212, U+2215, U+25A0-25FF, U+2600-27BF, U+FEFF, U+FFFD; }
  @font-face { font-family: 'Space Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url('fonts/space-mono-400-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
  @font-face { font-family: 'Space Mono'; font-style: normal; font-weight: 700; font-display: swap; src: url('fonts/space-mono-700-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2190-21FF, U+2212, U+2215, U+25A0-25FF, U+2600-27BF, U+FEFF, U+FFFD; }
  @font-face { font-family: 'Space Mono'; font-style: normal; font-weight: 700; font-display: swap; src: url('fonts/space-mono-700-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

  /* ---------- Editions. The day edition unless the page asks otherwise: data-theme="auto" on <html> follows the
     reader's system setting; data-theme="dark" or "light" on any element fixes that element and everything in it. */

  :root { color-scheme: light; }
  :root[data-theme='auto'] { color-scheme: light dark; }
  [data-theme='dark'] { color-scheme: dark; }
  [data-theme='light'] { color-scheme: light; }

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

  *, *::before, *::after { box-sizing: border-box; }
  [hidden] { display: none !important; }
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  body {
    margin: 0;
    min-width: 320px;
    background:
      linear-gradient(var(--grid-line) 1px, transparent 1px),
      linear-gradient(90deg, var(--grid-line) 1px, transparent 1px),
      var(--paper);
    background-size: 32px 32px;
    color: var(--ink);
    font-family: var(--serif);
    line-height: 1.5;
    /* Playfair defaults to old-style figures; quantities, dates and amounts read better lining. */
    font-variant-numeric: lining-nums;
  }
  /* Paper grain. A file rather than a data: URL, so it loads under img-src 'self'. */
  body::before {
    content: ''; position: fixed; inset: 0; pointer-events: none; z-index: var(--z-grain);
    opacity: 0.22; mix-blend-mode: multiply; background-image: url('noise.svg');
  }
  ::selection { background: var(--acid); color: var(--on-bright); }

  a { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 1px; }
  a:hover { text-decoration-thickness: 2px; }
  h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: var(--leading-snug); text-wrap: balance; }
  h1 { font-size: var(--text-display); line-height: var(--leading-tight); letter-spacing: -0.05em; margin: 0 0 0.6rem; overflow-wrap: anywhere; }
  h2 { font-size: var(--text-xl); margin: 1.6rem 0 0.6rem; }
  h3 { font-size: var(--text-lg); margin: 1rem 0 0.4rem; }
  /* Reading text stops at a comfortable line length and avoids a lone last word. */
  p, li, dd, blockquote { text-wrap: pretty; }
  p, blockquote { max-width: var(--measure); }
  img, video { max-width: 100%; height: auto; }
  code, kbd, pre, samp { font-family: var(--mono); }
  :not(pre) > code { font-size: 0.875em; background: var(--paper-deep); padding: 0.05em 0.3em; }
  pre { font-size: var(--text-sm); line-height: 1.6; padding: var(--space-3); background: var(--paper-deep); overflow: auto; white-space: pre-wrap; word-break: break-word; }
  kbd { display: inline-block; font-size: var(--text-label); line-height: 1.4; padding: 0 0.4em; border: 1px solid var(--line-strong); border-bottom-width: 2px; background: var(--surface); }
  blockquote { border-left: 3px solid var(--teal); margin: 0.8rem 0; padding-left: 0.8rem; }
  hr { border: 0; border-top: 1px solid var(--line-strong); }
  details > summary { cursor: pointer; font-family: var(--mono); font-size: var(--text-control); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }

  :focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; }

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

  button, input, textarea, select { font: inherit; color: inherit; border-radius: 0; }
  button, .button {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.4em; min-height: var(--control-height);
    cursor: pointer; background: var(--paper); color: var(--ink); border: 1px solid var(--ink); padding: 0.45rem 0.8rem;
    font: var(--text-control)/1.3 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; text-decoration: none;
    touch-action: manipulation; -webkit-tap-highlight-color: transparent;
    transition: background-color var(--duration-fast) var(--ease), color var(--duration-fast) var(--ease), border-color var(--duration-fast) var(--ease);
  }
  button:hover, .button:hover { background: var(--paper-deep); }
  /* A press nudges the button into the page, the way a printed key would move. */
  button:active:not(:disabled), .button:active { translate: 1px 1px; }
  button:disabled, .button[aria-disabled='true'] { opacity: 0.5; cursor: not-allowed; }
  .primary, button.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
  .primary:hover, button.primary:hover { background: var(--teal-ink); border-color: var(--teal-ink); }
  .accent, button.accent { background: var(--acid); color: var(--on-bright); border-color: var(--on-bright); }
  .accent:hover, button.accent:hover { background: var(--acid-deep); }
  .danger, button.danger { background: var(--bad); color: var(--paper); border-color: var(--bad); }
  .danger:hover, button.danger:hover { background: var(--bad-deep); border-color: var(--bad-deep); }
  /* A destructive action that is not the main one on its screen. */
  .danger.quiet, button.danger.quiet { background: transparent; color: var(--bad); }
  .danger.quiet:hover, button.danger.quiet:hover { background: var(--bad-soft); color: var(--bad); border-color: var(--bad); }
  /* A button that reads as a link: actions inside running text or a list row. */
  .link-button, button.link-button {
    min-height: 0; padding: 0.2rem 0; border: 0; background: transparent; color: var(--muted);
    text-decoration: underline; text-underline-offset: 3px;
  }
  .link-button:hover, button.link-button:hover { background: transparent; color: var(--ink); }

  label { display: grid; gap: 0.35rem; font: var(--text-label)/1.4 var(--mono); letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--muted); }
  input, textarea, select {
    width: 100%; min-width: 0; min-height: var(--control-height); background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); padding: 0.55rem 0.7rem;
    font-family: var(--serif); font-size: var(--text-md); line-height: 1.4; letter-spacing: normal; text-transform: none; font-variant-numeric: lining-nums;
  }
  textarea { font-family: var(--serif-text); font-size: var(--text-reading); line-height: var(--leading-body); }
  input:focus-visible, textarea:focus-visible, select:focus-visible { outline-offset: 0; border-color: var(--ink); }
  ::placeholder { color: var(--muted); opacity: 1; }
  input:disabled, textarea:disabled, select:disabled { background: var(--paper-deep); color: var(--muted); cursor: not-allowed; }
  /* A field the person has left invalid (after they touch it, not on page load), or one the page marks invalid. */
  input:user-invalid, textarea:user-invalid, select:user-invalid, [aria-invalid='true'] { border-color: var(--bad); box-shadow: inset 0 0 0 1px var(--bad); }
  input[type='checkbox'], input[type='radio'] { width: 1.125rem; height: 1.125rem; min-height: 0; flex: none; margin: 0; padding: 0; accent-color: var(--ink); }
  /* A label wrapping a checkbox or radio is a choice, read as text beside its box, not a field caption. */
  label:has(> input[type='checkbox'], > input[type='radio']) {
    display: flex; align-items: center; gap: 0.5rem;
    font: inherit; letter-spacing: normal; text-transform: none; color: var(--ink);
  }
  input[type='file'] { font-family: var(--mono); font-size: var(--text-control); }
  textarea { min-height: 5.5rem; resize: vertical; }
  /* Help under a field, and the message when it is refused. */
  .hint { margin: 0; font-size: var(--text-sm); line-height: 1.45; color: var(--muted); }
  .error { color: var(--bad); }

  /* Touch screens get 44px targets. */
  @media (pointer: coarse) {
    :root { --control-height: 2.75rem; }
    .link-button, button.link-button { min-height: var(--control-height); }
    input[type='checkbox'], input[type='radio'] { width: 1.35rem; height: 1.35rem; }
  }

  /* ---------- Page frame */

  .shell { width: min(100%, 1600px); margin: 0 auto; padding: max(1rem, env(safe-area-inset-top)) clamp(0.75rem, 3vw, 3rem) 3rem; }
  .masthead {
    display: flex; justify-content: space-between; align-items: center; gap: 0.5rem 1rem; flex-wrap: wrap;
    border-top: 4px solid var(--ink); border-bottom: 1px solid var(--line-strong); padding: 0.65rem 0;
    font: 700 var(--text-control)/1.5 var(--mono); letter-spacing: 0.06em; text-transform: uppercase;
  }
  /* 24px tall at least, the WCAG 2.2 target size, so wrapped links on a phone stay separately tappable. */
  .masthead a { display: inline-flex; align-items: center; gap: 0.3rem; min-height: 1.5rem; text-decoration: none; }
  .masthead a:hover { text-decoration: underline; }
  .masthead nav { display: flex; gap: 0.25rem 1rem; align-items: center; flex-wrap: wrap; }
  .masthead nav a[aria-current='page'], .masthead nav a.on { background: var(--ink); color: var(--paper); padding: 0 0.3rem; }
  .masthead .who { color: var(--coral-ink); }
  .title-row { display: flex; justify-content: space-between; align-items: end; gap: 1rem; flex-wrap: wrap; padding: 1.2rem 0 1rem; }
  .title-row h1 { margin: 0; }
  /* The first link on the page, shown only when a keyboard reaches it, so the masthead can be skipped. */
  .skip-link { position: absolute; left: var(--space-3); top: var(--space-3); z-index: var(--z-banner); background: var(--ink); color: var(--paper); padding: var(--space-2) var(--space-3); font: var(--text-control)/1.3 var(--mono); text-transform: uppercase; letter-spacing: 0.06em; }
  .skip-link:not(:focus) { clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; white-space: nowrap; padding: 0; }
  .visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

  /* ---------- Layout. Space between things belongs to the container, so a component never carries outer margins. */

  /* Children stacked with even space between them; set --stack-gap to change it. */
  .stack { display: flex; flex-direction: column; gap: var(--stack-gap, var(--space-3)); }
  .stack > * { margin-block: 0; }
  /* A heading opens a new part of the stack, so it sits further from what came before than from what follows. */
  .stack > :is(h2, h3):not(:first-child) { margin-top: var(--space-4); }
  /* Children in a row that wraps: buttons, chips, a field beside its action. */
  .cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--cluster-gap, var(--space-2)); }
  /* A label at one end and its value or action at the other. */
  .cluster.spread { justify-content: space-between; }
  /* As many columns of at least --grid-min as fit, collapsing to one on a phone. */
  .grid { display: grid; gap: var(--grid-gap, var(--space-4)); grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--grid-min, 15rem)), 1fr)); }
  /* A body of reading text: paragraph spacing, links set apart in teal. */
  .prose, .reading { max-width: var(--measure); font-family: var(--serif-text); font-size: var(--text-reading); line-height: var(--leading-body); }
  .prose > *, .reading > * { margin-block: 0 0.8em; }
  .prose > :last-child, .reading > :last-child { margin-bottom: 0; }
  .prose a, .reading a { color: var(--teal-ink); }
  .reading li { margin: 0.25rem 0; }

  .markdown { overflow-wrap: break-word; }
  .markdown :is(h1, h2, h3, h4, h5, h6) {
    font-family: var(--serif); font-weight: 700; line-height: 1.3; letter-spacing: normal;
    text-wrap: pretty; margin-block: 1.8em 0.65em;
  }
  .markdown h1 { font-size: var(--text-2xl); }
  .markdown h2 { font-size: var(--text-xl); }
  .markdown h3 { font-size: var(--text-lg); }
  .markdown :is(h4, h5, h6) { font-size: var(--text-md); }
  .markdown > :first-child { margin-top: 0; }
  .markdown :is(p, ul, ol, pre, blockquote, .table-wrap) { margin-block: 0 1.1em; }
  .markdown :is(ul, ol) { padding-inline-start: 1.5em; }
  .markdown li { padding-inline-start: 0.2em; margin-block: 0.5em; }
  .markdown li > :is(ul, ol) { margin-block: 0.4em; }
  .markdown li > p { margin-block: 0.5em; }
  .markdown blockquote { padding: var(--space-3) var(--space-4); background: var(--paper); }
  .markdown blockquote > :last-child { margin-bottom: 0; }
  .markdown hr { border-color: var(--line); margin-block: var(--space-8); }
  .markdown hr + :is(h1, h2, h3) { margin-top: 0; }
  .markdown pre { white-space: pre; overflow-wrap: normal; word-break: normal; }
  .markdown th, .markdown td { overflow-wrap: anywhere; word-break: normal; padding: var(--space-3); max-width: 24rem; }
  .markdown table { font-size: var(--text-md); }
  .markdown .table-wrap > table { width: max-content; min-width: max(100%, 34rem); }
  .markdown img { display: block; margin-inline: auto; }

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

  .eyebrow { margin: 0 0 0.35rem; font: var(--text-label)/1.5 var(--mono); letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--muted); }
  .section-label {
    display: flex; justify-content: space-between; align-items: center; gap: 0.6rem;
    padding: 0.4rem 0; border-bottom: 1px solid var(--line);
    font: 700 var(--text-label)/1.5 var(--mono); letter-spacing: var(--tracking-caps); text-transform: uppercase;
  }
  .mono { font-family: var(--mono); }
  .muted { color: var(--muted); }
  .small { font-size: var(--text-sm); }
  .num { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
  /* A headline figure: a balance, a count, a total. Pair it with an .eyebrow that names it. */
  .figure { margin: 0; font: 700 var(--text-2xl)/1.1 var(--serif); letter-spacing: -0.02em; font-variant-numeric: lining-nums tabular-nums; }
  /* The coral mark at display size (a headline's slash or full stop); small text takes .masthead .who or --coral-ink. */
  .accent-mark { color: var(--coral); }

  /* Labelled values: a <dl class="kv"> of <dt> names and <dd> values in two columns. */
  .kv { display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 1rem; margin: 0; }
  .kv dt { font: var(--text-label)/1.9 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
  .kv dd { margin: 0; overflow-wrap: anywhere; }
  @media (max-width: 30rem) { .kv { grid-template-columns: 1fr; } .kv dd + dt { margin-top: 0.4rem; } }

  /* Who said it, and when: a name in the serif, the rest in quiet mono. Put it above a message or an entry. */
  .byline { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 0.7rem; font: var(--text-control)/1.7 var(--mono); color: var(--muted); }
  .byline strong { font: 700 var(--text-lg)/1.3 var(--serif); color: var(--ink); }
  .byline a { color: inherit; text-decoration: none; }
  .byline a:hover { text-decoration: underline; }
  /* What can be done to the thing above: a row of quiet text actions (links or buttons). Mark the main one .lead. */
  .row-actions { display: flex; flex-wrap: wrap; gap: 0.2rem 1.1rem; }
  .row-actions :is(a, button) {
    display: inline-flex; align-items: center; min-height: 1.875rem; padding: 0.2rem 0; border: 0; background: transparent;
    font: var(--text-control)/1.5 var(--mono); letter-spacing: normal; text-transform: none; text-decoration: none; color: var(--ink); opacity: 0.72;
  }
  .row-actions :is(a, button):hover { background: transparent; opacity: 1; text-decoration: underline; }
  .row-actions .lead { color: var(--teal-ink); opacity: 1; font-weight: 700; }
  @media (pointer: coarse) { .row-actions :is(a, button) { min-height: var(--control-height); } }

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

  .panel { background: var(--surface); border: 1px solid var(--ink); padding: clamp(0.9rem, 2.5vw, 1.4rem); box-shadow: var(--shadow-card); min-width: 0; }
  .panel > :first-child { margin-top: 0; }
  .panel > :last-child { margin-bottom: 0; }
  .panel.quiet { border-color: var(--line-strong); box-shadow: none; }
  .stamp {
    display: inline-block; border: 1px solid var(--on-bright); padding: 0.25rem 0.55rem; rotate: -3deg; background: var(--acid);
    font: var(--text-label)/1.4 var(--mono); letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--on-bright);
  }
  .stamp.quiet { background: var(--paper-deep); color: var(--ink); border-color: var(--ink); }
  .chip {
    display: inline-flex; align-items: center; gap: 0.3rem; border: 1px solid var(--line-strong); background: var(--paper); color: var(--ink);
    padding: 0.05rem 0.4rem; margin: 0 0.2rem 0.1rem 0; font: var(--text-label)/1.6 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap;
  }
  .chip.good { border-color: var(--good); color: var(--good); }
  .chip.warn { border-color: var(--warn); color: var(--warn); background: var(--warn-soft); }
  .chip.bad { border-color: var(--bad); color: var(--paper); background: var(--bad); }
  .chip.accent { background: var(--acid); border-color: var(--on-bright); color: var(--on-bright); }
  .chip.teal { background: var(--teal-ink); border-color: var(--teal-ink); color: var(--paper); }
  .count { display: inline-grid; place-items: center; min-width: 1.35rem; height: 1.35rem; padding: 0 0.3rem; border-radius: 999px; border: 1px solid var(--on-bright); background: var(--coral); color: var(--on-bright); font: 700 var(--text-label)/1 var(--mono); }
  .notice { border-left: 4px solid var(--acid); background: var(--surface); padding: 0.7rem 0.9rem; line-height: 1.5; }
  .notice.warn { border-left-color: var(--warn); background: var(--warn-soft); }
  .notice.bad { border-left-color: var(--bad); background: var(--bad-soft); }
  .meter { height: 0.5rem; background: var(--paper-deep); border: 1px solid var(--line-strong); overflow: hidden; }
  .meter > span { display: block; height: 100%; background: var(--teal); }
  /* Nothing here yet: say so, and say what would fill it. */
  .empty { margin: var(--space-6) 0; color: var(--muted); font-style: italic; }

  /* ---------- Tables */

  table { width: 100%; border-collapse: collapse; background: var(--surface); border-top: 3px solid var(--ink); border-bottom: 1px solid var(--line-strong); }
  th, td { padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; line-height: 1.4; }
  th { font: 700 var(--text-label)/1.5 var(--mono); letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--muted); background: var(--paper); border-bottom-color: var(--line-strong); }
  th.num { text-align: right; }
  tr:last-child td { border-bottom: 0; }
  /* A wide table scrolls sideways on a narrow screen rather than squeezing each column to a word per line. */
  .table-wrap { width: 100%; overflow-x: auto; }
  .table-wrap > table { min-width: var(--table-min, 34rem); }

  /* ---------- Overlays */

  dialog { border: 1px solid var(--ink); background: var(--surface); color: var(--ink); padding: 1.2rem; width: min(32rem, calc(100vw - 1.5rem)); max-height: calc(100svh - 2rem); overflow: auto; box-shadow: var(--shadow-pop); }
  dialog[open] { animation: newsprint-rise var(--duration-med) var(--ease); }
  dialog::backdrop { background: var(--scrim); }
  .dialog-actions { display: flex; justify-content: flex-end; gap: 0.6rem; flex-wrap: wrap; margin-top: 1rem; }
  .toast {
    position: fixed; left: 50%; bottom: max(1.5rem, env(safe-area-inset-bottom)); translate: -50% 0; rotate: -1deg; z-index: var(--z-toast);
    background: var(--ink); color: var(--paper); padding: 0.55rem 0.9rem; max-width: calc(100vw - 2rem);
    font: var(--text-control)/1.4 var(--mono); letter-spacing: 0.05em;
    animation: newsprint-rise var(--duration-med) var(--ease);
  }
  .toast.error { background: var(--bad); }
  /* Shown by client.js when the platform session has ended. */
  .session-banner {
    position: sticky; top: 0; z-index: var(--z-banner); display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0.4rem 1rem;
    background: var(--acid); color: var(--on-bright); border-bottom: 2px solid var(--on-bright); padding: 0.6rem 1rem;
    font: var(--text-control)/1.4 var(--mono); letter-spacing: 0.04em;
  }
  .session-banner a { font-weight: 700; }

  @keyframes newsprint-rise { from { opacity: 0; transform: translateY(0.4rem); } }

  @media (max-width: 640px) {
    .masthead { font-size: var(--text-label); }
    .title-row { padding: 0.9rem 0 0.75rem; }
  }

  /* ---------- Preferences the reader has set */

  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
  }
  /* Windows high contrast replaces every colour; keep the shapes that colour alone was drawing. */
  @media (forced-colors: active) {
    .meter > span { forced-color-adjust: none; background: Highlight; }
    .stamp, .chip, .count, .notice { border: 1px solid CanvasText; }
    body::before { display: none; }
  }
  @media print {
    :root { color-scheme: light; }
    body { background: none; }
    body::before, .toast, .session-banner, .skip-link { display: none; }
    .panel, dialog { box-shadow: none; }
  }
}
