/* quotes.nooz.ai — design tokens + base shell styles
 * Ported from hyper.nooz.ai (nooz-public). Dark is the default theme;
 * [data-theme="light"] is an opt-in override, toggled via the theme
 * switcher and persisted to localStorage under the "nooz-theme" key.
 */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/inter-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/static/fonts/inter-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/static/fonts/inter-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/static/fonts/inter-700.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('/static/fonts/inter-800.woff2') format('woff2');
}
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/cormorant-garamond-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/cormorant-garamond-400-italic.woff2') format('woff2');
}
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/static/fonts/cormorant-garamond-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/static/fonts/cormorant-garamond-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/static/fonts/cormorant-garamond-700.woff2') format('woff2');
}

/* ---- Design tokens: midnight (blue) is the default (no data-theme attr, or data-theme="midnight") ---- */
:root,
[data-theme="midnight"] {
  --bg-primary: #0b0f1a;
  --bg-secondary: #111827;
  --bg-card: #1a2235;
  --bg-hover: #1e2a40;
  --text-primary: #f1f5f9;
  --text-secondary: #b8cad8;
  --text-muted: #8fa3b8;
  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
  --accent-green: #10b981;
  --accent-orange: #f59e0b;
  --accent-red: #ef4444;
  --border-color: #253048;
  --shadow-color: rgba(0, 0, 0, .4);

  /* semantic aliases used throughout the shell */
  --direct-fg: var(--accent-green);
  --direct-bg: rgba(16, 185, 129, .14);
  --reported-fg: var(--accent-orange);
  --reported-bg: rgba(245, 158, 11, .14);
}

[data-theme="light"] {
  /* Two-tier light: the PAGE background is a dimmer grey and the SECTION/
   * card backgrounds are bright white, so cards clearly pop off the page. */
  --bg-primary: #dce0e6;   /* dimmer grey page */
  --bg-secondary: #ffffff; /* bright white sections/header */
  --bg-card: #ffffff;      /* bright white cards */
  --bg-hover: #eef1f5;
  --text-primary: #1a1a1f;
  --text-secondary: #3a3a42;
  --text-muted: #6b6b76;
  --accent-blue: #3b3a6b;
  --accent-purple: #6b4fa0;
  --accent-green: #1f7a4d;
  --accent-orange: #8a6d1f;
  --accent-red: #b3261e;
  --border-color: #cfd4db;  /* visible medium-grey section borders (was near-white) */
  --shadow-color: rgba(20, 20, 30, .10);

  --direct-fg: #1f7a4d;
  --direct-bg: #e7f4ec;
  --reported-fg: #8a6d1f;
  --reported-bg: #f6efdc;
}

[data-theme="dark"] {          /* true monochrome grey */
  --bg-primary: #111112;
  --bg-secondary: #171719;
  --bg-card: #1d1d1f;
  --bg-hover: #262629;
  --text-primary: #ededee;
  --text-secondary: #adadb1;
  --text-muted: #79797f;
  --accent-blue: #d6d6d8;
  --accent-purple: #b9b9bd;
  --accent-green: #5fbf97;
  --accent-orange: #c9a06a;
  --accent-red: #d97e75;
  --border-color: #343438;
  --shadow-color: rgba(0, 0, 0, .5);

  --direct-fg: #adadb1;
  --direct-bg: rgba(255, 255, 255, .06);
  --reported-fg: #89898f;
  --reported-bg: rgba(255, 255, 255, .04);
}

/* ---- OCN theme: the constrained gold/serif single-brand surface (host-
 * gated, theme switch locked — see base.html `ocn_mode`). Palette matches the
 * OCN share-card renderer (app/card_image.py `ocn`): warm dark ground, cream
 * text, gold #c5963a accent. `--accent-blue` is the shell's accent alias
 * (logo, links, chips) — pointing it at gold recolors the whole UI to the
 * brand. Stance for/against keep their green/red (a signal, not the brand). */
[data-theme="ocn"] {
  --bg-primary: #16130d;   /* warm dark page */
  --bg-secondary: #1e1a12; /* sections/header */
  --bg-card: #221d14;      /* cards */
  --bg-hover: #2a2418;
  --text-primary: #f5f0e6; /* cream */
  --text-secondary: #d8cfbd;
  --text-muted: #a89b82;
  --accent-blue: #c5963a;  /* OCN gold — the brand accent */
  --accent-purple: #b98b3a;
  --accent-green: #10b981;
  --accent-orange: #d9a441;
  --accent-red: #ef4444;
  --border-color: #3a3222;
  --shadow-color: rgba(0, 0, 0, .5);

  --direct-fg: var(--accent-green);
  --direct-bg: rgba(16, 185, 129, .14);
  --reported-fg: var(--accent-orange);
  --reported-bg: rgba(217, 164, 65, .14);
}

/* OCN is a serif brand (mirrors ocn.nooz.ai): the wordmark, headings and
 * quote text carry the serif; body UI text stays the base stack for legibility
 * on a data-dense surface. */
[data-theme="ocn"] .logo,
[data-theme="ocn"] h1,
[data-theme="ocn"] h2,
[data-theme="ocn"] .page-h1,
[data-theme="ocn"] .page-h2,
[data-theme="ocn"] .quote {
  font-family: Georgia, 'Times New Roman', 'Noto Serif', serif;
}

* { box-sizing: border-box; }

/* The `hidden` attribute must always win over a component's own `display`
 * rule. Without this, e.g. `#graph-canvas-box .empty-state { display:flex }`
 * kept the "No stance data yet" overlay visible AND pointer-blocking on top
 * of a populated graph canvas, swallowing all pan/zoom/rotate input. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color .15s ease, color .15s ease;
}

a { color: inherit; text-decoration: none; }

/* ---- header / nav ---- */
header {
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--bg-secondary) 90%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-color);
  z-index: 5;
}

.bar {
  max-width: 920px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 28px;
}

.logo {
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -.02em;
}
.logo b { color: var(--accent-blue); }
.logo span { color: var(--text-muted); font-weight: 500; }

