@charset "UTF-8";
/* Seitenwerk Bibliothek & Buch-Reader — Basislayout & 3D-Blättermechanik im monochromen Studio-Designsystem. */

@font-face {
  font-family: "Newsreader";
  src: url("/newsreader.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --paper: var(--sw-bg);
  --ink: var(--sw-text);
  --muted: var(--sw-muted);
  --line: var(--sw-line);
  --white: var(--sw-panel);
  --shadow: var(--sw-shadow);
  font-family: var(--sw-font);
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); }
button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button { color: inherit; cursor: pointer; touch-action: manipulation; border: 0; }
button:disabled { cursor: default; opacity: 0.42; }
button, input, select { min-height: 44px; }
button span { pointer-events: none; }
a { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--sw-focus);
  outline-offset: 3px;
}
[hidden] { display: none !important; }

.wrap {
  width: min(1280px, calc(100% - clamp(32px, 6vw, 96px)));
  margin-inline: auto;
}
.skip-link {
  position: fixed;
  left: 16px;
  top: -80px;
  z-index: 10001;
  background: var(--sw-accent);
  color: var(--sw-on-accent);
  padding: 12px 16px;
  border-radius: var(--sw-r-sm);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { top: 12px; }
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.eyebrow {
  font-family: var(--sw-font);
  font-size: 11px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  font-weight: 600;
  line-height: 1.5;
  color: var(--sw-muted);
  margin: 0 0 12px;
}
.small-label {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  line-height: 1.4;
  color: var(--sw-muted);
}
.text-button {
  background: none;
  padding: 8px 0;
  font-size: 13.5px;
  font-weight: 550;
  color: var(--sw-muted);
  text-decoration: underline;
  text-decoration-color: var(--sw-line-strong);
  text-underline-offset: 4px;
}
.text-button:hover { color: var(--sw-text); }

.empty-state {
  padding: 56px 20px;
  text-align: center;
  color: var(--sw-muted);
  font-size: 14.5px;
  line-height: 1.65;
  background: var(--sw-panel);
  border: 1px solid var(--sw-line);
  border-radius: var(--sw-r-lg);
}
.empty-state h3 { color: var(--sw-text); margin: 0 0 8px; }

/* ── Buch-Reader Rahmen & Steuerung ── */
.reader-view {
  height: 100dvh;
  min-height: 400px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--sw-bg);
}
.reader-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
  padding: 10px clamp(16px, 3vw, 32px);
  background: var(--sw-panel);
  border-bottom: 1px solid var(--sw-line);
  flex-shrink: 0;
}
.reader-back {
  background: var(--sw-raised);
  border: 1px solid var(--sw-line-strong);
  border-radius: var(--sw-r-sm);
  padding: 8px 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  min-height: 42px;
}
.reader-back:hover { background: var(--sw-well); }
.reader-back > span:first-child { font-size: 16px; line-height: 1; }
.reader-book-name { text-align: center; min-width: 0; }
.reader-book-name h1 {
  font-family: var(--sw-serif);
  font-size: clamp(18px, 2vw, 22px);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 2px 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 44vw;
}
.reader-tools { display: flex; gap: 6px; }
.icon-button {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 44px;
  min-height: 44px;
  padding: 5px 9px;
  border: 1px solid transparent;
  border-radius: var(--sw-r-sm);
  background: transparent;
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
  color: var(--sw-secondary);
}
.icon-button .tool-label { font-size: 10px; font-weight: 550; line-height: 1.1; }
.icon-button:hover { background: var(--sw-raised); color: var(--sw-text); }
.icon-button[aria-pressed="true"] {
  background: var(--sw-raised);
  border-color: var(--sw-line-strong);
  color: var(--sw-text);
}
.reader-help {
  display: flex;
  justify-content: space-between;
  padding: 10px clamp(18px, 3.5vw, 40px) 2px;
  gap: 12px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  color: var(--sw-muted);
  font-size: 11px;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

.book-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 18px 64px 22px;
  perspective: 6000px;
  overflow: clip;
  isolation: isolate;
}
.page-container {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}
.page-container.spread { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.book-page {
  background: var(--sw-panel);
  border: 1px solid var(--sw-line);
  position: relative;
  min-width: 0;
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--sw-line-strong) transparent;
  padding: 28px 32px 34px;
  touch-action: pan-y;
  isolation: isolate;
}
.page-kicker {
  font-family: var(--sw-font);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sw-muted);
  margin: 0 0 10px;
  font-weight: 600;
}
.page-heading {
  font-family: var(--sw-serif);
  font-size: 27px;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0 0 18px;
  line-height: 1.16;
  color: var(--sw-text);
}
.page-number {
  position: sticky;
  bottom: -22px;
  float: right;
  display: block;
  margin: 18px 0 -20px;
  padding: 4px 7px;
  background: var(--sw-panel);
  color: var(--sw-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.story-text p, .guide-text p, .end-text p {
  font-size: clamp(16px, 1.35vw, 19px);
  line-height: 1.68;
  margin: 0 0 13px;
  color: var(--sw-text);
}
.story-figure { margin: 0 0 22px; }
.page-artwork { display: block; width: 100%; height: auto; object-fit: contain; border-radius: 4px; }
.artwork-button { padding: 0; background: transparent; display: block; width: 100%; position: relative; }
.artwork-button .zoom-hint {
  position: absolute;
  right: 8px;
  bottom: 8px;
  border: 1px solid var(--sw-line-strong);
  background: var(--sw-panel);
  color: var(--sw-text);
  border-radius: var(--sw-r-sm);
  font-size: 11px;
  font-weight: 550;
  padding: 6px 10px;
  min-height: 30px;
}
.artwork-crop { position: relative; aspect-ratio: 1; overflow: hidden; border-radius: 4px; display: block; }
.artwork-crop > img {
  position: absolute;
  max-width: none;
  object-fit: fill;
  height: var(--crop-height);
  width: var(--crop-width);
  left: var(--crop-left);
  top: var(--crop-top);
  border-radius: 0;
}
.read-together { border-top: 1px solid var(--sw-line); padding-top: 16px; margin-top: 17px; }
.read-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--sw-muted); margin: 0 0 6px; }
.read-word {
  font-family: var(--sw-font);
  font-size: clamp(34px, 4.8vw, 56px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.02em;
  margin: 0 0 12px;
  color: var(--sw-text);
  overflow-wrap: anywhere;
}
.letter-strip { font-size: 16px; letter-spacing: 2px; display: flex; gap: 18px; flex-wrap: wrap; color: var(--sw-secondary); margin: 8px 0; }
.page-tip {
  border-radius: var(--sw-r-sm);
  background: var(--sw-raised);
  border: 1px solid var(--sw-line);
  font-size: 13px;
  line-height: 1.6;
  padding: 13px 15px;
  margin-top: 18px;
  color: var(--sw-secondary);
}
.cover-page { padding: 0; overflow: hidden; background: var(--sw-cover); }
.cover-page .cover-page-image { width: 100%; height: 100%; object-fit: contain; display: block; }
.cover-text-fallback {
  height: 100%;
  padding: 40px 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  text-align: left;
  background: #17171a;
  color: #f4f4f3;
}
.cover-text-fallback .eyebrow { color: #a1a1aa; margin: 0; }
.cover-text-fallback h2 {
  font-family: var(--sw-serif);
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 450;
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0;
  color: #fafafa;
}
.cover-text-fallback p { font-size: 13.5px; line-height: 1.55; color: #c4c4ca; margin: 0; }

.comic-page { padding: 16px 16px 28px; }
.comic-page .page-heading { font-family: var(--sw-font); font-size: 16px; margin: 4px 0 12px; font-weight: 650; letter-spacing: -0.01em; }
.comic-panel { margin: 0 0 18px; border: 1px solid var(--sw-line); border-radius: var(--sw-r-sm); overflow: hidden; }
.comic-panel .page-artwork { border-radius: 0; }
.panel-dialogue { padding: 12px 14px; }
.panel-dialogue p { font-size: 15px; line-height: 1.6; margin: 0 0 8px; }
.panel-dialogue p:last-child { margin-bottom: 0; }
.transcript { margin-top: 16px; border-top: 1px solid var(--sw-line); padding-top: 6px; }
.transcript > summary { font-size: 13px; font-weight: 600; cursor: pointer; padding: 10px 0; min-height: 44px; line-height: 1.5; }
.transcript-text p { font-size: 15px; line-height: 1.65; margin: 0 0 10px; }
.image-fallback {
  padding: 32px 18px;
  background: var(--sw-raised);
  border: 1px dashed var(--sw-line-strong);
  border-radius: var(--sw-r-sm);
  font-size: 13px;
  line-height: 1.6;
  text-align: center;
  color: var(--sw-muted);
}
.end-page { display: flex; flex-direction: column; align-items: center; text-align: center; justify-content: safe center; padding: 40px 36px; }
.end-mark { color: var(--sw-muted); font-size: 44px; line-height: 1; margin-bottom: 20px; }
.end-page .page-heading { font-size: 34px; line-height: 1.12; margin-bottom: 20px; }
.end-page .end-text p { font-size: 16.5px; color: var(--sw-secondary); }
.end-page .primary-button { margin-top: 22px; }
.guide-page .page-heading { font-size: 28px; }
.guide-text p { font-size: 15px; line-height: 1.78; color: var(--sw-secondary); }

.reader-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 36px;
  padding: 10px 28px max(14px, env(safe-area-inset-bottom));
  background: var(--sw-panel);
  border-top: 1px solid var(--sw-line);
  flex-shrink: 0;
  min-height: 82px;
}
.turn-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border-radius: var(--sw-r-sm);
  background: var(--sw-raised);
  border: 1px solid var(--sw-line-strong);
  padding: 10px 18px;
  min-width: 116px;
  font-size: 13.5px;
  font-weight: 600;
  min-height: 44px;
}
.turn-button > span[aria-hidden] { font-size: 18px; line-height: 1; }
.turn-button:hover:not(:disabled) { background: var(--sw-well); border-color: var(--sw-text); }
.next-button {
  background: var(--sw-accent);
  color: var(--sw-on-accent);
  border-color: var(--sw-accent);
}
.next-button:hover:not(:disabled) {
  background: var(--sw-accent-hover);
  border-color: var(--sw-accent-hover);
  color: var(--sw-on-accent);
}
.page-progress { width: 210px; text-align: center; }
.page-progress > p { font-size: 12px; margin: 0 0 6px; font-weight: 600; color: var(--sw-secondary); font-variant-numeric: tabular-nums; }
.progress-track { height: 3px; background: var(--sw-line); border-radius: 2px; overflow: hidden; }
.progress-track span { display: block; height: 100%; width: 0; background: var(--sw-accent); transition: width 0.25s ease; }
.subtle-button { min-height: 36px; background: none; font-size: 11.5px; font-weight: 550; margin-top: 2px; padding: 4px 8px; color: var(--sw-muted); }
.subtle-button:hover { color: var(--sw-text); }

/* ── Dialoge ── */
dialog {
  color: var(--sw-text);
  border: 1px solid var(--sw-line-strong);
  background: var(--sw-panel);
  border-radius: var(--sw-r-lg);
  padding: 24px;
  max-height: 85dvh;
  width: min(94vw, 620px);
  box-shadow: var(--sw-shadow);
  overflow-y: auto;
}
dialog::backdrop {
  background: rgb(8 8 10 / 0.68);
  backdrop-filter: blur(4px);
}
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 18px; }
.dialog-header h2 { font-family: var(--sw-font); font-size: 22px; font-weight: 650; margin: 0; letter-spacing: -0.02em; }
.dialog-header .eyebrow { margin-bottom: 4px; }
.dialog-header .icon-button { font-size: 26px; }
.contents-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.contents-item {
  text-align: left;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 12px 14px;
  background: var(--sw-raised);
  border: 1px solid var(--sw-line);
  border-radius: var(--sw-r-md);
  min-height: 62px;
}
.contents-item:hover { border-color: var(--sw-line-strong); }
.contents-item[aria-current="page"] {
  border-color: var(--sw-accent);
  background: var(--sw-panel);
  font-weight: 600;
}
.contents-item > span:first-child {
  font-family: var(--sw-serif);
  font-size: 20px;
  color: var(--sw-muted);
  min-width: 24px;
  font-variant-numeric: tabular-nums;
}
.contents-item > span:last-child { font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; }
.contents-item small { display: block; font-size: 11px; color: var(--sw-muted); margin-top: 2px; font-weight: 450; }
.bookmark-notice {
  font-size: 13px;
  border: 1px solid var(--sw-line-strong);
  background: var(--sw-raised);
  padding: 10px 14px;
  border-radius: var(--sw-r-md);
  line-height: 1.55;
  margin-bottom: 12px;
}
.bookmark-notice button { display: block; background: none; padding: 6px 0 0; font-size: 13px; font-weight: 650; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; border-top: 1px solid var(--sw-line); padding: 18px 0; }
.setting-row strong { display: block; font-size: 14.5px; }
.setting-row small { display: block; font-size: 13px; line-height: 1.55; color: var(--sw-muted); margin-top: 4px; }
.setting-row input { accent-color: var(--sw-accent); width: 22px; height: 22px; min-height: 22px; flex-shrink: 0; }
.setting-note { font-size: 13px; line-height: 1.65; color: var(--sw-muted); }
.guide-button { margin-top: 12px; text-align: left; }
.info-dialog > p { font-size: 14.5px; line-height: 1.75; color: var(--sw-secondary); }
.zoom-dialog { width: min(96vw, 1200px); height: 94dvh; max-height: 94dvh; padding: 50px 18px 15px; background: var(--sw-panel); }
.zoom-close { position: absolute; right: 10px; top: 8px; background: var(--sw-raised); font-size: 28px; z-index: 2; }
.zoom-scroll {
  height: calc(100% - 34px);
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: pan-x pan-y;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: var(--sw-raised);
  border-radius: var(--sw-r-sm);
}
.zoom-scroll img { width: 100%; max-width: none; min-width: 700px; height: auto; object-fit: contain; flex-shrink: 0; }
.zoom-dialog > p { font-size: 12px; margin: 10px 0 0; color: var(--sw-muted); }
body.reading { overflow: hidden; }
.reader-view:fullscreen { width: 100%; height: 100dvh; }

