/* reader-theme: fire */
:root {
  --bg: #f6f1e8;
  --ink: #241c16;
  --line: #6a5344;
  --muted: #453c34;
  --soft: rgba(122, 63, 18, 0.12);
  --panel: #f0e6d8;
  --bar: #24160f;
  --bar-ink: #f8f1e6;
  --hero: #3a2416;
  --accent: #7a3f12;
  --focus: #f8efe2;
  --body: 19px;
}

body {
  background: var(--bar);
  color: var(--ink);
  font-size: 19px;
  line-height: 1.85;
}

.bookbar {
  position: fixed;
  z-index: 6;
  top: 0;
  left: 0;
  right: 0;
  min-height: 56px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 6px 16px;
  background: var(--bar);
  color: var(--bar-ink);
  border-bottom: 1px solid rgba(244, 239, 228, 0.28);
}

.bookbar a {
  font-family: var(--serif);
  font-size: 20px;
  text-decoration: none;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: var(--bar-ink);
}

.bookbar button {
  color: var(--bar-ink);
  border-color: rgba(244, 239, 228, 0.55);
  background: transparent;
}

.read-label {
  margin: 0 0 0 auto;
  color: var(--bar-ink);
  font-size: 15px;
  line-height: 1.4;
}

.desktop-hero {
  position: relative;
  height: 80vh;
  min-height: 520px;
  overflow: hidden;
  color: var(--bar-ink);
  background: var(--hero);
}

.desktop-hero img,
.mobile-open img {
  background: var(--hero);
}

.desktop-hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: 68% center;
}

.hero-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(8, 18, 20, 0.66) 0%, rgba(8, 18, 20, 0.2) 42%, rgba(8, 18, 20, 0) 70%);
  pointer-events: none;
}

.hero-copy {
  position: relative;
  z-index: 1;
  width: min(640px, 52vw);
  padding: calc(10vh + 56px) 0 0 6vw;
}

.hero-kicker {
  margin: 0;
  letter-spacing: 0.14em;
  font-size: 14px;
}

.desktop-hero h1 {
  font-size: 80px;
  line-height: 1.05;
  margin: 8px 0 12px;
  font-weight: 500;
}

.hero-copy .guide,
.hero-pending {
  font-size: 18px;
  line-height: 1.7;
  max-width: 24em;
}

.hero-plain {
  height: auto;
  min-height: 0;
}

.hero-plain .hero-copy {
  width: min(640px, calc(100% - 48px));
  padding: 88px 0 28px 6vw;
}

.hero-plain .down {
  position: static;
  margin-top: 8px;
}

.down {
  position: absolute;
  z-index: 1;
  left: 6vw;
  bottom: 28px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: var(--bar-ink);
  text-decoration: none;
  border-bottom: 1px solid rgba(244, 239, 228, 0.7);
}

.series-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 16px;
}

.series-links a,
.series-links span {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.desktop-hero .series-links a,
.mobile-open .series-links a,
.desktop-hero .series-links span,
.mobile-open .series-links span {
  color: var(--bar-ink);
}

.mobile-open { display: none; }

.paper {
  background: var(--bg);
  color: var(--ink);
  padding: 28px 0 64px;
}

.paper-grid {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: 156px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.toc-panel {
  position: sticky;
  top: 72px;
  max-height: calc(100vh - 88px);
  overflow: auto;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--ink);
  padding-left: 10px;
}

.toc-panel a {
  min-height: 44px;
  display: flex;
  align-items: center;
  text-decoration: none;
  font-size: 15px;
}

.toc-part {
  margin: 14px 0 2px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  line-height: 1.4;
}

.toc-panel a.toc-chapter {
  align-items: flex-start;
  gap: 6px;
  padding-left: 10px;
  line-height: 1.35;
}

.toc-panel a.toc-chapter span {
  flex: 0 0 auto;
}

.toc-panel a[aria-current="true"] {
  box-shadow: inset 3px 0 0 var(--accent);
  text-decoration: none;
}

.chapter,
.part-break,
.front-block,
.section,
.pair-open {
  scroll-margin-top: 76px;
}

.chapter { padding: 28px 0 12px; border-top: 1px solid rgba(28, 36, 34, 0.16); }

.ch-no,
.part-no {
  letter-spacing: 0.08em;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 4px;
}

.chapter > h2 { font-size: 40px; margin: 0 0 8px; }

.core-q {
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1.45;
  margin: 0 0 16px;
}

.section { padding: 8px 0 12px; }

.section h3,
.catalog h3,
.interaction h3 { font-size: 28px; margin: 12px 0 8px; }

.specimen { width: min(380px, 100%); margin: 12px 0 20px; }

.specimen img { background: var(--panel); }

.specimen figcaption,
.pair figcaption,
.img-fallback {
  font-size: 15px;
  color: var(--muted);
  margin-top: 6px;
}

.img-fallback[hidden] { display: none; }

.stand {
  background: var(--panel);
  border: 1px solid rgba(28, 36, 34, 0.28);
  padding: 18px 18px 8px;
  margin: 16px 0;
}

.part-break { padding: 42px 0 8px; }

.part-break h2 { font-size: 34px; margin: 0 0 8px; }

.catalog details,
.source-fold {
  border-top: 1px solid rgba(28, 36, 34, 0.2);
  margin: 0;
}

.catalog summary,
.source-fold summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-size: 18px;
  cursor: pointer;
  list-style: none;
}

.catalog summary::-webkit-details-marker,
.source-fold summary::-webkit-details-marker { display: none; }

.catalog summary::before,
.source-fold summary::before {
  content: "+";
  flex: 0 0 1em;
  color: var(--muted);
  font-family: var(--sans, sans-serif);
}