nav {
  display: flex;
  gap: 22px;
  font-weight: 500;
  font-size: 14px;
  color: var(--text-muted);
}
nav a.active { color: var(--text-primary); }
nav a.active::after {
  content: "";
  display: block;
  height: 2px;
  background: var(--accent-blue);
  margin-top: 6px;
  border-radius: 2px;
}
.grow { flex: 1; }

/* About/Help live at the FAR RIGHT of the bar — after the theme switch,
 * behind a separator (theme buttons | About Help). Utility links: quieter
 * than the product nav. */
.bar-right { display: flex; align-items: center; gap: 16px; }
.bar-sep { width: 1px; height: 20px; background: var(--border-color); flex: none; }
.bar-meta { display: flex; align-items: center; gap: 16px; }
.nav-meta {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
}
.nav-meta:hover { color: var(--text-primary); }
.nav-meta.active { color: var(--text-primary); }

.count { font-size: 13px; color: var(--text-muted); }

.theme-switch {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 3px;
}
/* Collapsed to icon buttons (☀ / ☾ / ◑), matching hyper.nooz.ai. The glyph
 * is the label; the theme name is the title/aria-label tooltip. */
.theme-switch button {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1;
  min-width: 30px;
  padding: 5px 0;
  border-radius: 50%;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
.theme-switch button:hover { color: var(--text-primary); background: var(--bg-hover); }
.theme-switch button.active {
  background: var(--accent-blue);
  color: #fff;
}
[data-theme="dark"] .theme-switch button.active { color: #111112; }

/* ---- filter row ---- */
.filters {
  max-width: 920px;
  margin: 0 auto;
  padding: 18px 24px 6px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.search {
  flex: 1;
  min-width: 220px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 9px 12px;
  color: var(--text-muted);
}
.search input {
  border: 0;
  outline: 0;
  flex: 1;
  font: inherit;
  color: var(--text-primary);
  background: transparent;
}
.chip {
  padding: 7px 13px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
}
.chip.on {
  background: var(--accent-blue);
  color: #fff;
  border-color: var(--accent-blue);
}
[data-theme="dark"] .chip.on {
  /* Grey theme's --accent-blue is a light grey (#d6d6d8), so white text is
   * illegible (~1.48:1 contrast). Use bg-primary text instead, matching the
   * same fix applied to the active target chip below. */
  color: var(--bg-primary);
}
.sort { margin-left: auto; font-size: 13px; color: var(--text-muted); }
.anon-toggle {
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
}
.anon-toggle:hover { color: var(--text-primary); text-decoration: underline; }

/* ---- main / feed ---- */
main {
  max-width: 920px;
  margin: 0 auto;
  padding: 12px 24px 60px;
}
.stream {
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ---- quote card ---- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 24px 26px;
  box-shadow: 0 1px 2px var(--shadow-color);
}
.card:hover { background: var(--bg-hover); }

/* Compact variant (person-page "Quotes over time" timeline): same shared
 * _card.html partial, no .who identity block, tighter padding/type so a
 * dense list of these reads as a lighter timeline card while staying
 * visually consistent (same border/radius/background) with the full card. */
.card.compact { padding: 16px 20px; }
.card.compact .quote { font-size: 15px; margin-bottom: 0; }
.card.compact .quote .mark { font-size: 18px; }
.card.compact .pillrow { margin-top: 8px; }
.card.compact .cardfoot { margin-top: 10px; padding-top: 10px; }

.quote {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 25px;
  line-height: 1.34;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 18px;
  position: relative;
}
.quote .mark {
  color: var(--accent-blue);
  opacity: .45;
  font-size: 30px;
  margin-right: 2px;
}

.who { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  flex: none;
  object-fit: cover;
  background: color-mix(in srgb, var(--accent-blue) 20%, transparent);
  color: var(--accent-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 15px;
  border: 1px solid var(--border-color);
}
.avatar.rep {
  background: var(--bg-hover);
  color: var(--text-muted);
}

.name { font-weight: 600; font-size: 15px; }
.title { color: var(--text-muted); font-size: 13px; }

/* Author prominence (feed cards): bigger avatar + bolder name inside the
 * .idlink author link. */
.idlink .avatar { width: 50px; height: 50px; }
.idlink .name { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.idlink .title { font-size: 12.5px; }

.pub { font-weight: 600; color: var(--text-secondary); }

.pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: .02em;
}
.pill.direct { color: var(--direct-fg); background: var(--direct-bg); }
.pill.reported { color: var(--reported-fg); background: var(--reported-bg); }
/* Full mode: the Direct/Reported pill sits at the top-right of the identity
 * row (.who), aligned to the top so it lines up with the speaker name even
 * when a title wraps below. Compact mode has no identity row, so the pill
 * keeps its own small line (.pillrow) just under the quote. */
.pillslot { flex: none; align-self: flex-start; }
.pillrow { margin-top: 10px; }

.idlink{display:flex;align-items:center;gap:12px;flex:1;min-width:0;text-decoration:none;color:inherit;border-radius:9px;margin:-4px;padding:4px}
.idlink:hover{background:var(--bg-hover)}
.idlink .arrow{color:var(--text-muted);opacity:0;transition:opacity .15s}
.idlink:hover .arrow{opacity:1}
.stance{display:inline-flex;align-items:center;gap:7px;margin-top:14px;font-size:13px;font-weight:600;
        padding:5px 11px;border-radius:8px;border:1px solid transparent;max-width:100%}
.stance .ic{font-size:11px}
.stance .tgt{color:inherit;opacity:.85;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.stance.for{color:var(--accent-green);background:color-mix(in srgb,var(--accent-green) 12%,transparent);border-color:color-mix(in srgb,var(--accent-green) 26%,transparent)}
.stance.against{color:var(--accent-red);background:color-mix(in srgb,var(--accent-red) 11%,transparent);border-color:color-mix(in srgb,var(--accent-red) 26%,transparent)}
.stance.neutral{color:var(--text-muted);background:color-mix(in srgb,var(--text-muted) 12%,transparent);border-color:color-mix(in srgb,var(--text-muted) 22%,transparent)}

/* Card footer: ONE balanced row — source provenance anchored left, action
 * buttons anchored right (justify-content: space-between), so the horizontal
 * space is used and the card doesn't bottom out into a sparse left-hugging
 * stack. Wraps to two lines (source, then buttons) only when too narrow. */
.cardfoot {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 20px;
  font-size: 12.5px;
  color: var(--text-muted);
}
.srcline { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-width: 0; }
.srcline a { color: var(--accent-blue); font-weight: 500; }
/* Keyword/credit/Wikipedia attribution — full-mode-only, inline after source. */
.srcextra { display: flex; align-items: center; gap: 8px; }
.credit { font-size: 11px; opacity: .7; }
.wikilink { font-size: 11px; opacity: .7; font-weight: 400; color: inherit; text-decoration: none; }
.wikilink:hover { opacity: 1; }

.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; }
.actions a { color: var(--accent-blue); font-weight: 500; }

.flagbtn {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  font-size: inherit;
  font-weight: 500;
  color: var(--accent-blue);
  cursor: pointer;
}
.flagbtn.on { color: var(--accent-green); }

.flagwrap { position: relative; display: inline-flex; }

.flagmenu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 30;
  margin-top: 6px;
  min-width: 180px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: 0 4px 16px var(--shadow-color);
  padding: 6px;
}
.flagmenu.open { display: block; }
.flagmenu button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 8px 10px;
  margin: 0;
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  border-radius: 6px;
}
.flagmenu button:hover { background: var(--bg-hover); }

/* ---- Share button + popover (mirrors the flag menu) ---- */
.sharewrap { position: relative; display: inline-flex; }
.sharebtn {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  font-weight: 500;
  color: var(--accent-blue);
  cursor: pointer;
}
.sharemenu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 30;
  margin-top: 6px;
  min-width: 160px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: 0 4px 16px var(--shadow-color);
  padding: 6px;
}
.sharemenu.open { display: block; }
.sharemenu-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 8px 10px;
  margin: 0;
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  border-radius: 6px;
  text-decoration: none;
}
.sharemenu-item:hover { background: var(--bg-hover); }

