/* Infinibook reader. Night is the default; paper is the light theme. */

:root {
  --bg: #09080a;
  --ink: #d9d1c3;
  --ink-soft: #b3aa9b;
  --muted: #857c70;
  --gold: #c9a86a;
  --gold-bright: #f0dcae;
  --rule: rgba(201, 168, 106, .28);
  --veil: rgba(9, 8, 10, .72);
  --glow: #9fe3c6;
  --scale: 1;
  --display: "Cormorant Garamond", "Cormorant", Georgia, serif;
  --text: "Literata", Georgia, "Times New Roman", serif;
  color-scheme: dark;
}
:root[data-theme="paper"] {
  --bg: #f4eee2;
  --ink: #2b2620;
  --ink-soft: #4a4238;
  --muted: #85796a;
  --gold: #8c6a2c;
  --gold-bright: #6b4e1a;
  --rule: rgba(140, 106, 44, .35);
  --veil: rgba(244, 238, 226, .82);
  color-scheme: light;
}

@view-transition { navigation: auto; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; background: var(--bg); }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink);
  font-family: var(--text); font-size: calc(1.19rem * var(--scale)); line-height: 1.72;
  font-optical-sizing: auto; font-kerning: normal; font-variant-numeric: oldstyle-nums;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: inherit; }
::selection { background: color-mix(in srgb, var(--gold) 35%, transparent); }

canvas.fx { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; display: block;
  opacity: 0; transition: opacity 1.6s ease; pointer-events: none; }
canvas.fx.on { opacity: 1; }

/* ------------------------------------------------------------ top bar --- */

.bar {
  position: fixed; inset: 0 0 auto 0; z-index: 20; height: 3.4rem;
  display: flex; align-items: center; gap: 1rem; padding: 0 1.25rem;
  font-family: var(--display); font-size: .95rem; letter-spacing: .22em; text-transform: uppercase;
  color: var(--muted);
  background: linear-gradient(var(--veil), transparent);
  transition: transform .45s ease, opacity .45s ease;
}
.bar.away { transform: translateY(-100%); opacity: 0; }
.bar a { text-decoration: none; color: var(--gold); }
.bar .where { flex: 1; text-align: center; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  font-size: .8rem; }
.bar button {
  font: inherit; letter-spacing: 0; text-transform: none; font-size: 1.25rem; line-height: 1;
  color: var(--gold); background: none; border: 1px solid var(--rule); border-radius: 999px;
  width: 2.4rem; height: 2.4rem; cursor: pointer; transition: border-color .3s, background .3s;
}
.bar button:hover, .bar button[aria-expanded="true"] { border-color: var(--gold);
  background: color-mix(in srgb, var(--gold) 12%, transparent); }

.progress { position: fixed; inset: 0 0 auto 0; height: 2px; z-index: 30; pointer-events: none; }
.progress i { display: block; height: 100%; width: 100%; transform-origin: 0 50%; transform: scaleX(0);
  background: linear-gradient(90deg, transparent, var(--gold) 30%, var(--gold-bright));
  box-shadow: 0 0 12px color-mix(in srgb, var(--gold) 70%, transparent); }

.panel {
  position: fixed; top: 3.6rem; right: 1.25rem; z-index: 25; width: 15.5rem; padding: 1.1rem 1.2rem 1.2rem;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(1.2); backdrop-filter: blur(18px) saturate(1.2);
  border: 1px solid var(--rule); border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
  font-family: var(--display); font-size: 1rem;
}
.panel[hidden] { display: none; }
.panel h3 { margin: 0 0 .5rem; font-size: .72rem; font-weight: 500; letter-spacing: .28em;
  text-transform: uppercase; color: var(--muted); }
.panel .row { display: flex; gap: .5rem; margin-bottom: 1.1rem; }
.panel .row:last-child { margin-bottom: 0; }
.panel button {
  flex: 1; padding: .55rem 0; font: inherit; color: var(--ink); cursor: pointer;
  background: none; border: 1px solid var(--rule); border-radius: 9px; transition: border-color .25s, background .25s;
}
.panel button:hover { border-color: var(--gold); }
.panel button[aria-pressed="true"] { border-color: var(--gold); color: var(--gold-bright);
  background: color-mix(in srgb, var(--gold) 12%, transparent); }
.panel .size button:first-child { font-size: .9rem; }
.panel .size button:last-child { font-size: 1.35rem; line-height: 1; }

