/* ============================================================
   Legacy variable compatibility bridge
   Maps old newssite CSS variable names → new design tokens
   Load after tokens.css to ensure token values are resolved.
   ============================================================ */

/* White text over (possibly bright) hero/feature images — guarantee legibility
   with a deeper gradient scrim + a strong text shadow under the white lettering. */
.hero-lead::before,
.splitfeat-main::before {
  background: linear-gradient(to top,
      rgba(5,8,16,0.95) 0%,
      rgba(5,8,16,0.72) 38%,
      rgba(5,8,16,0.34) 66%,
      rgba(5,8,16,0.08) 100%);
}
.hero-lead-body,
.splitfeat-main .b {
  text-shadow: 0 1px 2px rgba(0,0,0,0.6), 0 4px 18px rgba(0,0,0,0.55);
}
.hero-lead-body h1,
.splitfeat-main .b h3 { text-shadow: 0 2px 4px rgba(0,0,0,0.65), 0 6px 22px rgba(0,0,0,0.5); }
/* a subtle frosted plate behind the text block for the worst-case bright image */
.hero-lead-body::before {
  content: "";
  position: absolute; inset: auto -34px -34px -34px; top: -20px;
  z-index: -1;
  background: linear-gradient(to top, rgba(5,8,16,0.55), transparent 85%);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  pointer-events: none;
}

/* Nav "Saved" count badge */
.wn-saved-count {
  position: absolute; top: 2px; right: 2px;
  min-width: 15px; height: 15px; padding: 0 3px;
  background: var(--brand); color: #fff;
  font-family: var(--font-mono); font-size: 9px; font-weight: 600; line-height: 15px;
  text-align: center; border-radius: 999px;
}

/* Saved (bookmarked) state for the article Save button + Listen playing state */
.share-btn.wn-save.saved { color: var(--brand); border-color: var(--brand-line); background: var(--brand-soft); }
.share-btn.wn-save.saved svg path { fill: var(--brand); }
.ai-summary-head .listen.playing { color: var(--cat-ai); border-color: var(--cat-ai); background: var(--cat-ai-soft); }
.ai-summary-head .listen { margin-left: auto; }

/* Live (responsive/multiplex) AdSense units need flexible height, not the
   fixed leaderboard/MPU box the theme uses for placeholders. */
.ad.is-live {
  height: auto;
  min-height: 100px;
  aspect-ratio: auto;
  display: block;
  padding: 10px;
}
.ad.is-live .adsbygoogle { display: block; width: 100%; }

/* Real images filling theme media containers (which position .mesh absolute) */
.wn-cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  z-index: 0;
}
.card-media, .river-item .thumb, .hero-sec .thumb, .hero-lead,
.art-hero, .splitfeat-main, .cat-hero-bg { position: relative; }

:root {
  /* Brand / primary */
  --primary:        var(--brand);
  --primary-hover:  var(--brand-ink);
  --primary-active: var(--brand-ink);
  --primary-dark:   var(--brand-ink);
  --primary-light:  var(--brand-soft);
  --primary-rgb:    0, 120, 212;
  --accent:         var(--brand);

  /* Backgrounds */
  --bg-alt:         var(--surface-2);
  --bg-elevated:    var(--surface);
  --card-bg:        var(--surface);

  /* Text */
  --text-primary:   var(--text);
  --text-secondary: var(--text-2);
  --text-muted:     var(--text-3);
  --text-light:     var(--text-faint);

  /* Borders */
  --border:         var(--line);
  --border-light:   var(--line-2);

  /* Nav glass */
  --nav-bg:         var(--glass-bg);
  --nav-border:     var(--glass-edge);
  --nav-blur:       var(--glass-blur);

  /* Shadow aliases */
  --shadow-xs:  var(--sh-xs);
  --shadow-sm:  var(--sh-sm);
  --shadow:     var(--sh-sm);
  --shadow-md:  var(--sh-md);
  --shadow-lg:  var(--sh-lg);
  --shadow-xl:  var(--sh-xl);
  --shadow-2xl: var(--sh-xl);

  /* Misc */
  --hover-bg:      var(--brand-soft);
  --surface-hover: var(--surface-2);
  --success:       var(--cat-enterprise);
  --warning:       var(--cat-dev);
  --error:         var(--cat-security);
  --info:          var(--brand);
  --code-bg:       var(--surface-3);
  --gradient-primary: linear-gradient(135deg, var(--brand) 0%, var(--brand-bright) 100%);
}

/* ---- .container compatibility ---- */
.container {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 28px;
}
@media (max-width: 980px) {
  .container { padding: 0 18px; }
}

