/*
 * wowsuchai UI language: the tokens of docs/design/design.md
 * painted over the site's own components. One dark theme: warm charcoal
 * surfaces, 1px hairlines, every corner square, no shadow, no gradient. Geist
 * for people, Geist Mono for machine values. Shared by the site, the SPA and
 * the API-rendered pages (/pages.css).
 */

:root {
  color-scheme: dark;

  --bg-canvas: #171412;
  --bg-machine: #1f1b18;
  --bg-raised: #26221e;
  --bg-selected: #2e2823;

  --text-primary: #eee8df;
  --text-secondary: #c9c0b4;
  --text-tag: #b4aa9e;
  --text-muted: #9c9286;
  --text-code: #d6cec3;
  --text-code-key: #efa36b;
  --text-error: #f0907f;
  --text-disabled: #6b635a;

  --accent-primary: #e97131;

  --semantic-success: #7db487;
  --semantic-warning: #d8a64e;
  --semantic-error: #e5776b;
  --semantic-info: #7fa6d6;

  --border-default: #2e2a26;
  --border-tag: #4a443e;
  --border-control: #7a7066;
  --focus-ring: #efa36b;

  --font-sans: "Geist", system-ui, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, monospace;

  --gutter: 40px;
  --rail: 360px;
}
@media (max-width: 959px) {
  :root { --gutter: 20px; }
}

* { border-radius: 0; box-shadow: none; }

