/* Just Another Patriot: site styles
   Identity: near-black #111418, cool grey, one amber accent #f2b705.
   Archivo (condensed, heavy) for headings, Source Serif 4 for reading,
   IBM Plex Mono for labels. One type scale, one spacing scale. */

:root {
  /* Colour */
  --paper: #f4f5f3;
  --paper-2: #e9ebe7;
  --ink: #111418;
  --ink-2: #3b4148;
  --ink-3: #5a6168;          /* meta text: 5.9:1 on paper */
  --rule: #cfd3ce;
  --rule-strong: #111418;
  --accent: #f2b705;
  --accent-hover: #ffc824;
  --accent-ink: #111418;
  --link: #111418;
  --focus: #111418;
  --night: #111418;           /* always-dark surfaces: hero, footer, player */
  --night-ink: #f4f3ef;
  --night-ink-2: #b9bfc5;     /* 9.6:1 on --night */

  /* Type */
  --display: "Archivo", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --body: "Source Serif 4", Georgia, "Times New Roman", serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --step--2: 0.75rem;
  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: clamp(1.375rem, 1.2rem + 0.8vw, 1.75rem);
  --step-3: clamp(1.75rem, 1.4rem + 1.6vw, 2.5rem);
  --step-4: clamp(2.25rem, 1.6rem + 3.2vw, 4rem);

  /* Space */
  --space-2xs: 0.25rem;
  --space-xs: 0.5rem;
  --space-s: 0.75rem;
  --space-m: 1rem;
  --space-l: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4.5rem;
  --section: clamp(2.75rem, 2rem + 4vw, 5rem);
  --gutter: clamp(1.125rem, 0.75rem + 2vw, 2rem);

  /* Measure */
  --measure: 65ch;
  --article: 42rem;
  --media: 60rem;
  --wide: 76rem;
  color-scheme: light dark;
}
@media (min-width: 48rem) { :root { --step-0: 1.125rem; } }
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f1214;
    --paper-2: #181c1f;
    --ink: #eceeea;
    --ink-2: #b3b9be;
    --ink-3: #9aa1a7;         /* 7.2:1 on dark paper */
    --rule: #2a3034;
    --rule-strong: #eceeea;
    --link: #eceeea;
    --focus: #f2b705;
  }
}

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: var(--step-0);
  line-height: 1.6;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; height: auto; }
