:root {
  --paper: #fbeadf;
  --paper-edge: #f1dccd;
  --ink: #2b1d1a;
  --ink-soft: #6e5a52;   /* the only grey: names, dates, counts, "by" */
  --rule: #c7d3e6;
  --margin-line: #e39388;
  --orange: #f07d17;     /* numbers, underlines, highlights, active state; never sentences */
  --orange-soft: rgba(240, 125, 23, 0.28);
  --desk: #e6d8cb;
  --tape: rgba(255, 246, 214, 0.72);
  --sticky: #ffe58a;
  --photo-paper: #fffdf8;

  --line: 34px;          /* ruled line spacing; body text sits on it */
  --gutter: 110px;       /* distance from page edge to the red margin */
  --spiral-w: 54px;

  /* Type: two voices.
     --hand  (Caveat)     = Joséphine's pen: headings and short labels.
     --body  (Newsreader) = print: anything read as a sentence, and list rows. */
  --hand: "Caveat", "Bradley Hand", cursive;
  --body: "Newsreader", Georgia, serif;

  /* Type scale: seven steps, nothing in between. */
  --t-display: 84px;   /* hand 700: cover title only */
  --t-h1: 64px;        /* hand 700: episode title */
  --t-h2: 40px;        /* hand 700: section heads */
  --t-h3: 30px;        /* hand 700 for headings, 500 for bylines */
  --t-label: 24px;     /* hand 500: names, links, chips, numbers (700 + orange) */
  --t-body: 19px;      /* body 400: everything you read */
  --t-small: 16px;     /* body 400: counts */

  /* Colour roles: ink for content, one grey for metadata, orange only for marks. */
  --hairline: rgba(91, 73, 67, .3);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }
body { overflow-x: clip; }

body {
  margin: 0;
  background: var(--desk);
  background-image:
    radial-gradient(circle at 20% 10%, rgba(255,255,255,.35), transparent 50%),
    radial-gradient(circle at 80% 90%, rgba(120, 90, 70, .08), transparent 55%);
  color: var(--ink);
  font-family: var(--body);
  font-weight: 400;
  font-size: var(--t-body);
  line-height: var(--line);
  min-height: 100vh;
}

a { color: inherit; }

.desk {
  padding: 40px 24px 80px;
  display: flex;
  justify-content: center;
}

/* ---------- notebook ---------- */

.notebook {
  position: relative;
  width: 100%;
  max-width: 1180px;
  perspective: 2600px;
}

.spiral {
  position: absolute;
  z-index: 5;
  top: 18px;
  bottom: 18px;
  left: -14px;
  width: var(--spiral-w);
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='54' height='68' viewBox='0 0 54 68'%3E%3Cdefs%3E%3ClinearGradient id='m' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%23f4f4f4'/%3E%3Cstop offset='.45' stop-color='%239a9a9a'/%3E%3Cstop offset='.6' stop-color='%23d9d9d9'/%3E%3Cstop offset='1' stop-color='%23555'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cellipse cx='40' cy='34' rx='7.5' ry='8' fill='%23231a17'/%3E%3Cpath d='M41 28 C 30 22, 6 22, 4 31 C 3 36, 8 40, 16 40 L 41 40' fill='none' stroke='url(%23m)' stroke-width='6' stroke-linecap='round'/%3E%3Cpath d='M41 28 C 30 22, 6 22, 4 31' fill='none' stroke='%23fff' stroke-opacity='.6' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: repeat-y;
  background-size: 54px 68px;
}

.page {
  position: relative;
  min-height: 900px;
  padding: 56px 64px 72px calc(var(--gutter) + 40px);
  background-color: var(--paper);
  background-image:
    /* red margin line */
    linear-gradient(90deg, transparent var(--gutter), var(--margin-line) var(--gutter), var(--margin-line) calc(var(--gutter) + 1.5px), transparent calc(var(--gutter) + 1.5px)),
    /* blue rules */
    repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--line) - 1px), var(--rule) calc(var(--line) - 1px), var(--rule) var(--line)),
    /* paper grain */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45  0 0 0 0 .35  0 0 0 0 .28  0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-position: 0 0, 0 22px, 0 0;
  border-radius: 4px 10px 10px 4px;
  box-shadow:
    0 1px 0 var(--paper-edge),
    0 3px 0 -1px #f6e3d6, 0 4px 1px -1px rgba(0,0,0,.08),
    0 7px 0 -3px #f3dfd1, 0 8px 1px -3px rgba(0,0,0,.08),
    0 30px 60px -20px rgba(70, 45, 30, .35);
  outline: none;
  transform-origin: left center;
}

