/* /book/ surface — primary navigation, the book itself.
   Index page = 10 section cards. Section detail page = opener
   prose + episodes grid + journey filter + map CTA.
   Shares fonts + palette with /journeys/. */

@font-face {
  font-family: 'Newsreader';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/Newsreader-Regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Newsreader';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/Newsreader-Italic.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/JetBrainsMono-Regular.woff2') format('woff2');
}

:root {
  --paper: #fafaf8;
  --paper-warm: #f4f1ea;
  --ink: #1a1a1a;
  --rule: #d8d3c8;
  --pencil: #b8b0a0;
  --accent: #6b5d4f;
  --quiet: #4a4a4a;
  --amber: #a87a3c;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
}

body {
  font-family: 'Newsreader', Georgia, 'Times New Roman', serif;
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Shared header dimensions across /book/, /journeys/, /tracks/ so
   the top-right nav doesn't jump position between surfaces. */
body > header {
  height: 60px;
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--paper);
}
.wordmark {
  font-weight: 400;
  font-size: 1.25rem;
  letter-spacing: 0.01em;
  margin: 0;
}
.wordmark a { color: inherit; text-decoration: none; }
.wordmark a:hover { color: var(--accent); }
.nav-links {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.8rem;
}
.nav-links a {
  color: var(--quiet);
  text-decoration: none;
  margin-left: 1rem;
}
.nav-links a:hover { color: var(--ink); }
.nav-links a.active {
  color: var(--ink);
  font-weight: 600;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 3px;
}

/* -------------------- /book/ index page -------------------- */

.book-index {
  max-width: 920px;
  margin: 0 auto;
  padding: 2.4rem 1.5rem 4rem;
}
.book-index-header {
  margin-bottom: 0;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 1.4rem;
}
.book-title {
  font-size: 2.4rem;
  font-weight: 400;
  letter-spacing: 0.005em;
  margin: 0 0 0.4rem;
}
.book-subtitle {
  font-style: italic;
  color: var(--quiet);
  font-size: 1.15rem;
  margin: 0 0 1rem;
}
.book-blurb {
  margin: 0;
  font-size: 1rem;
  color: var(--quiet);
  max-width: 56ch;
}

/* The spine: the ten chapters as one falling argument, in one breath.
   The accented terms are the ten stations of the descent. */
.book-spine {
  max-width: 40em;
  margin: 1.8rem auto 0.6rem;
}
.book-spine-label {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--pencil);
  margin: 0 0 0.7rem;
}
.book-spine-lede {
  font-size: 1.12rem;
  line-height: 1.72;
  color: var(--ink);
  margin: 0;
}
.book-spine-lede .t {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.12s, border-color 0.12s;
}
.book-spine-lede a.t:hover,
.book-spine-lede a.t:focus-visible {
  color: var(--ink);
  border-bottom-color: var(--accent);
}
.book-spine-coda {
  font-style: italic;
  color: var(--quiet);
  font-size: 1.02rem;
  margin: 0.9rem 0 0;
}

.section-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}
.section-card {
  display: grid;
  grid-template-columns: 4rem 1fr auto;
  gap: 1rem;
  align-items: baseline;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
  color: inherit;
  transition: background 0.12s;
}
.section-card:hover { background: var(--paper-warm); }
.section-number {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.8rem;
  color: var(--pencil);
  letter-spacing: 0.12em;
}
.section-card-body { min-width: 0; }
.section-card-title {
  font-size: 1.45rem;
  font-weight: 400;
  letter-spacing: 0.005em;
  margin: 0 0 0.1rem;
}
.section-card-subtitle {
  font-size: 0.95rem;
  color: var(--quiet);
  margin: 0;
  font-style: italic;
}
.section-card-count {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.7rem;
  color: var(--quiet);
  letter-spacing: 0.06em;
  white-space: nowrap;
}

/* -------------------- /book/<section>/ detail page -------------------- */

