/* ==============================================================================
   BEYOND COSMIC HORIZON — Rich Editorial Theme & Unified Navigation System
   Provides:
   1. Persistent Glassmorphism Top Navigation Header with Portal routing
   2. Seamless Light & Dark Theme Variables across all rich articles
   3. Theme Switcher Controls (☀️ Light Mode / 🌙 Dark Mode)
   4. High-Impact Editorial Typography, Scoreboards, Chapters & Footers
   ============================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Archivo+Narrow:ital,wght@0,500;0,600;0,700;1,500&family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,700;1,9..40,400&family=Space+Grotesk:wght@600;700;800&family=Newsreader:ital,opsz,wght@0,6..72,400;0,6..72,600;1,6..72,400&display=swap');

/* --- 1. Global Navigation Bar --- */
.bch-site-nav-bar {
  position: sticky;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 10000;
  background: rgba(10, 14, 23, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0.65rem 1.25rem;
  transition: background 0.25s ease, border-color 0.25s ease;
  box-sizing: border-box;
}

[data-theme="light"] .bch-site-nav-bar,
html[data-theme="light"] .bch-site-nav-bar {
  background: rgba(248, 250, 252, 0.92);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.bch-nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.bch-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: #ffffff;
  font-family: 'Space Grotesk', -apple-system, sans-serif;
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  transition: opacity 0.2s;
}

[data-theme="light"] .bch-brand,
html[data-theme="light"] .bch-brand {
  color: #0f172a;
}

.bch-brand:hover {
  opacity: 0.85;
}

.bch-brand-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.bch-brand-text {
  line-height: 1.15;
}

.bch-nav-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.bch-nav-link {
  color: rgba(255, 255, 255, 0.78);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: 'DM Sans', -apple-system, sans-serif;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  transition: all 0.2s ease;
}

[data-theme="light"] .bch-nav-link,
html[data-theme="light"] .bch-nav-link {
  color: #475569;
}

.bch-nav-link:hover {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
}

[data-theme="light"] .bch-nav-link:hover,
html[data-theme="light"] .bch-nav-link:hover {
  color: #0284c7;
  background: rgba(2, 132, 199, 0.08);
}

.bch-nav-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.bch-theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.85rem;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: 'DM Sans', -apple-system, sans-serif;
  cursor: pointer;
  transition: all 0.2s ease;
}

[data-theme="light"] .bch-theme-toggle,
html[data-theme="light"] .bch-theme-toggle {
  border-color: rgba(0, 0, 0, 0.15);
  background: rgba(0, 0, 0, 0.05);
  color: #0f172a;
}

.bch-theme-toggle:hover {
  border-color: #38bdf8;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
}

.bch-back-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.95rem;
  border-radius: 6px;
  background: #38bdf8;
  color: #04151b !important;
  font-family: 'DM Sans', -apple-system, sans-serif;
  font-weight: 700;
  font-size: 0.82rem;
  text-decoration: none;
  transition: all 0.2s ease;
}

.bch-back-btn:hover {
  background: #7dd3fc;
  transform: translateY(-1px);
}

/* --- 2. Global Site Footer --- */
.bch-site-footer {
  width: 100%;
  background: #060b11;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 2.75rem 1.5rem;
  margin-top: 5rem;
  color: rgba(255, 255, 255, 0.65);
  font-family: 'DM Sans', -apple-system, sans-serif;
  font-size: 0.85rem;
  line-height: 1.6;
  box-sizing: border-box;
}

[data-theme="light"] .bch-site-footer,
html[data-theme="light"] .bch-site-footer {
  background: #f1f5f9;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  color: #475569;
}

.bch-footer-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.bch-footer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.bch-footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.95rem;
  color: #ffffff;
  font-weight: 700;
}

[data-theme="light"] .bch-footer-brand,
html[data-theme="light"] .bch-footer-brand {
  color: #0f172a;
}

.bch-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.35rem;
}

.bch-footer-link {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  transition: color 0.2s ease;
}

[data-theme="light"] .bch-footer-link,
html[data-theme="light"] .bch-footer-link {
  color: #64748b;
}