/* ---- feed: empty state + pagination ---- */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
  font-size: 14px;
}

.load-more {
  align-self: center;
  margin: 8px auto 0;
  padding: 10px 22px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.load-more:hover { background: var(--bg-hover); }

/* ---- initials-avatar color hash (deterministic, theme-safe) ----
 * app.main._avatar_color() hashes a name to one of these 5 indices;
 * Task 7 swaps in real photos and these become an unused fallback. */
.avatar-color-0 { background: color-mix(in srgb, var(--accent-blue) 20%, transparent); color: var(--accent-blue); }
.avatar-color-1 { background: color-mix(in srgb, var(--accent-purple) 20%, transparent); color: var(--accent-purple); }
.avatar-color-2 { background: color-mix(in srgb, var(--accent-green) 20%, transparent); color: var(--accent-green); }
.avatar-color-3 { background: color-mix(in srgb, var(--accent-orange) 20%, transparent); color: var(--accent-orange); }
.avatar-color-4 { background: color-mix(in srgb, var(--accent-red) 20%, transparent); color: var(--accent-red); }

/* ---- People: sort control + "shifted" badge (Part B discovery) ---- */
.people-sort {
  max-width: 920px;
  margin: 12px auto 0;
  display: flex;
  gap: 14px;
  font-size: 13px;
}
.people-sort a {
  color: var(--text-muted);
  text-decoration: none;
}
.people-sort a:hover { color: var(--text-primary); text-decoration: underline; }
.people-sort a.active { color: var(--accent-blue); font-weight: 600; text-decoration: none; }
.shift-badge {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  color: var(--accent-orange);
  background: color-mix(in srgb, var(--accent-orange) 16%, transparent);
}

/* ---- People: directory grid ---- */
.people-grid {
  max-width: 920px;
  margin: 0 auto;
  padding: 24px 0 60px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}
.person-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  box-shadow: 0 1px 2px var(--shadow-color);
}
.person-card:hover { background: var(--bg-hover); }
.person-card-name { font-weight: 600; font-size: 14.5px; }
.person-card-count { font-size: 12.5px; color: var(--text-muted); }
.person-card-credit {
  font-size: 10.5px;
  color: var(--text-muted);
  opacity: .7;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.avatar-lg { width: 64px; height: 64px; font-size: 19px; }
.avatar-xl {
  width: 132px;
  height: 132px;
  border-radius: 16px;
  font-size: 40px;
  margin-bottom: 16px;
}

/* ---- Person page: identity column + "Quotes over time" timeline ---- */
.wrap {
  /* Wide enough that the timeline column (1fr) is ~680px — the SAME width as
   * a feed card (.stream) — so the unified card's single-row footer (source
   * left / buttons right) fits on one line here too, instead of wrapping to
   * two left-aligned rows in a cramped column. */
  max-width: 1060px;
  margin: 0 auto;
  padding: 20px 24px 60px;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 36px;
}
.crumb { grid-column: 1 / -1; font-size: 13px; color: var(--text-muted); }
.crumb a { color: var(--accent-blue); }

.id { position: sticky; top: 78px; align-self: start; }
.pname {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 32px;
  font-weight: 600;
  line-height: 1.1;
  margin: 0 0 4px;
}
.prole { color: var(--text-muted); font-size: 14px; margin-bottom: 16px; }
.stats {
  display: flex;
  gap: 20px;
  padding: 14px 0;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 16px;
}
.stat b { display: block; font-size: 20px; font-weight: 700; }
.stat span { font-size: 12px; color: var(--text-muted); }
.bio { font-size: 13.5px; color: var(--text-secondary); line-height: 1.55; margin-bottom: 10px; }
.attr { font-size: 11.5px; color: var(--text-muted); }
.attr a { color: var(--accent-blue); }
.topics { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.topics-label {
  width: 100%;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 2px;
}
.topic {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 20px;
  background: color-mix(in srgb, var(--accent-blue) 16%, transparent);
  color: var(--accent-blue);
  font-weight: 500;
  text-decoration: none;
}
.topic:hover { background: color-mix(in srgb, var(--accent-blue) 26%, transparent); }
.topic.on {
  background: var(--accent-blue);
  color: #fff;
}
[data-theme="dark"] .topic.on { color: #111112; }
.topic.clear { background: transparent; border: 1px solid var(--border-color); color: var(--text-muted); }

/* Compare-with-others bridge bar (person page -> scoped /search) */
.compare-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin-bottom: 16px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--bg-card);
  text-decoration: none;
  font-size: 13px;
}
.compare-bar:hover { background: var(--bg-hover); border-color: color-mix(in srgb, var(--accent-blue) 40%, var(--border-color)); }
.compare-lead { font-weight: 700; color: var(--accent-blue); white-space: nowrap; }
.compare-scope { color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compare-arrow { margin-left: auto; color: var(--accent-blue); font-weight: 700; }

.pstance {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 22px;
}
.sbar {
  display: flex;
  height: 8px;
  border-radius: 5px;
  overflow: hidden;
  background: var(--border-color);
}
.sbar i { display: block; height: 100%; }
.sbar .f { background: var(--accent-green); }
.sbar .a { background: var(--accent-red); }
.sbar .n { background: var(--text-muted); }
.slegend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-top: 10px;
  font-size: 12.5px;
}
.slegend a.sl {
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 6px;
  padding: 2px 4px;
  margin: -2px -4px;
}
.slegend a.sl:hover { color: var(--text-primary); background: var(--bg-hover); }
.slegend a.sl b { color: var(--text-primary); font-weight: 700; margin-right: 4px; }
.slegend a.sl.on {
  /* Filled active state, same high-contrast convention as .tgts .t.on /
   * .chip.on / .mode.on. */
  color: #fff;
  background: var(--accent-blue);
}
.slegend a.sl.on b { color: inherit; }
[data-theme="dark"] .slegend a.sl.on {
  /* Grey theme's --accent-blue is a light grey — white text is illegible
   * there, same fix as .tgts .t.on. */
  color: var(--bg-primary);
}
.slegend a.sl.clear { font-size: 11.5px; opacity: .8; }
.slegend a.sl.clear:hover { opacity: 1; }
.tgts {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
}
.tgts .t {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  text-decoration: none;
  background: var(--bg-secondary);
}
.tgts .t:hover { background: var(--bg-hover); }
.tgts .t b { font-weight: 700; }
.tgts .t.on {
  /* Filled, high-contrast active state — the previous 12%-tint fill read as
   * near-invisible in light mode. Matches the .chip.on / .mode.on solid-fill
   * convention used elsewhere so the active target is unmistakable in all
   * three themes. */
  background: var(--accent-blue);
  color: #fff;
  border-color: var(--accent-blue);
}
[data-theme="dark"] .tgts .t.on {
  /* Grey theme's --accent-blue is a light grey (#d6d6d8), so white text is
   * illegible (~1.45:1). Use the theme's near-black bg-primary as the text
   * color instead — #d6d6d8 bg / #111112 text ≈ 13:1, well past AA. */
  color: var(--bg-primary);
}

/* ---- Position shifts (Feature 2, opinion flip-flop) — a canonical target
 * the person has taken both a "for" and an "against" stance on. ---- */
.pshifts {
  margin-bottom: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.pshifts-head {
  font-family: 'Cormorant Garamond', serif;
  font-size: 20px;
  font-weight: 600;
}
.pshift {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px 16px;
}
.pshift-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.pshift-target { font-weight: 700; color: var(--text-primary); }
.pshift-chip {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 20px;
  color: var(--accent-orange);
  background: color-mix(in srgb, var(--accent-orange) 16%, transparent);
}
.pshift-counts { color: var(--text-muted); font-size: 12px; margin-left: auto; }
/* "Mixed stances (unverified)" — the honest framing (qp#1). We deliberately
 * do NOT claim a reversal: automated stance labels placing a speaker on both
 * sides of a target is a weak, unverified signal, not a flip-flop. Muted
 * neutral tone so it never reads as an accusation. (Genuine-reversal
 * detection is gated behind qp#2's semantic judgment layer.) */
.pshift-chip.mixed, .shift-chip.mixed {
  color: var(--text-muted);
  background: color-mix(in srgb, var(--text-muted) 14%, transparent);
}
.pshifts-note {
  color: var(--text-muted);
  font-size: 12.5px;
  line-height: 1.5;
  margin: 4px 0 14px;
  max-width: 640px;
}
.pshift-quotes {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pshift-q {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
  line-height: 1.5;
}
.pshift-dot { flex: none; font-size: 10px; }
.pshift-dot.for { color: var(--accent-green); }
.pshift-dot.against { color: var(--accent-red); }
.pshift-meta { flex: none; color: var(--text-muted); font-size: 11.5px; min-width: 90px; }
.pshift-text { color: var(--text-secondary); text-decoration: none; }
.pshift-text:hover { color: var(--text-primary); text-decoration: underline; }

/* ---- /shifts discovery page (Shifts & Drift) ----
 * Corpus-wide generalization of the per-identity "Position shifts"
 * section (.pshift-* above) and the per-cluster /quotes/{id}/variants
 * compare view — same card look, laid out as two ranked lists. */
.shifts-section { max-width: 920px; margin: 0 auto 40px; }
.shifts-section-head {
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px;
  font-weight: 600;
  margin: 2px 0 6px;
}
/* Strong "experimental / not accurate yet" banner for stance-derived
 * surfaces (stance, flip-flops/mixed stances, misquotes). Deliberately loud —
 * accent-red framing so it can't be mistaken for a settled result. */
.wip-banner {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 14px;
  margin: 0 0 16px;
  border: 1px solid color-mix(in srgb, var(--accent-red) 50%, var(--border-color));
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent-red) 10%, transparent);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}
.wip-badge {
  flex: none;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #fff;
  background: var(--accent-red);
  padding: 3px 9px;
  border-radius: 20px;
  white-space: nowrap;
}
.wip-text b { color: var(--accent-red); }

.shifts-section-sub { font-size: 13px; color: var(--text-muted); margin: 0 0 18px; max-width: 640px; }
.shifts-search-box { max-width: 340px; margin: 0 0 16px; }

/* Misquote (wording changed) vs verbatim (syndicated copy) badges on the
 * /misquotes page — real misquotes get the accent, verbatim is muted. */
.misquote-badge, .verbatim-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 20px;
  letter-spacing: .02em;
  margin-bottom: 8px;
}
.misquote-badge {
  color: var(--accent-red);
  background: color-mix(in srgb, var(--accent-red) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent-red) 26%, transparent);
}
.verbatim-badge { color: var(--text-muted); background: var(--bg-hover); }
.drift-cluster.is-misquote { border-color: color-mix(in srgb, var(--accent-red) 30%, var(--border-color)); }
/* Severity gradation: sev-1 (minor reword) reads calmer, sev-3 (meaning may
 * differ) is the strongest signal. Overrides the base .misquote-badge. */
