/* ============================================================
   INFORMED — reader UI
   Authoritative editorial system: warm paper, ink, one crimson
   accent. Newsreader (serif display) + Inter (sans body).
   Light by default; dark via [data-theme="dark"] or OS pref.
   ============================================================ */

:root {
  --paper:    #FAF9F6;
  --surface:  #FFFFFF;
  --ink:      #14161B;
  --strong:   #000000;
  --muted:    #5B5F66;
  --faint:    #8A8F97;
  --line:     #E6E3DC;
  --line-soft:#EFEDE7;
  --accent:   #B11226;   /* authoritative crimson */
  --accent-ink:#8E0E1E;
  --good:     #1E7A4B;   /* verified */
  --good-bg:  #E7F2EC;
  --tag-bg:   #F1EFE9;

  --maxw: 720px;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20,22,27,.05), 0 8px 24px rgba(20,22,27,.04);

  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans:  "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

[data-theme="dark"] {
  --paper:    #0E0F13;
  --surface:  #15171C;
  --ink:      #ECEAE4;
  --strong:   #FFFFFF;
  --muted:    #9AA0A8;
  --faint:    #6C727B;
  --line:     #23262D;
  --line-soft:#1C1F25;
  --accent:   #E5484D;
  --accent-ink:#F26669;
  --good:     #54B98A;
  --good-bg:  #14241D;
  --tag-bg:   #1C1F25;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.25);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:#0E0F13; --surface:#15171C; --ink:#ECEAE4; --strong:#FFFFFF;
    --muted:#9AA0A8; --faint:#6C727B; --line:#23262D; --line-soft:#1C1F25;
    --accent:#E5484D; --accent-ink:#F26669; --good:#54B98A; --good-bg:#14241D; --tag-bg:#1C1F25;
    --shadow:0 1px 2px rgba(0,0,0,.3),0 10px 30px rgba(0,0,0,.25);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }

/* ----- Masthead ----------------------------------------------------- */
.masthead {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.masthead-inner {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px 10px;
}
.wordmark {
  font-family: var(--serif);
  font-weight: 700; font-size: 24px; letter-spacing: -.02em;
  color: var(--accent);
}
.wordmark-dot { color: var(--accent); }
.masthead-right { display: flex; align-items: center; gap: 14px; }
.live {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; letter-spacing: .08em;
  color: var(--muted);
}
.live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent);
  animation: pulse 2.4s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); }
  70%  { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.icon-btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 15px;
  display: grid; place-items: center; transition: color .15s, border-color .15s;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }

.masthead-rule { height: 2px; background: var(--accent); max-width: var(--maxw); margin: 0 auto; }

.chips {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; gap: 8px; padding: 10px 18px;
  overflow-x: auto; scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; cursor: pointer;
  font-size: 12.5px; font-weight: 500; letter-spacing: .01em;
  padding: 6px 13px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  white-space: nowrap; transition: all .15s;
}
.chip:hover { color: var(--ink); border-color: var(--faint); }
.chip[aria-pressed="true"] {
  background: var(--ink); color: var(--paper); border-color: var(--ink);
}

/* ----- App shell ---------------------------------------------------- */
.app { max-width: var(--maxw); margin: 0 auto; padding: 8px 18px 40px; min-height: 60vh; }