/* ── Illustration, Text & Comic-Blätter ── */
.illustration-page { padding: 12px; overflow: hidden; container-type: size; display: flex; align-items: center; justify-content: center; }
.illustration-page .story-figure { margin: 0; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.illustration-page .story-figure > .page-artwork { height: 100%; width: 100%; object-fit: contain; }
.illustration-page .artwork-crop { --crop-ratio: 1; width: min(100cqw, calc(100cqh * var(--crop-ratio))); max-width: 100%; flex-shrink: 0; }
.illustration-page .page-number { position: absolute; right: 9px; bottom: 7px; float: none; margin: 0; background: transparent; }
.story-page { display: flex; flex-direction: column; justify-content: safe center; }
.story-page > .page-heading { font-size: clamp(22px, 2.1vw, 28px); margin-bottom: 16px; }
.story-page > .page-number { position: absolute; right: 12px; bottom: 8px; float: none; margin: 0; }
.story-page .story-text p { line-height: 1.62; margin-bottom: 11px; }
.story-page .read-together { padding-top: 14px; margin-top: 17px; }
.comic-sheet-page { display: flex; flex-direction: column; container-type: size; }
.comic-sheet-page > .page-heading { flex-shrink: 0; }
.comic-sheet-page > .story-figure { flex: 1; min-height: 0; margin: 0; display: flex; justify-content: center; }
.comic-sheet-page .artwork-button { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; min-height: 0; }
.comic-sheet-page .page-artwork { width: 100%; height: 100%; object-fit: contain; }
.comic-sheet-page > .transcript { flex-shrink: 0; margin-top: 7px; padding-top: 0; }
.comic-sheet-page > .page-number { position: absolute; right: 8px; bottom: 5px; margin: 0; float: none; }
.comic-sheet-page:has(.transcript[open]) > .story-figure { flex: none; height: max(180px, calc(100cqh - 85px)); }

@media (max-width: 1000px) {
  .book-stage { padding: 15px 28px 20px; }
  .reader-header { padding: 10px 20px; }
  .reader-help { padding-inline: 24px; }
  .book-page { padding: 24px 25px 30px; }
  .comic-page { padding: 13px 13px 26px; }
  .reader-book-name h1 { max-width: 36vw; }
  .fullscreen-control { display: none; }
}
@media (max-width: 720px) {
  .reader-header { min-height: 62px; padding: 8px 12px; gap: 8px; }
  .reader-back { min-width: 44px; padding: 8px 10px; }
  .reader-back > span:last-child { display: none; }
  .reader-book-name { text-align: left; flex: 1; }
  .reader-book-name h1 { font-size: 17px; max-width: calc(100vw - 205px); }
  .reader-tools { gap: 2px; }
  .reader-tools .icon-button { padding-inline: 5px; font-size: 17px; }
  .reader-tools .tool-label { font-size: 9px; }
  .reader-help { padding: 8px 16px 2px; font-size: 10px; }
  .reader-help > span:first-child { display: none; }
  .book-stage { padding: 12px 13px 15px; }
  .book-page { padding: 22px 22px 30px; }
  .illustration-page { padding: 9px; }
  .story-page > .page-heading { font-size: 24px; }
  .story-page .story-text p { font-size: 17px; line-height: 1.58; }
  .story-page .read-word { font-size: 42px; }
  .comic-sheet-page > .page-heading { font-size: 13px; margin-bottom: 9px; }
  .reader-footer { padding: 8px 12px max(12px, env(safe-area-inset-bottom)); min-height: 76px; gap: 12px; }
  .turn-button { min-width: 0; padding: 9px 12px; font-size: 12.5px; gap: 6px; }
  .page-progress { width: 146px; }
  .page-progress > p { font-size: 11px; }
  .contents-list { grid-template-columns: 1fr; }
  dialog { padding: 20px; }
  .zoom-dialog { padding: 48px 10px 14px; }
  .zoom-scroll { justify-content: flex-start; }
  .zoom-scroll img { min-width: 820px; }
}
@media (max-height: 600px) {
  .story-page { justify-content: flex-start; padding-top: 16px; padding-bottom: 25px; }
  .story-page .page-kicker { margin-bottom: 6px; font-size: 9px; }
  .story-page > .page-heading { font-size: 22px; margin-bottom: 12px; }
  .story-page .story-text p { font-size: 16px; line-height: 1.48; margin-bottom: 8px; }
  .story-page .read-together { margin-top: 10px; padding-top: 9px; }
  .story-page .read-word { font-size: 34px; margin-bottom: 7px; }
}

/* ── Buchkörper, Schnittkante & 3D-Umblättern ── */
@media screen {
  .book-stage {
    container-type: size;
    align-items: center;
    padding: 24px clamp(16px, 3vw, 48px) 30px;
    background: radial-gradient(ellipse at 50% 35%, var(--sw-panel) 0%, var(--sw-bg) 76%);
    touch-action: pan-y pinch-zoom;
  }
  .page-container, .page-container.spread {
    --leaf-width: min(100cqw, 34rem, 66.6667cqh);
    --board: #1f1f23;
    --edge-light: #e7e7ea;
    --edge-dark: #bebec6;
    --leaf-paper: #fafaf9;
    --binding-shade: rgb(15 15 18 / 0.14);
    width: var(--leaf-width);
    height: calc(var(--leaf-width) * 1.5);
    flex: none;
    grid-template-rows: minmax(0, 1fr);
  }
  .page-container.spread-mode {
    --leaf-width: min(50cqw, 34rem, 66.6667cqh);
  }
  .page-container.spread {
    width: calc(var(--leaf-width) * 2);
  }
  .page-container::before, .page-container::after, .closing-stack::before, .closing-stack::after {
    content: "";
    position: absolute;
    pointer-events: none;
    border-radius: 2px 5px 5px 2px;
  }
  .page-container::before, .closing-stack::before {
    inset: 1px calc(-3px - var(--right-stack)) -11px -3px;
    background: var(--board);
    box-shadow: 0 22px 36px -10px rgb(0 0 0 / 0.36), 0 4px 8px rgb(0 0 0 / 0.2);
  }
  .page-container::after, .closing-stack::after {
    inset: 1px calc(0px - var(--right-stack)) -8px 0;
    background:
      repeating-linear-gradient(90deg, var(--edge-dark) 0 1px, var(--edge-light) 1px 3px) right / var(--right-stack) 100% no-repeat,
      repeating-linear-gradient(0deg, var(--edge-dark) 0 1px, var(--edge-light) 1px 3px);
  }
  .closing-stack > .book-page { z-index: 1; }
  .page-container.spread::before { left: calc(-3px - var(--left-stack)); }
  .page-container.spread::after {
    left: calc(0px - var(--left-stack));
    background:
      repeating-linear-gradient(90deg, var(--edge-dark) 0 1px, var(--edge-light) 1px 3px) right / var(--right-stack) 100% no-repeat,
      repeating-linear-gradient(90deg, var(--edge-light) 0 2px, var(--edge-dark) 2px 3px) left / var(--left-stack) 100% no-repeat,
      linear-gradient(90deg, transparent 47%, rgb(0 0 0 / 0.24) 50%, transparent 53%),
      repeating-linear-gradient(0deg, var(--edge-dark) 0 1px, var(--edge-light) 1px 3px);
  }
  :root[data-theme="dark"] .page-container {
    --board: #27272c;
    --edge-light: #71717a;
    --edge-dark: #52525b;
    --leaf-paper: #19191c;
    --binding-shade: rgb(0 0 0 / 0.55);
  }
  .book-page { touch-action: pan-y pinch-zoom; }
  .page-container > .book-page {
    --fold: linear-gradient(90deg, var(--binding-shade), transparent min(8%, 28px));
    z-index: 1;
    width: 100%;
    margin: 0;
    border: 0;
    border-radius: 2px 5px 5px 2px;
    background-color: var(--leaf-paper);
    background-image: var(--fold);
    box-shadow: none;
  }
  .page-container.spread > .book-page:first-child {
    --fold: linear-gradient(270deg, var(--binding-shade), transparent min(11%, 38px));
    border-radius: 5px 0 0 2px;
  }
  .page-container.spread > .book-page:last-child { border-radius: 0 5px 2px 0; }
  .page-container > .cover-page { background-color: var(--board); padding: 0; cursor: pointer; }
  .cover-page .cover-page-image { object-fit: cover; }
  .cover-page::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(90deg, rgb(0 0 0 / 0.34), rgb(0 0 0 / 0.16) 1.5%, rgb(255 255 255 / 0.12) 2.2%, rgb(0 0 0 / 0.2) 3.2%, transparent 6.5%);
    box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.08);
  }
  .page-container.turn-opening > .book-page:first-child,
  .page-container.turn-cover-hidden > .book-page { opacity: 0; }
  .page-container.turn-opening::before,
  .page-container.turn-opening::after { clip-path: inset(-15px -25px -50px 50%); }
  .page-container.turn-cover-hidden::before,
  .page-container.turn-cover-hidden::after { visibility: hidden; }
  .page-container .book-page .page-number, .turn-overlay .book-page .page-number { background: transparent; }
  .spread > .book-page:first-child > .page-number { float: left; right: auto; left: 10px; }
  .page-container .illustration-page { padding: clamp(9px, 2cqw, 18px); }
  .page-container .story-page { padding-inline: clamp(20px, 5cqw, 38px); }
  .story-page .story-text { font-family: var(--sw-serif); }
  .story-page .story-text p { font-size: clamp(16px, 2.7cqw, 19.5px); }
  .story-page .read-word { font-size: clamp(35px, 7cqw, 52px); }
}