.misquote-badge.sev-1 {
  color: var(--accent-orange);
  background: color-mix(in srgb, var(--accent-orange) 12%, transparent);
  border-color: color-mix(in srgb, var(--accent-orange) 26%, transparent);
}
.drift-cluster.sev-1 { border-color: color-mix(in srgb, var(--accent-orange) 26%, var(--border-color)); }
.drift-cluster.sev-3 { border-color: color-mix(in srgb, var(--accent-red) 48%, var(--border-color)); }

/* Result-type toggle on /search — Quotes · Misquotes · Position shifts.
 * Mirrors the .chip pill styling; the active type gets the solid accent
 * fill (same treatment, and the same grey-theme override, as .chip.on). */
.search-types { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 18px; }
.search-types .stype {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
}
.search-types .stype:hover { background: var(--bg-hover); }
.search-types .stype.on {
  background: var(--accent-blue);
  color: #fff;
  border-color: var(--accent-blue);
}
[data-theme="dark"] .search-types .stype.on { color: #111112; }
.shift-people, .drift-clusters { display: flex; flex-direction: column; gap: 12px; }
.shift-person, .drift-cluster {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 16px 20px;
}
.shift-person-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-primary);
  text-decoration: none;
}
.shift-person-name:hover { text-decoration: underline; }
.shift-person-targets { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.shift-target { display: flex; align-items: center; gap: 8px; font-size: 13px; flex-wrap: wrap; }
.shift-chip {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
  color: var(--accent-orange);
  background: color-mix(in srgb, var(--accent-orange) 16%, transparent);
  flex: none;
}
.shift-target-label { font-weight: 600; color: var(--text-secondary); }
.shift-target-counts { color: var(--text-muted); font-size: 12px; margin-left: auto; }
.shift-target-counts .for { color: var(--accent-green); font-weight: 600; }
.shift-target-counts .against { color: var(--accent-red); font-weight: 600; }

.drift-cluster-text { font-size: 14px; color: var(--text-primary); margin: 0 0 8px; line-height: 1.5; }
.drift-cluster-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.drift-cluster-meta b { color: var(--text-secondary); }
.drift-cluster-compare { margin-left: auto; color: var(--accent-blue); text-decoration: none; font-weight: 600; }
.drift-cluster-compare:hover { text-decoration: underline; }

.tl-head { font-family: 'Cormorant Garamond', serif; font-size: 22px; font-weight: 600; margin: 2px 0 18px; }
.month {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 22px 0 12px;
}
.spine { position: relative; padding-left: 26px; }
.spine::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--border-color);
}
.q { position: relative; margin-bottom: 16px; }
.q::before {
  content: "";
  position: absolute;
  left: -26px;
  top: 8px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--accent-blue);
}
.truncated-note {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--text-muted);
  text-align: center;
}

