:root {
  color-scheme: light dark;
  --paper: #f4ede1;
  --paper-bright: #fffaf1;
  --ink: #241711;
  --ink-soft: #655147;
  --coffee: #7a321f;
  --coffee-dark: #401b13;
  --cream: #f7e4bd;
  --orange: #dc6b35;
  --sage: #4d7163;
  --line: rgba(65, 35, 24, 0.24);
  --serif: Georgia, "Times New Roman", serif;
  --sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --shell: min(1180px, calc(100vw - 48px));
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  min-width: 300px;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

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

audio {
  display: block;
  width: 100%;
}

code {
  font-family: var(--mono);
  font-size: 0.88em;
}

:focus-visible {
  outline: 3px solid #e45d2d;
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.8rem;
  left: 0.8rem;
  padding: 0.65rem 0.9rem;
  transform: translateY(-180%);
  background: #fff4d6;
  box-shadow: 0 6px 24px rgba(20, 10, 6, 0.25);
  color: #21130c;
  font-weight: 800;
}

.skip-link:focus {
  transform: translateY(0);
}

.global-header {
  display: flex;
  width: var(--shell);
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  margin: 0 auto;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--serif);
  font-size: 1.08rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.cup-mark {
  position: relative;
  width: 24px;
  height: 17px;
  border: 2px solid currentColor;
  border-top-width: 1px;
  border-radius: 3px 3px 11px 11px;
}

.cup-mark::after {
  position: absolute;
  top: 2px;
  right: -9px;
  width: 7px;
  height: 8px;
  border: 2px solid currentColor;
  border-left: 0;
  border-radius: 0 7px 7px 0;
  content: "";
}

.language-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.language-nav a {
  padding: 0.45rem 0.62rem;
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 0.74rem;
  font-weight: 750;
  text-decoration: none;
}

.language-nav a:hover,
.language-nav a[aria-current="page"] {
  background: var(--ink);
  color: var(--paper-bright);
}

.kicker {
  margin: 0 0 1rem;
  color: var(--coffee);
  font-family: var(--mono);
  font-size: 0.71rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.15rem;
  border: 1px solid currentColor;
  font-size: 0.83rem;
  font-weight: 800;
  text-decoration: none;
}

.button.primary {
  border-color: var(--coffee);
  background: var(--coffee);
  color: #fff9ec;
}

.button.secondary {
  background: transparent;
}

.concept-nav {
  display: flex;
  width: var(--shell);
  align-items: center;
  justify-content: flex-end;
  gap: 0.7rem;
  margin: 0.8rem auto 0;
  font-family: var(--mono);
  font-size: 0.67rem;
}

.concept-nav span {
  margin-right: auto;
  color: var(--ink-soft);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.concept-nav a {
  padding: 0.22rem 0.1rem;
  color: var(--ink-soft);
  text-decoration: none;
}

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

.root-actions,
.text-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
}

.text-links {
  margin-top: 1rem;
  font-size: 0.8rem;
  font-weight: 750;
}

.text-links a:first-child {
  color: var(--coffee);
}

.root-footer,
.interior-footer {
  display: flex;
  width: var(--shell);
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  margin: 0 auto;
  padding: 2.4rem 0 3.5rem;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.76rem;
}

.root-footer p {
  margin: 0;
}

.root-footer strong {
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1rem;
}

/* Shared shelf and episode surface: a long café ledger, never a card grid. */

.interior {
  background:
    linear-gradient(rgba(76, 37, 22, 0.035) 1px, transparent 1px) 0 0 / 100% 32px,
    var(--paper);
}

.interior .global-header {
  border-bottom-color: var(--coffee-dark);
}

.interior-main,
.episode-main,
.welcome-main {
  width: var(--shell);
  margin: 0 auto;
}

.shelf-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(260px, 0.55fr);
  gap: clamp(3rem, 8vw, 8rem);
  align-items: end;
  padding: clamp(4rem, 9vw, 8rem) 0 clamp(3.5rem, 7vw, 6rem);
}

.shelf-hero h1,
.episode-hero h1,
.welcome-hero h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(3.1rem, 8vw, 7.7rem);
  font-weight: 500;
  letter-spacing: -0.055em;
  line-height: 0.91;
}

