/* Book text is live HTML, separate from the text-free illustration sources. */
.book-reader { max-width: 1100px; margin: 42px auto 0; }
.book-heading { text-align: center; margin-bottom: 24px; }
.book-heading h3 { font-size: var(--text-550); }
.book-heading p { color: var(--color-muted); font-size: var(--text-250); margin-top: 6px; }
.book-stage { position: relative; width: 100%; filter: drop-shadow(0 16px 24px var(--book-shadow)); }
.sample-book { margin: 0 auto; background: var(--paper); }
.sample-book:not(.stf__parent) { display: grid; grid-template-columns: 1fr 1fr; }
.book-leaf { background: var(--paper); overflow: hidden; color: var(--paper-ink); }
.book-leaf[hidden] { display: none; }
.book-leaf-surface { position: relative; width: 100%; height: 100%; aspect-ratio: 1; overflow: hidden; container-type: inline-size; }
.book-illustration { position: absolute; top: 0; width: 200%; max-width: none; height: 100%; object-fit: fill; pointer-events: none; user-select: none; }
.book-leaf--left .book-illustration { left: 0; }
.book-leaf--right .book-illustration { left: -100%; }
.book-leaf-surface::after { content: ''; position: absolute; inset: 0; pointer-events: none; box-shadow: inset -9px 0 12px -12px var(--paper-fold); }
.book-leaf--right .book-leaf-surface::after { box-shadow: inset 9px 0 12px -12px var(--paper-fold); }
.book-copy { position: absolute; z-index: 1; left: 8%; right: 8%; padding: 3% 4%; margin: 0; color: var(--paper-ink); background: var(--reader-copy-fill); border-radius: 8px; font-size: var(--text-book); font-weight: 700; line-height: 1.5; white-space: pre-line; text-wrap: pretty; user-select: text; }
.book-copy--top { top: 5%; }
.book-copy--bottom { bottom: 7%; }
.book-copy--compact { top: 2%; padding: 2% 3%; font-size: var(--text-book-compact); line-height: 1.4; }
.book-page-number { position: absolute; bottom: 2%; left: 0; right: 0; text-align: center; color: var(--paper-ink); font-size: var(--text-150); font-weight: 700; }
.book-page-number::before { content: ''; position: absolute; z-index: -1; inset: -3px calc(50% - 13px); border-radius: var(--radius-pill); background: var(--reader-number-fill); }
.book-toolbar { display: flex; align-items: center; justify-content: center; gap: 20px; margin-top: 26px; }
.book-toolbar button { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; font-size: var(--text-500); transition: transform .2s; }
.book-toolbar button:hover:not(:disabled) { transform: translateY(-2px); }
.book-toolbar button:disabled { opacity: .3; cursor: default; }
.book-status { min-width: 100px; text-align: center; font-size: var(--text-300); color: var(--color-muted); font-variant-numeric: tabular-nums; }
.book-hint { text-align: center; margin-top: 12px; font-size: var(--text-200); color: var(--color-muted); }
.book-reader:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 12px; }
.book-reader + .caption { max-width: 620px; margin: 20px auto 0; line-height: 1.7; }
@media (max-width: 700px) {
  .book-reader { margin-top: 30px; }
  .book-heading h3 { font-size: var(--text-500); }
  .sample-book:not(.stf__parent) { grid-template-columns: 1fr; }
  .book-toolbar { margin-top: 20px; }
  .book-leaf-surface { aspect-ratio: 1 / 1.6; }
  .book-illustration { height: auto; }
  .book-leaf:not(.has-copy) .book-illustration { top: 18.75%; }
  .book-copy, .book-copy--compact { top: auto; bottom: 6%; padding: 0; background: none; font-size: var(--text-book); line-height: 1.45; }
  .book-page-number { bottom: 1.5%; }
}
@media (prefers-reduced-motion: reduce) {
  .book-toolbar button { transition: none; }
  .sample-book { pointer-events: none; }
}
