/* Captain Smart — Mid-fi site styles
   Direction: Dark Cinematic (navy + gold), serif editorial type.
   Palette from logo:
     --navy:    #0E1E3F  (seal background)
     --navy-2:  #0A1630  (deeper navy for layering)
     --gold:    #C9A14A  (ring)
     --gold-2:  #E8C878  (highlight gold)
     --cream:   #F4EEE2  (slightly-white parchment)
     --ink:     #0A0A0A
*/

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&family=Source+Serif+4:ital,wght@0,400;0,500;0,600;0,700;1,400&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --navy: #0E1E3F;
  --navy-2: #0A1630;
  --navy-3: #081126;
  --gold: #C9A14A;
  --gold-2: #E8C878;
  --gold-dim: #8C7232;
  --cream: #F4EEE2;
  --cream-2: #E8DFCC;
  --ink: #0A0A0A;
  --muted: rgba(244, 238, 226, 0.65);
  --muted-2: rgba(244, 238, 226, 0.4);
  --rule: rgba(201, 161, 74, 0.25);
  --rule-strong: rgba(201, 161, 74, 0.6);

  --f-display: 'Source Serif 4', Georgia, serif;
  --f-serif: 'Source Serif 4', Georgia, serif;
  --f-mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--navy-2); color: var(--cream); font-family: var(--f-serif); }
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

a { color: inherit; text-decoration: none; }

.mono { font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold); }
.mono-muted { font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }

.display { font-family: var(--f-display); font-weight: 500; line-height: 0.95; letter-spacing: -0.01em; }
.serif { font-family: var(--f-serif); }
.italic { font-style: italic; }

.container { max-width: 1400px; margin: 0 auto; padding: 0 48px; }

/* ────────── NAV ────────── */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  padding: 16px 48px;
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(10, 22, 48, 0);
  transition: background .4s ease, border-color .4s ease, padding .3s ease;
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: rgba(8, 17, 38, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--rule);
  padding: 12px 48px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-seal {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--navy); border: 1.5px solid var(--gold);
  display: flex; align-items: center; justify-content: center; position: relative;
  box-shadow: 0 0 0 3px rgba(201, 161, 74, 0.15), inset 0 0 0 2px var(--navy);
}
.brand-seal::before {
  content: ''; position: absolute; inset: 3px; border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #1a2d56 0%, var(--navy) 70%);
}
.brand-seal svg { position: relative; width: 22px; height: 22px; color: var(--gold); }
.brand-seal-img { overflow: hidden; background: var(--navy); }
.brand-seal-img::before { display: none; }
.brand-seal-img img { position: relative; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.brand-text { font-family: var(--f-display); font-weight: 600; font-size: 18px; letter-spacing: 0.06em; color: var(--cream); }
.brand-sub { font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.2em; color: var(--muted); margin-top: -2px; text-transform: uppercase; }

.nav-links { display: flex; gap: 28px; }
.nav-link {
  font-family: var(--f-serif); font-size: 14px; letter-spacing: 0.02em;
  color: var(--cream); opacity: 0.75; padding: 4px 0; position: relative;
  transition: opacity .2s ease;
  cursor: pointer;
}
.nav-link::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -2px; height: 1px; background: var(--gold);
  transform: scaleX(0); transform-origin: left; transition: transform .3s ease;
}
.nav-link:hover { opacity: 1; }
.nav-link:hover::after, .nav-link.active::after { transform: scaleX(1); }
.nav-link.active { color: var(--gold); opacity: 1; }
.nav-link.disabled { opacity: 0.4; cursor: not-allowed; }
.nav-link .pill {
  display: inline-block; font-family: var(--f-mono); font-size: 8px; letter-spacing: 0.15em;
  padding: 2px 5px; margin-left: 6px; border: 1px solid var(--muted-2); border-radius: 2px; vertical-align: middle;
}

.nav-cta {
  font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
  padding: 10px 18px; border: 1px solid var(--gold); color: var(--gold);
  transition: all .25s ease; cursor: pointer;
}
.nav-cta:hover { background: var(--gold); color: var(--navy); }

/* ────────── EXPLORE LINK (used under each latest-dispatches row) ────────── */
.explore-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 28px;
  cursor: pointer;
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  border-bottom: 1px solid var(--gold);
  padding-bottom: 4px;
  transition: color .2s ease, border-color .2s ease, transform .2s ease;
}
.explore-link:hover {
  color: var(--gold-2);
  border-bottom-color: var(--gold-2);
  transform: translateX(2px);
}

