/* Red Basilisk — dark by default, parchment as the light theme. */

:root {
  --bg: #0e0c0b;
  --surface: #171412;
  --surface-2: #1f1b18;
  --line: #2c2522;
  --text: #f2ede6;
  --muted: #a39a90;
  --red: #a11d23;          /* basilisk red: fills, rules, crest */
  --red-ink: #e0494f;      /* red that reads as text on black */
  --oxblood: #6e1417;
  --gold: #e1a02a;
  --chart-cream: #f5f1e8;

  --serif: 'Source Serif 4 Variable', 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --sans: 'Inter Variable', Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Cinzel Variable', Cinzel, 'Trajan Pro', var(--serif);

  --radius: 6px;
  --gutter: clamp(16px, 4vw, 32px);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f5f1e8;
  --surface: #fbf8f1;
  --surface-2: #efe9dc;
  --line: #ddd3c2;
  --text: #171310;
  --muted: #5a5148;
  --red-ink: #a11d23;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
::selection { background: var(--red); color: #fff; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 2px; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 16px; z-index: 10; background: var(--surface); padding: 8px 12px; }

.wrap { max-width: 1160px; margin-inline: auto; padding-inline: var(--gutter); }
.wrap-wide { max-width: 960px; margin-inline: auto; padding-inline: var(--gutter); }
.wrap-narrow { max-width: 700px; margin-inline: auto; padding-inline: var(--gutter); }

/* ── Masthead ───────────────────────────────────────── */
.mast {
  position: sticky; top: 0; z-index: 5;
  padding-top: env(safe-area-inset-top, 0px);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.mast::after { /* the thin red rule under the masthead */
  content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--red) 20%, var(--red) 80%, transparent);
  opacity: .8;
}
.mast-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 64px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.wordmark {
  font: 600 17px/1 var(--display);
  letter-spacing: .22em; text-transform: uppercase;
}
.nav { display: flex; align-items: center; gap: clamp(12px, 3vw, 28px); font-size: 14px; letter-spacing: .04em; }
.nav a { text-decoration: none; color: var(--muted); transition: color .15s; }
.nav a:hover { color: var(--text); }
.theme-toggle {
  display: grid; place-items: center; width: 34px; height: 34px;
  border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer;
}
.theme-toggle:hover { color: var(--gold); border-color: var(--gold); }
@media (max-width: 520px) {
  .wordmark { font-size: 14px; letter-spacing: .16em; }
  .brand img { width: 28px; height: 28px; }
  .nav { gap: 14px; }
  .nav a[href="/"] { display: none; }
}

/* ── Hero ───────────────────────────────────────────── */
.hero { padding-block: clamp(48px, 9vw, 96px) clamp(24px, 5vw, 48px); text-align: center; }
.hero-inner { display: flex; flex-direction: column; align-items: center; }
.crest { width: clamp(170px, 26vw, 260px); height: auto; filter: drop-shadow(0 0 36px rgba(200, 20, 28, .35)); }
:root[data-theme="light"] .crest { filter: drop-shadow(0 10px 18px rgba(23, 19, 16, .22)); }
.crest--sm { width: 120px; margin-bottom: 20px; }
.hero-title {
  margin: 20px 0 0;
  font: 600 clamp(34px, 7vw, 64px)/1.05 var(--display);
  letter-spacing: .14em; text-transform: uppercase;
}
.motto { margin: 14px 0 0; font: italic 400 clamp(17px, 2.2vw, 20px)/1.4 var(--serif); color: var(--muted); }

.ornament { display: flex; align-items: center; gap: 14px; width: min(280px, 70%); margin: 28px auto 0; color: var(--red); }
.ornament span { flex: 1; height: 1px; background: currentColor; opacity: .7; }

/* ── Feed & cards ───────────────────────────────────── */
.feed { padding-bottom: 96px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 40px 28px; margin-top: 56px; }
.empty { text-align: center; color: var(--muted); font: italic 18px var(--serif); padding: 48px 0; }

.card-link { display: block; text-decoration: none; }
.card-media {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden;
  border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line);
}
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.card-media--empty { display: grid; place-items: center; background: radial-gradient(circle at 50% 50%, var(--surface-2), var(--surface)); }
.card-media--empty .card-mark { width: 22%; height: auto; opacity: .85; }
.card-link:hover .card-media img:not(.card-mark) { transform: scale(1.025); }
.card-body { padding-top: 16px; }
.card-title {
  margin: 8px 0 0; font: 600 22px/1.25 var(--serif); letter-spacing: -.005em;
  text-wrap: balance; transition: color .15s;
}
.card-link:hover .card-title { color: var(--red-ink); }
.card-excerpt { margin: 8px 0 0; color: var(--muted); font-size: 15.5px; line-height: 1.55; }

.card--featured .card-link { display: grid; grid-template-columns: 1.35fr 1fr; gap: 36px; align-items: center; }
.card--featured .card-title { font-size: clamp(26px, 3.4vw, 38px); line-height: 1.15; }
.card--featured .card-excerpt { font-size: 17px; }
@media (max-width: 800px) { .card--featured .card-link { grid-template-columns: 1fr; gap: 0; } }

