/* The real printed pages are the visual. Controls stay quiet around them. */
.book-cover-link { display: block; border-radius: 2px; cursor: pointer; }
.book-cover-link:focus-visible { outline: 3px solid var(--sun); outline-offset: 10px; }
.book-open-label { display: inline-flex; align-items: center; gap: 16px; min-height: 44px; text-underline-offset: 6px; font-weight: 600; }
.book-open-label:hover { color: var(--sun); }
body.book-is-open { overflow: hidden; }
#book-preview {
  width: min(1240px, calc(100vw - 32px)); height: calc(100dvh - 32px); max-height: 1100px;
  max-width: none; padding: 0; margin: auto; border: 1px solid #78908e; border-radius: 8px;
  background: #254851; color: #f0eee7; overflow: hidden; box-shadow: 0 24px 100px #07182099;
}
#book-preview[open] { display: flex; flex-direction: column; }
#book-preview::backdrop { background: #081d27d9; backdrop-filter: blur(9px); }
#book-preview button, #book-preview select { font: inherit; font-size: .82rem; }
#book-preview button { min-height: 44px; border: 1px solid #8fa39d70; border-radius: 3px; background: transparent; color: inherit; padding: 10px 16px; }
#book-preview button:hover:not(:disabled) { background: #ffffff12; }
#book-preview button:disabled { opacity: .35; cursor: default; }
#book-preview button:focus-visible, #book-preview a:focus-visible, #book-preview select:focus-visible { outline: 3px solid #f0bd68; outline-offset: 3px; }
#book-preview button[aria-pressed="true"] { background: #f0eee7; color: #173441; }
.book-topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 19px 28px 13px; }
#book-preview-title { margin: 0; font-size: 1.08rem; font-weight: 650; line-height: 1.3; letter-spacing: -.02em; }
.book-topbar p { font-size: .76rem; color: #c2d1ca; margin: 6px 0 0; }
#book-close { flex-shrink: 0; }
#book-close span { margin-left: 12px; font-size: 1.15rem; }
.book-toolbar { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 0 28px 14px; }
.book-toolbar label { display: flex; align-items: center; gap: 12px; font-size: .75rem; color: #d5ded7; }
#book-section { background: #173441; color: #f0eee7; border: 1px solid #8fa39d70; border-radius: 3px; padding: 10px; min-height: 44px; max-width: 180px; }
.book-toolbar > div { display: flex; gap: 8px; }
.book-viewport { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 16px 28px 24px; scrollbar-color: #8a9c96 #254851; }
.book-spread { position: relative; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); width: min(100%, calc(var(--book-page-height, 400px) * 1.3333), 1040px); margin: auto; perspective: 2200px; isolation: isolate; box-shadow: 0 16px 36px #0b22274d, 0 3px 0 #d5d1c0, 0 6px 0 #8e9a8d; touch-action: pan-y pinch-zoom; }
.book-page { position: relative; min-width: 0; aspect-ratio: 2 / 3; background: #fff; }
.book-page img { display: block; width: 100%; height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.book-page::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, transparent 85%, #37402b0d 96%, #192b2826); }
.book-page + .book-page::after { background: linear-gradient(90deg, #192b2826, #37402b0a 4%, transparent 12%); }
.book-spread.is-single { grid-template-columns: minmax(0,1fr); width: min(100%, calc(var(--book-page-height, 400px) * .6667), 640px); }
.book-spread.is-single .book-page::after { background: linear-gradient(90deg,#192b2815, transparent 5%); }
#book-preview.is-zoomed .book-spread { width: 1120px; max-width: none; }
#book-preview.is-zoomed .book-spread.is-single { width: 720px; }
.book-leaf { position: absolute; top: 0; bottom: 0; width: 50%; left: 50%; transform-origin: left center; transform-style: preserve-3d; pointer-events: none; z-index: 4; }
.book-leaf.is-backward { left: 0; transform-origin: right center; }
.book-leaf.is-single { left: 0; width: 100%; }
.book-leaf-face { position: absolute; inset: 0; -webkit-backface-visibility: hidden; backface-visibility: hidden; background: #fff; }
.book-leaf-face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.book-leaf-face.back { transform: rotateY(180deg); }
.book-leaf-face::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, #17292322, transparent 20%, #1729230c); }
.book-bottom { padding: 14px 28px 16px; border-top: 1px solid #a8b8af33; background: #203e48; }
.book-pagination { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 14px; max-width: 640px; margin: auto; }
#book-prev { justify-self: start; } #book-next { justify-self: end; }
#book-position { font-size: .82rem; text-align: center; font-variant-numeric: tabular-nums; }
.book-footnote { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 9px; }
#book-help { font-size: .7rem; color: #c2d1ca; margin: 0; }
.book-footnote a { font-size: .75rem; text-underline-offset: 4px; min-height: 32px; display: inline-flex; align-items: center; }
#book-loading, #book-error { margin: auto; padding: 32px; font-size: 1rem; }
.book-transcript { margin: 0 auto; max-width: 690px; background: #fffdf7; color: #202824; padding: 32px clamp(24px, 5vw, 56px); border-radius: 2px; }
.book-transcript h3 { font: 600 .8rem/1.5 'Avenir Next','Helvetica Neue',sans-serif; color: #7c3329; margin: 0 0 24px; }
.book-transcript p { white-space: pre-line; font: 1.2rem/1.8 Charter,Georgia,serif; max-width: none; margin: 0 0 36px; text-wrap: auto; }
.book-transcript p:last-child { margin-bottom: 0; }
@media(max-width:700px) {
  #book-preview { width: 100%; height: 100dvh; max-height: none; border: 0; border-radius: 0; }
  .book-topbar { padding: max(14px,env(safe-area-inset-top)) 18px 12px; gap: 12px; }
  .book-topbar p { display: none; }
  #book-preview-title { margin: 0; font-size: .95rem; }
  #book-preview button { padding-inline: 12px; font-size: .75rem; }
  .book-toolbar { padding: 0 18px 12px; flex-wrap: wrap; gap: 9px; }
  .book-toolbar label { gap: 8px; }
  #book-section { font-size: .75rem; max-width: 140px; }
  .book-toolbar > div { gap: 6px; }
  .book-viewport { padding: 12px 18px 22px; }
  .book-spread.is-single { width: min(100%, calc(var(--book-page-height, 400px) * .6667)); }
  .book-bottom { padding: 10px 18px max(12px,env(safe-area-inset-bottom)); }
  .book-pagination { gap: 8px; }
  #book-position { font-size: .75rem; }
  .book-footnote { align-items: start; gap: 10px; }
  #book-help { max-width: 20ch; font-size: .65rem; }
  .book-footnote a { font-size: .68rem; text-align: right; }
  .book-transcript { padding: 26px 23px; }
  .book-transcript p { font-size: 1.1rem; }
}
@media(prefers-reduced-motion:reduce) { .book-leaf { display: none; } }

#book-loading { position: absolute; z-index: 6; top: 48%; left: 50%; transform: translate(-50%, -50%); margin: 0; padding: 18px 24px; border-radius: 4px; background: #173441; box-shadow: 0 8px 30px #102b4060; }

#book-preview button[aria-disabled="true"] { opacity: .45; cursor: default; }
#book-zoom { min-width: 112px; }
#book-preview.is-zoomed .book-spread { touch-action: auto; }
