/* Layout: banknote engraving meets a long-form archive. Deep navy ground, brass engraving
   lines, a high-contrast Bodoni for names and numbers, plain grotesk for reading. One bold
   moment per page: the engraved rosette. Left-aligned throughout. */
:root {
  --bg: #0d1726;
  --bg-2: #132036;
  --bg-3: #1a2a44;
  --line: #24354f;
  --fg: #ece8de;
  --muted: #98a4b8;
  --brass: #cba557;
  --brass-soft: rgba(203, 165, 87, 0.16);
  --on-brass: #0d1726;
  --display: "Bodoni Moda", "Didot", "Bodoni 72", Georgia, serif;
  --body: "Hanken Grotesk", "Helvetica Neue", Arial, sans-serif;
  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.3rem;
  --step-2: 1.75rem;
  --step-3: 2.5rem;
  --step-4: clamp(2.8rem, 6.5vw, 5.4rem);
  --gut: max(16px, env(safe-area-inset-left, 0px));
  --gut-r: max(16px, env(safe-area-inset-right, 0px));
  --wrap: 1180px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #eef1ec; --bg-2: #e3e8e1; --bg-3: #d8dfd6; --line: #c3ccc2; --fg: #0d1726;
    --muted: #4f5f77; --brass: #8a6a1f; --brass-soft: rgba(138, 106, 31, 0.12); --on-brass: #ffffff;
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #eef1ec; --bg-2: #e3e8e1; --bg-3: #d8dfd6; --line: #c3ccc2; --fg: #0d1726;
  --muted: #4f5f77; --brass: #8a6a1f; --brass-soft: rgba(138, 106, 31, 0.12); --on-brass: #ffffff;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: var(--body); font-size: var(--step-0); line-height: 1.6;
  font-variant-numeric: tabular-nums;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration-color: var(--brass); text-underline-offset: 0.2em; }
a:hover { color: var(--brass); }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 3px; border-radius: 2px; }
h1, h2, h3 { font-family: var(--display); font-weight: 500; line-height: 1.08; text-wrap: balance; margin: 0; letter-spacing: -0.01em; }
p { margin: 0; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding-left: var(--gut); padding-right: var(--gut-r); }
.muted { color: var(--muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Draft banner */
.draft { background: var(--brass); color: var(--on-brass); font-size: var(--step--1); }
.draft .wrap { padding-block: 8px; }

/* Header */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg); }
.site-head { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 14px; flex-wrap: wrap; }
.mark { display: flex; flex-direction: column; text-decoration: none; line-height: 1.1; }
.mark b { font-family: var(--display); font-weight: 600; font-size: 1.35rem; }
.mark span { font-size: var(--step--1); color: var(--muted); }
.nav { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.nav a { text-decoration: none; font-weight: 500; }
.nav a[aria-current="page"] { color: var(--brass); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 999px; border: 1px solid var(--brass); background: var(--brass); color: var(--on-brass); font: 600 var(--step--1)/1 var(--body); text-decoration: none; cursor: pointer; }
.btn:hover { color: var(--on-brass); filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--fg); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--brass); color: var(--brass); }
.bag-btn { position: relative; }
.bag-count { min-width: 1.4em; height: 1.4em; border-radius: 999px; background: var(--on-brass); color: var(--brass); font-size: 0.75rem; display: inline-grid; place-items: center; padding: 0 4px; }

