/* ─── Daily Brief — typography first, lightly tuftefied ────────────────────
 * Borrows Tufte CSS's measure & rhythm; uses EB Garamond throughout for
 * visual continuity with the print PDF (the print version uses EB Garamond
 * for masthead + TeX Gyre Termes for body, but TGT isn't on Google Fonts;
 * Garamond as a single family reads cleanly on screen). Modern CSS for
 * paragraph quality.
 *
 * Fonts loaded from Google Fonts via <link rel="stylesheet"> in base.html.
 * Local fallback chain: Georgia → Times New Roman → serif.
 * ─────────────────────────────────────────────────────────────────────── */

:root {
  --c-ink: #1a1a1a;
  --c-muted: #555;
  --c-muted-2: #888;
  --c-rule: #ccc;
  --c-link: #2a4d8f;
  --c-link-visited: #6a3d8f;
  --c-bg: #fbfaf7;       /* warm off-white, easier on the eye than #fff */
  --c-bg-card: #fff;
  --c-bg-soft: #f3f1ec;
  --c-disagree: #762828; /* deeper than red, restrained */
  --serif-body: "EB Garamond", Georgia, "Times New Roman", serif;
  --serif-display: "EB Garamond", Georgia, "Times New Roman", serif;
  --measure: 38rem;      /* ~70 chars per line */
}

/* System-preference-driven dark, when no manual override is set. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --c-ink: #ece8df;
    --c-muted: #a09a8d;
    --c-muted-2: #807a6d;
    --c-rule: #3a3833;
    --c-link: #b4c8e4;
    --c-link-visited: #c8b4e4;
    --c-bg: #1a1916;
    --c-bg-card: #211f1b;
    --c-bg-soft: #25241f;
    --c-disagree: #d68a8a;
  }
}
/* Manual dark override (data-theme="dark" overrides system light pref). */
:root[data-theme="dark"] {
  --c-ink: #ece8df;
  --c-muted: #a09a8d;
  --c-muted-2: #807a6d;
  --c-rule: #3a3833;
  --c-link: #b4c8e4;
  --c-link-visited: #c8b4e4;
  --c-bg: #1a1916;
  --c-bg-card: #211f1b;
  --c-bg-soft: #25241f;
  --c-disagree: #d68a8a;
}
/* Manual light override (already the :root default values, but let
   them win against any prefers-color-scheme:dark media block). */
:root[data-theme="light"] {
  --c-ink: #1a1a1a;
  --c-muted: #555;
  --c-muted-2: #888;
  --c-rule: #ccc;
  --c-link: #2a4d8f;
  --c-link-visited: #6a3d8f;
  --c-bg: #fbfaf7;
  --c-bg-card: #fff;
  --c-bg-soft: #f3f1ec;
  --c-disagree: #762828;
}
/* Theme toggle: position: absolute by default so it overlays the
   top-right corner of the page (sharing horizontal whitespace with
   the masthead, taking ZERO vertical flow space). When the user
   scrolls past ~120px, JS adds `.floating` and the toggle becomes
   position: fixed so it stays reachable while reading. */
.theme-toggle {
  position: absolute;
  top: 0.7rem;
  right: 0.9rem;
  z-index: 50;
  background: transparent;
  border: 1px solid var(--c-rule);
  color: var(--c-muted);
  font: inherit;
  font-size: 0.78rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  cursor: pointer;
  font-variant: small-caps;
  letter-spacing: 0.04em;
  transition: box-shadow 0.15s ease, background 0.15s ease;
}
.theme-toggle:hover { background: var(--c-bg-soft); color: var(--c-ink); }
.theme-toggle.floating {
  position: fixed;
  background: var(--c-bg-card);
  box-shadow: 0 2px 8px rgba(0,0,0,0.10);
}
@media (max-width: 640px) {
  .theme-toggle { top: 0.4rem; right: 0.5rem; font-size: 0.72rem; }
}

* { box-sizing: border-box; }

html {
  font-size: 18px;
  -webkit-text-size-adjust: 100%;
}
@media (max-width: 640px) {
  html { font-size: 17px; }
}

body {
  font-family: var(--serif-body);
  font-feature-settings: "kern", "liga", "onum", "pnum";
  text-rendering: optimizeLegibility;
  background: var(--c-bg);
  color: var(--c-ink);
  line-height: 1.5;
  margin: 0;
  padding: 0;
}