a { color: var(--link); text-decoration-color: var(--accent); text-decoration-thickness: 0.12em; text-underline-offset: 0.2em; }
a:hover { background: var(--accent); color: var(--accent-ink); text-decoration-color: var(--accent-ink); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
::selection { background: var(--accent); color: var(--accent-ink); }

.wrap { max-width: var(--wide); margin-inline: auto; padding-inline: var(--gutter); }
.skip { position: absolute; left: -9999px; top: 0; }
.skip:focus { left: var(--space-m); top: var(--space-m); background: var(--accent); color: var(--accent-ink); padding: var(--space-xs) var(--space-s); z-index: 100; font-family: var(--display); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; outline-color: var(--ink); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

/* Type */
h1, h2, h3 { font-family: var(--display); font-stretch: 75%; font-weight: 800; line-height: 1; letter-spacing: -0.005em; margin: 0 0 var(--space-m); text-wrap: balance; }
h1 { font-size: var(--step-4); text-transform: uppercase; }
h2 { font-size: var(--step-3); text-transform: uppercase; margin-top: var(--space-2xl); }
h3 { font-size: var(--step-2); font-weight: 700; line-height: 1.05; }
p { margin: 0 0 var(--space-m); text-wrap: pretty; }
.kicker, .meta, .label { font-family: var(--mono); font-size: var(--step--2); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.kicker { margin: 0 0 var(--space-s); }
.kicker strong { color: var(--ink); font-weight: 600; }
.lede { font-size: clamp(1.1875rem, 1.05rem + 0.6vw, 1.4375rem); line-height: 1.45; max-width: 36em; color: var(--ink-2); margin-bottom: 0; }
.mark { background: var(--accent); color: var(--accent-ink); padding: 0 0.15em; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.prose { max-width: var(--measure); }
.prose > h2 { font-size: var(--step-2); margin-top: var(--space-2xl); }
.prose > h2:first-child { margin-top: 0; }
.prose > h3 { font-size: var(--step-1); margin-top: var(--space-xl); margin-bottom: var(--space-xs); }
.prose ol, .prose ul { padding-left: 1.25em; margin: 0 0 var(--space-m); }
.prose li { margin-bottom: var(--space-xs); }
.muted { color: var(--ink-3); }

/* Masthead */
.masthead { border-bottom: 1px solid var(--rule); background: var(--paper); }
.masthead .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-s) var(--space-xl); padding-block: var(--space-s); }
.brand { display: inline-flex; align-items: center; text-decoration: none; }
.brand:hover { background: none; }
.brand-wordmark { height: 3rem; width: auto; display: block; }
.nav { display: flex; flex-wrap: wrap; gap: var(--space-2xs) var(--space-l); font-family: var(--display); font-size: 0.9375rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; }
.nav a { text-decoration: none; padding: var(--space-xs) 0.1rem; box-shadow: inset 0 -0.2em 0 transparent; }
.nav a:hover { background: none; color: var(--ink); box-shadow: inset 0 -0.2em 0 var(--rule); }
.nav a[aria-current] { box-shadow: inset 0 -0.2em 0 var(--accent); }

/* Mobile header: hamburger menu below 720px. */
.menu-toggle { display: none; background: none; border: 0; padding: 0.6rem; margin-right: -0.6rem; cursor: pointer; color: inherit; min-width: 44px; min-height: 44px; }
.menu-toggle span { display: block; width: 24px; height: 2px; margin: 5px 0; background: currentColor; transition: transform 0.2s, opacity 0.2s; }
.menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
@media (max-width: 720px) {
  .menu-toggle { display: block; }
  .nav { display: none; width: 100%; flex-direction: column; gap: 0; padding: var(--space-2xs) 0 var(--space-s); }
  .nav.open { display: flex; }
  .nav a { padding: var(--space-s) 0; border-top: 1px solid var(--rule); font-size: 1rem; }
  .nav a[aria-current] { box-shadow: inset 4px 0 0 var(--accent); padding-left: var(--space-s); }
  .brand-wordmark { height: 2.5rem; }
}

/* Page header (inner pages) */
.page-head { padding-block: clamp(2.5rem, 1.5rem + 5vw, 5rem) clamp(2rem, 1.5rem + 3vw, 3.5rem); border-bottom: 1px solid var(--rule); }
.page-head h1 { max-width: 16ch; }
.page-head .lede { margin-top: var(--space-l); }

/* Sections */
.section { padding-block: var(--section); border-bottom: 1px solid var(--rule); }
.section-title { display: flex; align-items: center; gap: var(--space-s); font-size: var(--step-1); letter-spacing: 0.04em; margin: 0 0 var(--space-xl); }
.section-title::before { content: ""; width: 0.65em; height: 0.65em; background: var(--accent); flex: none; }
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--rule); }
.section-foot { margin: var(--space-xl) 0 0; }