/* ------------------------------------------------------------ chapter --- */

main.reading { position: relative; z-index: 1; padding: 0 1.4rem 6rem; }
article { max-width: 31em; margin: 0 auto; }

.chapter-head { min-height: 68vh; display: flex; flex-direction: column; justify-content: flex-end;
  align-items: center; text-align: center; padding: 6rem 0 3.2rem; }
.chapter-no { margin: 0 0 1.4rem; font-family: var(--display); font-size: .82em; font-weight: 500;
  letter-spacing: .5em; text-indent: .5em; text-transform: uppercase; color: var(--gold); }
.chapter-head h1 {
  margin: 0; font-family: var(--display); font-weight: 500; font-size: clamp(3.2rem, 11vw, 6rem);
  line-height: 1; letter-spacing: .06em;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold) 55%, color-mix(in srgb, var(--gold) 55%, var(--bg)));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.chapter-head .meta { margin: 1.6rem 0 0; font-family: var(--display); font-size: .8em; letter-spacing: .3em;
  text-transform: uppercase; color: var(--muted); }
.chapter-head::after { content: ""; width: 1px; height: 4.5rem; margin-top: 2.4rem;
  background: linear-gradient(var(--gold), transparent); opacity: .7; }

.epigraph { margin: 0 auto 4.5rem; max-width: 25em; text-align: center; font-family: var(--display);
  font-size: 1.14em; line-height: 1.6; color: var(--ink-soft); }
.epigraph > p { margin: 0 0 1.2rem; font-size: .68em; letter-spacing: .34em; text-transform: uppercase;
  color: var(--gold); }
.epigraph > p em { font-style: normal; }
.epigraph blockquote { margin: 0; padding: 0; font-style: italic; }
.epigraph blockquote p { margin: 0 0 1em; text-wrap: balance; }
.epigraph blockquote p.note { margin-top: 1.6em; padding-top: 1.4em; border-top: 1px solid var(--rule);
  font-size: .86em; color: var(--muted); }
.epigraph blockquote p.note em { font-style: normal; }

.prose p { scroll-margin-top: 5.5rem; margin: 0; text-indent: 1.5em; text-wrap: pretty; hyphens: auto; overflow-wrap: break-word;
  hanging-punctuation: first; }
.prose > p:first-child, .prose .break + p, .prose h3 + p { text-indent: 0; }
.prose > p:first-child::first-letter {
  font-family: var(--display); font-weight: 600; font-size: 3.5em; line-height: .8;
  padding-right: .03em; color: var(--gold);
}
.prose > p:first-child::first-line { font-variant-caps: small-caps; letter-spacing: .06em; }
.prose em { font-style: italic; color: color-mix(in srgb, var(--ink) 88%, var(--gold)); }
.prose h3 { font-family: var(--display); font-weight: 500; font-size: 1.3em; text-align: center; margin: 2.5em 0 1em; }
.prose blockquote { margin: 1.6em 1.5em; font-style: italic; color: var(--ink-soft); }

.break { display: flex; align-items: center; justify-content: center; gap: .9rem; margin: 2.6em 0; }
.break::before, .break::after { content: ""; width: 3.2rem; height: 1px; background: var(--rule); }
.break::before { background: linear-gradient(90deg, transparent, var(--gold)); opacity: .55; }
.break::after { background: linear-gradient(270deg, transparent, var(--gold)); opacity: .55; }
.break span { width: .42rem; height: .42rem; transform: rotate(45deg); background: var(--gold);
  box-shadow: 0 0 10px color-mix(in srgb, var(--gold) 60%, transparent); }

.chapter-end { max-width: 31em; margin: 6rem auto 0; text-align: center; font-family: var(--display); }
.chapter-end .fin { display: block; width: 1px; height: 4rem; margin: 0 auto 2.6rem;
  background: linear-gradient(transparent, var(--gold)); opacity: .7; }
.next {
  display: block; padding: 2.2rem 1.5rem 2.4rem; text-decoration: none; border: 1px solid var(--rule);
  border-radius: 4px; position: relative; overflow: hidden;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  transition: border-color .4s, transform .4s, background .4s;
}
.next:hover { border-color: var(--gold); transform: translateY(-2px);
  background: color-mix(in srgb, var(--gold) 7%, transparent); }