main {
  max-width: var(--measure);
  margin: 2.5rem auto;
  padding: 0 1.25rem;
  text-wrap: pretty;        /* better paragraph fills, Chrome 117+/Safari 17.4+ */
  hyphens: auto;
}

/* Brief view scales to wider viewports with a multi-column flow, mirroring
 * the print PDF's two-column layout. The lead spans the full width, then
 * the headline list flows in 2 columns at >=900px and 3 at >=1400px. Each
 * <li> uses break-inside: avoid so a story never splits across columns. */
main.brief-main {
  max-width: var(--measure);
}
@media (min-width: 900px) {
  main.brief-main { max-width: 64rem; }
  main.brief-main .story-list {
    columns: 2;
    column-gap: 2.5rem;
    column-rule: 1px solid var(--c-rule);
  }
  main.brief-main .story-list li { break-inside: avoid; }
  main.brief-main .lead { column-span: all; }
}
@media (min-width: 1400px) {
  main.brief-main { max-width: 84rem; }
  main.brief-main .story-list { columns: 3; }
}

h1, h2, h3 { font-family: var(--serif-display); font-weight: 700; }
h1 {
  font-size: 2.4rem;
  line-height: 1.15;
  margin: 1.5rem 0 0.4rem;
  letter-spacing: 0.005em;
  text-wrap: balance;
}
h2 {
  font-size: 1.5rem;
  line-height: 1.25;
  margin: 2rem 0 0.4rem;
  text-wrap: balance;
}
h3 {
  font-size: 1.15rem;
  line-height: 1.3;
  margin: 1.5rem 0 0.4rem;
  font-weight: 700;
}

p { margin: 0 0 1em; }

a {
  color: var(--c-link);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
a:visited { color: var(--c-link-visited); }
a:hover { background: var(--c-bg-soft); }

hr {
  border: 0;
  border-top: 1px solid var(--c-rule);
  margin: 2rem 0;
}

/* ─── masthead ─── */
.masthead {
  text-align: center;
  border-top: 1px solid var(--c-rule);
  border-bottom: 1px solid var(--c-rule);
  /* Right-padding leaves room for the absolutely-positioned theme
     toggle so the centered title doesn't visually run under it. */
  padding: 0.6rem 5.5rem 0.6rem 0.5rem;
  margin: 1rem 0 1.5rem;
}
.masthead-title {
  font-family: var(--serif-display);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.masthead-meta {
  display: block;
  font-size: 0.85rem;
  color: var(--c-muted);
  letter-spacing: 0.04em;
  font-variant: small-caps;
  margin-top: 0.25rem;
}

/* ─── story cards on the brief index ─── */
.story-list { padding: 0; list-style: none; margin: 0; }
.story-list li {
  margin: 0;
  padding: 1.4rem 0;
  border-bottom: 1px solid var(--c-rule);
}
.story-list li:last-child { border-bottom: 0; }
.story-num {
  font-variant: lining-nums tabular-nums;
  color: var(--c-muted-2);
  font-size: 0.85rem;
  margin-right: 0.4em;
}
.story-title {
  font-family: var(--serif-display);
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 0.4rem;
  text-wrap: balance;
}
.story-title a {
  color: inherit;
  border-bottom: 0;
}
.story-title a:hover { text-decoration: underline; }
.story-meta {
  font-size: 0.85rem;
  color: var(--c-muted);
  font-style: italic;
  margin-bottom: 0.5rem;
}
.story-summary {
  font-size: 1rem;
  line-height: 1.55;
  color: var(--c-ink);
}

/* ─── end-of-brief block ─── */
/* Signals "you're done — there is no more". Bounded-artifact principle:
 * the reader should feel completion, not infinite scroll. */
.end-of-brief {
  text-align: center;
  margin: 3.5rem 0 1rem;
  padding: 1.2rem 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1rem;
  align-items: center;
}
.end-of-brief .end-rule {
  height: 1px;
  background: var(--c-rule);
}
.end-of-brief .end-label {
  font-variant: small-caps;
  letter-spacing: 0.16em;
  font-size: 0.85rem;
  color: var(--c-muted);
  font-style: italic;
}
.end-of-brief .end-next {
  grid-column: 1 / -1;
  margin: 0.5rem 0 0;
  font-style: italic;
}

/* ─── brief sections ─── */
.brief-section { margin-top: 2.5rem; }
.section-header {
  font-size: 0.95rem;
  font-variant: small-caps;
  letter-spacing: 0.12em;
  color: var(--c-muted);
  margin: 0 0 0.8rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--c-rule);
  font-weight: 700;
  text-wrap: balance;
}

/* ─── lead story styling on /brief ─── */
.lead {
  margin: 0 0 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--c-ink);
}
.lead .story-title { font-size: 2rem; }
.lead .story-summary { font-size: 1.05rem; }
.lead-kicker {
  text-align: center;
  font-variant: small-caps;
  letter-spacing: 0.15em;
  font-size: 0.85rem;
  color: var(--c-muted);
  margin: 1rem 0 0.5rem;
}