.turn-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  perspective: 5600px;
}
.turn-plane, .turn-stationary, .turning-leaf, .turn-cast-shadow,
.leaf-segment, .leaf-face, .leaf-window {
  position: absolute;
}
.turn-plane { inset: 0; }
.turn-plane, .turning-leaf, .leaf-segment { transform-style: preserve-3d; }
.turn-overlay .book-page {
  width: 100%;
  height: 100%;
  border: 0;
  scrollbar-color: transparent transparent;
}
.turn-overlay .copied-left-page > .page-number { float: left; right: auto; left: 10px; }
.turn-overlay .cover-page { background-color: #1f1f23; }
.leaf-segment { inset-block: 0; left: 0; transform-origin: left center; }
.hinge-right .leaf-segment { left: auto; right: 0; transform-origin: right center; }
.leaf-face { inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.leaf-back { transform: rotateY(180deg); }
.leaf-window { inset-block: 0; overflow: hidden; }
.leaf-window::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgb(0 0 0 / 0.28), rgb(255 255 255 / 0.12) 55%, rgb(0 0 0 / 0.36))
    var(--print-offset) 0 / var(--print-width) 100% no-repeat;
  opacity: var(--paper-shade, 0);
}
.leaf-window > .book-page { position: absolute; top: 0; max-width: none; }
.turn-cast-shadow { background: linear-gradient(90deg, transparent, rgb(0 0 0 / 0.45) 50%, transparent); opacity: 0; }