.section-page {
  max-width: 920px;
  margin: 0 auto;
  padding: 2.4rem 1.5rem 1.4rem;
}
.section-back {
  display: inline-block;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.72rem;
  color: var(--quiet);
  text-decoration: none;
  margin-bottom: 0.9rem;
  letter-spacing: 0.04em;
}
.section-back:hover { color: var(--ink); }
.section-meta {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--quiet);
  margin: 0 0 0.35rem;
}
.section-title {
  font-size: 2.6rem;
  font-weight: 400;
  letter-spacing: 0.005em;
  margin: 0 0 0.3rem;
  line-height: 1.1;
}
.section-subtitle {
  font-style: italic;
  color: var(--quiet);
  font-size: 1.25rem;
  margin: 0 0 1.4rem;
}
.section-opener {
  font-size: 1.1rem;
  line-height: 1.7;
  color: var(--ink);
  max-width: 38em;
  margin: 0 0 0;
}

/* -------------------- section hero (chapter wallpaper) -------------------- */
/* Top of each section page: the chapter's first photo, full-bleed, title +
   subtitle overlaid on a bottom scrim. Falls back to the plain text header
   (.section-page above) when the chapter has no photos yet. */
.section-hero {
  position: relative;
  min-height: 58vh;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: flex-end;
}
.section-hero-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top,
    rgba(18, 16, 14, 0.82) 0%,
    rgba(18, 16, 14, 0.34) 42%,
    rgba(18, 16, 14, 0.12) 100%);
}
.section-hero-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: 2rem 1.5rem 2.2rem;
}
.section-hero .section-meta { color: rgba(250, 250, 248, 0.78); }
.section-hero .section-title { color: #fafaf8; font-size: 3rem; }
.section-hero .section-subtitle { color: rgba(250, 250, 248, 0.92); margin-bottom: 0; }
.section-back-hero { color: rgba(250, 250, 248, 0.85); }
.section-back-hero:hover { color: #fff; }
.section-page-hero { padding-top: 1.8rem; }

/* Chapter-to-chapter navigation: hero arrows, a dot strip, a bottom pager. */
.chapter-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.32);
  color: #fafaf8;
  font-size: 2rem;
  line-height: 1;
  text-decoration: none;
  transition: background 0.15s;
}
.chapter-arrow:hover { background: rgba(0, 0, 0, 0.58); }
.chapter-arrow-prev { left: 0.8rem; }
.chapter-arrow-next { right: 0.8rem; }

.chapter-dots {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 1.1rem;
}
.chapter-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(250, 250, 248, 0.38);
  transition: background 0.15s, transform 0.15s;
}
.chapter-dot:hover { background: rgba(250, 250, 248, 0.75); transform: scale(1.25); }
.chapter-dot.active { background: var(--amber); transform: scale(1.3); }
/* dots in the plain text header (no dark hero behind them) */
.section-page .chapter-dots { margin: 0.2rem 0 1.5rem; }
.section-page .chapter-dot { background: rgba(26, 26, 26, 0.22); }
.section-page .chapter-dot:hover { background: rgba(26, 26, 26, 0.5); }
.section-page .chapter-dot.active { background: var(--amber); }

.chapter-pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  max-width: 920px;
  margin: 0 auto;
  padding: 1.4rem 1.5rem 3rem;
  border-top: 1px solid var(--rule);
}
.chapter-pager-link {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  text-decoration: none;
  color: var(--ink);
}
.chapter-pager-next { text-align: right; margin-left: auto; }
.chapter-pager-dir {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--quiet);
}
.chapter-pager-title { font-size: 1.1rem; }
.chapter-pager-link:hover .chapter-pager-title { color: var(--amber); }

@media (max-width: 600px) {
  .section-hero { min-height: 46vh; }
  .section-hero .section-title { font-size: 2rem; }
  .chapter-arrow { width: 2.4rem; height: 2.4rem; font-size: 1.6rem; }
  .chapter-pager-title { font-size: 0.98rem; }
}

/* Filter overlay: small mono row of journey buttons that scope the
   episode list to one geographic chapter. "All" returns to the
   unscoped section view. */