/* ─── sources / disagreement captions ─── */
.disagree-caption,
.sources-caption {
  font-size: 0.78rem;
  color: var(--c-muted);
  margin-top: 0.6rem;
  font-style: italic;
}
.disagree-caption {
  color: var(--c-disagree);
}
.disagree-caption .label,
.sources-caption .label {
  font-variant: small-caps;
  font-weight: 700;
  letter-spacing: 0.08em;
  font-style: normal;
  margin-right: 0.4em;
}

/* ─── quiz ─── */
.quiz {
  margin: 2rem 0;
  padding: 1.2rem 1.4rem;
  background: var(--c-bg-card);
  border: 1px solid var(--c-rule);
  border-radius: 6px;
}
.quiz h3 { margin-top: 0; font-size: 1rem; font-variant: small-caps; letter-spacing: 0.08em; }
.quiz-q { margin: 0.5rem 0 0.6rem; font-weight: 700; }
.quiz-options { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.4rem; }
.quiz-options li { margin: 0; }
.quiz-options button {
  width: 100%;
  text-align: left;
  font: inherit;
  background: var(--c-bg);
  color: var(--c-ink);
  border: 1px solid var(--c-rule);
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  cursor: pointer;
}
.quiz-options button:hover { background: var(--c-bg-soft); }
.quiz-options button.correct,
.quiz-options button.incorrect {
  /* Force readable contrast: the pastel backgrounds need dark text in
     both themes, otherwise dark-mode's light --c-ink is unreadable on
     light pastel green/red. */
  color: #1a1a1a;
}
.quiz-options button.correct   { background: #d8e8d2; border-color: #6a9056; }
.quiz-options button.incorrect { background: #f1d8d8; border-color: #a06060; }
.quiz-options button.correct strong,
.quiz-options button.incorrect strong { color: inherit; }
@media (prefers-color-scheme: dark) {
  .quiz-options button.correct   { background: #2d4a2a; border-color: #6a9056; color: #ece8df; }
  .quiz-options button.incorrect { background: #4a2d2d; border-color: #a06060; color: #ece8df; }
}
.quiz-feedback {
  margin-top: 0.8rem;
  font-size: 0.9rem;
  color: var(--c-muted);
}
.quiz-launcher {
  margin: 2.5rem 0;
  padding: 1.4rem 1.5rem;
  background: var(--c-bg-card);
  border: 1px solid var(--c-rule);
  border-radius: 6px;
  text-align: center;
}
.quiz-launcher h3 {
  margin: 0 0 0.4rem;
  font-variant: small-caps;
  letter-spacing: 0.08em;
  font-size: 1rem;
}
.quiz-launcher p { margin: 0 0 1rem; }
.option-pct {
  margin-left: 0.7em;
  font-variant: lining-nums tabular-nums;
  color: var(--c-muted);
  font-size: 0.85em;
  font-weight: 500;
  font-style: italic;
}
.quiz-done {
  margin-top: 1rem;
  text-align: center;
  font-style: italic;
}

/* ─── leaderboard ─── */
.leaderboard-table { margin-top: 1.5rem; }
.leaderboard-table tr.self {
  background: var(--c-bg-soft);
  font-weight: 600;
}
.leaderboard-self {
  background: var(--c-bg-soft);
  border-left: 3px solid var(--c-link);
  padding: 0.9rem 1.1rem;
  border-radius: 4px;
  margin: 1.5rem 0;
}

/* ─── Wikipedia look-up ─── */
/* `.wiki-term-pending` is invisible — a candidate that hasn't been
   verified against Wikipedia yet. Once verified, JS swaps the class to
   `.wiki-term` (visible underline) or unwraps to plain text (no Wiki
   article). This avoids a flash of underlined-then-stripped terms. */
.wiki-term-pending { /* invisible, no styling */ }
.wiki-term {
  border-bottom: 1px dotted var(--c-muted);
  cursor: help;
  transition: background 0.15s, border-color 0.15s;
}
.wiki-term:hover,
.wiki-term:focus {
  border-bottom-color: var(--c-ink);
  background: rgba(0,0,0,0.04);
  outline: none;
}
#wiki-popover {
  position: absolute;
  z-index: 1100;
  width: min(92vw, 24rem);
  background: var(--c-bg-card);
  border: 1px solid var(--c-rule);
  border-radius: 6px;
  padding: 0.9rem 1.1rem 0.7rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
}
#wiki-popover .wiki-close {
  position: absolute;
  top: 0.4rem;
  right: 0.5rem;
  background: none;
  border: 0;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--c-muted);
  cursor: pointer;
  padding: 0.2rem 0.5rem;
}
#wiki-popover .wiki-close:hover { color: var(--c-ink); }
#wiki-popover .wiki-title {
  margin: 0 1.5rem 0.5rem 0;
  font-family: var(--serif-display);
  font-weight: 700;
  font-size: 1.15rem;
}
#wiki-popover .wiki-body {
  margin: 0 0 0.7rem;
  font-size: 0.95rem;
  line-height: 1.5;
}
#wiki-popover .wiki-link {
  margin: 0;
  font-size: 0.85rem;
}