/* Buttons */
.actions { display: flex; flex-wrap: wrap; gap: var(--space-s); margin: 0; padding: 0; list-style: none; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5em; min-height: 2.875rem; padding: 0.65rem 1.15rem; font-family: var(--display); font-weight: 700; font-size: 0.9375rem; line-height: 1; letter-spacing: 0.07em; text-transform: uppercase; text-decoration: none; border: 2px solid var(--ink); color: var(--ink); background: transparent; }
.btn:hover { background: var(--ink); color: var(--paper); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.btn .arrow { font-family: var(--body); font-weight: 600; }
.text-link { font-family: var(--display); font-weight: 700; font-size: 0.9375rem; text-transform: uppercase; letter-spacing: 0.07em; }

/* Hero banner: matches the Buy Me a Coffee cover (always dark, both themes). */
.hero-banner { --focus: #f2b705; position: relative; overflow: hidden; background: var(--night); color: var(--night-ink); padding: clamp(3rem, 8vw, 6rem) 0; min-height: clamp(320px, 42vw, 560px); display: flex; align-items: center; }
.hero-photo { position: absolute; top: 0; bottom: 0; right: 0; left: 38%; background: url(hero-tom.jpg) 15% 18% / cover no-repeat; }
.hero-photo::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, #111418 0%, rgba(17,20,24,.6) 18%, rgba(17,20,24,0) 40%); }
.hero-inner { position: relative; width: 100%; }
.hero-wordmark { height: clamp(90px, 13vw, 170px); width: auto; display: block; }
.hero-tag { margin: 1.25rem 0 0; font-family: var(--body); font-size: clamp(1.25rem, 0.9rem + 1.6vw, 1.9rem); line-height: 1.3; color: #e9e7e1; max-width: 26ch; }
.hero-tag .mark { background: #f2b705; color: #111418; }
.hero-motto { margin: var(--space-s) 0 0; font-family: var(--mono); font-size: var(--step--1); letter-spacing: 0.06em; text-transform: uppercase; color: var(--night-ink-2); }
@media (max-width: 640px) {
  .hero-banner { display: block; padding: 0 0 2.25rem; min-height: 0; }
  .hero-photo { position: relative; left: 0; height: 62vw; background-position: 30% 15%; }
  .hero-photo::after { background: linear-gradient(180deg, rgba(17,20,24,0) 55%, #111418 100%); }
  .hero-wordmark { display: none; }
  .hero-inner { margin-top: -0.5rem; }
  .hero-tag { margin-top: 0.4rem; font-size: 1.375rem; }
  .hero-motto { font-size: var(--step--2); }
}

/* Episode feature (home + episode list) */
.feature { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: var(--space-l) clamp(1.5rem, 1rem + 2.5vw, 3rem); align-items: center; }
.thumb { position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; background: var(--night); text-decoration: none; }
.thumb:hover { background: var(--night); }
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.thumb .chip { position: absolute; left: var(--space-s); bottom: var(--space-s); display: inline-flex; align-items: center; gap: 0.5em; background: rgba(17,20,24,.88); color: #f4f3ef; font-family: var(--mono); font-size: var(--step--2); letter-spacing: 0.08em; text-transform: uppercase; padding: 0.35rem 0.6rem; }
.thumb .chip::before { content: ""; width: 0; height: 0; border-style: solid; border-width: 0.4em 0 0.4em 0.65em; border-color: transparent transparent transparent #f2b705; }
.feature-body > * + * { margin-top: var(--space-s); }
.feature-body .kicker { margin: 0; }
.feature-title { font-size: var(--step-3); text-transform: uppercase; line-height: 0.98; margin: 0; }
.feature-title a { text-decoration: none; }
.feature-title a:hover { background: none; color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 0.08em; }
.standfirst { font-size: var(--step-1); line-height: 1.4; color: var(--ink-2); margin-bottom: 0; max-width: 32em; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2xs) var(--space-s); margin: 0; }
.meta > * + *::before { content: "·"; margin-right: var(--space-s); color: var(--ink-3); }
.badge { display: inline-block; font-family: var(--mono); font-size: var(--step--2); font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent-ink); background: var(--accent); padding: 0.15rem 0.45rem; }
.feature .actions { padding-top: var(--space-xs); }
@media (prefers-reduced-motion: no-preference) {
  .thumb img { transition: transform 0.4s ease; }
  .thumb:hover img { transform: scale(1.025); }
}
@media (max-width: 860px) {
  .feature { grid-template-columns: minmax(0, 1fr); }
}

/* Principles */
.principles { list-style: none; padding: 0; margin: 0; counter-reset: p; display: grid; gap: var(--space-xl) var(--space-l); grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); }
.principles li { counter-increment: p; border-top: 3px solid var(--rule-strong); padding-top: var(--space-s); font-size: var(--step--1); line-height: 1.55; color: var(--ink-2); }
.principles li::before { content: "0" counter(p); display: block; font-family: var(--mono); font-size: var(--step--2); letter-spacing: 0.08em; color: var(--ink-3); margin-bottom: var(--space-xs); }
.principles strong { display: block; font-family: var(--display); font-stretch: 75%; font-weight: 800; font-size: 1.375rem; text-transform: uppercase; line-height: 1.05; color: var(--ink); margin-bottom: var(--space-xs); }

/* Follow / support band */
.band { background: var(--paper-2); border-bottom: 1px solid var(--rule); padding-block: var(--space-xl); }
.band .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-m) var(--space-xl); }
.band h2 { font-size: var(--step-1); letter-spacing: 0.04em; margin: 0 0 var(--space-2xs); }
.band p { margin: 0; color: var(--ink-2); font-size: var(--step--1); max-width: 46ch; }

/* Article (episode page) */
.article-head { padding-block: clamp(2.25rem, 1.5rem + 4vw, 4.5rem) var(--space-xl); }
.article-col { max-width: var(--article); margin-inline: auto; }
.media-col { max-width: var(--media); margin-inline: auto; }
.article-head h1 { font-size: clamp(2.25rem, 1.6rem + 3vw, 3.75rem); margin-bottom: var(--space-l); }
.article-head .meta { margin-top: var(--space-l); padding-top: var(--space-s); border-top: 1px solid var(--rule); }
.player { margin: 0 auto; }
.player-frame { position: relative; aspect-ratio: 16 / 9; background: var(--night); overflow: hidden; }
.player-frame img, .player-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; object-fit: cover; }
.player-frame img { filter: brightness(0.42) saturate(0.9); }
.player-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-s); padding: var(--space-m); text-align: center; color: #f4f3ef; }
.player-overlay .play { width: clamp(3rem, 2rem + 4vw, 4.5rem); aspect-ratio: 1; border-radius: 50%; border: 2px solid rgba(244,243,239,.85); display: grid; place-items: center; }
.player-overlay .play::before { content: ""; border-style: solid; border-width: 0.55em 0 0.55em 0.9em; border-color: transparent transparent transparent #f2b705; margin-left: 0.2em; font-size: clamp(0.9rem, 0.6rem + 1vw, 1.3rem); }
.player-overlay strong { font-family: var(--display); font-stretch: 75%; font-weight: 800; font-size: clamp(1.25rem, 1rem + 1.4vw, 2rem); text-transform: uppercase; letter-spacing: 0.02em; line-height: 1; }
.player-overlay span { font-family: var(--mono); font-size: var(--step--2); letter-spacing: 0.06em; text-transform: uppercase; color: #c9ced3; max-width: 40ch; }
.player figcaption { font-family: var(--mono); font-size: var(--step--2); letter-spacing: 0.04em; color: var(--ink-3); padding: var(--space-s) 0 0; border-bottom: 1px solid var(--rule); padding-bottom: var(--space-s); }
.article-body { padding-block: var(--space-2xl) var(--section); }
.article-body .prose { max-width: none; }
.article-body .prose > p, .article-body .callout { max-width: none; }

/* In-text source references, styled as footnote markers */
.ref { font-family: var(--mono); font-size: 0.7em; font-weight: 600; vertical-align: 0.35em; line-height: 0; text-decoration: none; padding: 0.15em 0.3em; margin-left: 0.1em; background: var(--paper-2); color: var(--ink-2); border-radius: 2px; white-space: nowrap; }
.ref:hover { background: var(--accent); color: var(--accent-ink); }

/* Callout */
.callout { border-left: 5px solid var(--accent); padding: var(--space-m) var(--space-l); background: var(--paper-2); margin: var(--space-xl) 0; max-width: var(--measure); }
.callout p:last-child { margin-bottom: 0; }

/* Sources: numbered footnotes with domains */
.sources-head { margin-top: var(--space-3xl); }
.sources-head h2 { font-size: var(--step-2); margin: 0 0 var(--space-xs); }
.sources-head p { color: var(--ink-3); font-size: var(--step--1); margin-bottom: var(--space-l); }
.sources { list-style: none; padding: 0; margin: 0; border-top: 2px solid var(--rule-strong); }
.sources > li { display: grid; grid-template-columns: 3.25rem minmax(0, 1fr); gap: var(--space-s); padding: var(--space-m) 0; border-bottom: 1px solid var(--rule); font-size: var(--step--1); line-height: 1.5; scroll-margin-top: var(--space-l); }
.sources > li:target { background: color-mix(in srgb, var(--accent) 14%, transparent); box-shadow: -0.75rem 0 0 color-mix(in srgb, var(--accent) 14%, transparent), 0.75rem 0 0 color-mix(in srgb, var(--accent) 14%, transparent); }
.sources .num { font-family: var(--mono); font-size: var(--step--2); font-weight: 600; padding-top: 0.2em; }
.sources .num span { background: var(--accent); color: var(--accent-ink); padding: 0.1rem 0.35rem; }
.sources .cite { margin: 0; color: var(--ink); }
.sources .links { list-style: none; margin: var(--space-xs) 0 0; padding: 0; display: grid; gap: var(--space-2xs); }
.sources .links li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--space-xs); }
.sources .links a { overflow-wrap: anywhere; }
.domain { font-family: var(--mono); font-size: var(--step--2); letter-spacing: 0.02em; color: var(--ink-3); }
.sources .note { color: var(--ink-3); font-style: italic; margin: var(--space-2xs) 0 0; }

/* Share / support band (episode page) */
.share { margin-top: var(--space-3xl); border-top: 2px solid var(--rule-strong); padding-top: var(--space-l); display: grid; gap: var(--space-xl); grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); }
.share h2 { font-size: var(--step-1); letter-spacing: 0.04em; margin: 0 0 var(--space-s); }
.share p { font-size: var(--step--1); color: var(--ink-2); margin-bottom: var(--space-s); }
.share .btn { font-size: 0.8125rem; min-height: 2.625rem; padding: 0.55rem 0.9rem; }
.errors { margin-top: var(--space-xl); font-size: var(--step--1); color: var(--ink-3); max-width: var(--measure); }