.illustration-page .motion-artwork:not(.artwork-crop) {
  position: relative;
  display: block;
  overflow: hidden;
  flex-shrink: 0;
  width: min(100cqw, 150cqh);
  aspect-ratio: 3 / 2;
  border-radius: 4px;
}
.motion-artwork:not(.artwork-crop) > .page-artwork { width: 100%; height: 100%; }
.motion-clip {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  visibility: hidden;
}
.motion-clip.has-frame { visibility: visible; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}

@media print {
  body { background: white; color: black; }
  .site-header, .site-footer, .library-intro, .personal-shelf, .shelf-toolbar, .shelf-filters, .reading-note,
  .reader-header, .reader-footer, .reader-help, dialog, .skip-link { display: none !important; }
  .reader-view { height: auto; display: block !important; background: white; overflow: visible; }
  .book-stage { display: block; padding: 0; perspective: none; }
  .page-container, .page-container.spread { display: block; width: 100%; height: auto; filter: none; }
  .book-page, .page-container.spread > .book-page {
    display: block; width: 100%; height: auto; min-height: 95vh; overflow: visible;
    break-after: page; border: 0; border-radius: 0; box-shadow: none; padding: 20mm;
  }
  .illustration-page { container-type: normal; min-height: 95vh; }
  .illustration-page .story-figure { height: auto; }
  .illustration-page .artwork-crop { width: 100%; max-width: 100%; }
  .comic-sheet-page { display: block; container-type: normal; }
  .comic-sheet-page > .story-figure, .comic-sheet-page .page-artwork, .comic-sheet-page .artwork-button { height: auto; }
  .zoom-hint, .subtle-button { display: none !important; }
  .transcript { display: block; }
  .page-number { position: static; }
  body.reading { overflow: visible; }
  .turn-overlay { display: none !important; }
}