.bch-footer-link:hover {
  color: #38bdf8;
}

.bch-footer-copy {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 1.25rem;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.45);
}

[data-theme="light"] .bch-footer-copy,
html[data-theme="light"] .bch-footer-copy {
  border-top-color: rgba(0, 0, 0, 0.08);
  color: #94a3b8;
}

/* --- 3. Theme Overrides for Specific Muse Articles --- */
/* Ship 40 Overrides */
html[data-theme="light"] body {
  --paper: #eef0ec !important;
  --ink: #141918 !important;
  --muted: #53605b !important;
  --line: #c2c9c4 !important;
  --panel: #f8f9f6 !important;
  --deep: #102e2e !important;
  --teal: #087c78 !important;
  --signal: #f25c3b !important;
  --ocean: #174e5b !important;
  --foam: #dbe9e5 !important;
  --steel: #aab4af !important;
}

html[data-theme="dark"] body {
  --paper: #111615 !important;
  --ink: #eef2ed !important;
  --muted: #a9b4af !important;
  --line: #39433f !important;
  --panel: #19201e !important;
  --deep: #071f20 !important;
  --teal: #3fb6ad !important;
  --signal: #ff7759 !important;
  --ocean: #1b6070 !important;
  --foam: #d5ebe5 !important;
  --steel: #77837d !important;
}

/* FRB 20240304B Overrides */
html[data-theme="light"] body {
  --bg: #f3f1ec !important;
  --paper: #fbfaf7 !important;
  --ink: #131719 !important;
  --muted: #555d60 !important;
  --line: #c9c7c0 !important;
  --signal: #e84a2a !important;
  --signal-dark: #a52f1a !important;
  --radio: #0d7786 !important;
  --night: #11171c !important;
  --night-soft: #1b242b !important;
  --night-text: #f5f2e9 !important;
}

html[data-theme="dark"] body {
  --bg: #0c1115 !important;
  --paper: #12191e !important;
  --ink: #f3f0e7 !important;
  --muted: #aeb8bc !important;
  --line: #334047 !important;
  --signal: #ff6849 !important;
  --signal-dark: #ff8a72 !important;
  --radio: #5ec3cf !important;
  --night: #080c0f !important;
  --night-soft: #182127 !important;
  --night-text: #f6f3ea !important;
}

/* IceCube Overrides */
html[data-theme="light"] body {
  --bg: #f1f6f7 !important;
  --paper: #ffffff !important;
  --ink: #10242c !important;
  --muted: #4e6872 !important;
  --line: #c8d9dd !important;
  --cyan: #007c92 !important;
  --bright: #00a6c4 !important;
  --ice: #d9f6fb !important;
  --deep: #053845 !important;
  --night: #021d25 !important;
  --gold: #be7b16 !important;
}

html[data-theme="dark"] body {
  --bg: #04151b !important;
  --paper: #09232b !important;
  --ink: #eefbfe !important;
  --muted: #abc2c9 !important;
  --line: #26464f !important;
  --cyan: #54d3ea !important;
  --bright: #79e5f5 !important;
  --ice: #123c47 !important;
  --deep: #b7edf5 !important;
  --night: #010b0f !important;
  --gold: #f2b85a !important;
}

/* Crew 12 Overrides */
html[data-theme="light"] body {
  --ink: #101417 !important;
  --muted: #4c5960 !important;
  --paper: #f4f5f2 !important;
  --surface: #ffffff !important;
  --line: #cbd2d1 !important;
  --signal: #e5402f !important;
  --ocean: #0d6475 !important;
  --deep: #082832 !important;
}

html[data-theme="dark"] body {
  --ink: #f1f5f3 !important;
  --muted: #aebcbf !important;
  --paper: #0c1113 !important;
  --surface: #131b1e !important;
  --line: #334246 !important;
  --signal: #ff6b58 !important;
  --ocean: #62c4d4 !important;
  --deep: #061c23 !important;
}