.play {
  position: absolute; left: 50%; top: 50%; translate: -50% -50%;
  display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%;
  background: var(--red); color: #fff; box-shadow: 0 0 0 6px rgba(161, 29, 35, .25), 0 8px 24px rgba(0, 0, 0, .4);
  transition: transform .2s;
}
.play svg { width: 26px; height: 26px; margin-left: 3px; }
.play--lg { width: 76px; height: 76px; }
.play--lg svg { width: 34px; height: 34px; }

.kicker { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; font-size: 13px; color: var(--muted); letter-spacing: .02em; }
.badge {
  font: 600 10.5px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase;
  padding: 5px 8px 4px; border-radius: 3px; border: 1px solid var(--line); color: var(--text);
}
.badge--video { background: var(--red); border-color: var(--red); color: #fff; }
.dot { opacity: .6; }

/* ── Post ───────────────────────────────────────────── */
.post { padding-bottom: 96px; }
.post-head { padding-top: clamp(40px, 7vw, 80px); padding-bottom: 32px; }
.notfound { text-align: center; padding-bottom: 120px; }
.notfound .crest { margin-inline: auto; }
.post-title { margin: 14px 0 0; font: 650 clamp(32px, 5.4vw, 50px)/1.1 var(--serif); letter-spacing: -.015em; text-wrap: balance; }
.deck { margin: 16px 0 0; font: 400 clamp(19px, 2.4vw, 22px)/1.45 var(--serif); color: var(--muted); }
.deck a { color: var(--red-ink); }
.byline { margin: 20px 0 0; font-size: 14px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

.post-cover { margin-block: 8px 40px; }
.post-cover img { width: 100%; border-radius: var(--radius); }

.yt { margin-block: 8px 40px; }
.yt-play, .yt iframe {
  position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; padding: 0; border: 0;
  border-radius: var(--radius); overflow: hidden; background: #000; cursor: pointer;
}
.yt-play img { width: 100%; height: 100%; object-fit: cover; opacity: .9; transition: opacity .2s; }
.yt-play:hover img { opacity: 1; }
.yt-play:hover .play { transform: scale(1.06); }

.prose { font: 400 19px/1.72 var(--serif); }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose figure, .prose pre, .prose table { margin-block: 0; }
.prose > * + * { margin-top: 1.15em; }
.prose h2, .prose h3 { font-family: var(--serif); line-height: 1.25; letter-spacing: -.01em; }
.prose h2 { font-size: 1.5em; font-weight: 650; margin-top: 2em; }
.prose h3 { font-size: 1.2em; font-weight: 650; margin-top: 1.6em; }
.prose a { color: var(--red-ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.prose a:hover { text-decoration-thickness: 2px; }
.prose blockquote { border-left: 2px solid var(--red); padding-left: 1em; font-style: italic; color: var(--muted); }
.prose hr { border: 0; height: 1px; background: var(--line); margin-block: 2.4em; }
.prose code { font-size: .88em; background: var(--surface-2); padding: .1em .35em; border-radius: 3px; }
.prose pre { background: var(--surface); padding: 16px; border-radius: var(--radius); overflow-x: auto; font-size: 15px; }
.prose table { display: block; overflow-x: auto; border-collapse: collapse; font: 15px/1.5 var(--sans); }
.prose th, .prose td { border-bottom: 1px solid var(--line); padding: 8px 12px; text-align: left; }
/* Charts and maps are cream-backed images; frame them as their own cards so they
   sit well on both the black and parchment grounds. */
.prose figure, .prose > p > img { margin-inline: calc(-1 * min(8vw, 60px)); }
.prose img { width: 100%; border-radius: var(--radius); background: var(--chart-cream); }
.prose figcaption { margin-top: 10px; font: 13.5px/1.5 var(--sans); color: var(--muted); text-align: center; padding-inline: var(--gutter); }
@media (max-width: 760px) { .prose figure, .prose > p > img { margin-inline: 0; } }

.sources { margin-top: 64px; }
.sources .ornament { margin: 0 0 24px; width: 100%; }
.sources h2 { font: 600 13px/1 var(--sans); letter-spacing: .18em; text-transform: uppercase; color: var(--muted); margin: 0 0 16px; }
.sources ol { margin: 0; padding-left: 1.4em; font-size: 15px; line-height: 1.55; }
.sources li + li { margin-top: 8px; }
.sources a { color: var(--text); text-decoration-color: var(--red); text-underline-offset: 3px; overflow-wrap: anywhere; }
.sources li::marker { color: var(--muted); }

.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 32px; }
.tag { font-size: 12.5px; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 3px 12px; }

/* ── Footer ─────────────────────────────────────────── */
.foot { border-top: 1px solid var(--line); padding-block: 40px 48px; color: var(--muted); font-size: 14px; }
.foot-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 32px; }
.foot-brand { display: flex; align-items: center; gap: 10px; font: 600 13px var(--display); letter-spacing: .2em; text-transform: uppercase; color: var(--text); }
.foot-nav { display: flex; gap: 20px; }
.foot-nav a { text-decoration: none; }
.foot-nav a:hover { color: var(--text); }
.foot-note { flex-basis: 100%; margin: 0; font-size: 13px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