@media (max-width: 760px) {
  .wrap { grid-template-columns: 1fr; }
  .id { position: static; }
}

/* ---- Search: big search box, Keyword/Semantic toggle, results count ---- */
.bigsearch {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 15px 18px;
  box-shadow: 0 1px 3px var(--shadow-color);
  font-size: 17px;
}
.bigsearch input {
  border: 0;
  outline: 0;
  flex: 1;
  font: inherit;
  color: var(--text-primary);
  background: transparent;
}
.modes {
  max-width: 760px;
  margin: 16px auto 8px;
  display: flex;
  gap: 8px;
}
.mode {
  padding: 7px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
}
.mode.on { background: var(--accent-blue); color: #fff; border-color: var(--accent-blue); }
[data-theme="dark"] .mode.on { color: var(--bg-primary); }
.mode.disabled { cursor: not-allowed; opacity: .55; }
.mode small { opacity: .8; font-weight: 400; }

/* ---- Quotesphere: chip bar, "+ filter" popover, autocomplete ---- */
.search-toolbar {
  max-width: 760px;
  margin: 14px auto 0;
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 10px;
}
.chipbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
a.graph-btn { text-decoration: none; display: inline-block; }
.filter-add { position: relative; flex: none; }

.fchip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 5px 8px 5px 12px;
  border-radius: 20px;
  border: 1px solid color-mix(in srgb, var(--accent-blue) 30%, var(--border-color));
  background: color-mix(in srgb, var(--accent-blue) 12%, var(--bg-card));
  color: var(--accent-blue);
  font-size: 12.5px;
  font-weight: 500;
}
.fchip-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fchip.exclude {
  border-color: color-mix(in srgb, var(--accent-red) 35%, var(--border-color));
  background: color-mix(in srgb, var(--accent-red) 12%, var(--bg-card));
  color: var(--accent-red);
}
.fchip-x {
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font-size: 14px;
  line-height: 1;
  padding: 2px;
  cursor: pointer;
  opacity: .75;
}
.fchip-x:hover { opacity: 1; background: color-mix(in srgb, currentColor 15%, transparent); }