html, body {
  background: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 24px;
  margin: 0;
  /* A token, URL or email longer than the line breaks instead of widening the page. */
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

/* Tabular figures only where numbers line up (tables, numerals, counts). */
.table .num, .t-num-lg, .t-num-md, .t-num-sm, .tabular { font-variant-numeric: tabular-nums; }

a { color: inherit; }

:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Type roles ---------- */
.t-wordmark { font-family: var(--font-sans); font-size: 24px; font-weight: 700; line-height: 28px; letter-spacing: -0.01em; }
.t-page { font-size: 28px; font-weight: 600; line-height: 34px; letter-spacing: -0.01em; margin: 0; color: var(--text-primary); }
.t-section { font-size: 22px; font-weight: 600; line-height: 28px; letter-spacing: -0.01em; margin: 0; color: var(--text-primary); }
.t-entry { font-size: 22px; font-weight: 600; line-height: 28px; letter-spacing: -0.01em; margin: 0; color: var(--text-primary); }
.t-small-display { font-size: 15px; font-weight: 600; line-height: 20px; color: var(--text-primary); }
.t-num-lg { font-size: 28px; font-weight: 600; line-height: 34px; letter-spacing: -0.01em; color: var(--text-primary); }
.t-num-md { font-size: 22px; font-weight: 600; line-height: 28px; color: var(--text-primary); }
.t-num-sm { font-family: var(--font-mono); font-size: 14px; font-weight: 400; line-height: 20px; color: var(--text-primary); }
.t-body { font-size: 16px; font-weight: 400; line-height: 24px; color: var(--text-secondary); }
.t-body-strong { font-size: 16px; font-weight: 600; line-height: 24px; color: var(--text-primary); }
.t-ui { font-size: 15px; font-weight: 500; line-height: 20px; color: var(--text-primary); }
.t-small { font-size: 14px; font-weight: 400; line-height: 20px; color: var(--text-secondary); }
.t-label { font-size: 14px; font-weight: 600; line-height: 20px; letter-spacing: 0.02em; color: var(--text-tag); }
.t-caption { font-size: 14px; font-weight: 400; line-height: 20px; color: var(--text-muted); }
.t-mono { font-family: var(--font-mono); font-size: 14px; font-weight: 400; line-height: 20px; }
.t-mono-small { font-family: var(--font-mono); font-size: 14px; font-weight: 400; line-height: 20px; color: var(--text-muted); }
.prose-cap { max-width: 720px; }
.t-grey { color: var(--text-muted); }
.t-alert { color: var(--text-error); }
.struck { text-decoration: line-through; text-decoration-thickness: 1px; }

@media (max-width: 599px) {
  .t-wordmark { font-size: 22px; }
  .t-page { font-size: 24px; line-height: 30px; }
  .t-section, .t-entry, .t-num-md { font-size: 20px; }
  .t-num-lg { font-size: 24px; line-height: 30px; }
}

/* ---------- Layout ---------- */
.gutter { padding-left: var(--gutter); padding-right: var(--gutter); }
.page-body { display: grid; grid-template-columns: minmax(0, 1fr) var(--rail); margin: 0 var(--gutter); min-height: calc(100dvh - 180px); }
.page-main { padding: 32px 40px 48px 0; min-width: 0; }
.page-rail { border-left: 1px solid var(--border-default); padding: 32px 0 48px 32px; min-width: 0; }
.page-full { margin: 0 var(--gutter); padding: 32px 0 48px; }
@media (max-width: 959px) {
  .page-body { grid-template-columns: minmax(0, 1fr); }
  .page-main { padding-right: 0; }
  .page-rail { border-left: 0; border-top: 1px solid var(--border-default); padding-left: 0; padding-top: 32px; margin-top: 16px; }
  .has-tabbar { padding-bottom: 56px; }
  /* A focused field scrolls clear of the 56px bottom tab bar. */
  html { scroll-padding-bottom: 56px; }
}

.section { margin-top: 40px; }
.section:first-child { margin-top: 0; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border-default); position: relative; }
@media (max-width: 959px) {
  .section { margin-top: 44px; }
}
.section-head .count { font-family: var(--font-mono); font-size: 14px; font-weight: 400; color: var(--text-muted); }
.row-divided > * { border-bottom: 1px solid var(--border-default); }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th { font-size: 14px; font-weight: 600; line-height: 20px; letter-spacing: 0.02em; color: var(--text-muted); text-align: left; padding: 8px 12px; height: 48px; box-sizing: border-box; border-bottom: 1px solid var(--border-default); white-space: nowrap; }
.table td { font-size: 14px; line-height: 20px; color: var(--text-secondary); padding: 8px 12px; height: 48px; box-sizing: border-box; border-bottom: 1px solid var(--border-default); vertical-align: middle; }
.table.with-scores td { height: 48px; }
.table tbody tr:hover { background: var(--bg-raised); }
.table td.num { text-align: right; font-family: var(--font-mono); font-size: 14px; color: var(--text-primary); }
.table th.num { text-align: right; }
.table tr.selected { background: var(--bg-selected); }
/* Positioned, so a visually hidden header label stays inside the scroller instead of widening the page. */
.table-wrap { overflow-x: auto; position: relative; }
@media (max-width: 959px) { .table .low-priority { display: none; } }

/* ---------- Buttons ---------- */
/* One bordered style; a primary action is told apart by position, never by fill. */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; box-sizing: border-box; border: 0; cursor: pointer; text-decoration: none; white-space: nowrap; font-family: var(--font-sans); background: none; }
.btn:disabled { cursor: not-allowed; }
.btn-primary, .btn-secondary, .btn-destructive, .btn-on-ink { border: 1px solid var(--border-control); background: transparent; color: var(--text-primary); font-size: 15px; font-weight: 500; line-height: 20px; height: 40px; padding: 0 16px; }
.btn-primary { height: 44px; padding: 0 20px; }
.btn-primary:hover:not(:disabled), .btn-secondary:hover:not(:disabled), .btn-destructive:hover:not(:disabled), .btn-on-ink:hover { background: var(--bg-raised); }
.btn-primary:active:not(:disabled), .btn-secondary:active:not(:disabled), .btn-destructive:active:not(:disabled) { background: var(--bg-selected); }
.btn-primary:disabled, .btn-secondary:disabled, .btn-destructive:disabled { border-color: var(--border-default); color: var(--text-disabled); }
.btn-destructive { border-color: var(--semantic-error); color: var(--text-error); }
.btn-tertiary { padding: 0 2px; font-size: 15px; font-weight: 500; color: var(--text-primary); text-decoration: underline; text-decoration-thickness: 1px; text-decoration-color: var(--border-control); text-underline-offset: 4px; height: auto; }
.btn-tertiary:hover:not(:disabled) { text-decoration-color: var(--text-primary); }
.btn-tertiary:active:not(:disabled) { background: var(--bg-selected); }
.btn-tertiary:disabled { color: var(--text-disabled); text-decoration-color: var(--border-default); }
.btn-compact { height: 32px; font-size: 14px; padding: 0 12px; }
/* A tertiary action outside running text keeps a 28px thumb target at narrow widths. */
@media (max-width: 959px) { .btn-tertiary:not(p *) { min-height: 28px; } }
.btn-on-ink { height: 32px; font-size: 14px; padding: 0 12px; }
/* Read by screen readers, not drawn. */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.loading-dots::after { content: "..."; display: inline-block; width: 1.2em; text-align: left; animation: dots 1.2s steps(4, end) infinite; overflow: hidden; vertical-align: bottom; }
@keyframes dots { 0% { width: 0; } 100% { width: 1.2em; } }
@media (prefers-reduced-motion: reduce) { .loading-dots::after { width: 1.2em; } }