/* page turning leaf, a frozen copy of a page that flips over the spiral */
.leaf {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 4;
  overflow: hidden;
  pointer-events: none;
  backface-visibility: hidden;
  transform-origin: left center;
  will-change: transform;
}
.leaf.turn-forward { animation: turn-forward .75s cubic-bezier(.45, .05, .35, 1) forwards; }
.leaf.turn-back    { animation: turn-back .75s cubic-bezier(.45, .05, .35, 1) forwards; }

@keyframes turn-forward {
  0%   { transform: rotateY(0deg);    box-shadow: 0 0 0 rgba(0,0,0,0); filter: brightness(1); }
  60%  { filter: brightness(.92); }
  100% { transform: rotateY(-100deg); box-shadow: -40px 0 60px rgba(0,0,0,.25); filter: brightness(.8); }
}
@keyframes turn-back {
  0%   { transform: rotateY(-100deg); filter: brightness(.8); }
  100% { transform: rotateY(0deg);    filter: brightness(1); }
}

/* ---------- shared handwriting bits ---------- */

/* metadata inside a label, e.g. the date after an episode number */
.meta { color: var(--ink-soft); }

.underline-orange {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 12' preserveAspectRatio='none'%3E%3Cpath d='M3 8 C 80 3, 190 2, 297 5' fill='none' stroke='%23f07d17' stroke-width='3.2' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat left bottom / 100% 10px;
  padding-bottom: 6px;
}

mark {
  background: linear-gradient(100deg, transparent 0 2%, var(--orange-soft) 3% 96%, transparent 97%);
  color: inherit;
  padding: 0 2px;
  border-radius: 3px;
}

.page-number {
  position: absolute;
  right: 48px;
  bottom: 22px;
  font-family: var(--hand);
  font-size: var(--t-label);
  color: var(--ink-soft);
}

.tape {
  position: absolute;
  width: 120px;
  height: 30px;
  background: var(--tape);
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
  z-index: 2;
}

.btn-hand {
  font-family: var(--hand);
  font-weight: 500;
  font-size: var(--t-label);
  background: none;
  border: none;
  color: var(--ink);
  cursor: pointer;
  padding: 0;
  text-decoration: none;
}
.btn-hand:hover { color: var(--orange); }

/* ---------- cover / contents ---------- */

.cover {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  grid-template-rows: auto auto;
  gap: 22px 48px;
  align-items: center;
}