.filter-menu {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 40;
  margin-top: 6px;
  min-width: 200px;
  max-width: min(280px, calc(100vw - 32px));
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: 0 4px 16px var(--shadow-color);
  padding: 6px;
}
.filter-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 8px 10px;
  margin: 0;
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  border-radius: 6px;
}
.filter-menu-item:hover { background: var(--bg-hover); }
.filter-back { color: var(--text-muted); margin-bottom: 4px; }

.filter-form { padding: 4px 4px 2px; }
.filter-form-row { display: flex; align-items: center; gap: 6px; }
.filter-toggle {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--bg-hover);
  color: var(--text-primary);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.filter-toggle.exclude {
  color: var(--accent-red);
  border-color: color-mix(in srgb, var(--accent-red) 40%, var(--border-color));
}
.filter-input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font: inherit;
  font-size: 12.5px;
  padding: 6px 8px;
}
.filter-add-btn {
  flex: none;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--accent-blue);
  color: #fff;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 10px;
  cursor: pointer;
}
[data-theme="dark"] .filter-add-btn { color: var(--bg-primary); }

.suggest-list {
  margin-top: 6px;
  max-height: 160px;
  overflow-y: auto;
  border-top: 1px solid var(--border-color);
}
.suggest-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 7px 8px;
  margin: 0;
  font: inherit;
  font-size: 12.5px;
  color: var(--text-primary);
  cursor: pointer;
  border-radius: 6px;
}
.suggest-item:hover { background: var(--bg-hover); }

.hint {
  max-width: 760px;
  margin: 6px auto 22px;
  font-size: 13px;
  color: var(--text-muted);
}
.hint b { color: var(--accent-blue); }
.rescount {
  max-width: 680px;
  margin: 0 auto 14px;
  font-size: 13px;
  color: var(--text-muted);
}

/* Literal query-term highlighting in Search results (server-built from
 * escaped segments — see app.main._highlight_query_terms — never |safe
 * on raw input). */
mark {
  background: color-mix(in srgb, var(--accent-orange) 40%, transparent);
  color: var(--text-primary);
  border-radius: 3px;
  padding: 0 1px;
}

/* ---- "Find similar quotes" (Task 8): seed card + match-strength bar ---- */
.seed-stream { max-width: 680px; margin: 0 auto 8px; }
.similar-head {
  max-width: 680px;
  margin: 28px auto 16px;
  text-align: center;
}
.matchbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 0;
  font-size: 11.5px;
  color: var(--text-muted);
}
.matchbar-track {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--border-color);
  overflow: hidden;
}
.matchbar-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--accent-blue);
}
.matchpct { flex: none; font-weight: 500; }

/* ---- "In context" reader view (Task 4): article body with the extracted
 * quote highlighted in place, plus a stance/sentiment/rationale footer.
 * Sentiment is shown ONLY here — never on cards elsewhere. ---- */
.reader {
  max-width: 680px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 30px 34px 26px;
  box-shadow: 0 1px 2px var(--shadow-color);
}
.reader-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.reader-meta .pub { font-weight: 600; color: var(--text-secondary); }
.reader-meta-links { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.reader-meta-links a { color: var(--accent-blue); font-weight: 500; }
.reader h1 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 30px;
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 18px;
  color: var(--text-primary);
}
.reader-excerpt {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic;
  font-size: 17px;
  color: var(--text-secondary);
  border-left: 3px solid var(--accent-blue);
  padding: 2px 0 2px 16px;
  margin: 0 0 20px;
}
.reader-body {
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-secondary);
}
/* The article body is now rendered as real <p> paragraphs (see
 * main._render_paragraphs), restoring the paragraph structure the stored
 * full_text carried only as bare newlines. Paragraph spacing does the work
 * pre-wrap used to fake — last paragraph drops its trailing margin. */
.reader-body p, .full-article p { margin: 0 0 .95em; }
.reader-body p:last-child, .full-article p:last-child { margin-bottom: 0; }
.reader-body mark#q, .full-article mark#q {
  background: color-mix(in srgb, var(--accent-orange) 45%, transparent);
  color: var(--text-primary);
  border-radius: 3px;
  padding: 0 2px;
  scroll-margin-top: 90px;
}
.reader-fallback { font-style: italic; }
.reader-note { color: var(--text-muted); font-size: 13.5px; }

/* Foreign article: the reader body shows the English translation, with the
 * original in a labelled, collapsible block below. */
.translated-badge {
  display: inline-block;
  font-size: 12.5px;
  color: var(--accent-orange);
  background: color-mix(in srgb, var(--accent-orange) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent-orange) 28%, transparent);
  border-radius: 20px;
  padding: 3px 11px;
  margin: 0 0 14px;
}
.reader-original { margin-top: 18px; padding-top: 4px; }
.orig-head {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.orig-title { font-size: 20px; margin: 6px 0 10px; color: var(--text-secondary); }
.reader-foot {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border-color);
}
.reader-sentiment {
  margin-top: 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}
.reader-rationale {
  margin-top: 8px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-muted);
}
.reader-flag { margin-top: 12px; font-size: 13px; }
.reader-back {
  max-width: 680px;
  margin: 18px auto 0;
  font-size: 13px;
}
.reader-back a { color: var(--accent-blue); font-weight: 500; }

/* Back-to-caller link (top crumb + bottom .reader-back), see the inline
 * history.back()+same-origin-guard handler in context.html — falls back
 * to "/" only when there's no usable referrer/history. */
.backlink { color: var(--accent-blue); font-weight: 500; text-decoration: none; }
.backlink:hover { text-decoration: underline; }

/* ---- Misquote/drift variants (Feature 1): every quote sharing a
 * cluster_id, word-diffed against the longest variant. Reuses .reader for
 * the card chrome and the global `mark` rule for the diff highlight. ---- */