/* ────────── BUTTONS ────────── */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--f-mono); font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase;
  padding: 14px 24px; cursor: pointer; border: 1px solid transparent;
  transition: all .25s ease;
}
.btn-gold { background: var(--gold); color: var(--navy-2); }
.btn-gold:hover { background: var(--gold-2); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--cream); border-color: var(--cream); }
.btn-ghost:hover { background: var(--cream); color: var(--navy-2); }
.btn-navy { background: var(--navy-2); color: var(--cream); border-color: var(--gold); }

/* ────────── SECTION MARKERS ────────── */
.section-head {
  display: flex; align-items: center; gap: 18px; margin-bottom: 40px;
}
.section-head .rule { flex: 1; height: 1px; background: var(--rule-strong); }
.section-head .num { font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.2em; color: var(--gold); }

.kicker {
  font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.28em; text-transform: uppercase;
  color: var(--gold); display: inline-flex; align-items: center; gap: 10px;
}
.kicker::before { content: ''; width: 22px; height: 1px; background: var(--gold); }

/* ────────── SCROLL REVEAL ────────── */
.reveal { opacity: 0; transform: translateY(30px); transition: opacity .9s ease, transform .9s cubic-bezier(.2,.7,.3,1); }
.reveal.in { opacity: 1; transform: none; }
.reveal-slow { transition-duration: 1.4s; }

/* ────────── PLACEHOLDER IMAGES ────────── */
.ph {
  position: relative; background: var(--navy-3); overflow: hidden;
  border: 1px solid var(--rule);
}
.ph::before {
  content: ''; position: absolute; inset: 0;
  background:
    repeating-linear-gradient(135deg, transparent 0 14px, rgba(201,161,74,0.04) 14px 15px),
    radial-gradient(ellipse at 30% 20%, rgba(201,161,74,0.08), transparent 60%),
    linear-gradient(180deg, rgba(10,22,48,0.3) 0%, rgba(8,17,38,0.9) 100%);
}
.ph-label {
  position: absolute; left: 14px; bottom: 12px;
  font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.18em;
  color: rgba(244, 238, 226, 0.5); text-transform: uppercase;
}
.ph-ring {
  position: absolute; inset: 16px; border: 1px solid var(--rule); pointer-events: none;
}

/* ────────── FOOTER ────────── */
.footer {
  background: var(--navy-3); border-top: 1px solid var(--rule-strong);
  padding: 80px 48px 40px;
}
.footer-banner {
  margin: 0 -48px 60px;
  width: calc(100% + 96px);
  overflow: hidden;
  line-height: 0;
}
.footer-banner img { width: 100%; height: auto; display: block; }

.footer-cta {
  margin: -80px -48px 0;
  width: calc(100% + 96px);
  padding: 96px 48px;
  background: var(--gold);
  text-align: center;
}
.footer-cta-inner { max-width: 820px; margin: 0 auto; }
.footer-cta-kicker { color: var(--navy-2); opacity: 0.7; margin-bottom: 18px; }
.footer-cta-title {
  font-family: var(--f-display);
  font-size: clamp(30px, 3.8vw, 50px);
  font-weight: 500;
  margin: 0;
  line-height: 1.12;
  color: var(--navy-2);
  letter-spacing: -0.01em;
}
.footer-cta-desc {
  font-family: var(--f-serif);
  font-size: 17px;
  line-height: 1.6;
  color: rgba(14, 30, 63, 0.78);
  margin: 22px auto 0;
  max-width: 600px;
}
.footer-subscribe {
  display: flex;
  gap: 6px;
  margin: 32px auto 0;
  padding: 6px;
  background: var(--cream);
  border-radius: 999px;
  max-width: 460px;
  border: 1px solid rgba(14, 30, 63, 0.15);
}
.footer-subscribe input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  padding: 10px 18px;
  font-family: var(--f-serif);
  font-size: 15px;
  color: var(--navy-2);
  min-width: 0;
}
.footer-subscribe input::placeholder { color: rgba(14, 30, 63, 0.45); }
.footer-subscribe button {
  border: none;
  cursor: pointer;
  padding: 12px 22px;
  background: var(--navy-2);
  color: var(--cream);
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  border-radius: 999px;
  transition: background .2s ease;
  white-space: nowrap;
}
.footer-subscribe button:hover { background: var(--navy); }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 60px; max-width: 1400px; margin: 0 auto; }
.footer h4 { font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.2em; color: var(--gold); text-transform: uppercase; margin: 0 0 16px; }
.footer ul { list-style: none; padding: 0; margin: 0; }
.footer li { font-family: var(--f-serif); font-size: 15px; color: var(--muted); padding: 6px 0; cursor: pointer; transition: color .2s; }
.footer li:hover { color: var(--cream); }
.footer-bottom {
  max-width: 1400px; margin: 60px auto 0; padding-top: 30px;
  border-top: 1px solid var(--rule); display: flex; justify-content: space-between;
  font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.18em; color: var(--muted); text-transform: uppercase;
}