/* ----- Feed --------------------------------------------------------- */
/* every story is a card */
.story {
  display: block; cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 12px;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.story:hover { border-color: var(--faint); box-shadow: var(--shadow); transform: translateY(-1px); }
.story:hover .headline { color: var(--accent); }
.story .headline {
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(19px, 5vw, 22px); line-height: 1.18; letter-spacing: -.01em;
  color: var(--ink); margin: 8px 0 7px; transition: color .15s;
}
.story .dek {
  color: var(--muted); font-size: 14.5px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* lead card — solid red, white text (same type size as other cards) */
.lead.story {
  margin: 8px 0 14px;
  background: var(--accent);
  border-color: var(--accent);
}
.lead.story:hover { border-color: var(--accent); }
.lead .headline { color: #fff; }
.lead.story:hover .headline { color: #fff; }
.lead .dek { color: rgba(255, 255, 255, .88); max-width: 40em; -webkit-line-clamp: 3; }
.lead .kicker .tag { color: #fff; }
.lead .kicker .co { color: rgba(255, 255, 255, .78); }
.lead .kicker .co::before { color: rgba(255, 255, 255, .4); }
.lead .meta, .lead .meta span { color: rgba(255, 255, 255, .75); }

.feed-list { display: flex; flex-direction: column; }

/* kicker + meta */
.kicker {
  display: flex; align-items: center; gap: 9px;
  font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase;
}
.tag {
  font-weight: 600; color: var(--accent);
}
.kicker .co { color: var(--faint); font-weight: 500; }
.kicker .co::before { content: "·"; margin-right: 9px; color: var(--line); }

.meta {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 9px; font-size: 12px; color: var(--faint);
}
.meta .dot { color: var(--line); }
.verified {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--good); font-weight: 600;
}
.verified svg { width: 13px; height: 13px; }

/* ----- Article ------------------------------------------------------ */
.back {
  display: inline-flex; align-items: center; gap: 6px;
  margin: 16px 0 4px; font-size: 13px; font-weight: 500; color: var(--muted);
}
.back:hover { color: var(--accent); }

.article { padding: 6px 0 8px; }
.article-head { padding: 10px 0 18px; border-bottom: 1px solid var(--line); margin-bottom: 26px; }
.article-head .headline {
  font-family: var(--serif); font-weight: 700;
  font-size: clamp(28px, 7.5vw, 44px); line-height: 1.07; letter-spacing: -.022em;
  color: var(--strong); margin: 12px 0 16px;
}
.byline {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 13px; color: var(--muted);
}
.byline .src { font-weight: 600; color: var(--ink); }
.byline .src a { color: inherit; text-decoration: none; }
.byline .src a:hover { text-decoration: underline; }

/* rendered body */
.prose { font-size: 17px; line-height: 1.66; color: var(--ink); }
.prose > *:first-child { margin-top: 0; }
.prose h2 {
  font-family: var(--serif); font-weight: 600; letter-spacing: -.01em;
  font-size: 23px; line-height: 1.2; margin: 38px 0 12px; color: var(--strong);
}
.prose h3 {
  font-family: var(--serif); font-weight: 600;
  font-size: 19px; margin: 28px 0 10px; color: var(--strong);
}
.prose p { margin: 0 0 18px; }
.prose strong { color: var(--strong); font-weight: 600; }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
.prose ul, .prose ol { margin: 0 0 18px; padding-left: 1.25em; }
.prose li { margin: 4px 0; }
.prose blockquote {
  margin: 18px 0; padding: 4px 0 4px 18px; border-left: 3px solid var(--accent);
  color: var(--muted); font-style: italic;
}
.prose hr { border: none; border-top: 1px solid var(--line); margin: 30px 0; }
.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88em;
  background: var(--tag-bg); padding: 1px 5px; border-radius: 5px;
}

/* tables (IPO snapshots etc.) — scrollable on mobile */
.prose .table-wrap { overflow-x: auto; margin: 0 0 22px; -webkit-overflow-scrolling: touch; }
.prose table {
  border-collapse: collapse; width: 100%; font-size: 14.5px;
  border: 1px solid var(--line);
}
.prose th, .prose td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.prose thead th {
  background: var(--tag-bg); font-weight: 600; color: var(--strong);
  font-size: 12px; letter-spacing: .03em; text-transform: uppercase; white-space: nowrap;
}
.prose tbody tr:last-child td { border-bottom: none; }

/* inline citation markers [n] */
.prose .cite {
  font-size: .62em; font-weight: 600; vertical-align: super; line-height: 0;
  color: var(--accent); padding: 0 1px;
}

/* Sources reference list */
.prose h2.sources-h {
  font-size: 13px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); font-family: var(--sans); font-weight: 600;
  margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--line);
}
.prose ol.sources { list-style: none; margin: 0; padding: 0; counter-reset: none; }
.prose li.ref {
  display: flex; gap: 10px; align-items: baseline;
  padding: 7px 0; border-bottom: 1px solid var(--line-soft);
  font-size: 13.5px; line-height: 1.45;
}
.prose li.ref:last-child { border-bottom: none; }
.prose .ref-n {
  flex: 0 0 auto; min-width: 18px; text-align: right;
  color: var(--accent); font-weight: 600; font-variant-numeric: tabular-nums;
}
.prose .ref-body { color: var(--muted); word-break: break-word; }
.prose .ref-body a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); }
.prose .ref-body a:hover { color: var(--accent); border-color: var(--accent); }
.prose li.ref:target { background: var(--good-bg); border-radius: 6px; }