.driftlink { color: var(--accent-orange) !important; }
.variants-head {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 26px;
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--text-primary);
}
.variants-speaker {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 18px;
}
.variants-list { display: flex; flex-direction: column; }
.variant-row {
  padding: 14px 0;
  border-top: 1px solid var(--border-color);
}
.variant-row:first-child { border-top: none; padding-top: 0; }
.variant-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.variant-meta .pub { font-weight: 600; color: var(--text-secondary); }
.variant-meta a { color: var(--accent-blue); font-weight: 500; }
.variant-text {
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0;
}

/* "hyper.nooz.ai" article-detail links, both in the card action row
 * (_card.html) and the "in context" page's meta row. */
.hyperlink { color: var(--accent-blue); font-weight: 500; text-decoration: none; }
.hyperlink:hover { opacity: .8; }

/* "Expand to full article" toggle + the full body it reveals (Task 4
 * rework: the context excerpt is the default reader content, the full
 * article is opt-in). */
.expand-btn {
  display: block;
  margin: 16px 0 0;
  padding: 8px 14px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-hover);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.expand-btn:hover { color: var(--text-primary); }
.full-article {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border-color);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-secondary);
}
.hidden { display: none; }

/* ---- Relationship graph (/graph) ----
 * Self-contained canvas force layout (static/js/graph.js) — no CDN/deps.
 * The wrap keeps the whole page from ever scrolling horizontally (the
 * canvas box is the one element allowed to define a fixed height). */
.graph-wrap {
  max-width: 920px;
  margin: 0 auto;
  padding: 18px 24px 60px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.graph-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.graph-controls .search { max-width: 340px; }

.graph-btn {
  padding: 7px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.graph-btn:hover { background: var(--bg-hover); }
.graph-btn[aria-pressed="true"] {
  background: var(--accent-blue);
  color: #fff;
  border-color: var(--accent-blue);
}
[data-theme="dark"] .graph-btn[aria-pressed="true"] {
  /* Same fix as .chip.on: grey theme's --accent-blue is too light for
   * white text to read on. */
  color: var(--bg-primary);
}

.graph-hint {
  font-size: 12px;
  color: var(--text-muted);
  opacity: 0.75;
}

#graph-canvas-box {
  position: relative;
  width: 100%;
  height: 70vh;
  min-height: 360px;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  background: var(--bg-card);
  overflow: hidden;
}
#graph {
  display: block;
  width: 100%;
  height: 100%;
  cursor: default;
}
#graph-canvas-box .empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  pointer-events: none;   /* never intercept canvas pan/zoom, even if shown */
}

.graph-tooltip {
  position: absolute;
  z-index: 6;
  pointer-events: none;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12.5px;
  color: var(--text-primary);
  box-shadow: 0 2px 8px var(--shadow-color);
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.graph-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--text-muted);
}
.graph-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.graph-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex: none;
}
.graph-swatch-person { background: var(--accent-blue); }
.graph-swatch-target { background: var(--bg-card); border: 2px solid var(--accent-purple); }
.graph-swatch-edge { width: 16px; height: 3px; border-radius: 2px; }
.graph-swatch-for { background: var(--accent-green); }
.graph-swatch-against { background: var(--accent-red); }
.graph-swatch-neutral { background: var(--text-muted); }

.graph-note {
  font-size: 12.5px;
  color: var(--text-muted);
}

/* ---- node action menu (popover shown on single-click) ---- */
.graph-node-menu {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 20;
  min-width: 190px;
  max-width: min(260px, calc(100% - 16px));
  max-height: calc(100% - 16px);
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: 0 4px 16px var(--shadow-color);
  padding: 6px;
  font-size: 13px;
}
.graph-node-menu-header {
  padding: 6px 10px 8px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 4px;
}
.graph-node-menu-title {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 13.5px;
  overflow-wrap: break-word;
}
.graph-node-menu-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}
.graph-node-menu-actions { display: flex; flex-direction: column; }
.graph-node-menu-back { margin-bottom: 4px; }

.graph-node-menu-neighbors { display: flex; flex-direction: column; }
.graph-node-menu-neighbor {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 7px 10px;
  margin: 0;
  font: inherit;
  font-size: 12.5px;
  color: var(--text-primary);
  cursor: pointer;
  border-radius: 6px;
}
.graph-node-menu-neighbor:hover { background: var(--bg-hover); }
.graph-node-menu-neighbor-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.graph-node-menu-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}
.graph-node-menu-dot.stance-for { background: var(--accent-green); }
.graph-node-menu-dot.stance-against { background: var(--accent-red); }
.graph-node-menu-dot.stance-neutral { background: var(--text-muted); }
.graph-node-menu-empty {
  padding: 8px 10px;
  font-size: 12.5px;
  color: var(--text-muted);
}

/* ---- Details view (GET /api/graph/node): headshot, sample quotes, richer
 * connections. Wider than the plain action menu, and its own body scrolls
 * independently so a long quote list never grows the popover past the
 * canvas box (the outer .graph-node-menu's max-height/overflow above is
 * the final clamp if this still doesn't fit). ---- */
.graph-node-menu.graph-node-menu-wide {
  width: 320px;
  max-width: min(320px, calc(100% - 16px));
}

.graph-node-menu-details-header { border-bottom: 1px solid var(--border-color); }
.graph-node-menu-details-top {
  display: flex;
  align-items: center;
  gap: 10px;
}
.graph-node-menu-details-titlewrap { min-width: 0; flex: 1; }
.graph-node-menu-avatar {
  width: 40px;
  height: 40px;
  font-size: 13px;
  flex: none;
}
.graph-node-menu-wiki {
  display: inline-block;
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--accent-blue);
  text-decoration: none;
}
.graph-node-menu-wiki:hover { text-decoration: underline; }

.graph-node-menu-details-body {
  max-height: 320px;
  overflow-y: auto;
}