/* ─── swipe (onboarding) ─── */
.swipe-wrap {
  max-width: 32rem;
  margin: 2rem auto;
  padding: 0 1rem;
}
.swipe-progress {
  text-align: center;
  font-variant: small-caps;
  letter-spacing: 0.1em;
  color: var(--c-muted);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}
.swipe-progress-bar {
  height: 4px;
  background: var(--c-rule);
  border-radius: 2px;
  overflow: hidden;
  margin: 0.5rem 0;
}
.swipe-progress-bar > span {
  display: block;
  height: 100%;
  background: var(--c-ink);
  transition: width 0.3s ease;
}
.phase-hint {
  background: var(--c-bg-soft);
  border-left: 3px solid var(--c-link);
  border-radius: 4px;
  padding: 0.7rem 0.9rem;
  margin: 0.5rem 0 1.5rem;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--c-ink);
}
.phase-hint strong {
  font-variant: small-caps;
  letter-spacing: 0.06em;
  font-weight: 700;
}
.card {
  background: var(--c-bg-card);
  border: 1px solid var(--c-rule);
  border-radius: 8px;
  padding: 2rem 1.5rem;
  margin: 1rem 0;
  min-height: 14rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.card-source {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--c-muted);
  margin-bottom: 0.6rem;
}
.card-title {
  font-family: var(--serif-display);
  font-size: 1.5rem;
  line-height: 1.2;
  font-weight: 700;
  margin: 0 0 0.6rem;
  text-wrap: balance;
}
.card-lede {
  font-size: 0.95rem;
  color: var(--c-muted);
  line-height: 1.5;
}
.swipe-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}
.swipe-buttons button {
  font: inherit;
  font-size: 1.05rem;
  padding: 0.9rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--c-rule);
  background: var(--c-bg-card);
  color: var(--c-ink);
  cursor: pointer;
  font-variant: small-caps;
  letter-spacing: 0.08em;
}
.swipe-buttons .yes {
  background: var(--c-ink);
  color: var(--c-bg-card);
  border-color: var(--c-ink);
}
.swipe-buttons button:hover { transform: translateY(-1px); }

/* ─── forms (login/signup) ─── */
.form-card {
  max-width: 26rem;
  margin: 4rem auto;
  padding: 2rem 1.5rem;
}
.form-card h1 { font-size: 1.6rem; margin-bottom: 0.3rem; }
.form-card .lede { color: var(--c-muted); margin-bottom: 1.5rem; }
.form-row { margin: 0.8rem 0; }
.form-row label {
  display: block;
  font-variant: small-caps;
  letter-spacing: 0.08em;
  color: var(--c-muted);
  font-size: 0.85rem;
  margin-bottom: 0.2rem;
}
.form-row input {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--c-rule);
  border-radius: 4px;
  background: var(--c-bg-card);
  color: var(--c-ink);
}
.form-row input:focus { outline: 2px solid var(--c-link); border-color: var(--c-link); }
.form-error {
  background: #fae5e5;
  color: #762828;
  padding: 0.5rem 0.7rem;
  border-radius: 4px;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}