.section-filter {
  max-width: 920px;
  margin: 1.6rem auto 0;
  padding: 1.2rem 1.5rem;
  border-top: 1px solid var(--rule);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.section-filter-label {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--quiet);
  margin-right: 0.5rem;
}
.filter-pill {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.7rem;
  color: var(--quiet);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 1px;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.filter-pill:hover { color: var(--ink); border-color: var(--accent); }
.filter-pill.active {
  color: var(--paper);
  background: var(--ink);
  border-color: var(--ink);
}

/* Episodes list. Each episode is the unit: photograph + passage. */
.episodes-list {
  max-width: 920px;
  margin: 0 auto;
  padding: 1.4rem 1.5rem 4rem;
}
.episode {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 1.6rem;
  align-items: start;
  padding: 1.8rem 0;
  border-top: 1px solid var(--rule);
}
.episode:first-child { border-top: none; padding-top: 0.6rem; }
.episode-image {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--paper-warm);
  border: 1px solid var(--rule);
  border-radius: 2px;
}
.episode-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--paper-warm);
  border: 1px dashed var(--rule);
  border-radius: 2px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.66rem;
  color: var(--pencil);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  padding: 0.5rem;
}
.episode-body { min-width: 0; }
.episode-meta {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--quiet);
  margin: 0 0 0.3rem;
}
.episode-meta .episode-meta-sep {
  margin: 0 0.5rem;
  color: var(--pencil);
}
.episode-meta a {
  color: var(--quiet);
  text-decoration: none;
  border-bottom: 1px dotted var(--pencil);
}
.episode-meta a:hover { color: var(--ink); border-color: var(--accent); }
.episode-title {
  font-size: 1.4rem;
  font-weight: 400;
  letter-spacing: 0.005em;
  margin: 0 0 0.55rem;
}
.episode-passage {
  margin: 0 0 0.7rem;
  font-size: 1rem;
  line-height: 1.65;
  color: var(--ink);
}
.episode-aphorism {
  margin: 0 0 0.7rem;
  font-size: 0.9rem;
  font-style: italic;
  color: var(--quiet);
  border-left: 2px solid var(--rule);
  padding-left: 0.7rem;
}

/* Click-to-play YouTube overlay. The poster image renders normally;
   the .episode-play button sits absolutely on top. Click swaps the
   .episode-media contents for an iframe (in book.js attachPlayHandlers).
   Lazy load: no iframe JS until the user asks for it. */
.episode-media {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--paper-warm);
  border: 1px solid var(--rule);
  border-radius: 2px;
  overflow: hidden;
}
.episode-media .episode-image,
.episode-media .episode-placeholder {
  border: none;
  border-radius: 0;
  width: 100%;
  height: 100%;
  margin: 0;
}
.episode-play {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: rgba(26, 26, 26, 0.32);
  border: none;
  cursor: pointer;
  color: var(--paper);
  transition: background 0.15s;
}
.episode-play:hover { background: rgba(26, 26, 26, 0.48); }
.episode-play-icon {
  width: 2.6rem;
  height: 2.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(250, 250, 248, 0.85);
  color: var(--ink);
  border-radius: 50%;
  font-size: 1.1rem;
  padding-left: 0.18rem;
}
.episode-play-label {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(26, 26, 26, 0.65);
  padding: 0.2rem 0.5rem;
  border-radius: 1px;
}
.episode-iframe-wrap {
  width: 100%;
  height: 100%;
}
.episode-iframe {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
}

/* Instagram strip per episode. Static thumbnails (no live feed), each
   linking to a curated permalink. Squares show 'IG' label to indicate
   the destination; user replaces with real thumbnail images later. */
.episode-ig-strip {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.2rem;
}
.ig-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  background: var(--ink);
  color: var(--paper-warm);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  text-decoration: none;
  border-radius: 1px;
  transition: opacity 0.12s, transform 0.12s;
}
.ig-thumb:hover { opacity: 0.85; transform: translateY(-1px); }