/* Table */
.table-wrap { overflow-x: auto; margin-block: 0 var(--space-2xl); border: 1px solid var(--rule); }
table { width: 100%; border-collapse: collapse; font-size: var(--step--1); min-width: 34rem; }
caption { text-align: left; }
th, td { text-align: left; padding: var(--space-s) var(--space-m); border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-family: var(--display); text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.8125rem; background: var(--paper-2); }
td.empty { text-align: center; color: var(--ink-3); font-style: italic; padding-block: var(--space-l); }

/* Simple link pills (404) */
.links-row { list-style: none; padding: 0; margin: var(--space-xl) 0 0; display: flex; flex-wrap: wrap; gap: var(--space-s); }

/* Footer: always dark, closes every page */
.footer { --focus: #f2b705; --link: #f4f3ef; background: var(--night); color: var(--night-ink-2); border-top: 4px solid var(--accent); padding-block: var(--space-2xl) var(--space-xl); font-size: var(--step--1); line-height: 1.55; }
.footer a { color: var(--night-ink); }
.footer a:hover { color: #111418; }
.footer-top { display: grid; gap: var(--space-xl); grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); align-items: start; }
.footer-brand img { height: 3.25rem; width: auto; display: block; }
.footer-brand p { margin: var(--space-s) 0 0; max-width: 36ch; color: #d6dade; }
.footer-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-xs) var(--space-l); list-style: none; padding: 0; margin: 0; font-family: var(--display); font-weight: 700; font-size: 0.875rem; text-transform: uppercase; letter-spacing: 0.07em; }
.footer-nav a { text-decoration: none; display: inline-block; padding-block: 0.35rem; }
.footer-nav a:hover { background: none; color: #f2b705; }
.footer-nav .contact { grid-column: 1 / -1; font-family: var(--mono); font-weight: 400; text-transform: none; letter-spacing: 0; font-size: var(--step--1); }
.footer-nav .contact a { text-decoration: underline; text-decoration-color: #f2b705; }
.footer-bottom { margin-top: var(--space-2xl); padding-top: var(--space-m); border-top: 1px solid #2c3236; display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-xs) var(--space-xl); font-family: var(--mono); font-size: var(--step--2); letter-spacing: 0.03em; }
.footer-bottom p { margin: 0; }
@media (max-width: 720px) {
  .footer-top { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: no-preference) {
  a, .btn { transition: background-color 0.12s ease, color 0.12s ease, border-color 0.12s ease; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* Small screens: keep the player overlay legible over the poster's own lettering. */
@media (max-width: 560px) {
  .player-frame img { filter: brightness(0.28) saturate(0.8); }
  .player-overlay span:not(.play) { display: none; }
}
@media (max-width: 640px) { .meta > * + *::before { content: none; } .meta { gap: var(--space-2xs) var(--space-m); } }