/* ---------- Inputs ---------- */
.field { display: grid; gap: 8px; }
.field + .field { margin-top: 18px; }
.field-label { font-size: 14px; font-weight: 600; line-height: 20px; letter-spacing: 0.02em; color: var(--text-tag); display: flex; gap: 8px; align-items: baseline; }
.field-label .t-caption { letter-spacing: 0; font-weight: 400; }
.input { height: 44px; border: 1px solid var(--border-control); background: var(--bg-canvas); color: var(--text-primary); font-family: var(--font-sans); font-size: 15px; font-weight: 500; padding: 0 12px; width: 100%; box-sizing: border-box; }
.input::placeholder { color: var(--text-muted); opacity: 1; }
.input:focus-visible { border-color: var(--text-tag); }
.input.t-mono { font-family: var(--font-mono); font-size: 14px; font-weight: 400; }
textarea.input { height: auto; min-height: 120px; padding: 12px; resize: vertical; line-height: 24px; font-size: 16px; font-weight: 400; }
select.input { appearance: none; padding-right: 40px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23B4AA9E' stroke-width='2' stroke-linecap='square'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
select.input option { background: var(--bg-raised); color: var(--text-primary); }
.input.invalid { border-color: var(--semantic-error); }
.input:disabled { border-color: var(--border-default); color: var(--text-disabled); }
input[type="checkbox"] { appearance: none; flex: none; box-sizing: border-box; width: 18px; height: 18px; margin: 1px; border: 1px solid var(--border-control); background: var(--bg-canvas); cursor: pointer; }
input[type="checkbox"]:checked { background-color: var(--text-primary); border-color: var(--text-primary); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23171412' stroke-width='2' stroke-linecap='square' stroke-linejoin='miter'%3E%3Cpath d='m3 8 3 3 7-7'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: center; background-size: 14px 14px; }
input[type="checkbox"]:disabled { border-color: var(--border-default); cursor: not-allowed; }
.field-error { font-size: 14px; font-weight: 500; color: var(--text-error); }
.field-counter { font-family: var(--font-mono); font-size: 14px; font-weight: 400; color: var(--text-muted); text-align: right; }

/* ---------- Flags and tags ---------- */
/* Hairline chips. A flag that carries a state leads with an 8px square in its semantic colour. */
.flag { display: inline-flex; align-items: center; gap: 8px; box-sizing: border-box; min-height: 28px; font-size: 14px; font-weight: 400; line-height: 20px; padding: 0 8px; white-space: nowrap; border: 1px solid var(--border-tag); color: var(--text-secondary); background: transparent; }
.flag-problem::before, .flag-caution::before, .flag-done::before { content: ""; flex: none; width: 8px; height: 8px; }
.flag-problem::before { background: var(--semantic-error); }
.flag-caution::before { background: var(--semantic-warning); }
.flag-done::before { background: var(--semantic-success); }
.flag-neutral { color: var(--text-tag); }
.flag-withdrawn { color: var(--text-muted); }
.tag { display: inline-flex; align-items: center; box-sizing: border-box; min-height: 28px; border: 1px solid var(--border-tag); background: transparent; font-size: 14px; font-weight: 400; line-height: 20px; padding: 0 8px; color: var(--text-tag); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- Chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; box-sizing: border-box; max-width: 100%; overflow-wrap: anywhere; text-align: left; border: 1px solid var(--border-control); background: transparent; color: var(--text-primary); font-family: var(--font-sans); font-size: 14px; font-weight: 500; padding: 6px 12px; cursor: pointer; line-height: 20px; }
.chip:hover { background: var(--bg-raised); }
.chip.active { background: var(--bg-selected); border-color: var(--text-tag); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Overlays ---------- */
.menu { position: absolute; z-index: 30; margin-top: 4px; background: var(--bg-raised); border: 1px solid var(--border-default); min-width: 220px; padding: 4px 0; list-style: none; }
.menu-item { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 36px; padding: 0 12px; font-size: 15px; font-weight: 500; cursor: pointer; width: 100%; background: none; border: 0; text-align: left; font-family: var(--font-sans); color: var(--text-tag); }
.menu-item:hover { background: var(--bg-selected); color: var(--text-primary); }
.menu-item.current, .menu-item.selected { color: var(--text-primary); }
.menu-item.current::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--text-primary); }
.scrim { position: fixed; inset: 0; background: rgb(23 20 18 / 0.8); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
/* The page behind an open modal stays put, so only the modal scrolls. */
:root:has(.scrim) { overflow: hidden; }
.modal { overscroll-behavior: contain; background: var(--bg-raised); border: 1px solid var(--border-default); width: 560px; max-width: 100%; max-height: calc(100dvh - 32px); overflow: auto; padding: 24px; box-sizing: border-box; }
.modal-title { font-size: 28px; font-weight: 600; line-height: 34px; letter-spacing: -0.01em; color: var(--text-primary); padding-bottom: 12px; border-bottom: 1px solid var(--border-default); margin: 0 0 20px; }
@media (max-width: 599px) { .modal-title { font-size: 24px; line-height: 30px; } }
.modal-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; flex-wrap: wrap; }
.toast-stack { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: grid; gap: 8px; }
@media (max-width: 959px) { .toast-stack { bottom: 72px; } }

/*
 * Component styles shared by the SPA (its Vue components carry the markup)
 * and the pages the API renders on the server (briefs, record pages,
 * newsletter steps), which repeat the same markup and class names without
 * Vue. One source, so the two can never drift. Loaded after theme.css.
 */

/* ---------- Masthead ---------- */
.masthead { background: var(--bg-canvas); min-height: 64px; padding: 12px var(--gutter); box-sizing: border-box; border-bottom: 1px solid var(--border-default); display: flex; align-items: center; justify-content: space-between; gap: 40px; }
.wordmark { text-decoration: none; color: var(--text-primary); display: inline-flex; align-items: center; white-space: nowrap; }
.wordmark-mark { width: 40px; height: 40px; margin-right: 12px; }
.wordmark-block { margin-left: 0.25em; }
.masthead-nav { display: flex; align-items: center; gap: 32px; margin-left: auto; }
.masthead-link { display: inline-flex; align-items: center; min-height: 40px; box-sizing: border-box; font-size: 15px; font-weight: 500; line-height: 20px; color: var(--text-tag); text-decoration: none; border-bottom: 2px solid transparent; border-top: 2px solid transparent; }
.masthead-link:hover { color: var(--text-primary); }
.masthead-link.current { color: var(--text-primary); border-bottom-color: var(--text-primary); }
.masthead-divider { width: 1px; height: 20px; background: var(--border-tag); }
.masthead-account { white-space: nowrap; }
/* Narrow widths: the tab entries sit in the bottom tab bar; the other destinations and the account link open from this menu. */
.masthead-menu { display: none; }
@media (max-width: 959px) {
  .masthead { gap: 12px; position: relative; }
  .masthead-nav, .masthead-account { display: none; }
  .masthead-menu { display: block; margin-left: auto; }
  .masthead-menu summary { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin-right: -10px; color: var(--text-primary); cursor: pointer; list-style: none; }
  .masthead-menu summary::-webkit-details-marker { display: none; }
  .masthead-menu .icon-close, .masthead-menu[open] .icon-open { display: none; }
  .masthead-menu[open] .icon-close { display: block; }
  .masthead-menu-panel { position: absolute; z-index: 45; top: 100%; left: var(--gutter); right: var(--gutter); display: flex; flex-direction: column; padding: 4px 20px; background: var(--bg-raised); border: 1px solid var(--border-control); }
  .masthead-menu-link { display: flex; align-items: center; min-height: 48px; font-size: 15px; font-weight: 500; color: var(--text-tag); text-decoration: none; border-bottom: 1px solid var(--border-default); }
  .masthead-menu-link:last-child { border-bottom: 0; }
  .masthead-menu-link:hover, .masthead-menu-link.current { color: var(--text-primary); }
}

/* ---------- Live ticker ---------- */
.ticker { display: flex; height: 44px; background: var(--bg-machine); border-bottom: 1px solid var(--border-default); overflow: hidden; }
.ticker-live { flex: none; display: flex; align-items: center; gap: 8px; color: var(--text-primary); padding: 0 16px 0 var(--gutter); border-right: 1px solid var(--border-default); font-size: 14px; font-weight: 600; letter-spacing: 0.02em; }
.live-dot { width: 8px; height: 8px; background: var(--semantic-error); }
.ticker-window { flex: 1; overflow: hidden; display: flex; align-items: center; }
.ticker-track { display: flex; align-self: stretch; list-style: none; margin: 0; padding: 0; white-space: nowrap; animation: ticker-scroll linear infinite; }
.ticker-window:hover .ticker-track, .ticker-window:focus-within .ticker-track { animation-play-state: paused; }
.ticker-item { display: flex; align-items: center; gap: 10px; padding: 0 22px; border-right: 1px solid var(--border-default); }
.ticker-time { color: var(--text-muted); }
.ticker-headline { color: var(--text-secondary); font-size: 15px; font-weight: 400; text-decoration: none; align-self: stretch; display: flex; align-items: center; }
.ticker-headline:hover { color: var(--text-primary); text-decoration: underline; text-underline-offset: 4px; }
@keyframes ticker-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (max-width: 959px) {
  .ticker { height: 36px; }
  .ticker-live { padding: 0 12px 0 var(--gutter); }
  .ticker-item { padding: 0 16px; }
  .ticker-headline { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .ticker-track { animation: none; }
  .ticker-window { overflow-x: auto; }
}

/* ---------- Bottom tab bar (narrow) ---------- */
.tab-bar { display: none; }
@media (max-width: 959px) {
  .tab-bar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: 56px; background: var(--bg-raised); border-top: 1px solid var(--border-default); z-index: 40; }
  /* Equal cells that never shrink below their label. */
  .tab-bar-item { flex: 1 1 0; min-width: max-content; padding: 0 4px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--text-muted); text-decoration: none; min-height: 44px; }
  .tab-bar-item .t-label { color: inherit; font-weight: 500; letter-spacing: 0; }
  .tab-bar-item.current { color: var(--text-primary); }
}

