:root {
  --paper: #f6f1e7;
  --ink: #18233a;
  --muted: #6d6b69;
  --red: #ef3d55;
  --red-dark: #bb1835;
  --yellow: #ffd34e;
  --green: #176a88;
  --line: color-mix(in srgb, var(--ink) 18%, transparent);
  --shadow: 0 20px 60px rgb(42 30 17 / 12%);
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--paper);
  color: var(--ink);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--paper); }
a { color: inherit; text-underline-offset: .2em; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.hero { min-height: 88vh; padding: 1.25rem clamp(1.25rem, 4vw, 5rem) 0; border-bottom: 1px solid var(--line); background-image: radial-gradient(circle at 85% 20%, rgb(255 211 78 / 38%), transparent 24%), linear-gradient(115deg, transparent 55%, rgb(23 106 136 / 8%) 55%); overflow: hidden; }
nav { max-width: 1440px; margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 2rem; }
.brand { display: flex; align-items: center; gap: .75rem; font-weight: 850; letter-spacing: -.04em; text-decoration: none; font-size: 1.1rem; }
.brand-mark { display: grid; place-items: center; width: 2.35rem; aspect-ratio: 1; background: var(--red); color: white; border-radius: 50%; font-size: .72rem; letter-spacing: -.06em; transform: rotate(-7deg); }
.nav-links { display: flex; gap: clamp(1rem, 3vw, 2.5rem); font-size: .85rem; font-weight: 700; }
.nav-links a { text-decoration: none; }
.nav-links a:hover { color: var(--red); }

.hero-grid { max-width: 1440px; margin: clamp(4rem, 10vh, 8rem) auto 5rem; display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, .72fr); align-items: center; gap: clamp(3rem, 8vw, 8rem); }
.eyebrow { margin: 0 0 1rem; color: var(--red-dark); font-weight: 850; font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; }
h1, h2, h3 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-weight: 500; letter-spacing: -.055em; line-height: .92; }
h1 { font-size: clamp(4.5rem, 10vw, 9.2rem); }
h1 em { color: var(--red); font-weight: inherit; }
.lede { max-width: 660px; margin: 2rem 0; font-size: clamp(1.1rem, 2vw, 1.4rem); line-height: 1.55; color: #45453f; }
.primary-action { display: inline-flex; align-items: center; gap: 2rem; padding: 1rem 1.25rem; background: var(--ink); color: white; border-radius: 999px; text-decoration: none; font-weight: 750; }
.primary-action:hover { background: var(--red); }

.cassette { position: relative; width: min(100%, 560px); aspect-ratio: 1.55; padding: 8%; background: var(--green); border: 8px solid var(--ink); border-radius: 1.75rem; transform: rotate(4deg); box-shadow: 18px 22px 0 var(--yellow), var(--shadow); }
.cassette::before, .cassette::after { content: ""; position: absolute; width: 12px; aspect-ratio: 1; border-radius: 50%; background: var(--ink); top: 16px; }
.cassette::before { left: 18px; } .cassette::after { right: 18px; }
.cassette-label { height: 50%; padding: 7%; display: grid; grid-template-columns: auto 1fr; align-content: center; gap: .25rem 1rem; background: var(--paper); border-radius: .6rem; transform: rotate(-2deg); }
.cassette-label span { color: var(--red); font: 900 clamp(1.6rem, 4vw, 3rem)/1 sans-serif; }
.cassette-label strong { align-self: end; font-size: clamp(1rem, 2vw, 1.5rem); letter-spacing: .1em; }
.cassette-label small { grid-column: 1 / -1; border-top: 2px solid var(--ink); padding-top: .4rem; font: 700 .62rem/1 sans-serif; letter-spacing: .12em; }
.tape-window { position: absolute; left: 28%; right: 28%; bottom: 16%; height: 23%; display: flex; align-items: center; justify-content: space-between; padding: 4%; background: #d7cfc0; border: 5px solid var(--ink); border-radius: 999px; }
.tape-window i { width: 35%; aspect-ratio: 1; border: 8px dashed var(--ink); border-radius: 50%; background: var(--paper); }
.cassette-line { position: absolute; bottom: 6%; left: 18%; right: 18%; border-bottom: 4px solid var(--ink); }

.stats { max-width: 1440px; margin: auto; display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-bottom: 0; }
.stats div { min-height: 7rem; padding: 1.5rem; border-right: 1px solid var(--line); }
.stats div:last-child { border: 0; }
.stats dt { font: 500 clamp(2rem, 4vw, 3.5rem)/1 Georgia, serif; letter-spacing: -.05em; }
.stats dd { margin: .5rem 0 0; color: var(--muted); font-size: .76rem; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; }

.catalogue { max-width: 1440px; margin: auto; padding: clamp(5rem, 10vw, 9rem) clamp(1.25rem, 4vw, 5rem); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 2rem; margin-bottom: 2.5rem; }
h2 { font-size: clamp(3rem, 7vw, 6.5rem); }
.section-heading > p { color: var(--muted); font-weight: 700; white-space: nowrap; }
.search-panel { position: sticky; top: .75rem; z-index: 5; display: grid; grid-template-columns: minmax(260px, 1fr) auto auto auto; gap: .75rem; padding: .75rem; background: rgb(246 241 231 / 90%); border: 1px solid var(--line); border-radius: 1rem; box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.search-panel label { min-width: 10rem; }
.search-field { position: relative; display: flex; align-items: center; }
.search-field svg { position: absolute; left: 1rem; width: 1.1rem; fill: none; stroke: currentColor; stroke-width: 2; }
.search-field input { width: 100%; height: 100%; min-height: 3.25rem; padding: .8rem 3rem; border: 0; border-radius: .65rem; background: white; outline: 0; }
.search-field input:focus { box-shadow: 0 0 0 3px var(--yellow); }
kbd { position: absolute; right: 1rem; padding: .15rem .4rem; border: 1px solid var(--line); border-radius: .25rem; color: var(--muted); background: var(--paper); }
.filter-label { display: block; margin: .15rem .6rem .25rem; color: var(--muted); font-size: .62rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
select { min-width: 10rem; border: 0; background: transparent; font-weight: 700; }
#reset { border: 0; padding: 0 1rem; background: transparent; color: var(--red-dark); font-weight: 750; }

.results { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 2rem; margin-top: 3rem; border-top: 1px solid var(--ink); }
.episode-card { width: 100%; min-height: 7rem; display: grid; grid-template-columns: 4.8rem 1fr auto; gap: 1rem; align-items: center; padding: 1rem .25rem; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: inherit; text-align: left; }
.episode-card:hover { background: color-mix(in srgb, var(--yellow) 28%, transparent); }
.episode-number { color: var(--red); font: 500 1.7rem/1 Georgia, serif; }
.episode-copy { display: grid; gap: .45rem; min-width: 0; }
.episode-copy strong { font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.episode-copy small { color: var(--muted); }
.episode-arrow { font-size: 1.2rem; }
.empty { padding: 5rem; text-align: center; border-bottom: 1px solid var(--line); }
.empty strong { font: 500 2rem Georgia, serif; }

.api-teaser { display: grid; grid-template-columns: 1fr 1fr; gap: 8vw; padding: clamp(5rem, 10vw, 9rem) max(1.25rem, calc((100vw - 1280px) / 2)); background: var(--green); color: white; }
.api-teaser p:not(.eyebrow) { max-width: 42rem; color: #cbd9d3; font-size: 1.15rem; line-height: 1.6; }
.api-teaser .eyebrow { color: var(--yellow); }
.code-card { align-self: center; padding: 1.5rem; border: 1px solid rgb(255 255 255 / 25%); border-radius: 1rem; background: rgb(0 0 0 / 18%); box-shadow: var(--shadow); overflow: hidden; }
.code-bar { display: flex; justify-content: space-between; margin-bottom: 2rem; color: var(--yellow); font-size: .72rem; font-weight: 850; letter-spacing: .12em; }
.code-bar button { border: 0; color: white; background: transparent; }
.code-card code { display: block; margin-bottom: 2rem; color: #e8f4ef; font: 500 clamp(.8rem, 1.6vw, 1.05rem)/1.6 ui-monospace, SFMono-Regular, monospace; overflow-wrap: anywhere; }
.code-card a { color: var(--yellow); font-weight: 750; }

footer { display: flex; justify-content: space-between; gap: 2rem; padding: 2rem clamp(1.25rem, 4vw, 5rem); background: var(--ink); color: #bbb9b0; font-size: .78rem; }

dialog { width: min(760px, calc(100% - 2rem)); max-height: calc(100% - 2rem); padding: 0; border: 0; border-radius: 1.25rem; background: var(--paper); color: var(--ink); box-shadow: 0 30px 100px rgb(0 0 0 / 45%); }
dialog::backdrop { background: rgb(12 21 18 / 72%); backdrop-filter: blur(5px); }
.dialog-close { position: sticky; z-index: 2; top: 1rem; float: right; margin: 1rem; width: 2.6rem; aspect-ratio: 1; border: 0; border-radius: 50%; background: var(--ink); color: white; font-size: 1.5rem; }
#episode-detail { padding: clamp(2rem, 6vw, 4.5rem); }
.detail-number { color: var(--red); font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
#episode-detail h2 { margin: .7rem 0 1rem; font-size: clamp(2.5rem, 8vw, 5rem); }
.detail-meta { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 2rem; }
.pill { padding: .45rem .7rem; border: 1px solid var(--line); border-radius: 999px; font-size: .76rem; font-weight: 750; }
.detail-description { font: 1.08rem/1.7 Georgia, serif; }
.detail-section { margin-top: 2.5rem; }
.detail-section h3 { margin-bottom: 1rem; font: 700 .75rem/1 sans-serif; letter-spacing: .12em; text-transform: uppercase; }
.detail-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem 1.5rem; margin: 0; }
.detail-list div { padding-bottom: .55rem; border-bottom: 1px solid var(--line); }
.detail-list dt { color: var(--muted); font-size: .72rem; }
.detail-list dd { margin: .2rem 0 0; font-weight: 700; }
.detail-links { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 2.5rem; }
.detail-links a { padding: .7rem .9rem; border-radius: .5rem; background: var(--ink); color: white; font-size: .78rem; font-weight: 750; text-decoration: none; }

@media (max-width: 900px) {
  .hero { min-height: 0; }
  .hero-grid { grid-template-columns: 1fr; }
  .cassette { width: min(88%, 520px); margin: 0 auto; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stats div:nth-child(2) { border-right: 0; }
  .stats div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .search-panel { grid-template-columns: 1fr 1fr; }
  .search-field { grid-column: 1 / -1; }
  .api-teaser { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .nav-links a:first-child { display: none; }
  h1 { font-size: clamp(4rem, 22vw, 6rem); }
  .results { grid-template-columns: 1fr; }
  .section-heading { display: block; }
  .section-heading > p { margin-top: 1rem; }
  .search-panel { position: relative; top: auto; grid-template-columns: 1fr; }
  .search-field { grid-column: auto; }
  .search-panel label, select { width: 100%; }
  #reset { min-height: 2.5rem; }
  footer { display: block; }
  .detail-list { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
