/* ============================================================
   RWB Archive — Shared Stylesheet
   Loaded after page-specific inline <style> blocks, so this
   file takes precedence on equal-specificity selectors.
   Page-specific component classes (not defined here) continue
   to be controlled by each page's inline styles.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400&family=Inter:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Variables ───────────────────────────────────────────── */
:root {
  --navy-deep:        #151e36;
  --navy:             #1f2f52;
  --navy-light:       #2d4275;
  --gold:             #c5a55a;
  --gold-light:       #dfc07a;
  --gold-pale:        #e8d5a0;
  --cream:            #f5f0e8;
  --cream-dark:       #ece5d8;
  --ink:              #1c1c2e;
  --muted:            #6b6b80;
  --border:           #d4cfc4;
  --steel:            #4a6b9e;
  --sepia:            #8b7355;
  --sidebar-width:    260px;
  --mobile-h:         56px;
  --content-max:      860px;
  --radius:           8px;
  --transition:       0.2s ease;
}

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  padding: 0;
  padding-left: var(--sidebar-width);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 18px;
  line-height: 1.7;
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
}

/* On mobile the sidebar is hidden; remove body padding */
@media (max-width: 780px) {
  body { padding-left: 0; padding-top: var(--mobile-h); }
}

a { color: var(--steel); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--navy); }

/* ── Suppress old header (replaced by sidebar) ───────────── */
header.site-header,
header:not(.story-header):not(.page-header) {
  display: none;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--navy-deep);
  display: flex;
  flex-direction: column;
  z-index: 300;
  overflow: hidden;
  transition: transform var(--transition);
}

.sidebar-header {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-shrink: 0;
}

.sidebar-brand {
  text-decoration: none;
  display: block;
}
.sidebar-brand-name {
  font-family: 'Playfair Display', serif;
  font-size: 1.2em;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.02em;
  line-height: 1.2;
}
.sidebar-brand-sub {
  font-size: 0.72em;
  color: rgba(255,255,255,0.5);
  margin-top: 4px;
  line-height: 1.3;
  font-style: italic;
  font-family: 'Inter', sans-serif;
}

.sidebar-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.4);
  font-size: 1.3em;
  cursor: pointer;
  padding: 2px 4px;
  line-height: 1;
  display: none; /* shown only on mobile */
}
.sidebar-close:hover { color: white; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 2px; }

/* Sidebar nav links */
.sidebar-link {
  display: block;
  padding: 9px 20px;
  color: var(--gold-pale);
  font-size: 0.88em;
  font-weight: 400;
  text-decoration: none;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  border-left: 3px solid transparent;
  line-height: 1.3;
}
.sidebar-link:hover {
  background: rgba(255,255,255,0.05);
  color: white;
  border-left-color: rgba(197,165,90,0.4);
  text-decoration: none;
}
.sidebar-link.active {
  color: white;
  background: rgba(197,165,90,0.12);
  border-left-color: var(--gold);
  font-weight: 500;
}

/* Expandable sections */
.sidebar-section {}

.sidebar-section-toggle {
  width: 100%;
  background: none;
  border: none;
  border-left: 3px solid transparent;
  padding: 9px 20px;
  color: var(--gold-pale);
  font-size: 0.88em;
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background var(--transition), color var(--transition);
}
.sidebar-section-toggle:hover {
  background: rgba(255,255,255,0.05);
  color: white;
}
.sidebar-section-toggle.active {
  color: white;
  background: rgba(197,165,90,0.12);
  border-left-color: var(--gold);
  font-weight: 500;
}
.sidebar-toggle-arrow {
  font-size: 0.75em;
  opacity: 0.6;
  transition: transform var(--transition);
  margin-left: 4px;
}
.sidebar-section.open .sidebar-toggle-arrow { transform: rotate(180deg); }

.sidebar-section-items {
  display: none;
  background: rgba(0,0,0,0.15);
}
.sidebar-section.open .sidebar-section-items { display: block; }

.sidebar-child {
  padding-left: 32px;
  font-size: 0.84em;
  color: rgba(232,213,160,0.7);
}
.sidebar-child:hover { color: var(--gold-pale); }
.sidebar-child.active { color: white; border-left-color: var(--gold); font-weight: 500; }

/* Parent link inside dropdown */
.sidebar-link-parent {
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 0.84em;
}

.sidebar-divider {
  height: 1px;
  background: rgba(255,255,255,0.07);
  margin: 8px 0;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}