/* ══════════════════ MOBILE NAV ══════════════════ */
html, body { overflow-x: hidden; max-width: 100vw; }
.nav-burger { display: none; width: 44px; height: 44px; background: transparent; border: 1px solid var(--gold); color: var(--gold); cursor: pointer; align-items: center; justify-content: center; padding: 0; }
.nav-burger span, .nav-burger span::before, .nav-burger span::after { content:''; display:block; width: 20px; height: 1.5px; background: var(--gold); position: relative; transition: transform .3s, top .3s, bottom .3s, opacity .2s; }
.nav-burger span::before { position: absolute; top: -7px; left: 0; }
.nav-burger span::after  { position: absolute; top:  7px; left: 0; }
.nav-burger.open span { background: transparent; }
.nav-burger.open span::before { top: 0; transform: rotate(45deg); }
.nav-burger.open span::after  { top: 0; transform: rotate(-45deg); }

.mobile-drawer {
  position: fixed; inset: 0; z-index: 99;
  background: rgba(8,17,38,0.98); backdrop-filter: blur(16px);
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
  padding: 100px 40px 40px;
  transform: translateX(100%); transition: transform .45s cubic-bezier(.2,.8,.2,1);
  overflow-y: auto;
}
.mobile-drawer.open { transform: translateX(0); }
.mobile-drawer .nav-link { font-size: 26px; padding: 14px 0; width: 100%; border-bottom: 1px solid var(--rule); }
.mobile-drawer .nav-cta { margin-top: 30px; font-size: 12px; padding: 14px 22px; }