.shelf-hero > div > p:last-child {
  max-width: 64ch;
  margin: 2rem 0 0;
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: clamp(1.05rem, 1.8vw, 1.3rem);
}

.feed-ticket {
  padding: 1.35rem 0 0;
  border-top: 5px solid var(--coffee);
}

.feed-ticket span,
.feed-ticket small {
  display: block;
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
}

.feed-ticket a {
  display: block;
  margin: 0.65rem 0;
  overflow-wrap: anywhere;
  color: var(--coffee);
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 750;
}

.feed-ticket small {
  color: var(--ink-soft);
}

.section-title {
  margin: 0;
  padding: 1.25rem 0;
  border-block: 1px solid var(--coffee-dark);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.shelf-list {
  padding-bottom: 7rem;
}

.shelf-list > ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.episode-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.35fr) minmax(0, 1.65fr);
  gap: clamp(2rem, 7vw, 7rem);
  padding: clamp(2.25rem, 5vw, 4.6rem) 0;
  border-bottom: 1px solid var(--line);
}

.episode-row.is-latest {
  border-top: 8px solid var(--orange);
  background: linear-gradient(90deg, rgba(220, 107, 53, 0.08), transparent 60%);
}

.episode-order {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 0.69rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.episode-order > span:first-child {
  color: var(--coffee);
  font-family: var(--serif);
  font-size: clamp(3.6rem, 8vw, 7rem);
  letter-spacing: -0.08em;
  line-height: 0.8;
}

.latest-badge {
  margin-top: 1rem;
  padding: 0.28rem 0.5rem;
  background: var(--orange);
  color: #fff8e8;
}

.episode-meta {
  margin: 0 0 0.8rem;
  color: var(--coffee);
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.episode-copy h2 {
  max-width: 22ch;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2rem, 4vw, 4rem);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1.03;
}

.episode-copy h2 a {
  text-decoration: none;
}

.episode-copy h2 a:hover {
  color: var(--coffee);
}

.episode-copy > p:not(.episode-meta) {
  max-width: 70ch;
  margin: 1.2rem 0 1.5rem;
  color: var(--ink-soft);
}

.episode-copy audio {
  max-width: 620px;
}

.empty-shelf {
  display: grid;
  min-height: 480px;
  grid-template-columns: 0.65fr 1.35fr;
  gap: clamp(2rem, 8vw, 8rem);
  align-items: center;
  padding: 3rem 0 7rem;
  border-top: 1px solid var(--coffee-dark);
}

.empty-shelf h2 {
  max-width: 12ch;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2.7rem, 6vw, 5.7rem);
  font-weight: 500;
  letter-spacing: -0.05em;
  line-height: 0.96;
}

.empty-shelf p:not(.kicker) {
  max-width: 56ch;
  margin: 1.5rem 0 2rem;
  color: var(--ink-soft);
}

.empty-cup {
  position: relative;
  width: min(260px, 65vw);
  aspect-ratio: 1.3;
  border: 9px solid var(--coffee);
  border-top-width: 2px;
  border-radius: 8px 8px 46% 46%;
  opacity: 0.22;
}

.empty-cup::after {
  position: absolute;
  top: 18%;
  right: -28%;
  width: 32%;
  height: 45%;
  border: 9px solid var(--coffee);
  border-left: 0;
  border-radius: 0 50% 50% 0;
  content: "";
}

/* Episode pages */

.episode-main {
  max-width: 980px;
  padding: 2rem 0 8rem;
}

.back-link {
  display: inline-block;
  margin: 1.2rem 0 5rem;
  color: var(--coffee);
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 750;
  text-decoration: none;
}

.episode-hero {
  padding-bottom: clamp(3.5rem, 8vw, 7rem);
  border-bottom: 8px solid var(--coffee-dark);
}

.episode-hero h1 {
  max-width: 14ch;
  font-size: clamp(3rem, 7.2vw, 6.6rem);
}

.episode-deck {
  max-width: 68ch;
  margin: 2rem 0;
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: clamp(1.1rem, 2vw, 1.4rem);
}