/* ---- Article grid (legacy homepage grid, kept until index.php is migrated) ---- */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--gap);
  margin: 24px 0;
}
.article {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: transform .18s, box-shadow .2s, border-color .2s;
  display: flex;
  flex-direction: column;
}
.article:hover { transform: translateY(-3px); box-shadow: var(--sh-lg); border-color: var(--line-2); }
.article-image {
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--skeleton);
  position: relative;
}
.article-image img, .article-image picture { width: 100%; height: 100%; object-fit: cover; display: block; }
.article-body { padding: 16px; flex: 1; display: flex; flex-direction: column; }
.article-title {
  font-family: var(--font-display);
  font-weight: 700; font-size: 17px; line-height: 1.2;
  letter-spacing: -0.02em; margin: 0 0 8px;
  color: var(--text);
}
.article-title a { color: inherit; text-decoration: none; }
.article-title a:hover { color: var(--brand); }
.article-prefix {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 3px 8px; border-radius: var(--r-xs);
  background: var(--brand-soft); color: var(--brand);
  margin-bottom: 8px; text-decoration: none;
}
.article-date {
  font-family: var(--font-mono);
  font-size: 11px; color: var(--text-faint);
  margin-top: auto; padding-top: 12px;
  letter-spacing: 0.03em;
}
.article-tag {
  display: inline-block;
  font-family: var(--font-mono); font-size: 10.5px;
  color: var(--text-3); border: 1px solid var(--line);
  border-radius: var(--r-pill); padding: 3px 8px;
  text-decoration: none; margin: 2px;
  transition: border-color .15s, color .15s;
}
.article-tag:hover { border-color: var(--brand-line); color: var(--brand); }
.article-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }

/* ---- Daily summaries section ---- */
.daily-section { margin: 32px 0; }
.daily-section h2 {
  font-family: var(--font-display); font-weight: 700;
  font-size: 20px; letter-spacing: -0.02em; color: var(--text);
  margin-bottom: 16px;
}

/* ---- Pagination ---- */
.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; margin: 40px 0;
}
.pagination-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 38px; height: 38px; padding: 0 12px;
  font-family: var(--font-ui); font-size: 14px; font-weight: 500;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text-2);
  text-decoration: none;
  transition: border-color .15s, color .15s, background .15s;
}
.pagination-btn:hover { border-color: var(--brand-line); color: var(--brand); background: var(--brand-soft); }
.pagination-btn.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.pagination-btn:disabled,
.pagination-btn.disabled { opacity: .4; pointer-events: none; }
.pagination-ellipsis { color: var(--text-faint); padding: 0 4px; }

/* ---- Scroll-to-top button ---- */
.scroll-top {
  position: fixed; bottom: 24px; right: 24px; z-index: 50;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: none; align-items: center; justify-content: center;
  box-shadow: var(--sh-md);
  transition: background .2s, box-shadow .2s;
}
.scroll-top.visible { display: flex; }
.scroll-top:hover { background: var(--brand-ink); }

/* ---- No-results / empty state ---- */
.no-articles { text-align: center; padding: 60px 20px; color: var(--text-3); }
.no-articles h2 { font-family: var(--font-display); font-size: 22px; font-weight: 700; color: var(--text); margin-bottom: 8px; }

/* ============================================================
   Secondary pages re-theme — archive / search / podcast / FAQ
   (theme chrome already comes from nav/footer; this themes the bodies)
   ============================================================ */
.main-container, .podcast-page, .search-main { background: var(--bg-page); color: var(--text); }
.archive-index .container, .main-container > .container { max-width: var(--wrap-wide); margin: 0 auto; padding: 0 28px; }

