/*
 * style.css -- black and white, set like a printed journal.
 *   Headings, labels, player: Jost (geometric sans, Futura-like).
 *   Body text: EB Garamond (old-style serif).
 * Both fonts are self-hosted in fonts/ (SIL Open Font License).
 * Colours: black, white and neutral greys only (R = G = B).
 */

@font-face {
  font-family: "Jost";
  src: url("fonts/jost-roman.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Jost";
  src: url("fonts/jost-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "EB Garamond";
  src: url("fonts/eb-garamond.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #fff;
  --fg: #000;
  --muted: #595959;  /* captions, 7:1 on white */
  --rule: #000;      /* hairline rules */
  --track: #767676;  /* unplayed part of the seek bar, 4.5:1 on white */
  --sans: "Jost", "Futura", "Futura PT", "Century Gothic", "Avenir Next", sans-serif;
  --serif: "EB Garamond", "Iowan Old Style", Garamond, "Palatino Linotype", Georgia, serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000;
    --fg: #fff;
    --muted: #a6a6a6;  /* 8.6:1 on black */
    --rule: #fff;
    --track: #8c8c8c;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--serif);
  font-size: 1.25rem;
  line-height: 1.45;
  font-kerning: normal;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: .18em;
}
a:hover { text-decoration-thickness: 2px; }

h1, h2, h3 { margin: 0; font-weight: normal; }
p { margin: 0; }

:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 10;
  padding: .4rem .7rem;
  font-family: var(--sans); font-size: .9rem;
  background: var(--bg); color: var(--fg);
  border: 1px solid var(--rule);
}
.skip-link:focus { top: 1rem; }

/* The page: one narrow column with wide white margins. */
.page {
  max-width: 34rem;
  margin: 0 auto;
  padding: 4rem 1.5rem 2.5rem;
}

/* Running header: a hairline, then the title in small sans. */
.running-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  padding-top: .5rem;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: .95rem;
}
.running-head h1,
.running-title { font-size: inherit; line-height: 1.3; }
.running-head p:last-child { color: var(--muted); }

/* Body text: serif, first-line indent, no gap between paragraphs. */
.intro {
  margin-top: 3.5rem;
  text-indent: 1.5em;
  hyphens: auto;
  -webkit-hyphens: auto;
}

/* Episodes */
.episodes { list-style: none; margin: 0; padding: 0; }
.episode {
  margin-top: 3.5rem;
  scroll-margin-top: 1.5rem;
}

/* Caption line (like a photo caption): small grey sans. */
.caption {
  font-family: var(--sans);
  font-size: .8rem;
  line-height: 1.4;
  color: var(--muted);
  font-variant-numeric: lining-nums tabular-nums;
}
.ep-row { display: flex; justify-content: space-between; align-items: baseline; }
.ep-number { text-decoration: none; }
.ep-number:hover { text-decoration: underline; }

/* Title: bold geometric sans, tight leading. */
.ep-title {
  margin-top: .6rem;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 2.6rem;
  line-height: 1.02;
  letter-spacing: -.01em;
}
/* Hook: sans italic, like a subtitle. */
.ep-hook {
  margin-top: .45rem;
  font-family: var(--sans);
  font-style: italic;
  font-size: 1.3rem;
  line-height: 1.3;
}
/* Credit: small sans, like a byline description. */
.ep-credit {
  margin-top: .7rem;
  font-family: var(--sans);
  font-size: .85rem;
  line-height: 1.4;
}
.ep-credit cite { font-style: italic; }

.ep-play { margin-top: 1.25rem; margin-left: -.5rem; }
.episode.is-current .ep-play { display: none; }
.ep-empty { font-family: var(--sans); color: var(--muted); }
.noscript { margin-top: 3rem; font-family: var(--sans); font-size: 1rem; }

/* Player: seek line with plain text controls under it. */
.player[hidden] { display: none; }
.player {
  margin-top: 1.75rem;
  font-family: var(--sans);
}

.controls {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 0 .1rem;
  margin-left: -.5rem;
}
.times {
  margin-left: auto;
  font-size: .9rem;
  font-variant-numeric: lining-nums tabular-nums;
  white-space: nowrap;
}
.times-sep { color: var(--muted); }

/* Buttons: plain sans text labels. No boxes. */
.btn {
  min-width: 44px; min-height: 44px;
  padding: 0 .5rem;
  font-family: var(--sans);
  font-size: .95rem;
  font-variant-numeric: lining-nums tabular-nums;
  color: var(--fg);
  background: transparent;
  border: 0;
  border-radius: 0;
  cursor: pointer;
}
.btn:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .25em; }
.btn-play { font-weight: 700; min-width: 4.25rem; text-align: left; }
#btn-speed { min-width: 3.5rem; }
#btn-mute { min-width: 4.5rem; text-align: left; }

/* Range inputs (seek + volume): a 1px line with a small square playhead. */
input[type="range"] {
  --progress: 0%;
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 24px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 1px;
  /* Hard colour stop (no blend): played part solid, the rest grey. */
  background: linear-gradient(to right, var(--fg) var(--progress), var(--track) var(--progress));
}
input[type="range"]::-moz-range-track { height: 1px; background: var(--track); }
input[type="range"]::-moz-range-progress { height: 1px; background: var(--fg); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 9px; height: 9px;
  margin-top: -4px;
  border: 0; border-radius: 0;
  background: var(--fg);
}
input[type="range"]::-moz-range-thumb {
  width: 9px; height: 9px;
  border: 0; border-radius: 0;
  background: var(--fg);
}
input[type="range"]:focus-visible { outline-offset: 1px; }
input.volume { width: 4.5rem; flex: none; }

/* Running footer: italic sans. */
.running-foot {
  margin-top: 5rem;
  font-family: var(--sans);
}
.running-foot-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  font-size: .9rem;
  font-style: italic;
}

/* 404 */
.notfound { margin-top: 3.5rem; }

@media (max-width: 30em) {
  body { font-size: 1.15rem; }
  .page { padding-top: 2.5rem; }
  .ep-title { font-size: 2.1rem; }
  .ep-hook { font-size: 1.15rem; }
  .times { margin-left: auto; }
  input.volume { display: none; }  /* phones use hardware volume */
  .controls { margin-left: -.4rem; }
  .btn, .btn-play, #btn-speed, #btn-mute { min-width: 40px; padding: 0 .4rem; }
}

/* Respect reduced motion (nothing animates, but keep it explicit). */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}

/* Forced colours (Windows high contrast) */
@media (forced-colors: active) {
  .btn { border: 1px solid ButtonText; }
  input[type="range"]::-webkit-slider-runnable-track { background: CanvasText; }
  input[type="range"]::-webkit-slider-thumb { background: CanvasText; }
  input[type="range"]::-moz-range-track { background: CanvasText; }
  input[type="range"]::-moz-range-progress { background: CanvasText; }
  input[type="range"]::-moz-range-thumb { background: CanvasText; }
}