.next small { display: block; font-size: .72em; letter-spacing: .4em; text-transform: uppercase; color: var(--muted); }
.next b { display: block; margin-top: .7rem; font-weight: 500; font-size: 2.3em; line-height: 1.1;
  letter-spacing: .05em; color: var(--gold-bright); }
.next span { display: block; margin-top: .5rem; font-size: .8em; letter-spacing: .3em; text-transform: uppercase;
  color: var(--gold); }
.chapter-end .back { display: inline-block; margin-top: 2.2rem; font-size: .8em; letter-spacing: .3em;
  text-transform: uppercase; text-decoration: none; color: var(--muted); }
.chapter-end .back:hover { color: var(--gold); }
.chapter-end .tbc { font-style: italic; font-size: 1.15em; color: var(--muted); }

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

main.front { position: relative; z-index: 1; min-height: 100vh; display: grid; align-items: center;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: clamp(2rem, 6vw, 6rem);
  max-width: 78rem; margin: 0 auto; padding: 4rem clamp(1.4rem, 5vw, 4rem); }

.stage { display: flex; justify-content: center; perspective: 1600px; }
.book {
  position: relative; aspect-ratio: 2 / 3; height: min(82vh, 46rem); max-width: 100%;
  border-radius: 3px 7px 7px 3px; overflow: hidden; background: #050506;
  transform: rotateY(var(--ry, -7deg)) rotateX(var(--rx, 2deg)); transform-style: preserve-3d;
  transition: transform .5s cubic-bezier(.2, .7, .2, 1);
  box-shadow: 0 2px 0 rgba(255, 255, 255, .05) inset, 0 60px 120px -30px rgba(0, 0, 0, .9),
    0 30px 60px -20px rgba(0, 0, 0, .7), -18px 0 40px -18px color-mix(in srgb, var(--glow) 35%, transparent);
  animation: rise 1.6s cubic-bezier(.2, .7, .2, 1) both;
}
@keyframes rise { from { opacity: 0; translate: 0 2.5rem; } to { opacity: 1; translate: 0 0; } }
.book img, .book canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.book img { filter: brightness(1.9); }
.book canvas { opacity: 0; transition: opacity 1.4s ease; }
.book canvas.on { opacity: 1; }
.book::before { /* spine shadow and edge light */
  content: ""; position: absolute; inset: 0; z-index: 3; pointer-events: none;
  background: linear-gradient(90deg, rgba(0, 0, 0, .55), rgba(255, 255, 255, .07) 2.2%, rgba(0, 0, 0, .25) 4.2%, transparent 9%),
    linear-gradient(180deg, rgba(5, 5, 6, .6), rgba(5, 5, 6, .1) 34%, transparent 50%, rgba(5, 5, 6, .3));
}
.book::after { /* sheen that follows the pointer */
  content: ""; position: absolute; inset: -40%; z-index: 4; pointer-events: none; mix-blend-mode: soft-light;
  background: linear-gradient(105deg, transparent 42%, rgba(255, 244, 214, .5) 50%, transparent 58%);
  transform: translateX(var(--sheen, -30%)); transition: transform .5s cubic-bezier(.2, .7, .2, 1);
}
.book .frame { position: absolute; inset: 4.2%; z-index: 5; pointer-events: none;
  border: 1px solid color-mix(in srgb, var(--gold) 55%, transparent); }
.book .frame::after { content: ""; position: absolute; inset: 5px;
  border: 1px solid color-mix(in srgb, var(--gold) 22%, transparent); }