.sidebar-footer-link {
  display: block;
  color: rgba(255,255,255,0.35);
  font-size: 0.78em;
  padding: 4px 0;
  text-decoration: none;
  transition: color var(--transition);
}
.sidebar-footer-link:hover { color: rgba(255,255,255,0.7); text-decoration: none; }

/* ── Sidebar overlay (mobile backdrop) ────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 299;
}
.sidebar-overlay.open { display: block; }

/* ── Mobile header bar ────────────────────────────────────── */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--mobile-h);
  background: var(--navy-deep);
  border-bottom: 2px solid var(--gold);
  align-items: center;
  padding: 0 16px;
  z-index: 200;
  gap: 12px;
}
@media (max-width: 780px) {
  .mobile-header { display: flex; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: block; }
}

.sidebar-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.sidebar-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--gold);
  border-radius: 2px;
  transition: all var(--transition);
}

.mobile-brand {
  font-family: 'Playfair Display', serif;
  color: var(--gold);
  font-size: 1.05em;
  font-weight: 600;
  text-decoration: none;
}
.mobile-brand:hover { color: var(--gold-light); text-decoration: none; }

/* ── Hero (home page only) ────────────────────────────────── */
.hero {
  position: relative;
  height: 100vh;
  min-height: 560px;
  background-size: cover;
  background-position: center 30%;
  background-repeat: no-repeat;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to left,
    rgba(21,30,54,0.92) 0%,
    rgba(21,30,54,0.6) 45%,
    rgba(21,30,54,0.1) 75%,
    transparent 100%
  );
}
.hero-content {
  position: relative;
  z-index: 1;
  padding: 0 56px 72px;
  max-width: 520px;
  text-align: left;
}
.hero-eyebrow {
  font-size: 0.78em;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 14px;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
}
.hero-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2.2em, 4vw, 3.4em);
  font-weight: 600;
  color: white;
  line-height: 1.15;
  margin: 0 0 20px;
}
.hero-rule {
  width: 56px;
  height: 2px;
  background: var(--gold);
  margin-bottom: 18px;
}
.hero-dates {
  color: var(--gold-pale);
  font-size: 1em;
  font-family: 'Playfair Display', serif;
  font-style: italic;
  margin-bottom: 10px;
}
.hero-tagline {
  color: rgba(255,255,255,0.65);
  font-size: 0.88em;
  letter-spacing: 0.04em;
  font-family: 'Inter', sans-serif;
}
.hero-scroll {
  position: absolute;
  bottom: 28px;
  left: 48px;
  color: rgba(255,255,255,0.5);
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 0.75em;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  animation: bounce 2.2s ease-in-out infinite;
}
.hero-scroll:hover { color: var(--gold); text-decoration: none; }
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

/* ── Story / page header (preserved across nav updates) ──── */
.page-header {
  background: var(--navy-deep);
  color: white;
  padding: 36px 0 32px;
  border-bottom: 2px solid var(--gold);
}
.page-header .container {
  padding-top: 0;
  padding-bottom: 0;
}
.page-header h1 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.5em, 3vw, 2.1em);
  font-weight: 600;
  color: white;
  margin-bottom: 8px;
  line-height: 1.2;
}
.page-header .subtitle {
  font-size: 0.9em;
  color: var(--gold-pale);
  font-style: italic;
  opacity: 0.85;
}

/* ── Story article body improvements ─────────────────────── */

/* Give article a horizontal gutter — inline CSS has padding: 48px 0 (no sides) */
article {
  padding: 44px 40px !important;
  margin-bottom: 0;
}

/* Don't justify — looks bad with Inter; left-align is cleaner */
article p {
  text-align: left !important;
}

/* Context box: full card treatment matching record guide .content-section */
.context-box {
  border: 1px solid var(--border) !important;
  border-left: 4px solid var(--gold) !important;
  border-radius: 0 var(--radius) var(--radius) 0 !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  margin: 32px 0 !important;
}

/* Article headings: match record guide section heading style */
article h2 {
  border-bottom: 2px solid var(--gold);
  padding-bottom: 8px;
  margin-bottom: 20px;
  margin-top: 36px;
}
article h2:first-child { margin-top: 0; }

/* Story nav (prev/next) */
.story-nav {
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 0 0 40px;
}

article blockquote {
  border-left: 3px solid var(--gold);
  padding: 14px 20px 14px 24px;
  margin: 28px 0;
  background: rgba(197,165,90,0.05);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
  color: var(--muted);
  line-height: 1.65;
}

/* ── Page layout ──────────────────────────────────────────── */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 40px;
}

