@font-face {
  font-family: Fraunces;
  src: url("../assets/fonts/fraunces.ttf") format("truetype");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: Bricolage;
  src: url("../assets/fonts/bricolage.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("../assets/fonts/dm-sans.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: Plex;
  src: url("../assets/fonts/plex-mono.ttf") format("truetype");
  font-weight: 500;
  font-display: swap;
}

:root {
  --paper: #f8f6ee;
  --card: #fbfaf4;
  --ink: #273a2d;
  --green: #3b5945;
  --muted: #575d50;
  --line: #cbcbb9;
  --serif: Fraunces, Georgia, serif;
  --sans: "DM Sans", Arial, sans-serif;
  --mono: Plex, "Courier New", monospace;
  color-scheme: light;
  scroll-padding-top: 88px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 1rem/1.55 var(--sans); }
a { color: inherit; }
a:focus-visible { outline: 3px solid #a85611; outline-offset: 4px; }
img { display: block; max-width: 100%; }
h1, h2, h3, h4, p, figure, ol { margin: 0; }
.wrap { width: min(91%, 1360px); margin-inline: auto; }
.skip { position: fixed; top: -100px; left: 8px; z-index: 10; padding: 9px 16px; background: white; }
.skip:focus { top: 8px; }

.masthead { position: sticky; top: 0; z-index: 5; background: var(--paper); border-bottom: 1px solid var(--line); }
.masthead-inner, .masthead nav, .brand, .footer-inner { display: flex; align-items: center; }
.masthead-inner { min-height: 64px; justify-content: space-between; gap: 12px; }
.brand { gap: 8px; color: #26362b; text-decoration: none; font: 700 1.8rem/1 Bricolage, Arial, sans-serif; letter-spacing: -.065em; }
.brand img { image-rendering: pixelated; }
.masthead nav { gap: clamp(14px, 3vw, 38px); font-size: .9rem; }
.masthead nav a { text-decoration: none; }
.index-link { padding-block: 9px; }
.index-link:hover, .footer-inner a:last-child:hover { text-decoration: underline; }
.play-link { display: inline-flex; align-items: center; gap: 9px; padding: 8px 15px; border: 1px solid #abb3a1; border-radius: 4px; }
.play-link:hover { background: #e7eadc; }
.play-icon { font-size: .7em; }

.cover { background: #eae8da; border-bottom: 1px solid var(--line); }
.cover-inner { display: grid; grid-template-columns: .95fr 1.1fr; gap: clamp(28px, 4.5vw, 76px); align-items: center; padding-block: clamp(33px, 4.3vw, 70px); }
.eyebrow, .index-count, .index-meta, .chapter-label, .group-title { font: 500 .71rem/1.35 var(--mono); letter-spacing: .085em; text-transform: uppercase; }
.eyebrow { display: flex; align-items: center; gap: 10px; color: #465944; }
.saltire { width: 19px; height: 13px; background: linear-gradient(33deg, transparent 44%, #fffae6 45% 56%, transparent 57%), linear-gradient(-33deg, transparent 44%, #fffae6 45% 56%, transparent 57%), #4b7190; }
h1, h2, h4, .chapter-context h3 { font: 600 1em/1.05 var(--serif); }
h1 { max-width: 12ch; margin: 15px 0 19px; font-size: clamp(3.1rem, 4.8vw, 5.1rem); letter-spacing: -.059em; text-wrap: balance; }
h1 em { display: block; color: #526a48; font-style: normal; }
.lead { max-width: 46ch; color: #374537; font-size: clamp(1rem, 1.22vw, 1.2rem); line-height: 1.54; }
.read-link { display: inline-flex; align-items: center; gap: 22px; margin-top: 23px; padding: 10px 16px; border-radius: 3px; background: var(--ink); color: #fffdf1; text-decoration: none; font-size: .92rem; }
.read-link:hover { background: #425c40; }
.read-link span { font-size: 1.15em; }
.cover-plate { margin: 3px; padding: 7px 7px 0; border: 1px solid #c6c4b2; background: var(--card); box-shadow: 3px 4px 0 #d3d4c4; }
.cover-plate img { width: 100%; height: clamp(240px, 23.5vw, 380px); object-fit: cover; object-position: 63% 56%; }
.cover-plate figcaption { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 6px 9px; font-size: .79rem; color: var(--muted); }
.cover-plate figcaption a { flex-shrink: 0; font: 500 .65rem/1.5 var(--mono); text-transform: uppercase; text-underline-offset: 3px; }

.level-index { padding-block: clamp(32px, 4vw, 56px); }
.index-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 15px; margin-bottom: 17px; }
.index-heading h2 { font-size: clamp(1.85rem, 2.3vw, 2.45rem); letter-spacing: -.055em; }
.index-count { font-size: .64rem; color: var(--muted); }
.index-grid { list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 0; }
.index-grid li, .index-text { min-width: 0; }
.index-grid a { display: flex; align-items: center; min-height: 80px; height: 100%; padding: 7px 12px 7px 7px; gap: 14px; border: 1px solid var(--line); background: var(--card); text-decoration: none; }
.index-grid a:hover { background: #eeeee0; border-color: #8d9b7b; }
.index-grid img { width: clamp(52px, 6vw, 86px); height: 62px; object-fit: cover; }
.index-meta { display: block; margin-bottom: 5px; color: #56624d; font-size: .64rem; letter-spacing: .025em; }
.index-meta span { color: #777f68; }
.index-text strong { display: block; font: 600 clamp(1.01rem, 1.44vw, 1.4rem)/1.16 var(--serif); letter-spacing: -.045em; }
.down { margin-left: auto; align-self: end; font-size: .98rem; color: var(--green); }

.chapter { border-top: 1px solid var(--line); padding-block: clamp(44px, 5vw, 76px); }
.chapter:nth-child(odd) { background: #f0f0e5; }
.chapter-grid { display: grid; align-items: start; grid-template-columns: minmax(225px, .72fr) minmax(0, 1.28fr); gap: clamp(38px, 7vw, 116px); }
.chapter-context { max-width: 415px; }
.chapter-label { display: flex; align-items: center; gap: 12px; color: var(--green); }
.chapter-label span { display: inline-block; color: white; background: var(--green); padding: 5px 8px; }
.chapter-context h2 { max-width: 14ch; margin-block: 14px 18px; font-size: clamp(2.3rem, 3.7vw, 3.9rem); letter-spacing: -.06em; }
.scene { width: 100%; height: auto; aspect-ratio: 3 / 1; object-fit: cover; }
.chapter-context h3 { margin-block: 18px 8px; font-size: 1.25rem; line-height: 1.18; letter-spacing: -.035em; }
.chapter-context p { color: #414c40; line-height: 1.57; }
.group-title { display: flex; gap: 10px; align-items: center; border-block-end: 2px solid #626f59; padding: 4px 0 12px; }
.group-title span { border-left: 1px solid #9aa18f; padding-left: 10px; color: var(--muted); }
.group-title.more { margin-top: 36px; }
.entry { border-bottom: 1px solid var(--line); padding: 22px 0 24px; }
.entry h4 { width: fit-content; margin-bottom: 7px; font-size: clamp(1.4rem, 1.8vw, 1.8rem); line-height: 1.15; letter-spacing: -.044em; }
.entry h4 a { color: inherit; text-decoration: none; }
.permalink { margin-left: .4em; color: #65795d; opacity: 0; font: 500 .6em var(--mono); }
.entry h4 a:hover .permalink, .entry h4 a:focus-visible .permalink, .entry:target .permalink { opacity: 1; }
.entry:target { border-top: 2px solid #9d682b; }
.entry p { color: #364237; font-size: 1.025rem; max-width: 73ch; }
.note + .note { margin-top: 14px; }
.reference { display: inline-block; max-width: 100%; margin-top: 7px; color: #3c5948; text-decoration-thickness: 1px; text-underline-offset: 3px; font-size: .865rem; line-height: 1.45; }
.reference:hover { color: #70441f; }
.reference span { white-space: nowrap; font-size: .9em; }
.chapter-next { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 20px; min-height: 44px; color: var(--green); font-weight: 600; text-decoration: none; }
.chapter-next:hover { text-decoration: underline; }
footer { background: var(--ink); color: var(--paper); }
.footer-inner { min-height: 80px; gap: 14px; justify-content: space-between; }
.footer-inner .brand { color: var(--paper); font-size: 1.3rem; }
.footer-inner a:last-child { text-decoration: none; font-size: .9rem; }

@media (min-width: 800px) and (min-height: 760px) {
  .chapter-context { position: sticky; top: 87px; }
}
@media (max-width: 980px) {
  .index-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cover-inner { gap: 25px; grid-template-columns: 1fr 1fr; }
  .index-grid img { width: 74px; }
}
@media (max-width: 720px) {
  .wrap { width: min(91%, 570px); }
  .cover-inner, .chapter-grid { grid-template-columns: 1fr; }
  .cover-inner { gap: 25px; padding-block: 29px; }
  h1 { max-width: none; font-size: clamp(2.8rem, 8.8vw, 3.8rem); margin: 12px 0; }
  .lead { max-width: 52ch; }
  .read-link { margin-top: 16px; }
  .cover-plate { margin: 0; }
  .cover-plate img { height: auto; aspect-ratio: 2.7 / 1; }
  .chapter-grid { gap: 25px; }
  .chapter-context { max-width: none; }
  .chapter-context h2 { max-width: none; }
  .scene { max-height: 165px; }
  .index-grid { gap: 8px; }
  .index-grid a { gap: 7px; padding: 6px; }
  .index-grid img { width: 52px; height: 54px; }
  .index-meta { font-size: .6rem; }
  .down { display: none; }
}
@media (max-width: 500px) {
  :root { scroll-padding-top: 68px; }
  .masthead-inner { min-height: 54px; }
  .masthead nav { gap: 12px; font-size: .8rem; }
  .masthead .brand { font-size: 1.39rem; gap: 5px; }
  .masthead .brand img { width: 27px; height: 27px; }
  .play-link { padding: 6px 8px; gap: 5px; }
  .index-grid a { flex-direction: column; align-items: stretch; gap: 0; padding: 0; }
  .index-grid img { width: 100%; height: 52px; }
  .index-text { padding: 8px 9px 10px; }
  .index-meta { margin-bottom: 4px; }
  .index-count { font-size: .58rem; }
  .cover-plate figcaption { font-size: .71rem; }
  .entry { padding-block: 20px; }
}
@media print {
  .masthead, .skip, .read-link, .chapter-next, footer { display: none; }
  .wrap { width: 100%; }
  .cover-inner, .chapter-grid { display: block; }
  .cover-plate, .scene { display: none; }
  .chapter { break-before: page; padding: 1rem 0; }
  .chapter-context { position: static; max-width: none; margin-bottom: 1rem; }
  .entry { break-inside: avoid; }
}