.article-foot {
  margin-top: 34px; padding-top: 18px; border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--faint);
}

/* ----- States ------------------------------------------------------- */
.skel { background: linear-gradient(90deg, var(--line-soft) 25%, var(--line) 37%, var(--line-soft) 63%); background-size: 400% 100%; animation: sh 1.3s infinite; border-radius: 6px; }
@keyframes sh { 0%{background-position:100% 0} 100%{background-position:-100% 0} }
.skel-row { padding: 18px 0; border-bottom: 1px solid var(--line-soft); }
.skel-line { height: 12px; margin: 8px 0; }

.empty, .error {
  text-align: center; padding: 64px 20px; color: var(--muted);
}
.error { color: var(--accent); }
.empty .big { font-family: var(--serif); font-size: 22px; color: var(--ink); margin-bottom: 8px; }
.retry {
  margin-top: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  padding: 8px 16px; border-radius: 999px; cursor: pointer; font-size: 13px; font-weight: 500;
}
.retry:hover { border-color: var(--accent); color: var(--accent); }

/* ----- Search & Saved views ----------------------------------------- */
.view-title {
  font-family: var(--serif); font-weight: 700; letter-spacing: -.02em;
  font-size: 26px; color: var(--strong); margin: 18px 0 14px;
}
.searchbar { position: sticky; top: 0; padding: 14px 0 12px; background: var(--paper); z-index: 5; }
.searchbar input {
  width: 100%; box-sizing: border-box;
  font-family: var(--sans); font-size: 16px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 13px 16px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.searchbar input::placeholder { color: var(--faint); }
.searchbar input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }

/* save / bookmark button on article */
.save-btn {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  font-family: var(--sans); font-size: 13px; font-weight: 600;
  padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  transition: all .15s;
}
.save-btn svg { width: 15px; height: 15px; }
.save-btn:hover { border-color: var(--accent); color: var(--accent); }
.save-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ----- Auth / login ------------------------------------------------- */
.auth { max-width: 420px; margin: 0 auto; padding: 30px 4px 40px; }
.auth-title {
  font-family: var(--serif); font-weight: 700; letter-spacing: -.02em;
  font-size: 30px; color: var(--strong); margin: 0 0 8px;
}
.auth-sub { color: var(--muted); font-size: 15px; line-height: 1.5; margin: 0 0 26px; }
.auth-label {
  display: block; font-size: 12px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--faint); margin: 16px 0 8px;
}
.auth-input, .phone-field {
  width: 100%; box-sizing: border-box;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  transition: border-color .15s, box-shadow .15s;
}
.auth-input {
  font-family: var(--sans); font-size: 17px; color: var(--ink);
  padding: 14px 16px; outline: none;
}
.auth-input.otp { font-size: 24px; letter-spacing: .35em; text-align: center; font-variant-numeric: tabular-nums; }
.phone-field { display: flex; align-items: center; padding: 0 14px; }
.phone-field .cc { color: var(--muted); font-size: 17px; font-weight: 600; padding-right: 10px; border-right: 1px solid var(--line); }
.phone-field input {
  flex: 1; border: none; background: none; outline: none;
  font-family: var(--sans); font-size: 17px; color: var(--ink);
  padding: 14px 12px; letter-spacing: .03em;
}
.auth-input:focus, .phone-field:focus-within {
  border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
}
.auth-btn {
  width: 100%; margin-top: 22px; cursor: pointer;
  font-family: var(--sans); font-size: 16px; font-weight: 600;
  color: #fff; background: var(--accent); border: none; border-radius: 12px;
  padding: 15px; transition: opacity .15s, transform .1s;
}
.auth-btn:hover { opacity: .92; }
.auth-btn:active { transform: scale(.99); }
.auth-btn:disabled { opacity: .55; cursor: default; }
.auth-link {
  display: block; margin: 14px auto 0; background: none; border: none; cursor: pointer;
  color: var(--accent); font-family: var(--sans); font-size: 14px; font-weight: 500;
}
.auth-back { background: none; border: none; cursor: pointer; color: var(--muted);
  font-size: 13px; font-weight: 500; padding: 0; margin-bottom: 14px; }