/* --- 4. Rich Editorial Layout Styles (for all companion video articles) --- */
:root {
  --ed-bg: #0b0f19;
  --ed-surface: #111827;
  --ed-paper: #162032;
  --ed-ink: #f8fafc;
  --ed-muted: #94a3b8;
  --ed-line: #1e293b;
  --ed-accent: #38bdf8;
  --ed-signal: #f97316;
  --ed-gold: #fbbf24;
}

html[data-theme="light"] {
  --ed-bg: #f8fafc;
  --ed-surface: #ffffff;
  --ed-paper: #f1f5f9;
  --ed-ink: #0f172a;
  --ed-muted: #64748b;
  --ed-line: #e2e8f0;
  --ed-accent: #0284c7;
  --ed-signal: #ea580c;
  --ed-gold: #d97706;
}

.ed-body {
  background: var(--ed-bg);
  color: var(--ed-ink);
  font-family: 'DM Sans', -apple-system, sans-serif;
  line-height: 1.68;
  margin: 0;
  overflow-x: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}

.ed-container {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

/* Reading Progress */
.ed-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, #38bdf8, #818cf8);
  z-index: 10001;
  transition: width 0.1s ease-out;
}

/* Editorial Masthead Hero */
.ed-hero-masthead {
  padding: 4rem 0 3rem;
  border-bottom: 1px solid var(--ed-line);
}

.ed-eyebrow-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ed-accent);
  margin-bottom: 1.25rem;
}

.ed-eyebrow-tag::before {
  content: '';
  display: inline-block;
  width: 22px;
  height: 3px;
  background: var(--ed-signal);
  border-radius: 2px;
}

.ed-hero-title {
  font-family: 'Space Grotesk', -apple-system, sans-serif;
  font-size: clamp(2.4rem, 5.5vw, 4.4rem);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.035em;
  text-transform: uppercase;
  margin: 0 0 1.5rem;
  max-width: 980px;
}

.ed-hero-dek {
  font-family: 'DM Sans', sans-serif;
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  line-height: 1.5;
  color: var(--ed-muted);
  max-width: 820px;
  margin: 0 0 2rem;
}

.ed-hero-meta {
  display: flex;
  align-items: center;
  gap: 1.25rem 2rem;
  flex-wrap: wrap;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ed-muted);
  padding-top: 1.25rem;
  border-top: 1px solid var(--ed-line);
}

.ed-hero-meta strong {
  color: var(--ed-ink);
}

/* Scoreboard Metrics Bar */
.ed-scoreboard {
  background: var(--ed-surface);
  border: 1px solid var(--ed-line);
  border-left: 5px solid var(--ed-signal);
  border-radius: 12px;
  padding: 1.75rem 2rem;
  margin: 2.5rem 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
}

.ed-score-card h4 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ed-muted);
  margin: 0 0 0.4rem;
}

.ed-score-card .ed-score-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(1.8rem, 3.2vw, 2.4rem);
  font-weight: 800;
  line-height: 1;
  color: var(--ed-ink);
  letter-spacing: -0.02em;
}

.ed-score-card .ed-score-desc {
  font-size: 0.82rem;
  color: var(--ed-muted);
  margin-top: 0.35rem;
}

/* Editorial Lede Dropcap */
.ed-lede-section {
  padding: 2.5rem 0;
  max-width: 860px;
}

.ed-dropcap::first-letter {
  float: left;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 4.8rem;
  font-weight: 800;
  line-height: 0.82;
  margin: 0.08em 0.18em 0 0;
  color: var(--ed-signal);
}

.ed-lead-p {
  font-size: clamp(1.15rem, 2vw, 1.35rem);
  line-height: 1.58;
  font-weight: 500;
  color: var(--ed-ink);
}

/* Video Player Container */
.ed-player-container {
  margin: 2.5rem 0 4rem;
  background: var(--ed-surface);
  border: 1px solid var(--ed-line);
  border-radius: 16px;
  padding: 1rem;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.25);
}

.ed-player-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
}

.ed-player-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.ed-player-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.85rem 0.5rem 0.25rem;
}

