/* AudioSagas design system — tokens first, components second.
   Warm editorial palette: paper + ink + amber. Light/dark via
   prefers-color-scheme with [data-theme] override. */

/* ---------- tokens ---------- */

:root {
  color-scheme: light dark;

  /* type */
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.25rem;
  --text-xl: 1.625rem;
  --text-2xl: clamp(2rem, 5vw, 2.75rem);

  /* spacing scale (0.25rem base) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --space-16: 4rem;

  --radius-sm: 4px;
  --radius-md: 8px;
  --container: 68rem;

  /* light (paper) */
  --bg: #faf7f2;
  --surface: #ffffff;
  --ink: #1c1917;
  --muted: #57534e;
  --accent: #b45309;
  --accent-ink: #ffffff;
  --border: #e5ddd2;
  --shadow: 0 1px 2px rgb(28 25 23 / 0.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16130f;
    --surface: #201c17;
    --ink: #ece5da;
    --muted: #a8a29e;
    --accent: #f5a623;
    --accent-ink: #1c1207;
    --border: #332d26;
    --shadow: none;
  }
}

:root[data-theme="light"] {
  --bg: #faf7f2;
  --surface: #ffffff;
  --ink: #1c1917;
  --muted: #57534e;
  --accent: #b45309;
  --accent-ink: #ffffff;
  --border: #e5ddd2;
  --shadow: 0 1px 2px rgb(28 25 23 / 0.06);
}

:root[data-theme="dark"] {
  --bg: #16130f;
  --surface: #201c17;
  --ink: #ece5da;
  --muted: #a8a29e;
  --accent: #f5a623;
  --accent-ink: #1c1207;
  --border: #332d26;
  --shadow: none;
}

/* ---------- base ---------- */

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 var(--space-4);
  text-wrap: balance;
}

h1 {
  font-size: var(--text-2xl);
}

h2 {
  font-size: var(--text-xl);
}

h3 {
  font-size: var(--text-lg);
}

p {
  margin: 0 0 var(--space-4);
}

a {
  color: var(--accent);
  text-underline-offset: 2px;
}

a:hover {
  text-decoration-thickness: 2px;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- layout ---------- */

.container {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--space-4);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-ink);
  padding: var(--space-2) var(--space-4);
  border-radius: 0 0 var(--radius-sm) 0;
  z-index: 10;
}

.skip-link:focus {
  left: 0;
}

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.site-header .container {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  padding-block: var(--space-4);
}

.wordmark {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.wordmark span {
  color: var(--accent);
}

.site-nav {
  display: flex;
  gap: var(--space-6);
  font-size: var(--text-sm);
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 4px;
}

main {
  padding-block: var(--space-12) var(--space-16);
}

.site-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: var(--text-sm);
  padding-block: var(--space-8);
}

.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-4);
}

/* ---------- components ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: var(--text-sm);
  text-decoration: none;
  cursor: pointer;
}

.btn:hover {
  border-color: var(--accent);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.btn-primary:hover {
  filter: brightness(0.95);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-body {
  padding: var(--space-4);
}

.badge {
  display: inline-block;
  padding: 0 var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: var(--text-sm);
}

.muted {
  color: var(--muted);
}

.prose {
  max-width: 42rem;
}

/* ---------- landing ---------- */

.hero {
  padding-block: var(--space-8) var(--space-12);
  max-width: 46rem;
}

.hero p {
  font-size: var(--text-lg);
  color: var(--muted);
}

.show-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
  padding: 0;
  margin: 0;
  list-style: none;
}

@media (min-width: 640px) {
  .show-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .show-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.show-card .artwork {
  aspect-ratio: 1;
  width: 100%;
  object-fit: cover;
  background: var(--border);
}

.show-card h3 a {
  color: var(--ink);
  text-decoration: none;
}

.show-card h3 a:hover {
  text-decoration: underline;
}

.subscribe-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

/* ---------- show page ---------- */

.show-header {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
  align-items: flex-start;
  margin-bottom: var(--space-8);
}

.show-artwork {
  width: min(300px, 40vw);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.episode-list {
  padding: 0;
  margin: 0;
  list-style: none;
}

.episode-list li {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  align-items: baseline;
  padding-block: var(--space-3);
  border-bottom: 1px solid var(--border);
}

.pagination {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-top: var(--space-6);
}

/* ---------- episode page ---------- */

.episode > header {
  margin-block: var(--space-4) var(--space-6);
}

.player {
  width: 100%;
  max-width: 42rem;
  margin-bottom: var(--space-8);
}

.chapter-list li {
  padding-block: var(--space-1);
}

/* Video facade: 16:9 box, thumbnail + play affordance, iframe swapped in on click. */
.video-embed {
  aspect-ratio: 16 / 9;
  max-width: 42rem;
  margin-bottom: var(--space-8);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #000;
}

.video-embed iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.video-facade {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: #000;
  cursor: pointer;
}

.video-facade img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.85;
}

.video-facade:hover img,
.video-facade:focus-visible img {
  opacity: 1;
}

.video-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 2rem;
  color: #fff;
  text-shadow: 0 1px 8px rgb(0 0 0 / 0.6);
}

/* ---------- newsletter ---------- */

.newsletter {
  margin-top: var(--space-16);
  border-top: 1px solid var(--border);
  padding-top: var(--space-8);
  max-width: 32rem;
}

.newsletter form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.newsletter input[type="email"] {
  flex: 1 1 14rem;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

.hp-field {
  position: absolute;
  left: -9999px;
}