.auth-back:hover { color: var(--accent); }
.auth-err { color: var(--accent); font-size: 13.5px; min-height: 18px; margin: 14px 0 0; text-align: center; }
.auth-dev {
  margin: 12px 0 0; padding: 10px 12px; border-radius: 10px;
  background: var(--good-bg); color: var(--good); font-size: 13px; text-align: center;
}

/* ----- Me / profile ------------------------------------------------- */
.me { max-width: 420px; margin: 0 auto; padding: 30px 4px 40px; text-align: center; }
.avatar {
  width: 76px; height: 76px; border-radius: 50%; margin: 6px auto 14px;
  display: grid; place-items: center;
  background: var(--accent); color: #fff;
  font-family: var(--serif); font-weight: 700; font-size: 34px;
}
.me-name { font-family: var(--serif); font-weight: 700; font-size: 26px; color: var(--strong); margin: 0 0 4px; }
.me-phone { color: var(--muted); font-size: 15px; margin-bottom: 22px; }
.me-stats { display: flex; justify-content: center; gap: 10px; margin-bottom: 24px; }
.me-stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 26px; display: flex; flex-direction: column; gap: 2px; min-width: 96px;
}
.me-stat .n { font-family: var(--serif); font-weight: 700; font-size: 24px; color: var(--accent); }
.me-stat .l { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.me-section-label {
  text-align: left; font-size: 12px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--faint); margin: 4px 2px 8px;
}
.me-actions { text-align: left; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface); }
.me-row {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  padding: 15px 16px; border: none; border-bottom: 1px solid var(--line-soft); background: none; cursor: pointer;
  font-family: var(--sans); font-size: 15px; color: var(--ink); text-align: left;
}
.me-row:last-child { border-bottom: none; }
.me-row:hover { background: var(--tag-bg); }
.me-row.danger { color: var(--accent); font-weight: 600; }
.me-row .chev { color: var(--faint); font-size: 20px; }
.me-row-right { display: inline-flex; align-items: center; gap: 8px; }
.me-row-val { color: var(--muted); font-size: 14px; }
.me-foot { color: var(--faint); font-size: 12px; margin-top: 20px; }

/* ----- Listen button (on article) ---------------------------------- */
.listen-btn {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  margin-top: 16px;
  font-family: var(--sans); font-size: 13.5px; font-weight: 600;
  padding: 9px 16px; border-radius: 999px;
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
  transition: opacity .15s, transform .1s;
}
.listen-btn svg { width: 16px; height: 16px; }
.listen-btn:hover { opacity: .92; }
.listen-btn:active { transform: scale(.98); }
.listen-btn.on {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
}