/* ---------- Headline rows ---------- */
/* The headline leads. Time is a small line at the top with the score quiet at its right; the content spans the full row. */
.headline-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "time score" "content content"; column-gap: 24px; row-gap: 6px; padding: 20px 0; border-bottom: 1px solid var(--border-default); }
.hr-time { grid-area: time; display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.hr-time > span { font-family: var(--font-mono); font-size: 14px; font-weight: 400; line-height: 20px; color: var(--text-muted); }
.hr-content { grid-area: content; min-width: 0; }
.hr-score { grid-area: score; justify-self: end; }
.hr-flags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.hr-meta { display: flex; gap: 12px; flex-wrap: wrap; align-items: baseline; margin-bottom: 4px; font-weight: 400; letter-spacing: 0; }
.hr-link { display: inline-block; text-decoration: none; }
.hr-link:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
/* A withdrawn title stays struck, hovered or not. */
.hr-link.struck, .hr-link.struck:hover { text-decoration: line-through; text-decoration-thickness: 1px; }
.hr-summary { margin: 4px 0 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hr-tags { margin-top: 8px; }
/* In a row the score is a quiet mono readout in the time line: numeral and band word, no bar. The record page keeps the full numeral. */
.headline-row .hr-score .score-numeral { display: flex; flex-direction: row; align-items: baseline; gap: 8px; }
.headline-row .hr-score .score-numeral > span:first-child { font-family: var(--font-mono); font-size: 14px; font-weight: 400; line-height: 20px; color: var(--text-muted); background: none; padding: 0; }
.headline-row .hr-score .band-word { margin: 0; font-size: 14px; font-weight: 400; letter-spacing: 0; color: var(--text-muted); }
.headline-row .hr-score .score-bar-wrap { display: none; }
@media (max-width: 959px) {
  .headline-row { grid-template-columns: minmax(0, 1fr); grid-template-areas: "time" "content" "score"; }
  .headline-row .hr-score { justify-self: start; }
}

/* ---------- Score numeral ---------- */
.score-numeral { display: flex; flex-direction: column; min-width: 0; }
.score-numeral.align-right { align-items: flex-end; text-align: right; }
.score-numeral.align-left { align-items: flex-start; }
/* Trust is quiet: the numeral is never coloured or filled; low and capped read muted. */
.score-numeral > span:first-child { font-family: var(--font-mono); font-size: 14px; font-weight: 400; line-height: 20px; letter-spacing: 0; color: var(--text-primary); }
.score-numeral > span.t-grey:first-child { color: var(--text-muted); }
.score-numeral .band-word { margin-top: 6px; font-weight: 400; letter-spacing: 0; color: var(--text-muted); }
.score-numeral .score-bar-wrap { margin-top: 6px; }

/* ---------- Score bar ---------- */
.score-bar-wrap { width: 100%; }
.score-bar { position: relative; height: 4px; background: var(--border-default); margin: 6px 0; }
.score-bar-fill { position: absolute; inset: 0 auto 0 0; background: var(--text-primary); }
.score-bar-tick { position: absolute; top: -4px; bottom: -4px; width: 1px; background: var(--text-muted); }
.score-bar-scale { position: relative; height: 20px; margin-top: 4px; }
.score-bar-scale span { position: absolute; transform: translateX(-50%); }
.score-bar-scale span:first-child { transform: none; }
.score-bar-scale span:last-child { transform: translateX(-100%); }

/* ---------- Citation markers ---------- */
.citation-marker { font-family: var(--font-mono); font-size: 14px; font-weight: 400; line-height: 0; color: var(--text-tag); padding: 0 2px; }
.citation-marker a { text-decoration: none; }
.citation-marker a:hover { color: var(--text-primary); text-decoration: underline; }

/* ---------- State bands ---------- */
/* A state as a feedback block: bg.machine with a 3px left edge in its semantic colour. */
.state-band { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 16px; background: var(--bg-machine); border-left: 3px solid var(--semantic-info); }
.state-band + .state-band { margin-top: 8px; }
.band-text { font-size: 16px; line-height: 24px; color: var(--text-secondary); }
.band-disputed, .band-suppressed { border-left-color: var(--semantic-error); }
.band-withdrawn { border-left-color: var(--text-muted); }
.band-low, .band-capped { border-left-color: var(--semantic-warning); }

/* ---------- Rail head and stats ---------- */
.rail-head { font-size: 22px; font-weight: 600; line-height: 28px; letter-spacing: -0.01em; color: var(--text-primary); margin: 0; padding-bottom: 12px; border-bottom: 1px solid var(--border-default); }
.rail-stats dl { margin: 0; }
.rail-stat { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border-default); }
.rail-stat dt { font-weight: 400; color: var(--text-secondary); }
.rail-stat dd { margin: 0; font-family: var(--font-mono); font-size: 14px; font-weight: 400; line-height: 20px; }

/* ---------- Fact list ---------- */
.fact-list { margin: 0; }
.fact-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 40px; padding: 4px 0; box-sizing: border-box; border-bottom: 1px solid var(--border-default); }
.fact-row dd { margin: 0; text-align: right; color: var(--text-primary); overflow-wrap: anywhere; min-width: 0; }
.fact-row dd.t-grey { color: var(--text-muted); }