.graph-node-menu-subheading {
  padding: 8px 10px 4px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.graph-node-menu-quotes { display: flex; flex-direction: column; }
.graph-node-menu-quote {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  text-decoration: none;
  color: inherit;
}
.graph-node-menu-quote:hover { background: var(--bg-hover); }
.graph-node-menu-quote-dot {
  flex: none;
  font-size: 9px;
  line-height: 1.6;
}
.graph-node-menu-quote-dot.stance-for { color: var(--accent-green); }
.graph-node-menu-quote-dot.stance-against { color: var(--accent-red); }
.graph-node-menu-quote-dot.stance-neutral { color: var(--text-muted); }
.graph-node-menu-quote-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.graph-node-menu-quote-text {
  font-size: 12.5px;
  color: var(--text-primary);
  line-height: 1.4;
  overflow-wrap: break-word;
}
.graph-node-menu-quote-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.graph-node-menu-neighbor-static { cursor: default; }
.graph-node-menu-neighbor-static:hover { background: none; }
.graph-node-menu-neighbor-static .graph-node-menu-neighbor-label { flex: 1; }
.graph-node-menu-neighbor-count {
  flex: none;
  font-size: 11px;
  color: var(--text-muted);
}

/* ---- Content pages (/about, /help) + site footer -------------------------- */
.page {
  max-width: 820px;
  margin: 0 auto;
  padding: 32px 24px 56px;
}
.page-hero { padding: 20px 0 30px; border-bottom: 1px solid var(--border-color); margin-bottom: 8px; }
.page-hero.compact { padding-bottom: 20px; }
.page-eyebrow {
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-blue);
  margin: 0 0 10px;
}
.page-h1 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: 42px;
  line-height: 1.1;
  letter-spacing: -.01em;
  margin: 0 0 14px;
  text-wrap: balance;
  color: var(--text-primary);
}
.page-lede { font-size: 18px; line-height: 1.55; color: var(--text-secondary); margin: 0; max-width: 60ch; }
.page-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 22px; }
.page-btn {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 24px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
}
.page-btn:hover { background: var(--bg-hover); }
.page-btn.primary { background: var(--accent-blue); border-color: var(--accent-blue); color: #fff; }
[data-theme="dark"] .page-btn.primary { color: #111112; }

.page-sec { padding: 26px 0; border-bottom: 1px solid var(--border-color); }
.page-sec:last-child { border-bottom: 0; }
.page-h2 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: 26px;
  margin: 0 0 14px;
  color: var(--text-primary);
}
.page-sec p { font-size: 15.5px; line-height: 1.65; color: var(--text-secondary); margin: 0 0 12px; max-width: 66ch; }
.page-sec p:last-child { margin-bottom: 0; }

.page-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.page-feature {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
}
.page-feature h3 { margin: 0 0 6px; font-size: 15px; color: var(--text-primary); }
.page-feature p { font-size: 13.5px; line-height: 1.5; color: var(--text-secondary); margin: 0 0 10px; }
.page-feature a { color: var(--accent-blue); font-weight: 600; font-size: 13px; text-decoration: none; }
.page-feature a:hover { text-decoration: underline; }

.page-list { margin: 0; padding-left: 20px; }
.page-list li { font-size: 15px; line-height: 1.6; color: var(--text-secondary); margin-bottom: 8px; max-width: 64ch; }

.page-dl { margin: 0; }
.page-dl dt { font-weight: 700; color: var(--text-primary); font-size: 15px; margin-top: 12px; }
.page-dl dt:first-child { margin-top: 0; }
.page-dl dd { margin: 3px 0 0; font-size: 14.5px; line-height: 1.55; color: var(--text-secondary); }

.page-table { border-collapse: collapse; width: 100%; max-width: 560px; margin: 4px 0 4px; }
.page-table td { padding: 7px 12px 7px 0; vertical-align: top; font-size: 14.5px; color: var(--text-secondary); border-bottom: 1px solid var(--border-color); }
.page-table td:first-child { white-space: nowrap; }
.page code, .page-table code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-radius: 5px;
  padding: 1px 6px;
  color: var(--text-primary);
  white-space: nowrap;
}
.page-link { color: var(--accent-blue); font-weight: 600; text-decoration: none; }
.page-link:hover { text-decoration: underline; }
.page-fineprint p { font-size: 13.5px; color: var(--text-muted); }

/* Stats page (/stats) — big-number cards. */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.stat-grid-3 { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); max-width: 520px; }
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
}
.stat-num {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: 40px;
  line-height: 1;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.stat-num-sm { font-size: 22px; }
.stat-label { font-size: 13px; color: var(--text-muted); font-weight: 500; }

.help-dot { display: inline-block; width: 1.2em; text-align: center; font-size: 11px; }
.help-dot.for { color: var(--accent-green); }
.help-dot.against { color: var(--accent-red); }
.help-dot.neutral { color: var(--text-muted); }

.site-foot {
  border-top: 1px solid var(--border-color);
  background: color-mix(in srgb, var(--bg-secondary) 70%, transparent);
  margin-top: 40px;
}
.site-foot-inner { max-width: 920px; margin: 0 auto; padding: 26px 24px; }
.site-foot-brand { font-weight: 700; font-size: 15px; color: var(--text-secondary); }
.site-foot-brand b { color: var(--accent-blue); }
.site-foot-tag { display: block; font-weight: 400; font-size: 13px; color: var(--text-muted); margin-top: 3px; font-family: 'Cormorant Garamond', serif; font-style: italic; font-size: 15px; }
.site-foot-nav { display: flex; gap: 20px; flex-wrap: wrap; margin: 14px 0 12px; }
.site-foot-nav a { color: var(--text-secondary); font-size: 14px; font-weight: 500; text-decoration: none; }
.site-foot-nav a:hover { color: var(--text-primary); text-decoration: underline; }
.site-foot-note { font-size: 12.5px; color: var(--text-muted); margin: 0; max-width: 60ch; line-height: 1.5; }
.site-foot-ext { margin-top: 2px; margin-bottom: 14px; }
.site-foot-ext a { color: var(--text-muted); }
.site-foot-copy { font-size: 12px; color: var(--text-muted); margin: 12px 0 0; }

@media (max-width: 560px) {
  .page-h1 { font-size: 34px; }
  .page { padding: 24px 18px 44px; }
}