/* ----- Mini audio player (glass, above the tab bar) ----------------- */
.player {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(92px + env(safe-area-inset-bottom));
  z-index: 45;
  width: min(440px, calc(100% - 28px));
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 18px;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  -webkit-backdrop-filter: blur(24px) saturate(1.8);
  backdrop-filter: blur(24px) saturate(1.8);
  border: 1px solid color-mix(in srgb, var(--ink) 10%, transparent);
  box-shadow: 0 10px 30px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.25);
  animation: playerIn .25s ease;
}
@keyframes playerIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.player-play {
  flex: 0 0 auto; width: 42px; height: 42px; border-radius: 50%; cursor: pointer;
  border: none; background: var(--accent); color: #fff;
  display: grid; place-items: center;
}
.player-play svg { width: 20px; height: 20px; }
.player-body { flex: 1; min-width: 0; }
.player-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.player-kicker { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.player-count { font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }
.player-text {
  font-size: 13px; line-height: 1.35; color: var(--ink); margin: 3px 0 6px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.player-text.err { color: var(--accent); }
.player-bar { height: 3px; border-radius: 3px; background: var(--line); overflow: hidden; }
.player-bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s ease; }
.player-close {
  flex: 0 0 auto; border: none; background: none; cursor: pointer;
  color: var(--faint); font-size: 16px; padding: 4px; line-height: 1;
}
.player-close:hover { color: var(--accent); }

/* ----- Bottom glass tab bar (iOS-style) ----------------------------- */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 50;
  display: flex; gap: 4px;
  width: min(440px, calc(100% - 28px));
  padding: 7px;
  border-radius: 26px;
  background: color-mix(in srgb, var(--surface) 60%, transparent);
  -webkit-backdrop-filter: blur(24px) saturate(1.9);
  backdrop-filter: blur(24px) saturate(1.9);
  border: 1px solid color-mix(in srgb, var(--ink) 9%, transparent);
  box-shadow:
    0 10px 34px rgba(0,0,0,.20),
    0 2px 8px rgba(0,0,0,.10),
    inset 0 1px 0 rgba(255,255,255,.28);
}
[data-theme="dark"] .tabbar,
:root:not([data-theme="light"]) .tabbar {
  box-shadow: 0 10px 34px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.07);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 7px 4px; border: none; background: none; cursor: pointer;
  color: var(--faint); font-family: var(--sans); font-size: 10.5px; font-weight: 600;
  letter-spacing: .01em; border-radius: 18px;
  transition: color .15s, background .15s, transform .12s;
}
.tab svg { width: 22px; height: 22px; transition: transform .15s; }
.tab:hover { color: var(--ink); }
.tab:active { transform: scale(.92); }
.tab[aria-current="page"] {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 13%, transparent);
}

