/* The sole active turn model at every width. Explicit visible-paper pixel
   bounds are supplied by JS; perspective belongs to the stage, not its leaf. */
.book-reader { --book-turn-duration: 650ms; }
.book-turn-layer {
  overflow: visible;
  perspective: none;
  transform-style: flat;
  isolation: auto;
}
.book-turn-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  perspective: 1400px;
  perspective-origin: 0 50%;
  transform-style: preserve-3d;
}
.book-turn-sheet,
.book-turn-flat,
.book-turn-backface,
.book-turn-destination-page {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
  border-radius: 0;
  overflow: visible !important;
  clip-path: none !important;
  box-sizing: border-box;
  perspective: none;
  animation: none;
}
.book-turn-sheet {
  transform-origin: 0 50%;
  transform-style: preserve-3d;
  backface-visibility: visible;
  will-change: transform;
}
.book-turn-flat,
.book-turn-backface {
  background: var(--book-paper, #fffdf8);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.book-turn-flat { transform: rotateY(0deg); box-shadow: none; }
.book-turn-backface {
  transform: rotateY(180deg);
  border: 1px solid var(--book-paper-edge);
}
.book-turn-face-clip {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.book-turn-sheet::before,
.book-turn-sheet::after,
.book-turn-flat::before {
  display: none;
  content: none;
  animation: none !important;
}
.book-turn-layer .book-turn-destination-page {
  z-index: 1;
  opacity: 1;
  transform: none;
  animation: none !important;
}
.book-turn-layer .book-turn-flat { animation: none !important; }
.book-turn-sheet.is-book-turn-forward.is-book-turning {
  animation: book-spine-forward var(--book-turn-duration) ease-out both;
}
.book-turn-sheet.is-book-turn-back.is-book-turning {
  animation: book-spine-back var(--book-turn-duration) ease-out both;
}
.book-spine-ridge {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: 14px;
  opacity: 0;
  pointer-events: none;
  background: linear-gradient(to right, transparent, rgba(69, 52, 29, .2) 45%, rgba(255, 253, 248, .85) 70%, rgba(69, 52, 29, .12));
}
.book-turn-backface .book-spine-ridge { right: auto; left: 0; }
.book-turn-sheet.is-book-turning .book-spine-ridge {
  animation: book-spine-light var(--book-turn-duration) ease-out both;
}
.book-turn-layer .book-turn-destination-shadow {
  inset: 0 auto 0 0;
  width: 12%;
  height: 100%;
  z-index: 2;
  opacity: 0;
  background: linear-gradient(to right, rgba(55, 37, 15, .22), transparent);
  transform: none;
}
.book-turn-layer.is-book-turning.is-book-turn-layer-forward .book-turn-destination-shadow,
.book-turn-layer.is-book-turning.is-book-turn-layer-back .book-turn-destination-shadow {
  animation: book-spine-shadow var(--book-turn-duration) ease-out both;
}
.book-turn-layer.is-book-turning.is-book-turn-layer-back .book-turn-destination-shadow {
  animation-direction: reverse;
}
@keyframes book-spine-forward {
  from { transform: rotateY(0deg); }
  to { transform: rotateY(-180deg); }
}
@keyframes book-spine-back {
  from { transform: rotateY(-180deg); }
  to { transform: rotateY(0deg); }
}
@keyframes book-spine-light {
  0%, 100% { opacity: 0; }
  50% { opacity: .85; }
}
@keyframes book-spine-shadow {
  0% { opacity: 0; transform: translateX(700%); }
  50% { opacity: .6; transform: translateX(0); }
  100% { opacity: 0; transform: translateX(0); }
}
@media (prefers-reduced-motion: reduce) {
  /* Navigation stays enabled; JS does the established plain page change. */
  .book-turn-layer { display: none; }
}