/* Hero */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); }
.hero .wrap { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: 48px; align-items: center; padding-block: 72px 80px; }
.hero h1 { font-size: var(--step-4); font-weight: 500; }
.hero .by { font-family: var(--display); font-style: italic; font-size: var(--step-2); color: var(--brass); margin-top: 6px; }
.hero .lede { font-size: var(--step-1); max-width: 30ch; margin-top: 24px; }
.listen { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.feature { position: relative; display: grid; justify-items: center; min-width: 0; }
.rosette { position: absolute; inset: -18%; width: 136%; height: 136%; pointer-events: none; }
.feature-card { position: relative; width: min(100%, 380px); background: var(--bg-2); border: 1px solid var(--line); padding: 16px; display: grid; gap: 14px; text-decoration: none; }
.feature-card:hover { color: inherit; border-color: var(--brass); }
.feature-card .art { aspect-ratio: 1; width: 100%; object-fit: cover; background: var(--bg-3); }
.serial { font-family: var(--display); color: var(--brass); font-size: var(--step-1); line-height: 1; }
.serial small { font-family: var(--body); color: var(--muted); font-size: var(--step--1); margin-left: 8px; }
.feature-card h2 { font-size: var(--step-1); }

/* Sections */
.section { padding-block: 72px; border-bottom: 1px solid var(--line); }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.section-head h2 { font-size: var(--step-3); }

/* Episode ledger */
.ledger { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.ledger li { border-bottom: 1px solid var(--line); }
.ledger a { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr) 8.5rem; gap: 20px; padding-block: 18px; text-decoration: none; align-items: baseline; }
.ledger a:hover .t { color: var(--brass); }
.ledger .no { font-family: var(--display); font-size: var(--step-2); color: var(--brass); line-height: 1; }
.ledger .t { font-weight: 600; font-size: var(--step-0); display: block; }
.ledger .x { color: var(--muted); font-size: var(--step--1); display: block; margin-top: 4px; max-width: 75ch; }
.ledger .d { color: var(--muted); font-size: var(--step--1); text-align: right; white-space: nowrap; }

.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 24px; }
.filters input[type="search"] { flex: 1 1 260px; min-width: 0; background: var(--bg-2); color: var(--fg); border: 1px solid var(--line); border-radius: 999px; padding: 12px 18px; font: inherit; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: transparent; color: var(--fg); border-radius: 999px; padding: 7px 14px; font: 500 var(--step--1)/1 var(--body); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--brass); color: var(--on-brass); border-color: var(--brass); }
.count { color: var(--muted); font-size: var(--step--1); margin-bottom: 8px; }

/* Guests */
.guests { font-family: var(--display); font-size: var(--step-2); line-height: 1.35; max-width: 34ch; }
.guests span { white-space: nowrap; }
.guests span + span::before { content: ", "; color: var(--muted); white-space: normal; }

/* Newsletter band */
.band { background: var(--bg-2); }
.band .wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: end; padding-block: 56px; }
.band h2 { font-size: var(--step-3); }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; }
.form-row input { flex: 1 1 220px; min-width: 0; }
input, textarea, select { background: var(--bg); color: var(--fg); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font: inherit; }
textarea { min-height: 140px; resize: vertical; width: 100%; }
label { display: grid; gap: 6px; font-size: var(--step--1); color: var(--muted); }
.note { font-size: var(--step--1); color: var(--muted); margin-top: 10px; }
.note.ok { color: var(--brass); }

