/* TOT Insights — main.css
   Shared stylesheet for all site pages.
   Page-specific rules remain in per-page <style> blocks and override these defaults. */

/* ─── Colour system ─────────────────────────────────────────────────────────── */

:root {
  --navy:              #111d30;
  --navy-deep:         #0a1628;
  --navy-card:         var(--navy-deep);
  --gold:              #c9a84c;
  --gold-hover:        #E8B84B;
  --gold-pale:         #E8D5A0;
  --text:              rgba(232,228,220,0.90);
  --text-muted:        rgba(232,228,220,0.75);
  --text-muted-light-bg: rgba(26,26,46,0.65);
  --border:            rgba(255,255,255,0.07);
  --color-bg:          #111d30;
  --color-dark:        #0a1628;
  --color-primary:     var(--gold);
  --color-mid:         rgba(255,255,255,0.15);
  --color-accent:      var(--gold);
  --color-accent-pale: rgba(201,168,76,0.15);
  --color-border:      rgba(255,255,255,0.07);
  --color-text:        rgba(232,228,220,0.90);
  --color-text-muted:  var(--text-muted);
  --color-bg-alt:      var(--navy-deep);
  --color-bg-stats:    #f7f5f1;
  --card-bg:           #f2f0ec;

  /* Legacy aliases */
  --steel:   var(--color-primary);
  --gold-lt: var(--gold-pale);
  --cream:   var(--color-bg-alt);
  --muted:   var(--text-muted);
  --paper:   var(--navy-card);

  /* Typography */
  --font-serif:   'Libre Baskerville', Georgia, serif;
  --font-sans:    'IBM Plex Sans', sans-serif;
  --font-mono:    'IBM Plex Mono', monospace;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-source:  'Source Serif 4', Georgia, serif;
  --font-body:    'EB Garamond', Georgia, serif;

  /* Briefing shorthand aliases */
  --serif: var(--font-serif);
  --sans:  var(--font-sans);
  --mono:  var(--font-mono);
}

/* ─── Reset ─────────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

/* ─── Base ───────────────────────────────────────────────────────────────────── */

body {
  font-family: var(--font-body);
  background: var(--navy);
  color: rgba(232,228,220,0.90);
  font-size: 17px;
  line-height: 1.6;
}

h1 { font-size: 2.2rem; line-height: 1.2; }
h2 { font-size: 1.6rem; line-height: 1.25; }
h3 { font-size: 1.2rem; line-height: 1.3; }

/* ─── Site header ────────────────────────────────────────────────────────────── */

.site-header {
  background: var(--color-dark);
  border-bottom: 3px solid var(--color-accent);
  padding: 0 40px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 58px;
}
.site-logo {
  display: flex;
  align-items: baseline;
  gap: 12px;
  text-decoration: none;
}
.logo-main {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.02em;
}
.logo-sub {
  font-family: var(--font-mono);
  font-size: 9px;
  color: rgba(255,255,255,0.35);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.header-nav {
  display: flex;
  gap: 28px;
  align-items: center;
}
.header-nav a {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  color: rgba(255,255,255,0.55);
  text-decoration: none;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: color 0.15s;
}
.header-nav a:hover,
.header-nav a.active { color: #fff; }

@media (max-width: 700px) {
  .header-nav { gap: 14px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .header-nav a { font-size: 10px; white-space: nowrap; }
}

/* ─── Page hero ──────────────────────────────────────────────────────────────── */

.page-hero {
  background: var(--color-bg-alt);
  border-bottom: 1px solid var(--color-mid);
  padding: 36px 40px 32px;
}
.page-hero-inner { max-width: 1200px; margin: 0 auto; }
.page-eyebrow {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-primary);
  margin-bottom: 10px;
}
.page-title {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.22;
}

/* ─── Main content wrapper ───────────────────────────────────────────────────── */

.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 40px 80px;
}
@media (max-width: 700px) {
  .main-content { padding: 32px 20px 60px; }
  .page-hero { padding: 24px 20px 20px; }
}

/* ─── Section label ──────────────────────────────────────────────────────────── */

.section-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-mid);
}

/* ─── Filter buttons ─────────────────────────────────────────────────────────── */

.filter-btn {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 2px;
  border: 1px solid var(--color-mid);
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
  white-space: nowrap;
}
.filter-btn:hover { border-color: var(--color-primary); color: var(--color-primary); }
.filter-btn.active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }

/* ─── Desktop scaling (1024px+) ─────────────────────────────────────────────── */

@media (min-width: 1024px) {
  body { font-size: 18px; }

  .site-header { padding: 0 48px; }

  .header-inner,
  .page-hero-inner,
  .footer-inner { max-width: 1400px; }

  .page-hero { padding: 48px 48px 40px; }

  .main-content {
    max-width: 1400px;
    padding: 56px 48px 96px;
  }

  .page-title { font-size: 2rem; }

  .site-footer { padding: 26px 48px; }
}

/* ─── Document body: light-background contrast fixes ────────────────────────── */
/* .doc-footer sits on the light .doc-body background (#f8f9fb).
   Override the per-page rgba(181,146,58,0.55) with a dark-enough amber to pass WCAG AA. */
.doc-body .doc-footer { color: #7a5800; }

/* ─── Site footer ────────────────────────────────────────────────────────────── */

.site-footer {
  background: var(--color-dark);
  border-top: 2px solid var(--color-accent);
  padding: 22px 40px;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.footer-inner span { font-size: 11px; color: rgba(255,255,255,0.65); }
.footer-inner a { color: rgba(255,255,255,0.38); text-decoration: none; }
.footer-inner a:hover { color: rgba(255,255,255,0.7); }

/* ── Annotated-bibliography reading panel ──────────────────────────────
   Cream surface + dark navy text, reused verbatim from the Themes page
   .theme-card ("Governance") panel so the bibliography reading content
   matches the rest of the site. */
.reading-panel {
  background: #f2f0ec;
  border-radius: 3px;
  box-shadow: 0 2px 20px rgba(0,0,0,0.24), 0 0 0 1px rgba(0,0,0,0.10);
  padding: 36px 40px;
  margin: 0 0 2rem;
}
/* Entry titles → dark navy; italic annotations → same dark body tone as .theme-framing */
.reading-panel p[style] { color: #111d30 !important; }
.reading-panel p[style*="italic"] { color: rgba(17,29,48,0.78) !important; font-style: normal !important; }
/* Keep gold mono section sub-heads, but make their divider readable on cream */
.reading-panel .section-header { color: var(--gold); border-bottom-color: rgba(17,29,48,0.15); }
/* See-also body text legible on cream (links stay gold) */
.reading-panel .see-also-list { color: rgba(17,29,48,0.78); }
/* Resource-list entries: keep the gold left accent; make the row divider readable on cream (year tags + links stay gold) */
.reading-panel .res-entry { border-bottom-color: rgba(17,29,48,0.08); }

/* ── Base link colour ──────────────────────────────────────────────────
   Every link defaults to the site gold (nav, footer, and card components
   set their own colours and override this). Fixes unstyled links that
   would otherwise fall back to browser blue. */
a { color: var(--gold); transition: color 0.15s ease; }
a:hover { color: var(--gold-hover); }

/* Small external-link icon, appended by navigation.js to off-site links.
   Uses currentColor so it always matches the link colour. */
.ext-icon { display: inline-block; width: 0.66em; height: 0.66em; margin-left: 0.3em; vertical-align: -0.04em; flex: none; }