.episode-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 2.5rem;
  margin: 2.2rem 0;
}

.episode-facts div {
  display: grid;
  gap: 0.2rem;
}

.episode-facts dt {
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.episode-facts dd {
  margin: 0;
  font-weight: 700;
}

.player-wrap {
  max-width: 690px;
  padding: 1.2rem;
  border: 1px solid var(--line);
  background: var(--paper-bright);
}

.player-wrap > a {
  display: inline-block;
  margin-top: 0.7rem;
  color: var(--coffee);
  font-size: 0.75rem;
  font-weight: 750;
}

.episode-jump {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1.5rem;
  padding: 1.2rem 0;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 700;
}

.transcript {
  padding-top: clamp(4rem, 9vw, 8rem);
}

.transcript > header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--coffee-dark);
}

.transcript > header .kicker {
  width: 100%;
  margin-bottom: 0.5rem;
}

.transcript > header h2,
.episode-notes > h2,
.other-editions > h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2.7rem, 6vw, 5rem);
  font-weight: 500;
  letter-spacing: -0.05em;
}

.transcript > header a {
  flex: 0 0 auto;
  color: var(--coffee);
  font-size: 0.75rem;
  font-weight: 750;
}

.transcript-chapter {
  display: grid;
  grid-template-columns: minmax(180px, 0.55fr) minmax(0, 1.45fr);
  gap: clamp(2rem, 7vw, 6rem);
  padding: clamp(3rem, 6vw, 5.5rem) 0;
  border-bottom: 1px solid var(--line);
}

.transcript-chapter h2 {
  position: sticky;
  top: 2rem;
  align-self: start;
  margin: 0;
  color: var(--coffee);
  font-family: var(--serif);
  font-size: clamp(1.4rem, 2.8vw, 2.3rem);
  font-weight: 500;
  line-height: 1.12;
}

.transcript-chapter p {
  grid-column: 2;
  max-width: 68ch;
  margin: 0 0 1.25rem;
  font-family: var(--serif);
  font-size: clamp(1.03rem, 1.7vw, 1.18rem);
  line-height: 1.76;
}

.episode-notes,
.other-editions {
  padding: clamp(4rem, 8vw, 7rem) 0;
  border-bottom: 1px solid var(--line);
}

.episode-notes > p,
.other-editions > ul,
.source-section {
  max-width: 70ch;
}

.episode-notes a,
.other-editions a,
.reuse-note a {
  color: var(--coffee);
  font-weight: 700;
}

.section-note,
.correction-contact {
  padding: 1rem 1.2rem;
  border-left: 4px solid var(--orange);
  background: var(--paper-bright);
}

.source-section {
  padding: 2rem 0;
  border-top: 1px solid var(--line);
}

.source-section h3 {
  margin: 0 0 1rem;
  font-family: var(--serif);
  font-size: 1.8rem;
}

.source-section li {
  margin-bottom: 0.8rem;
}

.other-editions ul {
  padding-left: 1.2rem;
}

.other-editions li {
  margin-bottom: 0.8rem;
}

.reuse-note {
  margin: 2rem 0 0;
  color: var(--ink-soft);
  font-size: 0.78rem;
}

/* Welcome */

.welcome-main {
  max-width: 1080px;
  padding-bottom: 8rem;
}

.welcome-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(270px, 0.75fr);
  gap: clamp(2rem, 8vw, 7rem);
  align-items: end;
  padding: clamp(5rem, 11vw, 10rem) 0 6rem;
  border-bottom: 8px solid var(--coffee-dark);
}

.welcome-hero .kicker {
  grid-column: 1 / -1;
}

.welcome-hero h1 em {
  color: var(--coffee);
  font-weight: 400;
}

.welcome-hero > p:last-child {
  margin: 0;
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 1.2rem;
}

.welcome-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border-bottom: 1px solid var(--line);
}

.welcome-columns > section {
  padding: 3rem 2rem 3rem 0;
  border-right: 1px solid var(--line);
}

.welcome-columns > section + section {
  padding-left: 2rem;
}

.welcome-columns > section:last-child {
  border-right: 0;
}