/* Shop */
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 28px 20px; }
.product { display: grid; gap: 10px; text-decoration: none; text-align: left; background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; }
.product img { aspect-ratio: 1; object-fit: cover; background: #fff; border-radius: 4px; }
.product:hover .pn { color: var(--brass); }
.pn { font-weight: 600; line-height: 1.3; }
.pp { font-family: var(--display); font-size: var(--step-1); color: var(--brass); }
.pay-note { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-bottom: 32px; color: var(--muted); font-size: var(--step--1); }

dialog { border: 1px solid var(--line); background: var(--bg-2); color: var(--fg); padding: 0; width: min(760px, calc(100vw - 32px)); border-radius: 8px; }
dialog::backdrop { background: rgba(5, 10, 20, 0.6); }
.dlg { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.dlg img { width: 100%; height: 100%; object-fit: cover; background: #fff; }
.dlg .body { padding: 24px; display: grid; gap: 16px; align-content: start; }
.dlg h3 { font-size: var(--step-2); }
.close { position: absolute; top: 10px; right: 10px; background: var(--bg-2); color: var(--fg); border: 1px solid var(--line); border-radius: 999px; width: 36px; height: 36px; cursor: pointer; font-size: 1.1rem; }
.sizes { display: flex; flex-wrap: wrap; gap: 8px; }
.bag-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.bag-list li { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.bag-list img { width: 56px; height: 56px; object-fit: cover; background: #fff; border-radius: 4px; }
.bag-list button { background: none; border: 0; color: var(--muted); cursor: pointer; text-decoration: underline; font: inherit; font-size: var(--step--1); }
.total { display: flex; justify-content: space-between; font-weight: 600; border-top: 1px solid var(--line); padding-top: 12px; }
.pay { display: grid; gap: 10px; }
.pay .btn { padding: 14px 18px; font-size: var(--step-0); }

/* Episode page */
.ep-head { padding-block: 56px 32px; border-bottom: 1px solid var(--line); }
.ep-head .serial { font-size: var(--step-2); }
.ep-head h1 { font-size: clamp(2rem, 4.6vw, 3.6rem); margin-top: 16px; max-width: 22ch; }
.ep-grid { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 48px; padding-block: 48px 72px; align-items: start; }
.ep-side { position: sticky; top: 96px; display: grid; gap: 16px; }
.ep-art { position: relative; aspect-ratio: 1; background: var(--bg-2); border: 1px solid var(--line); overflow: hidden; }
.ep-art img { width: 100%; height: 100%; object-fit: cover; }
.ep-art canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.ep-art .num { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--display); font-size: 4.5rem; color: var(--fg); }
.player { display: grid; gap: 12px; padding: 18px; background: var(--bg-2); border: 1px solid var(--line); }
.player audio { width: 100%; }
.yt { position: relative; aspect-ratio: 16/9; background: #000; border: 1px solid var(--line); overflow: hidden; }
.yt button { position: absolute; inset: 0; border: 0; padding: 0; cursor: pointer; background: #000; }
.yt img { width: 100%; height: 100%; object-fit: cover; opacity: 0.85; }
.yt span { position: absolute; left: 16px; bottom: 16px; }
.yt iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.notes { max-width: 68ch; display: grid; gap: 1em; }
.notes a { word-break: break-word; }
.notes ul { margin: 0; padding-left: 1.2em; }
.pager { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; border-top: 1px solid var(--line); padding-block: 32px; }
.pager a { text-decoration: none; display: grid; gap: 4px; }
.pager a:last-child { text-align: right; }

/* About */
.about-grid { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 56px; padding-block: 64px; align-items: start; }
.portrait { position: relative; }
.portrait img { aspect-ratio: 4/5; object-fit: cover; width: 100%; filter: grayscale(0.15); border: 1px solid var(--line); }
.prose { display: grid; gap: 1.1em; max-width: 62ch; }
.prose h1 { font-size: var(--step-4); }
.prose h2 { font-size: var(--step-2); margin-top: 1em; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; border-block: 1px solid var(--line); padding-block: 20px; margin-block: 8px; }
.facts b { font-family: var(--display); font-size: var(--step-3); color: var(--brass); display: block; line-height: 1; font-weight: 500; }
.facts span { font-size: var(--step--1); color: var(--muted); }
.support { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.support > div { border: 1px solid var(--line); padding: 16px; display: grid; gap: 6px; background: var(--bg-2); }
.support b { font-weight: 600; }
.support code { font-family: var(--body); color: var(--brass); word-break: break-all; }
.copy { justify-self: start; background: none; border: 1px solid var(--line); color: var(--fg); border-radius: 999px; padding: 4px 12px; cursor: pointer; font: inherit; font-size: var(--step--1); }
.contact { display: grid; gap: 14px; max-width: 560px; }

/* Footer */
.site-foot { padding-block: 48px 64px; color: var(--muted); font-size: var(--step--1); }
.site-foot .wrap { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)); gap: 32px; }
.site-foot h3 { font-family: var(--body); font-size: var(--step--1); font-weight: 600; color: var(--fg); margin-bottom: 10px; }
.site-foot ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.site-foot a { text-decoration: none; }
.site-foot .mark b { color: var(--fg); }

@media (max-width: 860px) {
  .hero .wrap, .band .wrap, .ep-grid, .about-grid, .dlg { grid-template-columns: minmax(0, 1fr); }
  .hero .wrap { padding-block: 48px 64px; gap: 56px; }
  .ep-side { position: static; }
  .site-foot .wrap { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .dlg img { max-height: 320px; }
}
@media (max-width: 560px) {
  .ledger a { grid-template-columns: 3.6rem minmax(0, 1fr); gap: 12px; }
  .ledger .d { grid-column: 2; text-align: left; margin-top: -10px; }
  .ledger .no { font-size: var(--step-1); }
  .facts { grid-template-columns: minmax(0, 1fr); }
  .nav { gap: 14px; }
  .pager { grid-template-columns: minmax(0, 1fr); }
  .pager a:last-child { text-align: left; }
  .products { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 12px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