.form-submit {
  font: inherit;
  font-size: 1rem;
  background: var(--c-ink);
  color: var(--c-bg-card);
  padding: 0.65rem 1.2rem;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  font-variant: small-caps;
  letter-spacing: 0.1em;
}
.form-submit:hover { opacity: 0.9; }

/* ─── OAuth (Google) ─── */
.oauth-button {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  justify-content: center;
  font: inherit;
  font-size: 1rem;
  padding: 0.65rem 1rem;
  background: var(--c-bg-card);
  color: var(--c-ink);
  border: 1px solid var(--c-rule);
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 500;
  transition: background 0.15s ease;
}
.oauth-button:hover { background: var(--c-bg-soft); }
.oauth-button svg { flex-shrink: 0; }

.oauth-divider {
  text-align: center;
  margin: 1.2rem 0;
  position: relative;
  color: var(--c-muted);
  font-size: 0.85rem;
  font-style: italic;
}
.oauth-divider::before,
.oauth-divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 38%;
  height: 1px;
  background: var(--c-rule);
}
.oauth-divider::before { left: 0; }
.oauth-divider::after { right: 0; }
.oauth-divider span { background: var(--c-bg); padding: 0 0.5rem; }

/* Each "alternative" path is its own visually-distinct block so users
 * understand they're picking ONE, not filling out both. */
.alt-method {
  background: var(--c-bg-card);
  border: 1px solid var(--c-rule);
  border-radius: 6px;
  padding: 1.1rem 1.2rem;
}
.alt-method .form-row { margin: 0.5rem 0; }
.alt-method .form-submit, .alt-method .oauth-button { margin-top: 0.5rem; }
.oauth-aside {
  margin: 0.5rem 0 0;
  font-style: italic;
}

.bookmark-tip {
  margin: 2rem 0 0;
  padding: 1rem 1.2rem;
  background: var(--c-bg-soft);
  border-left: 3px solid var(--c-link);
  border-radius: 4px;
  font-size: 0.95rem;
}
.bookmark-tip h3 {
  margin-top: 0;
  margin-bottom: 0.4rem;
  font-size: 1rem;
  font-variant: small-caps;
  letter-spacing: 0.06em;
}
.bookmark-tip code {
  background: var(--c-bg-card);
  padding: 1px 0.4em;
  border-radius: 3px;
  font-size: 0.9em;
}
.bookmark-tip p { margin: 0; }

