/* Beacon Publishing: functional CSS only (viewer geometry, page turn, zoom pane, player progress).
   Visual styling belongs to the beacon-press theme; colours here read the theme tokens with neutral fallbacks. */
.bp-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.bp-icon { flex: none; }
.bp-look-trigger, .bp-btn { display: inline-flex; align-items: center; gap: .5em; }
.bp-btn[disabled] { opacity: .45; cursor: default; }

/* Reader */
.bp-reader { max-width: 940px; margin: 0 auto; }
.bp-book { position: relative; outline: none; }
.bp-book:focus-visible { outline: 2px solid var(--ink, #14161A); outline-offset: 10px; }
.bp-spread { position: relative; width: 100%; aspect-ratio: 1.414 / 1; perspective: 3800px; perspective-origin: 50% 45%; touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: grab; }
.bp-spread.is-drag { cursor: grabbing; }
.bp-spread::before { content: ""; position: absolute; inset: 1.2% -0.8% -1.6%; background: var(--bp-block, #DCDAD2); border-radius: 3px; box-shadow: 0 2px 2px rgba(20,22,26,.12), 0 30px 60px -20px rgba(20,22,26,.35); }
.bp-pg { position: absolute; top: 0; height: 100%; width: 50%; background: var(--card, #FBFBF9); overflow: hidden; }
.bp-pg--left { left: 0; border-radius: 2px 0 0 2px; }
.bp-pg--board { left: 50%; background: var(--bp-board, #E3E1DA); border-radius: 0 2px 2px 0; display: grid; place-items: center; color: var(--ink-2, #4A4F57); }
.bp-pg--board.bp-pg--full { left: 0; width: 100%; }
.bp-board { padding: 0 12%; text-align: center; font-size: 14px; }
.bp-leaf { position: absolute; top: 0; left: 50%; width: 50%; height: 100%; transform-origin: 0 50%; transform-style: preserve-3d; will-change: transform; }
.bp-leaf__face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; background: var(--card, #FBFBF9); overflow: hidden; }
.bp-leaf__front { border-radius: 0 2px 2px 0; }
.bp-leaf__back { transform: rotateY(180deg); border-radius: 2px 0 0 2px; }
.bp-leaf__face::after, .bp-pg--left::after { content: ""; position: absolute; inset: 0; pointer-events: none; }
.bp-leaf__front::after { background: linear-gradient(90deg, rgba(20,22,26,calc(.16 + var(--bp-p, 0) * .34)) 0, rgba(20,22,26,0) calc(9% + var(--bp-p, 0) * 30%)), linear-gradient(270deg, rgba(255,255,255,calc(var(--bp-p, 0) * .5)) 0, rgba(255,255,255,0) 30%); }
.bp-leaf__back::after { background: linear-gradient(270deg, rgba(20,22,26,calc(.16 + (1 - var(--bp-p, 1)) * .34)) 0, rgba(20,22,26,0) calc(9% + (1 - var(--bp-p, 1)) * 30%)); }
.bp-pg--left::after { background: linear-gradient(270deg, rgba(20,22,26,.16) 0, rgba(20,22,26,0) 9%); }
.bp-page { position: absolute; inset: 0; display: grid; place-items: center; }
.bp-page__img { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; -webkit-user-drag: none; }
.bp-page__err { position: absolute; inset: auto 10% 45%; text-align: center; font-size: 14px; color: var(--ink-2, #4A4F57); }
.bp-reader__bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 36px; }
.bp-reader__where { text-align: center; margin: 0; }
.bp-reader__where span { display: block; }
.bp-reader__tools { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 16px; }
.bp-reader__hint { text-align: center; margin-top: 12px; }
.bp-reader.is-single .bp-spread { aspect-ratio: 1 / 1.414; max-width: 520px; margin: 0 auto; touch-action: pan-y pinch-zoom; }
.bp-reader.is-single .bp-spread::before { inset: 1% -1.4% -1.6% 0; }
.bp-reader.is-single .bp-leaf { left: 0; width: 100%; }
.bp-reader.is-single .bp-book { overflow: hidden; padding: 0 3% 4% 0; margin-right: -3%; }
@media (max-width: 767px) { .bp-reader__bar .bp-btn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } }
.bp-noscript-page { display: block; max-width: 100%; height: auto; margin: 0 auto 16px; }
.bp-look__text[hidden] { display: none; }
.bp-look__text { max-width: 68ch; margin: 32px auto 0; }
.bp-look__text:focus { outline: 2px solid var(--ink, #14161A); outline-offset: 6px; }

/* Zoom */
.bp-zoom { width: min(1100px, 100vw); max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0 auto; padding: 0; border: 0; background: var(--paper, #F3F2EE); color: var(--ink, #14161A); }
.bp-zoom[open] { display: flex; flex-direction: column; }
.bp-zoom::backdrop { background: rgba(10,11,14,.72); }
.bp-zoom__bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 10px 16px; }
.bp-zoom__title { margin: 0; }
.bp-zoom__controls { display: flex; align-items: center; gap: 6px; }
.bp-zoom__level { min-width: 4.5ch; text-align: center; font-variant-numeric: tabular-nums; }
.bp-zoom__pane { flex: 1; overflow: auto; overscroll-behavior: contain; touch-action: pan-x pan-y pinch-zoom; text-align: center; cursor: grab; outline: none; }
.bp-zoom__pane:focus-visible { outline: 2px solid var(--ink, #14161A); outline-offset: -4px; }
.bp-zoom__pane.is-pan { cursor: grabbing; }
.bp-zoom__img { display: inline-block; max-width: none; height: auto; vertical-align: top; user-select: none; -webkit-user-select: none; }
html.bp-zoom-open { overflow: hidden; }

/* Players */
.bp-player[hidden] { display: none; }
.bp-player { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.bp-player--full { display: grid; gap: 10px; }
.bp-player__row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.bp-player__toggle, .bp-player__skip { display: inline-grid; place-items: center; min-width: 44px; min-height: 44px; }
.bp-player__toggle .bp-icon--pause { display: none; }
.is-playing .bp-player__toggle .bp-icon--play { display: none; }
.is-playing .bp-player__toggle .bp-icon--pause { display: block; }
.bp-player__seek { flex: 1 1 160px; min-width: 120px; accent-color: var(--series, var(--brand, #2F4BD8)); --bp-progress: 0%; }
.bp-player__time { font-variant-numeric: tabular-nums; white-space: nowrap; }
.bp-chapters { list-style: none; margin: 0; padding: 0; }
.bp-chapter { display: flex; width: 100%; gap: 12px; align-items: baseline; min-height: 44px; text-align: left; }
.bp-chapter[aria-current="true"] { font-weight: 700; }
.bp-audiobook + .bp-audiobook { margin-top: 40px; }
.bp-audiobook__head { display: flex; gap: 16px; align-items: flex-start; }
.bp-audiobook__cover { width: 72px; height: auto; flex: none; }
.has-error .bp-player::after { content: "This audio could not play. Reload the page and try again."; flex-basis: 100%; font-size: 14px; }

@media (prefers-reduced-motion: reduce) { .bp-leaf { will-change: auto; } }
@media (forced-colors: active) { .bp-spread::before, .bp-leaf__face::after, .bp-pg--left::after { display: none; } }