/* Archive */
.archive-header { padding: 26px 0 22px; border-bottom: 1px solid var(--line); background: var(--surface); }
.archive-header .breadcrumb { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.archive-header .breadcrumb a { color: var(--text-3); } .archive-header .breadcrumb .separator { opacity:.5; }
.archive-title { font-family: var(--font-display); font-weight: 800; font-size: clamp(26px,3.4vw,42px); letter-spacing: -.03em; color: var(--text); margin: 12px 0 6px; }
.archive-description { color: var(--text-2); font-size: 15px; max-width: 64ch; line-height: 1.5; }
.archive-meta { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-faint); margin-top: 14px; display: flex; gap: 18px; }
.archive-main > h2 { font-family: var(--font-display); font-weight: 700; font-size: 20px; letter-spacing: -.02em; margin: 18px 0 14px; }
.quick-links { display: grid; grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); gap: 12px; margin: 20px 0; }
.quick-link { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); color: var(--text); font-weight: 600; font-size: 14px; text-decoration: none; transition: border-color .15s, transform .15s; }
.quick-link:hover { border-color: var(--brand-line); transform: translateY(-2px); color: var(--brand); }
.archive-years { display: grid; grid-template-columns: repeat(auto-fit,minmax(220px,1fr)); gap: 16px; margin-top: 16px; }
.archive-year { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; background: var(--surface); }
.archive-year h3 a { font-family: var(--font-display); font-size: 18px; color: var(--text); }
.archive-months { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.archive-month { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-3); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 4px 10px; text-decoration: none; }
.archive-month:hover { color: var(--brand); border-color: var(--brand-line); }
.pagination { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 30px 0; }
.page-numbers { display: inline-flex; gap: 6px; }
.page-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 38px; height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-sm); font-family: var(--font-mono); font-size: 13px; color: var(--text-2); background: var(--surface); text-decoration: none; }
.page-btn.current { background: var(--brand); color: #fff; border-color: var(--brand); }
.page-btn:hover { border-color: var(--brand-line); color: var(--brand); }

/* Search results */
.results-list { display: flex; flex-direction: column; }
.result-item { padding: 18px 0; border-bottom: 1px solid var(--line); }
.result-item.has-image { display: grid; grid-template-columns: 160px 1fr; gap: 18px; align-items: start; }
.result-image { border-radius: var(--r-md); overflow: hidden; aspect-ratio: 16/11; background: var(--skeleton); }
.result-image img { width: 100%; height: 100%; object-fit: cover; }
.result-title { font-family: var(--font-display); font-weight: 700; font-size: 18px; line-height: 1.18; letter-spacing: -.02em; color: var(--text); }
.result-item:hover .result-title, .result-title:hover { color: var(--brand); }
.result-excerpt { color: var(--text-3); font-size: 14px; line-height: 1.5; margin-top: 5px; }
.result-meta { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.result-count { font-family: var(--font-mono); font-size: 11px; color: var(--text-3); }
.no-results, .no-articles, .error-message { text-align: center; padding: 56px 20px; color: var(--text-3); }
.no-articles h2 { font-family: var(--font-display); color: var(--text); }

/* Podcast */
.broadcast-header { padding: 22px 0; border-bottom: 1px solid var(--line); background: var(--surface); }
.podcast-grid { display: grid; gap: 22px; padding: 24px 0; }
.podcast-player-section, .live-feed-section, .broadcast-status { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.podcast-player-section, .live-feed-section { padding: 20px; }

/* FAQ / static page bodies */
.content-body { font-family: var(--font-read); font-size: 17px; line-height: 1.7; color: var(--text-2); }
.content-body h2, .content-body h3 { font-family: var(--font-display); color: var(--text); letter-spacing: -.02em; }
.faq-categories-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(260px,1fr)); gap: 16px; margin: 22px 0; }
/* !important: overrides inline critical-CSS that paints these dark in light mode */
.faq-category-card { border: 1px solid var(--line) !important; border-radius: var(--r-lg); background: var(--surface) !important; padding: 18px; }
.faq-category-header { font-family: var(--font-display); font-weight: 700; font-size: 16px; margin-bottom: 8px; color: var(--text) !important; }
.faq-item { border-bottom: 1px solid var(--line) !important; background: transparent !important; }
.faq-question { font-weight: 600; font-size: 15px; color: var(--text) !important; background: transparent !important; padding: 12px 0; cursor: pointer; width: 100%; text-align: left; display: flex; align-items: center; justify-content: space-between; gap: 10px; border: none; }
.faq-question:hover { color: var(--brand) !important; }
.faq-answer { color: var(--text-3) !important; background: transparent !important; font-size: 14px; line-height: 1.6; padding-bottom: 12px; }
.faq-answer p { color: var(--text-3) !important; }

/* ---- Briefing page (/briefing) ---- */
.wn-brief-prose { max-width: 760px; }
.wn-brief-prose p { font-family: var(--font-read); font-size: 16.5px; line-height: 1.75; color: var(--text-2); margin: 0 0 18px; }
.wn-topic-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
.wn-insight-panel { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); padding: 18px 20px; margin-bottom: 14px; }
.wn-insight-panel .h { display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin-bottom: 8px; }
.wn-insight-panel p { font-size: 14.5px; line-height: 1.65; color: var(--text-2); margin: 0; }
.wn-timeline { display: flex; flex-direction: column; margin-top: 6px; }
.wn-tl-bucket { display: grid; grid-template-columns: 132px 1fr; gap: 18px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.wn-tl-bucket:last-child { border-bottom: none; }
.wn-tl-time { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; display: flex; align-items: flex-start; gap: 8px; padding-top: 3px; }
.wn-tl-time .d { width: 8px; height: 8px; border-radius: 50%; background: var(--cat-ai); flex: none; margin-top: 2px; box-shadow: 0 0 0 3px color-mix(in oklab, var(--cat-ai) 22%, transparent); }
.wn-tl-items { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.wn-tl-item { display: block; color: var(--text); }
.wn-tl-item h4 { font-family: var(--font-display); font-size: 15.5px; font-weight: 700; letter-spacing: -.01em; line-height: 1.35; margin: 0 0 4px; }
.wn-tl-item:hover h4 { color: var(--brand); }
.wn-tl-item p { font-size: 13px; color: var(--text-3); line-height: 1.5; margin: 0 0 6px; }
.mostread .mr-item.active .rt { color: var(--brand); }
@media (max-width: 700px) { .wn-tl-bucket { grid-template-columns: 1fr; gap: 6px; } }

/* Footer: 3 link columns (was 4 — Legal column removed in the dedupe) */
.footer-main { grid-template-columns: 1.6fr repeat(3, 1fr); }