/* ══════════════════ RESPONSIVE ══════════════════ */
@media (max-width: 900px) {
  html { font-size: 15px; }
  .container { padding: 0 22px; }

  /* Nav collapse */
  .nav { padding: 12px 22px !important; }
  .nav.scrolled { padding: 10px 22px !important; }
  .nav-links { display: none; }
  .nav-cta { display: none; }
  .nav-burger { display: inline-flex; }
  .brand-text { font-size: 15px; }
  .brand-sub { font-size: 8px; }
  .brand-seal { width: 36px; height: 36px; }

  /* All grids → 1 column by default */
  main section { padding-left: 22px !important; padding-right: 22px !important; }

  /* Buttons grow, stack */
  .btn { padding: 14px 20px; font-size: 11px; width: 100%; justify-content: center; }

  /* Placeholders breathe */
  .ph-ring { inset: 8px; }

  /* Footer */
  .footer { padding: 60px 22px 32px; }
  .footer-cta { margin: -60px -22px 0; width: calc(100% + 44px); padding: 72px 22px; }
  .footer-banner { margin: 0 -22px 40px; width: calc(100% + 44px); }
  .footer-subscribe { flex-direction: column; gap: 10px; padding: 10px; border-radius: 16px; }
  .footer-subscribe button { width: 100%; padding: 14px; }
  .footer-grid { grid-template-columns: 1fr !important; gap: 40px; }
  .footer-bottom { flex-direction: column; gap: 10px; text-align: left; font-size: 10px; }

  /* Section-head overflow */
  .section-head { flex-wrap: wrap; gap: 10px; margin-bottom: 28px; }

  /* Universal 2/3-col → 1-col for any styled grid on narrow screens */
  [style*="grid-template-columns: 1.6fr 1fr 1fr"],
  [style*="grid-template-columns:1.6fr 1fr 1fr"],
  [style*="repeat(3, 1fr)"],
  [style*="repeat(3,1fr)"],
  [style*="grid-template-columns: 1.2fr 1fr"],
  [style*="grid-template-columns:1.2fr 1fr"],
  [style*="grid-template-columns: 1.6fr 1fr"],
  [style*="grid-template-columns:1.6fr 1fr"],
  [style*="grid-template-columns: 1.1fr 1fr"],
  [style*="grid-template-columns: 1fr 1.2fr"],
  [style*="grid-template-columns: 1fr 2fr"],
  [style*="grid-template-columns:1fr 2fr"],
  [style*="grid-template-columns: 2fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns:1fr 1fr"],
  [style*="repeat(2, 1fr)"],
  [style*="repeat(2,1fr)"],
  [style*="grid-template-columns: 160px 1fr 160px 120px"],
  [style*="grid-template-columns: 160px 1fr 200px 140px"] {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
  }

  /* Articles list: stack meta above/below title */
  .articles-row { grid-template-columns: 1fr !important; gap: 8px !important; padding: 20px 0 !important; }

  /* Timeline → single vertical stack, card touches the rail, node sits on the rail */
  .timeline-row {
    display: block !important;
    position: relative !important;
    padding: 16px 16px 16px 28px !important;
  }
  /* Card-bearing side becomes a normal block; opposite empty side is hidden */
  .timeline-side-left,
  .timeline-side-right {
    display: block !important;
    padding: 0 !important;
    justify-content: flex-start !important;
  }
  .timeline-row.is-left .timeline-side-right,
  .timeline-row.is-right .timeline-side-left {
    display: none !important;
  }
  /* Card spans full width, meets the rail on its left edge */
  .timeline-card {
    max-width: 100% !important;
    width: 100% !important;
    text-align: left !important;
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
  }
  .timeline-card-head { justify-content: flex-start !important; }
  /* Node centered on the rail (top:50% / left:28px with -50% / -50% translate),
     drawn above the card so it visually punctures it */
  .timeline-node {
    position: absolute !important;
    left: 28px !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
    z-index: 5 !important;
    width: auto !important;
    height: auto !important;
    padding: 0 !important;
  }
  /* Drop the heavy navy halo so the node sits cleanly over the card edge */
  .timeline-node > div {
    box-shadow: 0 0 24px rgba(201, 161, 74, 0.35) !important;
  }
  /* Rail + progress fill + animating dot all anchored to the same x as the node */
  .timeline-rail, .timeline-rail-fill { left: 28px !important; }
  .timeline-rail-dot { left: 28px !important; }

  /* Gallery tiles: kill huge spans */
  [style*="grid-template-columns: repeat(12, 1fr)"] { grid-template-columns: repeat(2, 1fr) !important; grid-auto-rows: 120px !important; }
  [style*="grid-template-columns: repeat(12, 1fr)"] > * { grid-column: span 2 !important; grid-row: span 2 !important; }

  /* Foundation split → stacked */
  .foundation-split { grid-template-columns: 1fr !important; }
  .foundation-split .ph { min-height: 320px !important; }

  /* Hero */
  .hero { height: auto !important; min-height: 80vh !important; padding-top: 120px !important; padding-bottom: 60px !important; }
  .hero h1 { font-size: 52px !important; }
  .hero-inner { grid-template-columns: 1fr !important; gap: 32px !important; padding: 96px 22px 48px !important; }
  .hero-portrait { max-height: 50vh; }
  .hero-portrait img { max-height: 50vh !important; }

  /* Latest dispatches: collapse sticky-left layout to a single stack */
  .latest-grid { grid-template-columns: 1fr !important; gap: 48px !important; }
  .latest-sticky { position: static !important; top: auto !important; }
  .explore-link { margin-top: 22px !important; font-size: 11px !important; }

  /* Big display numbers scale down */
  .display { letter-spacing: -0.01em; }

  /* Tweaks panel narrower */
  .tweaks-panel { left: 12px !important; right: 12px !important; width: auto !important; bottom: 12px !important; }

  /* Section head num hidden on very small */
  .section-head .num { display: none; }
}

@media (max-width: 520px) {
  h1.display { font-size: 44px !important; }
  h2.display { font-size: 32px !important; }
  h3.display { font-size: 22px !important; }
  blockquote.display { font-size: 22px !important; }
  .container { padding: 0 18px; }
  .nav { padding: 10px 16px !important; }
  [style*="grid-template-columns: repeat(12, 1fr)"] { grid-template-columns: 1fr !important; grid-auto-rows: 180px !important; }
  [style*="grid-template-columns: repeat(12, 1fr)"] > * { grid-column: span 1 !important; grid-row: span 1 !important; }
}