.book .type { position: absolute; inset: 11% 8% auto; z-index: 6; text-align: center; font-family: var(--display); }
.foil {
  background: linear-gradient(100deg, #8a6a33 0%, #e9d3a0 22%, #b8935a 40%, #fff3d2 50%, #b8935a 60%, #e9d3a0 78%, #8a6a33 100%);
  background-size: 260% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: foil 9s ease-in-out infinite alternate;
}
@keyframes foil { from { background-position: 100% 0; } to { background-position: 0 0; } }
.book .kicker { margin: 0; font-size: clamp(.6rem, 1.5vh, .82rem); letter-spacing: .5em; text-indent: .5em;
  text-transform: uppercase; font-weight: 500; }
.book h1 { margin: .28em 0 0; font-weight: 500; line-height: 1; font-size: clamp(3rem, 12.5vh, 7rem);
  letter-spacing: .14em; text-indent: .14em; filter: drop-shadow(0 2px 14px rgba(0, 0, 0, .8)); }
.book .sub { margin: .7em 0 0; font-style: italic; font-size: clamp(.95rem, 2.7vh, 1.5rem); letter-spacing: .08em; }
.book .sub::before { content: ""; display: block; width: 2.6rem; height: 1px; margin: 0 auto .9em;
  background: var(--gold); opacity: .7; }

.side { font-family: var(--display); animation: rise 1.6s .25s cubic-bezier(.2, .7, .2, 1) both; max-width: 30rem; }
.side .kicker { margin: 0; font-size: .78rem; letter-spacing: .46em; text-transform: uppercase; color: var(--gold); }
.side h2 { margin: .5rem 0 0; font-weight: 500; font-size: clamp(3rem, 6vw, 4.6rem); line-height: 1; letter-spacing: .04em; }
.side .sub { margin: .5rem 0 0; font-style: italic; font-size: 1.4rem; color: var(--ink-soft); }
.side .blurb { margin: 2rem 0 0; font-family: var(--text); font-size: 1.02rem; line-height: 1.75; color: var(--ink-soft);
  text-wrap: pretty; }
.cta {
  display: inline-flex; align-items: center; gap: 1rem; margin: 2.4rem 0 0; padding: 1rem 2rem 1rem 2.2rem;
  font-size: .86rem; font-weight: 600; letter-spacing: .34em; text-transform: uppercase; text-decoration: none;
  color: #17120a; border-radius: 2px;
  background: linear-gradient(100deg, #b8935a, #f0dcae 45%, #c9a86a);
  box-shadow: 0 14px 40px -12px color-mix(in srgb, var(--gold) 70%, transparent);
  transition: transform .35s, box-shadow .35s, filter .35s;
}
.cta:hover { transform: translateY(-2px); filter: brightness(1.08);
  box-shadow: 0 20px 50px -12px color-mix(in srgb, var(--gold) 90%, transparent); }
.cta::after { content: "→"; letter-spacing: 0; font-size: 1.2em; transition: transform .35s; }
.cta:hover::after { transform: translateX(5px); }
.cta small { display: block; font-size: .78em; font-weight: 500; letter-spacing: .2em; opacity: .75; }

.contents { list-style: none; margin: 3rem 0 0; padding: 0; border-top: 1px solid var(--rule); }
.contents a { display: grid; grid-template-columns: 2.6rem 1fr auto; align-items: baseline; gap: .6rem;
  padding: 1.05rem .2rem; text-decoration: none; border-bottom: 1px solid var(--rule);
  transition: padding .35s, background .35s; }
.contents a:hover { padding-left: .8rem; background: linear-gradient(90deg, color-mix(in srgb, var(--gold) 9%, transparent), transparent); }
.contents .no { font-size: .95rem; letter-spacing: .1em; color: var(--gold); }
.contents .t { font-size: 1.5rem; font-weight: 500; letter-spacing: .03em; }
.contents .t small { display: block; font-size: .68rem; font-weight: 400; letter-spacing: .34em;
  text-transform: uppercase; color: var(--muted); }
.contents .len { font-size: .78rem; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.contents a.here .t::after { content: "•"; margin-left: .6rem; color: var(--gold); }
.colophon { margin: 2rem 0 0; font-size: .74rem; letter-spacing: .3em; text-transform: uppercase; color: var(--muted); }

/* ------------------------------------------------------------- narrow --- */

@media (max-width: 860px) {
  main.front { grid-template-columns: 1fr; gap: 2.6rem; padding: 2.4rem 1.4rem 4rem; }
  .book { height: auto; width: min(100%, 23rem); transform: none; }
  .book h1 { font-size: clamp(3rem, 19vw, 5.2rem); }
  .book .kicker { font-size: .68rem; }
  .book .sub { font-size: 1.1rem; }
  .side { max-width: none; text-align: center; margin: 0 auto; }
  .contents { text-align: left; }
  body { font-size: calc(1.1rem * var(--scale)); }
  .bar { padding: 0 .9rem; }
  .prose p { hyphens: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

@media print {
  canvas.fx, .bar, .progress, .panel, .chapter-end { display: none !important; }
  body { background: #fff; color: #000; }
  .chapter-head { min-height: 0; }
}

/* ---------------------------------------------- the chapter as a book --- */
/* pager.js lays the text out in columns and turns them; without it the page scrolls. */

:root { --page: #0e0d10; --page-back: #19171b; --edge: rgba(201, 168, 106, .16); --drop: rgba(0, 0, 0, .85); }
:root[data-theme="paper"] { --page: #faf6ec; --page-back: #ece4d4; --edge: rgba(140, 106, 44, .22); --bg: #e6dcc9; --drop: rgba(70, 48, 14, .4); }

.bar .tools { display: flex; gap: .55rem; }
.bar button svg { width: 1.05rem; height: 1.05rem; display: block; margin: auto; stroke: currentColor; fill: none;
  stroke-width: 1.4; stroke-linecap: round; }
.toc { width: min(21rem, calc(100vw - 2.5rem)); max-height: min(70vh, 34rem); overflow: auto; padding-bottom: .6rem; }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc a { display: grid; grid-template-columns: 2.1rem 1fr auto; align-items: baseline; gap: .4rem; padding: .7rem .3rem;
  text-decoration: none; border-bottom: 1px solid var(--rule); transition: background .25s, padding .25s; }
.toc a:hover { padding-left: .6rem; background: color-mix(in srgb, var(--gold) 9%, transparent); }
.toc li:last-child a { border-bottom: 0; }
.toc .no { font-size: .85rem; letter-spacing: .08em; color: var(--gold); }
.toc .t { font-size: 1.25rem; font-weight: 500; }
.toc .t small { display: block; font-size: .64rem; font-weight: 400; letter-spacing: .3em; text-transform: uppercase; color: var(--muted); }
.toc .read { font-size: .74rem; letter-spacing: .12em; color: var(--muted); }
.toc a[aria-current] .t { color: var(--gold-bright); }
.toc .home { display: block; margin: 0 0 .5rem; padding: .2rem .3rem .8rem; text-decoration: none; font-size: .74rem;
  letter-spacing: .3em; text-transform: uppercase; color: var(--gold); border-bottom: 1px solid var(--rule); }

.folio { display: none; }
/* Only a chapter is held still. The front page must scroll: the cast is below the cover. */
html[data-view="pages"] body.chapter { overflow: hidden; height: 100dvh; }
html[data-view="pages"] main.reading { padding: 0; }
html[data-view="pages"] main.reading > article, html[data-view="pages"] main.reading > footer { visibility: hidden; }
html[data-view="pages"] .progress { display: none; }

.pager {
  position: fixed; z-index: 2; top: 4rem; bottom: 3.7rem; overflow: hidden; overflow: clip;
  left: max(2.5rem, calc(50vw - 37rem)); right: max(2.5rem, calc(50vw - 37rem));
  --pad-x: clamp(2.2rem, 4.2vw, 4.2rem); --pad-top: 3.2rem; --pad-bottom: 3rem;
  background: var(--page); border-radius: 3px;
  box-shadow: 0 0 0 1px var(--edge), 0 50px 100px -40px var(--drop), 0 0 80px -20px color-mix(in srgb, var(--glow) 10%, transparent);
  -webkit-user-select: none; user-select: none; touch-action: none; cursor: pointer;
  opacity: 0; transition: opacity .7s ease;
}
.pager.ready { opacity: 1; }
.pager.nudge { animation: nudge .45s ease; }
@keyframes nudge { 30% { translate: -10px 0; } 60% { translate: 5px 0; } }
/* clip, not hidden: a hidden box can still be scrolled by a #link, by find-in-page or by a
   selection dragged to its edge, and the pages would slide out of register. */
.leaf { position: absolute; inset: 0; overflow: hidden; overflow: clip; background: var(--page); }
.leaf.under { z-index: 1; }
/* The page in front can be selected and copied; its two stand-ins cannot. */
body.selecting .pager { cursor: auto; box-shadow: 0 0 0 1px var(--gold), 0 50px 100px -40px var(--drop); }
body.selecting .leaf.over .flow { -webkit-user-select: text; user-select: text; cursor: text; }
body.selecting .pager .hint { display: none; }
html[data-view="scroll"] #select { display: none; }   /* a scrolling page is always selectable */
.bar button[aria-pressed="true"] { border-color: var(--gold); color: var(--gold-bright);
  background: color-mix(in srgb, var(--gold) 16%, transparent); }
.pager .hint { position: absolute; z-index: 4; top: 50%; width: .7rem; height: .7rem; pointer-events: none;
  border: solid var(--gold); border-width: 1px 1px 0 0; opacity: 0; transition: opacity .4s; }
.pager .hint.prev { left: 1.1rem; rotate: -135deg; }
.pager .hint.next { right: 1.1rem; rotate: 45deg; }
@media (hover: hover) { .pager:hover .hint { opacity: .45; } }
.pager.turning .hint { opacity: 0; }
.leaf.over { z-index: 2; }
.leaf.flap { z-index: 3; visibility: hidden; pointer-events: none; background: var(--page-back); }
.leaf.flap .flow { opacity: .13; }
.pager.turning .leaf.flap { visibility: visible; }
.pager::after { /* the gutter between the two pages of a spread */
  content: ""; position: absolute; z-index: 5; top: 0; bottom: 0; left: 50%; width: 7rem; translate: -50% 0; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(0, 0, 0, .2) 46%, rgba(0, 0, 0, .34) 50%, rgba(0, 0, 0, .2) 54%, transparent);
}
:root[data-theme="paper"] .pager::after {
  background: linear-gradient(90deg, transparent, rgba(60, 40, 10, .07) 44%, rgba(60, 40, 10, .16) 50%, rgba(60, 40, 10, .07) 56%, transparent); }
canvas.turn { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 6; pointer-events: none; display: block; }

.flow { position: absolute; left: var(--pad-x); right: var(--pad-x); top: var(--pad-top); bottom: var(--pad-bottom);
  columns: 2; column-gap: calc(var(--pad-x) * 2); column-fill: auto; will-change: transform; }
.flow article { max-width: none; margin: 0; }
.flow .chapter-head { min-height: 0; height: calc(var(--col-h, 70vh) - 2px); padding: 0; justify-content: center; }
.flow .chapter-head::after { height: 3.4rem; margin-top: 2rem; }
.flow .epigraph { margin: 0 auto 2.8rem; break-inside: avoid; font-size: 1.08em; }
.flow .prose p { orphans: 2; widows: 2; }
.flow .break { break-inside: avoid; break-after: avoid; margin: 1.9em 0; }
.flow .chapter-end { max-width: none; margin: 3rem 0 0; break-inside: avoid; }
.flow .chapter-end .fin { height: 2.4rem; margin-bottom: 1.8rem; }
.flow .next { padding: 1.5rem 1rem 1.7rem; }
.flow .next b { font-size: 1.9em; }

body.paged .folio {
  display: flex; position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; height: 3.7rem;
  align-items: center; justify-content: center; gap: 1.5rem;
  font-family: var(--display); font-size: .8rem; letter-spacing: .26em; text-transform: uppercase; color: var(--ink-soft);
  font-variant-numeric: lining-nums tabular-nums;
}
.folio span { min-width: 9rem; }
/* The arrows belong to selecting, when the page itself no longer turns under the hand. */
.folio button { display: none; flex: none; width: 2.2rem; height: 2.2rem; padding: 0; color: var(--gold); background: none;
  border: 1px solid var(--rule); border-radius: 50%; cursor: pointer; transition: border-color .25s, background .25s; }
body.selecting .folio button { display: grid; place-items: center; }
.folio button:hover { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 12%, transparent); }
.folio button svg { width: .9rem; height: .9rem; display: block; stroke: currentColor; fill: none; stroke-width: 1.5;
  stroke-linecap: round; stroke-linejoin: round; }
.folio #page-next svg { scale: -1 1; }   /* one drawing, mirrored: the two arrows cannot differ */
.toast { position: fixed; z-index: 40; left: 50%; bottom: 4.6rem; translate: -50% .6rem; max-width: calc(100vw - 2rem);
  padding: .7rem 1.3rem; border: 1px solid var(--rule); border-radius: 999px; pointer-events: none;
  background: color-mix(in srgb, var(--bg) 90%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  font-family: var(--display); font-size: .8rem; letter-spacing: .22em; text-transform: uppercase; color: var(--gold-bright);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0; transition: opacity .3s, translate .3s; }
.toast.on { opacity: 1; translate: -50% 0; }
.folio #folio-n { text-align: right; color: var(--gold-bright); }
.folio input { -webkit-appearance: none; appearance: none; width: min(24rem, 36vw); height: 1.6rem; margin: 0; background: none; cursor: pointer; }
.folio input::-webkit-slider-runnable-track { height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, var(--gold) var(--fill, 0%), var(--rule) var(--fill, 0%)); }
.folio input::-moz-range-track { height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, var(--gold) var(--fill, 0%), var(--rule) var(--fill, 0%)); }
.folio input::-webkit-slider-thumb { -webkit-appearance: none; width: .8rem; height: .8rem; margin-top: calc(-.4rem + 1px);
  border-radius: 50%; background: var(--gold-bright); box-shadow: 0 0 12px color-mix(in srgb, var(--gold) 80%, transparent); }
.folio input::-moz-range-thumb { width: .8rem; height: .8rem; border: 0; border-radius: 50%; background: var(--gold-bright); }

@media (max-width: 999px), (max-height: 540px) {
  /* One page, edge to edge. The bar and the scrubber come and go with a tap in the middle. */
  .pager { inset: 0; border-radius: 0; box-shadow: none; --pad-x: 1.5rem; --pad-top: 3.5rem; --pad-bottom: 3.3rem; }
  .pager::after { display: none; }
  .flow { columns: 1; }
  html[data-view="pages"] canvas.fx[data-fx="ambient"] { display: none; }
  body.paged .bar { background: var(--veil); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
    transform: translateY(-100%); opacity: 0; }
  body.paged.chrome .bar { transform: none; opacity: 1; }
  body.paged .folio { height: 3.2rem; gap: .9rem; pointer-events: none; transition: background .3s; font-size: .7rem; }
  body.paged .folio span { min-width: 0; }
  body.paged .folio input, body.paged .folio #folio-left, .pager .hint { display: none; }
  body.paged.chrome .folio { pointer-events: auto; background: var(--veil); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
  body.paged.chrome .folio input { display: block; width: 46vw; }
  body.paged.chrome .folio #folio-left { display: block; }
  /* While selecting, the bar and the arrows stay: they are the only way to turn and to leave. */
  body.paged.selecting .bar { transform: none; opacity: 1; }
  body.paged.selecting .folio { pointer-events: auto; background: var(--veil); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
  body.paged.selecting .folio input { display: block; width: 34vw; }
  .panel { top: 3.6rem; right: .9rem; }
}

/* ------------------------------------------------------------ the cast --- */
/* Under the cover: the people of the book, one plate each, in a reel that is swiped,
   dragged, or moved by its two arrows. A plate opens large when pressed. */

/* The cover's screen stops a little short, so the top of the reel shows that there is more below. */
main.front:has(+ .cast) { min-height: 0; padding-top: 3rem; padding-bottom: 2.5rem; }
main.front:has(+ .cast) .book { height: min(70vh, 46rem); }
.cast { position: relative; z-index: 1; padding: 1rem 0 6rem; --lift: 1.4; --inset: max(clamp(1.4rem, 5vw, 4rem), calc(50vw - 39rem + 4rem)); }
.cast header { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem;
  padding: 0 var(--inset) 1.6rem; font-family: var(--display); }
.cast .kicker { margin: 0; font-size: .78rem; letter-spacing: .46em; text-transform: uppercase; color: var(--gold); }
.cast h2 { margin: .4rem 0 0; font-weight: 500; font-size: clamp(2rem, 4vw, 2.8rem); line-height: 1; letter-spacing: .04em; }
.cast .arrows { display: flex; gap: .6rem; }
.cast .arrows button { display: grid; place-items: center; width: 2.6rem; height: 2.6rem; padding: 0; color: var(--gold);
  background: none; border: 1px solid var(--rule); border-radius: 50%; cursor: pointer;
  transition: border-color .25s, background .25s, opacity .25s; }
.cast .arrows button:hover { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 12%, transparent); }
.cast .arrows button:disabled { opacity: .25; cursor: default; }
.cast .arrows svg { width: .95rem; height: .95rem; stroke: currentColor; fill: none; stroke-width: 1.5;
  stroke-linecap: round; stroke-linejoin: round; }
.cast .arrows .fwd svg { scale: -1 1; }

.reel { list-style: none; margin: 0; display: flex; gap: clamp(1rem, 2.2vw, 2rem); overflow-x: auto;
  padding: .6rem var(--inset) 1.4rem; scroll-padding-inline: var(--inset); scroll-snap-type: x mandatory;
  scrollbar-width: none; -webkit-overflow-scrolling: touch; cursor: grab; }
.reel::-webkit-scrollbar { display: none; }
.reel.held { cursor: grabbing; scroll-snap-type: none; }
.reel:focus-visible { outline: 1px solid var(--gold); outline-offset: -4px; }
.plate { flex: none; width: clamp(13.5rem, 23vw, 19rem); scroll-snap-align: start; }
.plate figure { margin: 0; }
.plate button { display: block; width: 100%; padding: 0; border: 0; background: none; color: inherit; cursor: pointer;
  position: relative; aspect-ratio: 2 / 3; overflow: hidden; border-radius: 2px;
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .9); transition: transform .5s cubic-bezier(.2, .7, .2, 1), box-shadow .5s; }
.plate img { width: 100%; height: 100%; object-fit: cover; display: block; filter: brightness(var(--lift, 1.25));
  transition: transform 1.2s cubic-bezier(.2, .7, .2, 1), filter .6s; -webkit-user-drag: none; user-select: none; }
.plate button::after { content: ""; position: absolute; inset: .7rem; pointer-events: none;
  border: 1px solid color-mix(in srgb, var(--gold) 45%, transparent); opacity: .55; transition: opacity .5s, inset .5s; }
.plate button:hover, .plate button:focus-visible { transform: translateY(-6px);
  box-shadow: 0 40px 70px -30px rgba(0, 0, 0, .95), 0 0 50px -18px color-mix(in srgb, var(--glow) 40%, transparent); outline: none; }
.plate button:hover img, .plate button:focus-visible img { transform: scale(1.04); filter: brightness(calc(var(--lift, 1.25) + .2)); }
.plate button:hover::after, .plate button:focus-visible::after { opacity: 1; inset: .5rem; }
.plate figcaption { padding: 1.1rem .1rem 0; font-family: var(--display); }
.plate b { display: block; font-weight: 500; font-size: 1.6rem; line-height: 1.1; letter-spacing: .03em; }
.plate small { display: block; margin-top: .35rem; font-size: .68rem; letter-spacing: .32em; text-transform: uppercase; color: var(--gold); }
.plate q { display: block; margin-top: .7rem; font-style: italic; font-size: 1.08rem; line-height: 1.45; color: var(--ink-soft);
  quotes: none; text-wrap: pretty; }

dialog.viewer { padding: 0; border: 0; background: none; color: var(--ink); max-width: none; max-height: none;
  width: 100vw; height: 100dvh; overflow: hidden; --lift: 1.4; }
dialog.viewer::backdrop { background: rgba(4, 4, 5, .9); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
dialog.viewer[open] { display: grid; place-items: center; animation: rise .5s cubic-bezier(.2, .7, .2, 1) both; }
dialog.viewer figure { margin: 0; display: grid; grid-template-columns: auto minmax(0, 22rem); align-items: end;
  gap: clamp(1.2rem, 3vw, 3rem); padding: 1.5rem; max-width: 100vw; }
dialog.viewer img { display: block; max-height: 88dvh; max-width: min(100%, 62vw); width: auto; height: auto;
  filter: brightness(var(--lift, 1.25)); box-shadow: 0 50px 120px -30px #000; }
dialog.viewer figcaption { font-family: var(--display); padding-bottom: 1rem; }
dialog.viewer b { display: block; font-weight: 500; font-size: clamp(2.2rem, 4vw, 3.4rem); line-height: 1; letter-spacing: .03em;
  color: var(--gold-bright); }
dialog.viewer small { display: block; margin-top: .7rem; font-size: .74rem; letter-spacing: .36em; text-transform: uppercase; color: var(--gold); }
dialog.viewer q { display: block; margin-top: 1.2rem; font-style: italic; font-size: 1.3rem; line-height: 1.5; color: var(--ink-soft); quotes: none; }
dialog.viewer .close { position: fixed; top: 1.1rem; right: 1.2rem; width: 2.6rem; height: 2.6rem; padding: 0; font: inherit;
  font-size: 1.5rem; line-height: 1; color: var(--gold); background: none; border: 1px solid var(--rule); border-radius: 50%; cursor: pointer; }
dialog.viewer .close:hover { border-color: var(--gold); }

@media (max-width: 860px) {
  main.front { min-height: 0; }
  .cast { padding-bottom: 4rem; --inset: 1.4rem; }
  .cast .arrows { display: none; }
  .plate { width: 68vw; max-width: 17rem; }
  dialog.viewer figure { grid-template-columns: 1fr; justify-items: center; text-align: center; gap: 1rem; padding: 1rem; }
  dialog.viewer img { max-height: 66dvh; max-width: 100%; }
  dialog.viewer figcaption { padding-bottom: 0; }
  dialog.viewer q { font-size: 1.1rem; margin-top: .7rem; }
}