.catalog details[open] > summary::before,
.source-fold[open] > summary::before { content: "−"; }

.catalog details[open] > summary {
  font-family: var(--serif);
  font-size: 22px;
}

.catalog .quiet { font-size: 13px; color: var(--muted); }

.interaction article h4 {
  font-size: 22px;
  font-weight: 500;
  margin: 4px 0 8px;
}

.lookup { width: 100%; border-collapse: collapse; margin: 12px 0 18px; }

.lookup th,
.lookup td {
  border-bottom: 1px solid rgba(28, 36, 34, 0.2);
  text-align: left;
  vertical-align: top;
  padding: 8px 10px 8px 0;
}

.lookup th { width: 8em; font-weight: 500; }

.choice-row button[aria-pressed="true"],
.answers button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--bar-ink);
  border-color: var(--accent);
}

.pair-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 16px 0 8px;
}

.pair-open {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  min-height: 44px;
  cursor: zoom-in;
}

.pair-crop,
.lightbox-crop {
  display: block;
  overflow: hidden;
  width: 100%;
  background: var(--panel);
}

.pair-crop img,
.lightbox-crop img {
  width: 200%;
  max-width: none;
  height: auto;
  display: block;
}

.pair-right .pair-crop img,
.lightbox-crop.is-right img { margin-left: -100%; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.lightbox {
  border: 0;
  padding: 16px;
  background: var(--bar);
  color: var(--bar-ink);
  width: min(920px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow: auto;
}

.lightbox::backdrop { background: rgba(8, 16, 18, 0.72); }

.lightbox [data-lightbox-close] {
  color: var(--bar-ink);
  border-color: rgba(244, 239, 228, 0.7);
  min-height: 44px;
  margin-bottom: 12px;
}

html.is-enhanced [data-state-panel] { display: none; }
html.is-enhanced [data-state-panel].is-active { display: block; }
html.is-enhanced .reasons { display: none; }
html.is-enhanced .reasons.is-open { display: block; }

html { scroll-padding-top: 76px; }

@media (max-width: 1100px) {
  .desktop-hero h1 { font-size: 72px; }
}

@media (max-width: 800px) {
  body { font-size: 18px; }
  .desktop-hero { display: none; }
  .mobile-open { display: block; background: var(--hero); color: var(--bar-ink); }
  .mobile-open img {
    width: 100%;
    height: clamp(220px, 42svh, 420px);
    object-fit: cover;
    object-position: 100% center;
  }
  .mobile-title { padding: 18px 16px 28px; }
  .mobile-title h1 { font-size: 40px; line-height: 1.15; margin: 6px 0 8px; }
  .mobile-title .down { position: static; color: var(--bar-ink); }
  .paper-grid { display: block; width: min(1080px, calc(100% - 24px)); }
  .bookbar { min-height: 52px; padding: 4px 12px; }
  .toc-toggle {
    border: 0;
    border-bottom: 1px solid rgba(244, 239, 228, 0.75);
    min-height: 44px;
    min-width: 44px;
    padding: 0 10px;
  }
  .toc-panel {
    display: none;
    position: fixed;
    z-index: 5;
    top: 52px;
    left: 0;
    right: 0;
    max-height: min(70vh, 520px);
    overflow: auto;
    background: var(--bg);
    color: var(--ink);
    border-left: 0;
    border-bottom: 1px solid var(--ink);
    padding: 8px 16px 12px;
  }
  .toc-panel.is-open { display: flex; }
  .chapter > h2 { font-size: 32px; }
  .read-label { font-size: 14px; }
  .pair-grid { grid-template-columns: 1fr; }
}

@media (min-width: 801px) {
  .toc-toggle { display: none; }
}

@media (max-width: 360px) {
  .bookbar {
    flex-wrap: nowrap;
    gap: 6px;
    padding: 0 10px;
    min-height: 52px;
  }
  .bookbar > a { font-size: 17px; }
  .read-label {
    max-width: 7em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .bookbar .series-links { display: none; }
}

.bookbar :focus-visible,
.desktop-hero :focus-visible,
.mobile-open :focus-visible,
.lightbox :focus-visible,
.vignette-close:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.vignette-pair.is-single { margin: 16px 0 8px; }
.vignette-pane { margin: 0; }
.vignette-pane .vignette-frame {
  overflow: hidden;
  max-width: 460px;
  margin-inline: auto;
  background: var(--panel);
}
.vignette-frame img { width: 200%; max-width: none; height: auto; display: block; }
.vignette-frame.is-right img { margin-left: -100%; }
.vignette-open {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  min-height: 44px;
  cursor: pointer;
}
.vignette-pane figcaption { margin-top: 6px; font-size: 15px; color: var(--muted); }
.vignette-pane figcaption span { display: block; font-size: 13px; }
.vignette-open:focus-visible { outline: none; }
.vignette-pane:focus-within {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}
.vignette-dialog {
  box-sizing: border-box;
  border: 0;
  padding: 12px;
  background: var(--bar);
  color: var(--bar-ink);
  width: min(960px, calc(100vw - 16px));
  max-width: calc(100vw - 16px);
  max-height: calc(100vh - 16px);
  overflow: auto;
}
.vignette-dialog::backdrop { background: rgba(8, 16, 18, 0.72); }
.vignette-dialog .vignette-frame {
  width: 100%;
  max-width: 920px;
  margin-inline: 0;
  overflow: hidden;
  background: var(--panel);
}
.vignette-close {
  min-height: 44px;
  min-width: 44px;
  margin-top: 8px;
  color: var(--bar-ink);
  border: 1px solid rgba(244, 239, 228, 0.7);
  background: transparent;
}