/* Bottom CTA panels at the bottom of every section page: YouTube
   playlist, Instagram hashtag, map filter. Same three-panel pattern
   used on the journey detail pages. */
.section-cta {
  max-width: 920px;
  margin: 0 auto 3rem;
  padding: 0 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
/* The whole panel is the link -- no inner button. Matches the
   homepage explore-link pattern: bigger click target, cleaner look,
   chevron on the right via ::after. */
.section-cta-panel {
  position: relative;
  display: block;
  padding: 1rem 2.6rem 1rem 1.3rem;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  border-radius: 2px;
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(26, 26, 26, 0.12);
  transition: background 0.15s, border-color 0.15s, transform 0.12s, box-shadow 0.15s;
}
.section-cta-panel::after {
  content: '›';
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.4rem;
  line-height: 1;
  color: var(--paper-warm);
  transition: transform 0.15s;
}
.section-cta-panel:hover,
.section-cta-panel:focus-visible {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 4px 10px rgba(26, 26, 26, 0.18);
  transform: translateY(-1px);
}
.section-cta-panel:hover::after,
.section-cta-panel:focus-visible::after {
  transform: translateY(-50%) translateX(3px);
}
.section-cta-panel:active { transform: translateY(0); }
.section-cta-label {
  display: block;
  font-size: 1.1rem;
  font-style: italic;
  margin-bottom: 0.15rem;
  color: var(--paper);
}
.section-cta-sub {
  display: block;
  font-size: 0.85rem;
  color: rgba(250, 250, 248, 0.72);
  line-height: 1.4;
}

/* Empty-state when a filter produces no episodes. */
.empty-state {
  padding: 2.2rem 0;
  text-align: center;
  font-style: italic;
  color: var(--quiet);
}

@media (max-width: 700px) {
  body > header { height: 52px; padding: 0 0.75rem; }
  .book-index { padding: 1.6rem 1rem 3rem; }
  .book-title { font-size: 1.8rem; }
  .book-spine-lede { font-size: 1.04rem; }
  .section-card {
    grid-template-columns: 2.5rem 1fr;
    gap: 0.7rem;
  }
  .section-card-count { grid-column: 2; margin-top: 0.2rem; }
  .section-page { padding: 1.6rem 1rem 1rem; }
  .section-title { font-size: 1.9rem; }
  .section-subtitle { font-size: 1.05rem; }
  .section-filter { padding: 1rem 1rem; }
  .episodes-list { padding: 1.2rem 1rem 3rem; }
  .episode { grid-template-columns: 1fr; gap: 0.9rem; }
  /* Match the source 4:3 so the full frame shows (no top/bottom crop). */
  .episode-image, .episode-placeholder { aspect-ratio: 4 / 3; }
  .section-cta { padding: 0 1rem; gap: 0.55rem; }
  .section-cta-panel { flex-direction: column; align-items: flex-start; gap: 0.7rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* -------------------- index card: explainer thumbnail + modal -------------------- */
.section-card { position: relative; }
.section-card.has-explainer {
  grid-template-columns: auto 1fr auto;
  column-gap: 0.9rem;
  align-items: center;
}
.section-card-link { position: absolute; inset: 0; z-index: 1; }
/* Mini-cover thumbnail: the chapter's explainer cover (accent ring + numeral +
   name) recreated small, with the per-chapter --accent set inline. Opens the
   explainer modal; the corner play badge signals that. */
.section-explainer-thumb {
  position: relative; z-index: 2; align-self: center; padding: 0;
  width: 76px; height: 76px; border-radius: 6px; border: 1px solid var(--rule);
  background: var(--paper); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.section-explainer-thumb:hover { border-color: var(--accent); }
.section-explainer-thumb .thumb-cover {
  width: 60px; height: 60px; border-radius: 50%; border: 1px solid var(--accent);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
}
.section-explainer-thumb .thumb-num {
  font-family: 'Newsreader', Georgia, serif; font-weight: 500;
  font-size: 1.25rem; line-height: 1; color: var(--ink);
}
.section-explainer-thumb .thumb-name {
  font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 0.34rem;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent);
  max-width: 54px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.section-explainer-thumb .thumb-play {
  position: absolute; bottom: 3px; right: 5px; font-size: 0.62rem; line-height: 1;
  color: var(--accent); opacity: 0.65;
}

.explainer-modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
.explainer-modal[hidden] { display: none; }
.explainer-modal-backdrop { position: absolute; inset: 0; background: rgba(18,16,14,0.72); }
.explainer-modal-box {
  position: relative; z-index: 1; width: min(960px, 92vw); height: min(620px, 84vh);
  background: var(--paper); border-radius: 6px; overflow: hidden; box-shadow: 0 12px 48px rgba(0,0,0,0.42);
}
.explainer-modal-frame { width: 100%; height: 100%; border: 0; display: block; }
.explainer-modal-close {
  position: absolute; top: 8px; right: 10px; z-index: 2; width: 36px; height: 36px;
  border-radius: 50%; border: none; background: rgba(26,26,26,0.42); color: var(--paper);
  font-size: 1.4rem; line-height: 1; cursor: pointer;
}
.explainer-modal-close:hover { background: rgba(26,26,26,0.62); }

@media (max-width: 700px) {
  .section-card.has-explainer { grid-template-columns: auto 1fr; align-items: center; }
  .section-card.has-explainer .section-card-actions { grid-column: 2; align-items: flex-start; margin-top: 0.4rem; }
  .section-explainer-thumb { width: 68px; height: 68px; }
  .explainer-modal-box { width: 96vw; height: 88vh; }
}

/* -------------------- lightbox gallery viewer -------------------- */
/* Click any episode photo -> full-screen viewer: big image, passage +
   aphorism below, prev/next through the section's photos, and a link
   that flies to the pin on /tracks/. */
.episode-image.episode-zoomable { cursor: zoom-in; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  /* The scroll lives on .lightbox-inner (centred), NOT here — otherwise this
     full-viewport container's scrollbar sits at the right edge and clips the
     fixed .lightbox-next arrow on browsers with always-on scrollbars. */
  overflow: hidden;
  padding: 4vh 1rem;
  background: rgba(18, 16, 14, 0.94);
}
.lightbox[hidden] { display: none; }

.lightbox-inner {
  margin: auto;
  width: 100%;
  max-width: 920px;
  max-height: 92vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.lightbox-img {
  max-width: 100%;
  max-height: 72vh;
  object-fit: contain;
  border-radius: 2px;
  box-shadow: 0 16px 56px rgba(0, 0, 0, 0.55);
}
.lightbox-cap {
  width: 100%;
  max-width: 40rem;
  margin: 1.5rem auto 0;
  text-align: left;
}
.lightbox-meta {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--pencil);
  margin: 0 0 0.5rem;
}
.lightbox-title {
  font-size: 1.6rem;
  font-weight: 400;
  letter-spacing: 0.005em;
  color: var(--paper);
  margin: 0 0 0.6rem;
}
.lightbox-passage {
  font-size: 1.05rem;
  line-height: 1.7;
  color: rgba(250, 250, 248, 0.9);
  margin: 0 0 0.85rem;
}
.lightbox-aphorism {
  font-style: italic;
  color: var(--pencil);
  border-left: 2px solid rgba(168, 122, 60, 0.5);
  padding-left: 0.75rem;
  margin: 0 0 1.3rem;
}
.lightbox-map {
  display: inline-block;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  color: var(--amber);
  text-decoration: none;
  border: 1px solid rgba(168, 122, 60, 0.55);
  border-radius: 2px;
  padding: 0.55rem 0.9rem;
  transition: background 0.15s, border-color 0.15s;
}
.lightbox-map:hover,
.lightbox-map:focus-visible {
  background: rgba(168, 122, 60, 0.14);
  border-color: var(--amber);
}
.lightbox-close {
  position: fixed;
  top: 0.8rem;
  right: 1.1rem;
  z-index: 201;
  background: none;
  border: none;
  color: var(--paper);
  font-size: 2.1rem;
  line-height: 1;
  cursor: pointer;
}
/* The figure shrink-wraps the image (flex child of .lightbox-inner, which is
   align-items:center) so the arrows can anchor to the image's own edges. */
.lightbox-figure {
  position: relative;
  max-width: 100%;
  max-height: 72vh;
  line-height: 0;
}
/* Navigation sits BELOW the photo (no longer overlapping it): arrows flank a row
   of dots. Desktop shows both; mobile drops the arrows (swipe) and keeps the dots
   as the swipe hint. */
.lightbox-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin: 1rem auto 0;
}
.lightbox-arrow {
  flex: none;
  width: 2.6rem;
  height: 2.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: rgba(250, 250, 248, 0.12);
  color: var(--paper);
  font-size: 1.9rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s;
}
.lightbox-arrow:hover { background: rgba(250, 250, 248, 0.24); }
.lightbox-dots {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  max-width: 60vw;
}
.lightbox-dot {
  width: 7px;
  height: 7px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(250, 250, 248, 0.3);
  cursor: pointer;
}
.lightbox-dot.on { background: var(--amber); }

@media (max-width: 600px) {
  .lightbox-arrow { display: none; }   /* swipe the photos; the dots are the hint */
  .lightbox-title { font-size: 1.3rem; }
  .lightbox-img { max-height: 60vh; }
}

@media (prefers-reduced-motion: reduce) {
  .lightbox-map { transition: none; }
}

/* Chapter card: two clear targets, no overlay. The title is the Read link;
   a distinct "Explore map" button (right) opens the chapter as a journey. */
/* The chapter title is a clear "open this chapter" button — outline that warms
   to amber on hover, matching the site's secondary buttons. */
.section-card-read {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.34rem 0.85rem;
  font-size: 1.18rem;
  color: var(--ink);
  text-decoration: none;
  border: 1px solid var(--rule);
  border-radius: 7px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.section-card-read:hover,
.section-card-read:focus-visible {
  background: var(--amber);
  border-color: var(--amber);
  color: var(--paper);
}
.section-card-read-arrow {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.9em;
  color: var(--amber);
  transition: color 0.15s, transform 0.15s;
}
.section-card-read:hover .section-card-read-arrow {
  color: var(--paper);
  transform: translateX(2px);
}

.section-card-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.45rem;
  justify-self: end;
}
.section-card-mapbtn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.74rem;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.section-card-mapbtn:hover { background: var(--amber); border-color: var(--amber); color: var(--paper); }
.section-card-mapbtn-icon { color: var(--amber); }
.section-card-mapbtn:hover .section-card-mapbtn-icon { color: var(--paper); }

/* "Explore on the map" button on the chapter reading page. Hero variant sits
   on the dark scrim; the flat variant is for the (rare) no-photo fallback. */
.section-hero-mapbtn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  margin: 0.3rem 0 1rem;
  padding: 0.5rem 1rem;
  border: 1px solid rgba(250, 250, 248, 0.55);
  border-radius: 999px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.8rem;
  color: #fafaf8; text-decoration: none;
  background: rgba(0, 0, 0, 0.28);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.section-hero-mapbtn:hover { background: var(--amber); border-color: var(--amber); color: #fff; }
.section-flat-mapbtn { margin: 0.6rem 0 1rem; }

/* Looping bullet-time clip in an episode card (the Annealing orbit). Inherits
   .episode-image sizing; just a dark backdrop while it loads + no zoom cursor. */
.episode-video { background: var(--ink); cursor: default; }

/* Bullet-time clips in the lightbox play like photographs (loop, muted). */
.lightbox-video {
  max-width: 100%;
  max-height: 72vh;
  object-fit: contain;
  border-radius: 2px;
  box-shadow: 0 16px 56px rgba(0, 0, 0, 0.55);
}
.lightbox-img[hidden], .lightbox-video[hidden] { display: none; }