/* Settings page */
.settings-block {
  margin: 2rem 0;
  padding: 1.4rem 1.5rem;
  background: var(--c-bg-card);
  border: 1px solid var(--c-rule);
  border-radius: 6px;
}
.settings-block h2 {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
  font-variant: small-caps;
  letter-spacing: 0.06em;
}
.pipeline-form {
  display: flex;
  align-items: flex-start;
  gap: 1.2rem;
  padding: 0.9rem 0;
  border-top: 1px dashed var(--c-rule);
}
.pipeline-form > div { flex: 1; }
.pipeline-form > div p { margin: 0.3rem 0 0; }
.pipeline-form button {
  flex-shrink: 0;
  align-self: center;
  min-width: 9rem;
}
.pipeline-form button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.pipeline-diagram .pipe-row {
  display: flex;
  align-items: stretch;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 0.8rem;
}
.pipe-stage {
  flex: 1 1 11rem;
  min-width: 11rem;
  background: var(--c-bg-soft);
  border: 1px solid var(--c-rule);
  border-radius: 6px;
  padding: 0.7rem 0.8rem;
  display: flex;
  flex-direction: column;
}
.pipe-stage-name {
  font-weight: 700;
  margin-bottom: 0.4rem;
  font-size: 0.95rem;
}
.pipe-stage-desc {
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--c-muted);
  flex: 1;
}
.pipe-stage-meta {
  margin-top: 0.6rem;
  font-size: 0.75rem;
  color: var(--c-ink);
  border-top: 1px dashed var(--c-rule);
  padding-top: 0.4rem;
}
.pipe-stage-meta strong { font-weight: 700; }
.pipe-arrow {
  align-self: center;
  font-size: 1.4rem;
  color: var(--c-muted);
}
@media (max-width: 720px) {
  .pipe-arrow { transform: rotate(90deg); margin: 0.2rem auto; }
  .pipe-stage { flex-basis: 100%; }
}
.run-badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  font-variant: small-caps;
  letter-spacing: 0.05em;
}
.run-running { background: #fde68a; color: #92400e; }
.run-done    { background: #d1fae5; color: #065f46; }
.run-failed  { background: #fecaca; color: #7f1d1d; }
.cluster-card {
  background: var(--c-bg-soft);
  border: 1px solid var(--c-rule);
  border-radius: 6px;
  padding: 0.7rem 0.9rem;
  margin: 0.6rem 0;
}
.cluster-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.4rem;
}
.cluster-nearest {
  margin: 0;
  padding-left: 1.3rem;
  font-size: 0.88rem;
  line-height: 1.45;
}
.cluster-nearest li { margin: 0.15rem 0; }
.cluster-section-label { margin: 0.6rem 0 0.2rem; font-style: italic; }
.read-indicator { color: var(--c-muted); font-size: 0.85rem;
                  font-style: italic; }
.history-list { list-style: none; padding: 0; margin: 1rem 0; }
.history-item {
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--c-rule);
}
.history-item .story-title { font-size: 1.05rem; margin: 0 0 0.25rem; }

.masthead-schedule { margin: 0.4rem 0 0; }
.history-meta { display: flex; flex-wrap: wrap; gap: 0.4rem;
                margin-bottom: 0.3rem; }
.filter-tabs { display: flex; flex-wrap: wrap; gap: 0.4rem;
               margin: 0.6rem 0 1.2rem; }
.filter-tabs a {
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: var(--c-bg-soft);
  color: var(--c-ink);
  text-decoration: none;
  border: 1px solid var(--c-rule);
}
.filter-tabs a.active {
  background: var(--c-ink);
  color: var(--c-bg-card);
  border-color: var(--c-ink);
}

/* Admin transparency banner shown on story pages when an admin has
   touched the story (kill, factor, seed). Always render the underlying
   editorial choice — never silently re-rank. */
.admin-note-banner {
  background: #fef3c7;
  border-left: 3px solid #d97706;
  padding: 0.7rem 0.9rem;
  margin: 1rem 0;
  font-size: 0.92rem;
  border-radius: 4px;
}
.admin-note-banner strong { font-variant: small-caps; letter-spacing: 0.05em; }

/* Admin stories management list. */
.admin-story-card { padding: 0.9rem 1rem; margin: 0.7rem 0; }
.admin-story-card.admin-killed { background: #fee2e2; }
.admin-story-card.admin-tweaked { border-left: 3px solid #2563eb; }
.admin-note { background: var(--c-bg-soft); padding: 0.5rem 0.7rem;
              border-radius: 3px; margin: 0.4rem 0; }
.admin-action-row {
  display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 0.5rem;
  align-items: center;
}
.admin-action-row form { display: inline-flex; gap: 0.3rem; align-items: center;
                         margin: 0; }

/* Topic-grouped brief layout. Each topic = one card. The first card
   is the lead (slightly larger). Mobile: single column. Wide screens:
   2-column grid. Cards have equal-ish height; related stories stack
   under each card's lead. */
.topic-grid {
  display: grid;
  gap: 1.4rem;
  grid-template-columns: 1fr;
  margin: 1.5rem 0;
}
@media (min-width: 760px) {
  .topic-grid { grid-template-columns: 1fr 1fr; }
  .topic-lead-card { grid-column: 1 / -1; }
}
.topic-card {
  background: var(--c-bg-card);
  border: 1px solid var(--c-rule);
  border-radius: 6px;
  padding: 1.1rem 1.3rem;
}
.topic-lead-card {
  border-left: 3px solid var(--c-ink);
  padding: 1.4rem 1.6rem;
}
.topic-lead-card .story-title { font-size: 1.5rem; }
.topic-count { color: var(--c-muted); font-size: 0.85rem; }
.topic-related {
  list-style: none;
  margin: 0.9rem 0 0;
  padding: 0.7rem 0 0;
  border-top: 1px dashed var(--c-rule);
  font-size: 0.92rem;
}
.topic-related li { margin: 0.35rem 0; line-height: 1.4; }
.admin-note-inline {
  background: #fef3c7;
  border-left: 3px solid #d97706;
  padding: 0.4rem 0.6rem;
  margin: 0.5rem 0;
  border-radius: 3px;
}

/* Public admin-actions log. */
.admin-actions-public { list-style: none; padding: 0; }
.admin-actions-public li {
  border-bottom: 1px solid var(--c-rule);
  padding: 0.9rem 0;
}
.action-meta { margin-bottom: 0.3rem; display: flex; gap: 0.6rem;
               align-items: center; flex-wrap: wrap; }
.action-title { font-weight: 500; margin-bottom: 0.3rem; }
.action-note { color: var(--c-muted); font-size: 0.92rem;
               background: var(--c-bg-soft); padding: 0.5rem 0.7rem;
               border-radius: 3px; }

/* Tiny "view original" arrow next to each source link in the
   sources-caption. The main link goes to our reader; this is the
   escape hatch for "I want to see the actual page (with its ads)". */
.source-original {
  font-size: 0.75rem;
  margin-left: 0.15rem;
  color: var(--c-muted-2);
  text-decoration: none;
}
.source-original:hover { color: var(--c-ink); background: transparent; }

/* Reader-mode: visual frame so users always know this is a mirror
   of someone else's content, not ours. Banner + quoted-block treatment
   for the article body. */
.reader-banner {
  background: var(--c-bg-soft);
  border: 1px solid var(--c-rule);
  border-left: 3px solid var(--c-ink);
  border-radius: 4px;
  padding: 0.7rem 0.9rem;
  margin: 1rem 0 1.4rem;
  font-size: 0.92rem;
}
.reader-banner-row { display: flex; align-items: center; gap: 0.6rem; }
.reader-favicon { flex-shrink: 0; border-radius: 3px; }
.reader-banner-text { line-height: 1.4; }
.reader-banner strong { font-variant: small-caps; letter-spacing: 0.05em; }

.reader-article {
  max-width: 38rem;
  margin: 0 auto;
  background: var(--c-bg-card);
  border: 1px solid var(--c-rule);
  border-left: 4px solid var(--c-rule);
  border-radius: 6px;
  padding: 1.6rem 1.8rem 1.2rem;
}
@media (max-width: 640px) { .reader-article { padding: 1.1rem 1.1rem 0.8rem; } }
.reader-article-head { border-bottom: 1px dashed var(--c-rule); padding-bottom: 0.7rem; margin-bottom: 1rem; }
.reader-article .story-title { font-size: 1.5rem; margin-top: 0.3rem; text-align: left; }
.reader-byline { margin: 0.2rem 0 0; }
.reader-body p { margin: 0.9rem 0; line-height: 1.65; }
.reader-article-foot {
  margin-top: 1.5rem;
  padding-top: 0.7rem;
  border-top: 1px dashed var(--c-rule);
}
.settings-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
  font-size: 0.95rem;
}
.settings-table th,
.settings-table td {
  text-align: left;
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--c-rule);
}
.settings-table th {
  font-variant: small-caps;
  letter-spacing: 0.05em;
  color: var(--c-muted);
  font-size: 0.85rem;
  font-weight: 500;
}
.settings-table tbody tr:last-child td { border-bottom: 0; }
.settings-table td:nth-child(2),
.settings-table td:nth-child(3) {
  text-align: right;
  font-variant: lining-nums tabular-nums;
}
.danger-block {
  border-color: var(--c-disagree);
}
.danger-block h2 { color: var(--c-disagree); }
.danger-btn {
  background: var(--c-disagree);
}
.secondary-btn {
  background: var(--c-bg-card);
  color: var(--c-ink);
  border: 1px solid var(--c-rule);
}

/* ─── small utility / footer ─── */
.muted { color: var(--c-muted); }
.small { font-size: 0.85rem; }
footer.site-footer {
  text-align: center;
  font-size: 0.8rem;
  color: var(--c-muted-2);
  margin: 4rem 0 2rem;
  font-style: italic;
}