.cover-title { grid-column: 1; grid-row: 1; justify-self: start; position: relative; padding: 10px 30px 6px 22px; margin: 0; transform: rotate(-1deg); }
.cover-title h1 {
  margin: 0;
  font-family: var(--hand);
  font-weight: 700;
  font-size: var(--t-display);
  line-height: 1;
  white-space: nowrap;
  letter-spacing: .5px;
}
.cover-title svg.box {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.cover-text { grid-column: 1; grid-row: 2; align-self: start; }
.cover-sub {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px;
  font-family: var(--hand);
  font-weight: 500;
  font-size: var(--t-h3);
  line-height: 1.3;
}
.cover-by { font-size: var(--t-label); color: var(--ink-soft); }

.cover-photo { grid-column: 2; grid-row: 1 / span 2; position: relative; justify-self: end; }
.cover-photo img {
  display: block;
  width: 100%;
  max-width: 190px;
  filter: drop-shadow(0 0 3px #fff) drop-shadow(0 0 2px #fff) drop-shadow(0 6px 10px rgba(60, 35, 20, .18));
}
.cover-photo .sparks { position: absolute; top: 0; right: -18px; width: 36px; }

.intro { max-width: 640px; margin: 12px 0 0; }
.intro-links { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 4px; }
.intro-links a { font-family: var(--hand); font-weight: 500; font-size: var(--t-label); text-decoration: none; }
.intro-links a:hover { color: var(--orange); }

.section-head {
  margin: calc(var(--line) * 2) 0 var(--line);
  font-family: var(--hand);
  font-weight: 700;
  font-size: var(--t-h2);
  line-height: var(--line);
}
.section-head span { font-weight: 500; font-size: var(--t-label); color: var(--ink-soft); margin-left: 12px; }

.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 54px 40px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.note-card { position: relative; }
.note-card a { display: block; text-decoration: none; color: inherit; }

.polaroid {
  position: relative;
  background: var(--photo-paper);
  padding: 12px 12px 14px;
  box-shadow: 0 2px 3px rgba(0,0,0,.08), 0 14px 26px -12px rgba(60, 35, 20, .35);
  transform: rotate(-1.4deg);
  transition: transform .25s ease, box-shadow .25s ease;
}
.note-card:nth-child(even) .polaroid { transform: rotate(1.2deg); }
.note-card a:hover .polaroid,
.note-card a:focus-visible .polaroid { transform: rotate(0) translateY(-4px); box-shadow: 0 4px 6px rgba(0,0,0,.08), 0 22px 34px -12px rgba(60, 35, 20, .4); }
.polaroid .tape { top: -14px; left: 50%; margin-left: -60px; transform: rotate(-3deg); }
.polaroid img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; filter: saturate(.92); }
.polaroid .play {
  position: absolute; left: 50%; top: calc(12px + (100% - 26px) / 2);
  transform: translate(-50%, -50%);
  width: 62px; height: 62px; border-radius: 50%;
  background: rgba(43, 29, 26, .78);
  display: grid; place-items: center;
  opacity: 0; transition: opacity .2s ease;
}
.polaroid .play::after { content: ""; border-left: 20px solid #fff; border-top: 12px solid transparent; border-bottom: 12px solid transparent; margin-left: 5px; }
.note-card a:hover .play { opacity: 1; }

.card-meta { margin-top: 18px; padding-left: 6px; }
.card-no { font-family: var(--hand); font-weight: 700; font-size: var(--t-label); color: var(--orange); }
.card-no .meta { font-weight: 500; }
.card-title { margin: 2px 0 0; font-family: var(--hand); font-weight: 700; font-size: var(--t-h3); line-height: 1.1; }
.card-guest { margin-top: 6px; font-family: var(--hand); font-weight: 500; font-size: var(--t-label); color: var(--ink-soft); }
.card-blurb { margin: 4px 0 0; }
.card-themes { margin-top: 6px; font-family: var(--hand); font-weight: 500; font-size: var(--t-label); color: var(--ink-soft); }

/* theme chips: hand-circled words */
.themes { display: flex; flex-wrap: wrap; gap: 10px 14px; margin: 0 0 var(--line); }
.theme-chip {
  font-family: var(--hand); font-weight: 500; font-size: var(--t-label); line-height: 1.2;
  background: none; color: var(--ink); text-decoration: none; cursor: pointer;
  padding: 2px 14px 4px;
  border: 2px solid transparent;
  border-radius: 48% 52% 46% 54% / 60% 44% 56% 40%;
}
.theme-chip span { font-family: var(--body); font-size: var(--t-small); color: var(--ink-soft); }
.theme-chip:hover { border-color: var(--orange-soft); }
.theme-chip.on { border-color: var(--orange); transform: rotate(-1.5deg); }
.ep-themes { margin: 10px 0 0 -12px; }
.ep-themes .theme-chip { border-color: var(--orange-soft); }

/* contents: one ruled line per note, title ...... guest */
.contents-list { list-style: none; margin: 0; padding: 0; }
.contents-list a {
  display: flex; align-items: baseline; gap: 12px;
  text-decoration: none; color: inherit;
  line-height: var(--line);
}
.contents-list .row-no { font-family: var(--hand); font-weight: 700; font-size: var(--t-label); color: var(--orange); min-width: 30px; text-align: right; }
.contents-list .row-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex-shrink: 1; }
.contents-list .row-dots { flex: 1 1 24px; min-width: 24px; border-bottom: 2px dotted var(--hairline); transform: translateY(-7px); }
.contents-list .row-guest { font-family: var(--hand); font-weight: 500; font-size: var(--t-label); color: var(--ink-soft); white-space: nowrap; }
.contents-list .row-date { font-family: var(--hand); font-weight: 500; font-size: var(--t-label); color: var(--ink-soft); white-space: nowrap; min-width: 104px; text-align: right; }
.contents-list a:hover .row-title { text-decoration: underline; text-decoration-color: var(--orange); text-underline-offset: 4px; }
.contents-list a:hover .row-guest { color: var(--ink); }


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

.ep-top {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap;
}
.ep-top .no { font-family: var(--hand); font-weight: 700; font-size: var(--t-label); color: var(--orange); }
.ep-top .no .meta { font-weight: 500; }

.ep-title {
  margin: var(--line) 0 0;
  font-family: var(--hand);
  font-weight: 700;
  font-size: var(--t-h1);
  line-height: 1;
  max-width: 900px;
}
.ep-guest { margin-top: 18px; font-family: var(--hand); font-weight: 500; font-size: var(--t-h3); line-height: 1.2; }
.ep-guest strong { font-weight: 700; }

.ep-body {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  gap: 56px;
  margin-top: calc(var(--line) * 1.5);
  align-items: start;
}

.video-wrap {
  position: relative;
  background: var(--photo-paper);
  padding: 12px;
  box-shadow: 0 2px 3px rgba(0,0,0,.08), 0 18px 30px -14px rgba(60, 35, 20, .4);
  transform: rotate(-.8deg);
}
.video-wrap .tape.l { top: -12px; left: -26px; transform: rotate(-34deg); }
.video-wrap .tape.r { top: -12px; right: -26px; transform: rotate(32deg); }
.video-frame { position: relative; aspect-ratio: 16 / 9; background: #1b1412; }
.video-frame > iframe, .video-frame > div { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.ep-aside { margin-top: calc(var(--line) * 1.25); }
.ep-aside h3, .ep-notes h3 {
  margin: 0 0 4px;
  font-family: var(--hand);
  font-weight: 700;
  font-size: var(--t-h3);
  line-height: var(--line);
}

.chapters { list-style: none; padding: 0; margin: 0; }
.chapters button {
  display: flex; gap: 14px; align-items: baseline;
  width: 100%;
  background: none; border: 0; padding: 0;
  font: inherit; color: inherit; text-align: left; line-height: var(--line);
  cursor: pointer;
}
.chapters .t { font-family: var(--hand); font-weight: 700; font-size: var(--t-label); color: var(--orange); min-width: 56px; }
.chapters button:hover .label { text-decoration: underline; text-decoration-color: var(--orange); text-underline-offset: 4px; }
.chapters li.active .label { background: var(--orange-soft); border-radius: 3px; }
.chapters li.active .t::before { content: "→ "; }

.links-block { margin-top: calc(var(--line) * 1); }
.links-block ul { list-style: none; margin: 0; padding: 0; }
.links-block li { line-height: var(--line); }
.links-block a { text-decoration-color: var(--orange); text-underline-offset: 4px; }
.links-block a:hover { color: var(--orange); }
.links-block a::after { content: " ↗"; font-size: .8em; }

.ep-notes p { margin: 0 0 var(--line); }
.ep-notes .bullets { list-style: none; padding: 0; margin: 0 0 var(--line); }
.ep-notes .bullets li { position: relative; padding-left: 30px; margin-bottom: calc(var(--line) / 2); }
.ep-notes .bullets li::before {
  content: "";
  position: absolute; left: 4px; top: 11px;
  width: 12px; height: 12px;
  border: 2.4px solid var(--orange);
  border-radius: 50% 45% 55% 48%;
  transform: rotate(-12deg);
}
.ep-notes .signoff { font-style: italic; }

.sticky {
  position: relative;
  margin: calc(var(--line) / 2) 0 calc(var(--line) * 1.25) 12px;
  padding: 26px 24px 22px;
  background: var(--sticky);
  background-image: linear-gradient(180deg, rgba(255,255,255,.25), rgba(0,0,0,.03));
  box-shadow: 0 2px 2px rgba(0,0,0,.06), 0 16px 22px -14px rgba(80, 60, 0, .45);
  transform: rotate(1.6deg);
  max-width: 440px;
  line-height: 1.45;
}
.sticky .label { display: block; font-family: var(--hand); font-weight: 700; font-size: var(--t-h3); line-height: 1.1; margin-bottom: 6px; }
.sticky .tape { top: -15px; left: 50%; margin-left: -50px; width: 100px; transform: rotate(2deg); }

.ep-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  margin-top: calc(var(--line) * 2);
}
.ep-foot .btn-hand[disabled] { opacity: .35; cursor: default; color: var(--ink); }


/* ---------- small screens ---------- */

@media (max-width: 900px) {
  :root {
    --gutter: 46px; --line: 32px;
    --t-display: 44px; --t-h1: 44px; --t-h2: 34px; --t-h3: 26px;
    --t-label: 21px; --t-body: 17px; --t-small: 14px;
  }
  .desk { padding: 16px 12px 40px 22px; }
  .page { padding: 36px 20px 64px calc(var(--gutter) + 16px); }
  .spiral { left: -18px; transform: scale(.8); transform-origin: left top; height: 125%; }
  .cover { grid-template-columns: minmax(0, 1fr) 76px; gap: 18px 10px; }
  .cover-title { justify-self: start; padding: 8px 18px 4px 14px; }
  .cover-text { grid-column: 1 / -1; }
  .cover-photo { grid-column: 2; grid-row: 1; }
  .cover-sub { gap: 0 12px; }
  .cover-photo .sparks { display: none; }
  .ep-body { grid-template-columns: 1fr; gap: 36px; }
  .notes-grid { grid-template-columns: 1fr; }
  .section-head span { display: block; margin: 4px 0 0; }
  .themes { gap: 4px 2px; margin-left: -8px; }
  .theme-chip { padding: 2px 8px 3px; }
  .contents-list a { flex-wrap: wrap; gap: 0 10px; padding: 4px 0; line-height: 1.4; }
  .contents-list .row-title { white-space: normal; flex-basis: calc(100% - 44px); }
  .contents-list .row-dots { display: none; }
  .contents-list .row-guest { margin-left: 40px; white-space: normal; }
  .contents-list .row-date { min-width: 0; margin-left: 4px; }
  .contents-list .row-date::before { content: "· "; }
}

@media (prefers-reduced-motion: reduce) {
  .leaf { display: none; }
  .polaroid, .note-card a:hover .polaroid { transition: none; }
}