.welcome-columns h2,
.feed-directory h2,
.catalog-contract h2,
.reuse h2,
.privacy h2 {
  margin: 0 0 1.2rem;
  font-family: var(--serif);
  font-size: clamp(1.6rem, 3vw, 2.6rem);
  font-weight: 500;
  line-height: 1.08;
}

.welcome-columns p,
.welcome-columns li,
.catalog-contract p,
.reuse p,
.privacy p {
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.welcome-columns ul {
  padding-left: 1.1rem;
}

.welcome-columns li {
  margin-bottom: 0.6rem;
}

.welcome-columns dl {
  margin: 0;
}

.welcome-columns dl div {
  margin-bottom: 1rem;
}

.welcome-columns dt {
  font-family: var(--mono);
  font-size: 0.67rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.welcome-columns dd {
  margin: 0.2rem 0 0;
  font-size: 0.83rem;
}

.feed-directory,
.catalog-contract,
.reuse,
.privacy {
  padding: 5rem 0;
  border-bottom: 1px solid var(--line);
}

.feed-directory ul {
  margin: 2rem 0 0;
  padding: 0;
  border-top: 1px solid var(--line);
  list-style: none;
}

.feed-directory li {
  display: grid;
  grid-template-columns: 0.65fr 1.35fr;
  gap: 2rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}

.feed-directory li a {
  color: var(--coffee);
  font-weight: 750;
}

.feed-directory code {
  overflow-wrap: anywhere;
}

.catalog-contract p,
.reuse p,
.privacy p {
  max-width: 78ch;
  font-size: 1rem;
}

.welcome-note {
  margin-top: 4rem;
  padding: 2rem;
  border: 2px solid var(--coffee);
  background: var(--paper-bright);
}

.welcome-note p {
  margin: 0.5rem 0 0;
}

@media (max-width: 820px) {
  :root {
    --shell: min(100% - 32px, 680px);
  }

  .global-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.65rem;
    padding: 1rem 0;
  }

  .language-nav {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 0.25rem;
  }

  .concept-nav {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .concept-nav span {
    width: 100%;
  }

  .shelf-hero,
  .welcome-hero {
    grid-template-columns: 1fr;
  }

  .feed-ticket {
    max-width: 520px;
  }

  .episode-row,
  .empty-shelf,
  .transcript-chapter {
    grid-template-columns: 1fr;
  }

  .episode-order {
    flex-direction: row;
    align-items: baseline;
  }

  .episode-order > span:first-child {
    font-size: 3rem;
  }

  .latest-badge {
    margin: 0 0 0 auto;
  }

  .transcript-chapter h2 {
    position: static;
  }

  .transcript-chapter p {
    grid-column: 1;
  }

  .welcome-columns {
    grid-template-columns: 1fr;
  }

  .welcome-columns > section,
  .welcome-columns > section + section {
    padding: 2rem 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 520px) {
  :root {
    --shell: calc(100% - 24px);
  }

  .language-nav {
    margin-left: -0.4rem;
  }

  .language-nav a {
    padding-inline: 0.44rem;
    font-size: 0.69rem;
  }

  .concept-nav {
    gap: 0.35rem 0.75rem;
  }

  .root-actions .button {
    width: 100%;
  }

  .root-footer,
  .interior-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 1rem;
  }

  .shelf-hero h1,
  .episode-hero h1,
  .welcome-hero h1 {
    overflow-wrap: anywhere;
  }

  .episode-row.is-latest {
    padding-inline: 0.65rem;
  }

  .transcript > header {
    align-items: flex-start;
    flex-direction: column;
  }

  .feed-directory li {
    grid-template-columns: 1fr;
    gap: 0.3rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #17110e;
    --paper-bright: #211814;
    --ink: #f5e9d6;
    --ink-soft: #c5b4a5;
    --coffee: #ed8b57;
    --coffee-dark: #dda174;
    --line: rgba(245, 233, 214, 0.2);
  }

  .interior {
    background:
      linear-gradient(rgba(255, 240, 215, 0.025) 1px, transparent 1px) 0 0 / 100% 32px,
      var(--paper);
  }

  audio {
    filter: sepia(0.2);
  }
}