.ed-player-caption {
  font-size: 0.88rem;
  color: var(--ed-muted);
  font-weight: 500;
}

.ed-yt-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 1rem;
  border-radius: 8px;
  background: #e02424;
  color: #ffffff;
  font-weight: 700;
  font-size: 0.82rem;
  text-decoration: none;
  transition: opacity 0.2s;
}

.ed-yt-btn:hover {
  opacity: 0.9;
}

/* Two-Column Editorial Chapters */
.ed-chapters-section {
  padding: 3rem 0;
}

.ed-chapter-row {
  display: grid;
  grid-template-columns: minmax(130px, 0.35fr) minmax(0, 1.65fr);
  gap: 2.5rem;
  padding: 2.5rem 0;
  border-top: 1px solid var(--ed-line);
}

.ed-chapter-meta {
  position: sticky;
  top: 80px;
  align-self: start;
}

.ed-chapter-num {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 3.5rem;
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: -0.05em;
  color: var(--ed-line);
}

html[data-theme="light"] .ed-chapter-num {
  color: #cbd5e1;
}

.ed-chapter-time {
  display: inline-block;
  margin-top: 0.5rem;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ed-accent);
  background: rgba(56, 189, 248, 0.1);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.ed-chapter-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(1.6rem, 3.2vw, 2.3rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  margin: 0 0 1rem;
  line-height: 1.15;
}

.ed-chapter-content p {
  font-size: 1.05rem;
  line-height: 1.72;
  color: var(--ed-ink);
  margin: 0 0 1.25rem;
  max-width: 780px;
}

/* Callout Box */
.ed-callout {
  background: var(--ed-surface);
  border: 1px solid var(--ed-line);
  border-left: 4px solid var(--ed-accent);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
  font-size: 0.95rem;
  color: var(--ed-muted);
}

.ed-callout strong {
  color: var(--ed-ink);
}

/* Voiceover Transcript */
.ed-transcript-details {
  background: var(--ed-surface);
  border: 1px solid var(--ed-line);
  border-radius: 12px;
  padding: 1.5rem 2rem;
  margin: 2.5rem 0;
}

.ed-transcript-summary {
  cursor: pointer;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ed-ink);
}

.ed-transcript-body {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--ed-line);
  font-size: 1rem;
  line-height: 1.75;
  color: var(--ed-muted);
}

/* FAQ Accordion Grid */
.ed-faq-grid {
  display: grid;
  gap: 1.25rem;
  margin: 2rem 0;
}

.ed-faq-item {
  background: var(--ed-surface);
  border: 1px solid var(--ed-line);
  border-radius: 12px;
  padding: 1.5rem 1.75rem;
}

.ed-faq-q {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 0.6rem;
  color: var(--ed-ink);
}

.ed-faq-a {
  font-size: 0.96rem;
  line-height: 1.65;
  color: var(--ed-muted);
  margin: 0;
}

/* Attribution & Sources */
.ed-sources-box {
  background: var(--ed-surface);
  border: 1px solid var(--ed-line);
  border-radius: 12px;
  padding: 2rem;
  margin: 3rem 0;
}

.ed-sources-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 1rem;
}

.ed-sources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.ed-source-link {
  display: block;
  padding: 0.85rem 1rem;
  border: 1px solid var(--ed-line);
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.85rem;
  color: var(--ed-muted);
  font-weight: 600;
  transition: all 0.2s ease;
}

.ed-source-link:hover {
  border-color: var(--ed-accent);
  color: var(--ed-accent);
  background: rgba(56, 189, 248, 0.05);
}

/* Responsive Breakpoints */
@media (max-width: 820px) {
  .ed-chapter-row {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .ed-chapter-meta {
    position: static;
    display: flex;
    align-items: baseline;
    gap: 1rem;
  }
  .ed-chapter-num {
    font-size: 2.2rem;
  }
  .bch-nav-inner {
    flex-direction: column;
    align-items: flex-start;
  }
  .bch-nav-links {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 0.25rem;
  }
  .bch-nav-actions {
    width: 100%;
    justify-content: space-between;
  }
}