/* ----- Footer ------------------------------------------------------- */
.footer { border-top: 1px solid var(--line); margin-top: 30px; }
.footer-inner {
  max-width: var(--maxw); margin: 0 auto;
  padding: 22px 18px calc(110px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 6px;
}
.footer-mark { font-family: var(--serif); font-weight: 700; color: var(--ink); font-size: 15px; letter-spacing: -.01em; }
.footer-note { font-size: 12px; color: var(--faint); max-width: 42em; }

/* ----- Feeds (user-created topic feeds) ----------------------------- */
.feed-placeholder {
  font-size: 12.5px; color: var(--muted); background: var(--tag-bg);
  border: 1px dashed var(--line); border-radius: var(--radius); padding: 8px 12px; margin: 0 0 14px;
}

/* floating switcher — a pill showing the current feed, bottom-right */
.feed-fab {
  position: fixed; right: 18px; bottom: calc(96px + env(safe-area-inset-bottom));
  display: inline-flex; align-items: center; gap: 7px; padding: 11px 16px;
  border: none; border-radius: 999px; cursor: pointer;
  background: var(--accent); color: #fff; font-family: var(--sans); font-size: 14px; font-weight: 600;
  z-index: 48; box-shadow: 0 6px 20px rgba(177,18,38,.4), 0 2px 6px rgba(0,0,0,.2);
  transition: transform .15s;
}
.feed-fab svg { width: 18px; height: 18px; }
.feed-fab-label { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-fab-caret { font-size: 10px; opacity: .85; }
.feed-fab:active { transform: scale(.97); }

/* anchored navigator popover (opens just above the pill) */
.feed-nav-back { position: fixed; inset: 0; z-index: 100; background: transparent; }
.feed-nav {
  position: fixed; right: 18px; bottom: calc(96px + 52px + env(safe-area-inset-bottom));
  width: 232px; max-height: 54vh; overflow-y: auto; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 12px 36px rgba(0,0,0,.22);
  transform-origin: bottom right; transform: scale(.96); opacity: 0;
  transition: transform .14s ease, opacity .14s ease;
}
.feed-nav-back.open .feed-nav { transform: scale(1); opacity: 1; }
.feed-nav-list { display: flex; flex-direction: column; }
.feed-nav-item { display: flex; align-items: center; border-bottom: 1px solid var(--line-soft); }
.feed-nav-item:last-child { border-bottom: none; }
.feed-nav-pick {
  flex: 1; text-align: left; padding: 11px 12px; border: none; background: none; cursor: pointer;
  font-family: var(--serif); font-size: 16px; color: var(--ink);
}
.feed-nav-pick:hover { color: var(--accent); }
.feed-nav-item.active .feed-nav-pick { color: var(--accent); font-weight: 600; }
.feed-nav-del { border: none; background: none; color: var(--faint); font-size: 13px; cursor: pointer; padding: 6px 10px; }
.feed-nav-del:hover { color: var(--accent); }
.feed-nav-item.confirming { padding: 5px 10px; gap: 6px; }
.feed-nav-confirm { flex: 1; font-size: 13px; color: var(--muted); }
.feed-nav-yes { border: none; background: none; color: var(--accent); font-weight: 600; font-size: 13px; cursor: pointer; padding: 6px 8px; }
.feed-nav-no { border: none; background: none; color: var(--faint); font-size: 13px; cursor: pointer; padding: 6px 8px; }
.feed-nav-add { margin-top: 4px; border-top: 1px solid var(--line-soft); padding-top: 6px; }
.feed-nav-add input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px;
  font-family: var(--sans); font-size: 14px; color: var(--ink); background: var(--paper);
}
.feed-nav-add input:focus { outline: none; border-color: var(--accent); }
.feed-nav .auth-err { margin: 6px 4px 2px; font-size: 12px; }

/* ----- Card reader -------------------------------------------------- */
/* The reader fills the viewport; the only scroll is inside a card. */
body.in-reader .footer { display: none; }      /* drop the site footer in the reader */
body.cards-lock { overflow: hidden; }            /* no page scroll → no double scrollbar */
body.cards-lock .app { padding-bottom: 0; }

/* fills the space between masthead and the floating tab bar; tune --reader-h */
.reader {
  --reader-h: calc(100svh - 168px);
  display: flex; flex-direction: column; gap: 10px;
  height: var(--reader-h); min-height: 400px;
  padding-top: 6px;
}

/* article headline (first few words) — pinned at the top of content cards */
.rhead { padding: 0 2px; }
.rhead.hide, .rband.hide { display: none; }
.rhead-title {
  font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--faint);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* parent section — prominent heading ABOVE the deck; persists across a
   section's child cards */
.rband {
  display: flex; align-items: flex-end; min-height: 36px; padding: 0 2px;
  opacity: 0; transform: translateY(3px); transition: opacity .25s, transform .25s;
}
.rband.show { opacity: 1; transform: none; }
.rband-title {
  font-family: var(--serif); font-weight: 700; letter-spacing: -.022em;
  font-size: clamp(23px, 6.4vw, 31px); line-height: 1.08; color: var(--strong);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.cardstage {
  flex: 1; min-height: 0;
  display: flex; gap: 14px;
  overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory;   /* no CSS scroll-behavior:smooth — it loops with mandatory snap */
  -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.cardstage::-webkit-scrollbar { display: none; }

.rcard {
  flex: 0 0 100%; scroll-snap-align: start; scroll-snap-stop: always;
  min-width: 0; height: 100%;
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line); border-radius: 18px;
  overflow: hidden;
}
/* a hairline accent rule sits under the subheading */
.rcard-scroll {
  flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 26px 22px 30px;
}
.rcard-scroll::-webkit-scrollbar { width: 0; }
/* the card's own subheading, INSIDE the card above its body */
.rcard-sub {
  font-family: var(--serif); font-weight: 700; letter-spacing: -.01em;
  font-size: clamp(19px, 5vw, 23px); line-height: 1.2; color: var(--strong);
  margin: 0 0 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line-soft);
}
.rcard-body { font-size: 16.5px; line-height: 1.64; color: var(--ink); }
.rcard-body > *:first-child { margin-top: 0; }
.rcard-body h2, .rcard-body h3 { /* stray inline headings, if any */
  font-size: 18px; margin: 22px 0 8px;
}

/* cover card — crimson hero with a soft gradient */
.rcard-cover {
  border-color: transparent; justify-content: center;
  background: linear-gradient(158deg,
    color-mix(in srgb, var(--accent) 92%, #fff) 0%,
    var(--accent) 46%,
    var(--accent-ink) 100%);
  box-shadow: 0 1px 2px rgba(20,22,27,.06);
}
.rcard-coverin { display: flex; flex-direction: column; height: 100%; justify-content: center; padding: 34px 26px; }
.rcard-cover .kicker .tag, .rcard-cover .kicker .co { color: #fff; }
.rcard-cover .kicker .tag { letter-spacing: .08em; }
.rcard-cover .kicker .co::before { color: rgba(255,255,255,.5); }
.rcard-headline {
  font-family: var(--serif); font-weight: 700; letter-spacing: -.024em;
  font-size: clamp(29px, 8.2vw, 42px); line-height: 1.04; color: #fff;
  margin: 16px 0 18px;
  text-wrap: balance;
}
.rcard-cover .byline, .rcard-cover .byline span, .rcard-cover .byline .src,
.rcard-cover .verified { color: rgba(255,255,255,.92); }
.rcard-cover .byline .dot { color: rgba(255,255,255,.5); }
.rcard-cover-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 24px; }
.rcard-cover .listen-btn {
  margin-top: 0; background: #fff; color: var(--accent); border-color: #fff;
  box-shadow: 0 6px 18px -6px rgba(0,0,0,.35);
}
.rcard-cover .save-btn { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.5); color: #fff; }
.rcard-cover .save-btn[aria-pressed="true"] { background: #fff; color: var(--accent); border-color: #fff; }

/* Audio news — synced, per-language play control on the cover */
.audionews { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px;
  user-select: none; -webkit-user-select: none; }
.audionews[hidden] { display: none; }
.an-play {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  font-family: var(--sans); font-size: 13.5px; font-weight: 700; padding: 9px 16px;
  border-radius: 999px; border: 1px solid rgba(255,255,255,.55);
  background: rgba(255,255,255,.12); color: #fff; -webkit-tap-highlight-color: transparent;
  transition: opacity .15s, transform .1s;
}
.an-play svg { width: 15px; height: 15px; }
.an-play:active { transform: scale(.98); }
.audionews.on .an-play { background: #fff; color: var(--accent); border-color: #fff; }
.an-langs { display: inline-flex; gap: 6px; }
.an-lang {
  cursor: pointer; min-width: 34px; padding: 7px 11px; border-radius: 999px;
  font-family: var(--sans); font-size: 12px; font-weight: 700;
  border: 1px solid rgba(255,255,255,.5); background: rgba(255,255,255,.06); color: #fff;
  -webkit-tap-highlight-color: transparent;
}
.an-lang.on { background: #fff; color: var(--accent); border-color: #fff; }
.rcard-hint {
  margin-top: auto; padding-top: 30px;
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: rgba(255,255,255,.85);
}
.rcard-hint span { display: inline-block; font-size: 15px; animation: nudge 1.4s ease-in-out infinite; }
@keyframes nudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(5px); } }

/* no tap-flash / accidental text selection on the reader chrome */
.rhead, .rband, .rfoot, .rcard-hint, .rcard-cover-actions { user-select: none; -webkit-user-select: none; }
.rcard-cover .listen-btn, .rcard-cover .save-btn { -webkit-tap-highlight-color: transparent; }

/* progress + pager */
.rprogress { height: 4px; border-radius: 999px; background: var(--line-soft); overflow: hidden; }
.rprogress span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width .3s cubic-bezier(.4,0,.2,1); }

.rfoot { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 2px 2px 0; }
.rfoot-mid {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-width: 0; flex: 1;
}
.rcount { font-size: 11px; font-weight: 700; letter-spacing: .04em; color: var(--muted); font-variant-numeric: tabular-nums; }
.rnext-label {
  max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-size: 12px; font-weight: 600; color: var(--faint);
  opacity: 0; transition: opacity .2s;
}
.rnext-label.show { opacity: 1; }
.rnav {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  font-size: 18px; line-height: 1; display: grid; place-items: center;
  transition: border-color .15s, color .15s, background .15s, transform .1s;
  -webkit-tap-highlight-color: transparent;
}
.rnav:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.rnav:active:not(:disabled) { transform: scale(.9); background: color-mix(in srgb, var(--accent) 9%, var(--surface)); }
.rnav:disabled { opacity: .3; cursor: default; }
.rnav:focus { outline: none; }
.rnav:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }

/* ----- Desktop refinements ------------------------------------------ */
@media (min-width: 720px) {
  .app { padding-top: 14px; }
  .lead { display: grid; grid-template-columns: 1fr; }
}

/* ----- Server-rendered pages (trust / author / home / section) ------- */
/* These render server-side for crawlers; the trust + author pages are also the
   live human view (the SPA leaves SSR_ROOTS untouched), so they need real type. */
.footer-nav { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 10px; }
.footer-nav a { color: var(--muted); text-decoration: none; font-size: 13px; }
.footer-nav a:hover { color: var(--accent); }

.page { max-width: var(--maxw); margin: 0 auto; padding: 8px 0 24px; }
.page h1 { font-family: var(--serif, "Newsreader", Georgia, serif); font-size: 30px;
  line-height: 1.15; margin: 6px 0 14px; color: var(--strong, var(--ink)); }
.page h2 { font-size: 18px; margin: 22px 0 8px; }
.page p, .page li { color: var(--ink); line-height: 1.62; font-size: 16px; }
.page ul { padding-left: 20px; }
.page a { color: var(--accent); }
.author-role { color: var(--muted); margin-top: -8px; font-size: 15px; }
.author-articles { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 8px; }

.ssr-intro h1 { font-family: var(--serif, "Newsreader", Georgia, serif); font-size: 28px; }
.ssr-intro p { color: var(--muted); }
.ssr-list { list-style: none; padding: 0; margin: 8px 0; }
.ssr-list li { padding: 8px 0; border-bottom: 1px solid var(--line-soft, var(--line)); }
.ssr-list a { color: var(--ink); text-decoration: none; font-weight: 500; }
.ssr-list a:hover { color: var(--accent); }

.company-head h1 { font-family: var(--serif, "Newsreader", Georgia, serif); font-size: 28px; margin-bottom: 2px; }
.company-ticker { color: var(--muted); font-size: 14px; letter-spacing: .03em; margin-top: 0; }