/* ---------- Source rows ---------- */
.source-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--border-default); align-items: start; }
.source-row > .t-num-sm { color: var(--text-muted); }
.source-main { display: grid; gap: 4px; min-width: 0; }
.source-line { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.source-line > * { min-width: 0; overflow-wrap: anywhere; }
.source-url { color: var(--text-code); text-decoration: underline; text-decoration-thickness: 1px; text-decoration-color: var(--border-tag); text-underline-offset: 4px; overflow-wrap: anywhere; display: inline-flex; gap: 6px; align-items: center; }
.source-url svg { flex: none; color: var(--text-tag); }

/* ---------- Quotations ---------- */
.quotation-block { margin: 12px 0; border-left: 1px solid var(--border-tag); padding-left: 16px; }
.quotation-block blockquote { margin: 0 0 6px; }

/* ---------- Licence line ---------- */
.license-line { border-top: 1px solid var(--border-default); padding: 16px 0; margin: 24px 0 0; }
.license-line a { color: var(--text-tag); text-decoration: underline; text-underline-offset: 4px; }

/* ---------- Skeleton ----------
 * The shape of a value that has not arrived, drawn where it will land so
 * nothing moves when it does. Inline, so inside the text element it stands in
 * for it takes that element's line height; it carries no text. The pulse stops
 * under reduced motion with every other animation (theme.css). */
.skeleton { display: inline-block; vertical-align: middle; height: 12px; max-width: 100%; background: var(--border-tag); animation: skeleton-pulse 2s ease-in-out infinite; }
@keyframes skeleton-pulse { 50% { opacity: 0.45; } }

/* ---------- Empty state ---------- */
.empty-state { padding: 24px 0; }
.empty-state p { margin: 12px 0 18px; }

/* ---------- Call-to-action panel ---------- */
.signal-panel { background: var(--bg-machine); border: 1px solid var(--border-default); padding: 16px; }
.signal-title { font-size: 22px; font-weight: 600; line-height: 28px; letter-spacing: -0.01em; color: var(--text-primary); margin: 0; }
.signal-text { font-size: 16px; line-height: 24px; color: var(--text-secondary); margin: 8px 0 16px; }

/* ---------- Segmented control (buttons in the SPA, links on server pages) ---------- */
.segmented { display: inline-flex; border: 1px solid var(--border-control); }
.segment { display: inline-flex; align-items: center; text-decoration: none; height: 36px; padding: 0 14px; border: 0; border-left: 1px solid var(--border-control); background: transparent; font-family: var(--font-sans); font-size: 15px; font-weight: 500; color: var(--text-tag); cursor: pointer; }
.segment:first-child { border-left: 0; }
.segment:hover:not(.selected) { background: var(--bg-raised); color: var(--text-primary); }
.segment.selected { background: var(--bg-selected); color: var(--text-primary); }

/*
 * Styles only the pages the API renders on the server need (briefs, record
 * pages, newsletter steps). Tokens and shared classes come first in
 * /pages.css (packages/design/theme.css), then the components these pages
 * share with the SPA (packages/design/components.css); this file adds the
 * page parts and the few places the server markup differs.
 */

.app-shell { min-height: 100dvh; }

/* Brief items and corrections show their whole summary; only the archive rows clamp to two lines. */
.headline-row[id^="r-"] .hr-summary { display: block; -webkit-line-clamp: unset; overflow: visible; }

/* Rails */
.page-rail > * + * { margin-top: 32px; }
.rail-block .score-numeral { margin-top: 16px; }

/* A brief item's number heads its meta line on its own, so at narrow widths it gets a thumb-sized hit area around the unchanged marker. */
@media (max-width: 959px) {
  .hr-meta .citation-marker a { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; min-height: 28px; vertical-align: middle; }
  .hr-meta:has(.citation-marker) { margin-bottom: 8px; }
}

.state-band { margin-bottom: 18px; }
.state-band + .state-band { margin-top: -10px; }

.fact-row a { text-decoration: underline; text-decoration-color: var(--border-tag); text-underline-offset: 4px; }
@media (max-width: 959px) { .fact-row a { display: inline-flex; align-items: center; min-height: 28px; } }

/* The newsletter form */
.newsletter-panel .field { margin-bottom: 14px; }
.newsletter-panel .field + .field { margin-top: 0; }

/* Brief and record page parts */
.brief-kicker, .record-meta { display: flex; gap: 12px; flex-wrap: wrap; margin: 0 0 8px; }
.brief-kicker > span, .record-meta > span { min-width: 0; overflow-wrap: anywhere; }
.brief-dek, .record-summary { margin: 14px 0 0; }
.brief-section { margin-top: 32px; }
.brief-prose { margin: 14px 0 4px; }
/* The written brief: TL;DR, stories under their headings, then the radar. */
.brief-tldr { margin-top: 20px; padding: 16px 20px; background: var(--bg-machine); border-left: 3px solid var(--border-control); }
.brief-tldr-head { margin: 0; }
.brief-tldr .brief-list { margin-top: 8px; }
.brief-story { margin-top: 32px; }
.brief-story > .t-section { max-width: 720px; }
.brief-list { margin: 12px 0 4px; padding-left: 20px; }
.brief-list li + li { margin-top: 8px; }
.brief-prose strong, .brief-list strong { font-weight: 600; color: var(--text-primary); }
.brief-release-note { margin: 6px 0 0; }
.brief-sources { margin: 8px 0 0; }
.brief-sources a { color: var(--text-tag); text-decoration: underline; text-underline-offset: 4px; }
.brief-writer { margin: 28px 0 0; max-width: 62ch; }
.brief-pager { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 24px; }
.briefs-intro { margin: 14px 0 0; }
.briefs-filter { margin-top: 24px; }
.briefs-list { margin-top: 32px; }
.record-utility { margin: 14px 0; }
.record-labels { display: grid; gap: 10px; margin-top: 18px; }
.record-label-group { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.record-claims, .record-briefs { list-style: none; margin: 0; padding: 0; }
.record-claims li, .record-briefs li { padding: 12px 0; border-bottom: 1px solid var(--border-default); max-width: 62ch; }
.record-briefs li { display: flex; gap: 12px; flex-wrap: wrap; align-items: baseline; }
.record-actions { margin: 24px 0 0; }
.rail-flag { margin: 16px 0 0; }
.notice-page { max-width: 62ch; }
.notice-form { margin: 0 0 18px; }

/* Site footer */
.site-footer { display: flex; flex-wrap: wrap; gap: 12px 24px; margin: 0 var(--gutter); padding: 16px 0 32px; border-top: 1px solid var(--border-default); }
.site-footer a { color: var(--text-tag); text-decoration: underline; text-decoration-color: var(--border-tag); text-underline-offset: 4px; }
@media (max-width: 959px) { .site-footer a { display: inline-flex; align-items: center; justify-content: center; min-height: 28px; min-width: 28px; } }

@media (max-width: 959px) {
  .source-row { grid-template-columns: 32px minmax(0, 1fr); }
  .source-state { grid-column: 2; }
  .segment, .btn-secondary { min-height: 44px; }
}