/* Section headings get gold underline treatment */
h1, h2, h3 {
  font-family: 'Playfair Display', serif;
}
h1 { font-size: 1.9em; font-weight: 600; color: var(--navy); }
h2 { font-size: 1.35em; font-weight: 600; color: var(--navy); }
h3 { font-size: 1.1em; font-weight: 600; color: var(--navy); }

/* Section headings with gold underline */
.section h2, section h2 {
  border-bottom: 2px solid var(--gold);
  display: inline-block;
  padding-bottom: 4px;
  margin-bottom: 16px;
}

/* ── Monospace / data elements ────────────────────────────── */
code, pre, .mono, .value {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
}

/* ── Stat bars (shared pattern across pages) ──────────────── */
.stat-value, .stat .value, .hours-value {
  font-family: 'JetBrains Mono', monospace;
}

/* ── Footer ───────────────────────────────────────────────── */
footer {
  background: var(--navy-deep);
  color: rgba(255,255,255,0.45);
  padding: 28px 40px;
  font-size: 0.82em;
  line-height: 1.8;
  margin-top: 60px;
}
footer p { margin: 0; }
footer a { color: rgba(197,165,90,0.7); text-decoration: none; }
footer a:hover { color: var(--gold); text-decoration: none; }
.footer-container { max-width: var(--content-max); margin: 0 auto; }

/* ── Info notes / callouts ────────────────────────────────── */
.info-note, .note-box {
  background: rgba(74,107,158,0.08);
  border-left: 3px solid var(--steel);
  padding: 14px 18px;
  font-size: 0.88em;
  color: var(--muted);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 16px 0;
}

/* ── Pull quotes ──────────────────────────────────────────── */
.pull-quote {
  border-left: 3px solid var(--gold);
  padding: 16px 24px;
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: 1.15em;
  color: var(--navy);
  margin: 24px 0;
  background: rgba(197,165,90,0.06);
}

/* ── Tables ───────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88em;
}
.data-table th {
  background: var(--navy);
  color: var(--gold-pale);
  padding: 10px 14px;
  text-align: left;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 0.85em;
  letter-spacing: 0.03em;
}
.data-table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.data-table tr:hover td { background: rgba(197,165,90,0.04); }

/* ── Confidence badges ────────────────────────────────────── */
.confidence-high { color: #3f7457; }
.confidence-med  { color: #8b6d2f; }
.confidence-low  { color: #8b3030; }

/* ── Page-specific section suppression ────────────────────── */
/* Hide the old inline nav styles since sidebar replaces them */
.nav-menu { display: none !important; }

/* ── Flight-record match boxes (story pages) ─────────────── */
.flight-record-match {
  background: #eef2f8;
  border-left: 4px solid var(--navy);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 22px 24px;
  margin: 36px 0;
}
.flight-record-match h3 {
  font-family: 'Inter', sans-serif;
  font-size: 0.78em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--navy);
  margin-bottom: 14px;
}
.flight-record-match .fr-badge {
  display: inline-block;
  font-family: 'Inter', sans-serif;
  font-size: 0.72em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 3px 10px;
  border-radius: 3px;
  margin-bottom: 14px;
}
.fr-badge.confirmed  { background: #d4edda; color: #155724; }
.fr-badge.likely     { background: #cce5ff; color: #003d7a; }
.fr-badge.possible   { background: #fff3cd; color: #7a5c00; }
.fr-badge.no-record  { background: #f8d7da; color: #721c24; }
.flight-record-match .fr-entry {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88em;
  color: var(--navy);
  margin-bottom: 6px;
  line-height: 1.5;
}
.flight-record-match .fr-entry strong { color: var(--navy); }
.flight-record-match .fr-note {
  font-size: 0.88em;
  color: var(--muted);
  font-style: italic;
  margin-top: 12px;
  line-height: 1.6;
}
.flight-record-match .fr-link {
  display: inline-block;
  margin-top: 12px;
  font-family: 'Inter', sans-serif;
  font-size: 0.85em;
  color: var(--navy);
  text-decoration: none;
  font-weight: 500;
}
.flight-record-match .fr-link:hover { color: var(--gold); text-decoration: underline; }
.fr-form-image-wrap {
  margin: 18px 0 6px;
}
.fr-form-image-wrap img {
  width: 100%;
  display: block;
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.10);
}
.fr-form-caption {
  font-size: 0.78em;
  color: var(--muted);
  font-style: italic;
  text-align: center;
  margin-top: 6px;
  margin-bottom: 14px;
}

/* ── Sidebar JS ───────────────────────────────────────────── */
/* (JS is injected inline by update_nav.py) */
