/* The overlay and canvas are transparent: the homepage is the backdrop. */
.book-watch-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.book-watch-btn__icon {
  width: 14px;
  height: 14px;
  flex: none;
}

[data-theme="dark"] .book-watch-btn__icon { filter: brightness(0) invert(1); }

.book-intro {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 16px;
  background: transparent;
  overscroll-behavior: contain;
}
.book-intro[hidden] { display: none; }
body.has-book-intro { overflow: hidden; }

.book-intro__scene {
  position: relative;
  z-index: 1;
  width: min(100%, 900px, 165dvh);
  aspect-ratio: 1.85;
  perspective: 1400px;
  isolation: isolate;
  letter-spacing: 0;
  outline: none;
}
.book-intro__backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgb(248 250 246 / 17%);
  -webkit-backdrop-filter: blur(8px) saturate(.84);
  backdrop-filter: blur(8px) saturate(.84);
  pointer-events: none;
}
[data-theme="dark"] .book-intro__backdrop {
  background: rgb(15 23 20 / 15%);
}
.book-intro__canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: transparent;
  pointer-events: none;
  position: relative;
  z-index: 1;
}
.book-intro__ground-shadow {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 57%;
  height: 27%;
  z-index: 1;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgb(25 39 31 / 27%) 0%, rgb(25 39 31 / 15%) 34%, transparent 73%);
  filter: blur(13px);
  transform: perspective(520px) rotateX(57deg) scaleY(.72);
  pointer-events: none;
}
.book-intro__spread {
  position: absolute;
  z-index: 2;
  inset: 35% 13% 28%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10%;
  align-items: end;
  pointer-events: none;
  visibility: hidden;
}
.book-intro__scene.is-playing .book-intro__spread,
.book-intro__scene.is-static .book-intro__spread { visibility: visible; }
.book-intro__scene.has-inner-page .book-intro__words {
  visibility: hidden;
  opacity: 0;
}
.book-intro__page-reveal,
.book-intro__turn-sheet {
  position: absolute;
  left: 50%;
  right: 9%;
  top: 25%;
  bottom: 18%;
  padding: 8% 9% 11%;
  overflow: hidden;
  color: #21372e;
  background: transparent;
  border: 0;
  box-shadow: none;
  transform-origin: left center;
  backface-visibility: hidden;
  pointer-events: none;
}
.book-intro__page-reveal {
  z-index: 3;
  visibility: hidden;
  opacity: 0;
}
.book-intro__page-reveal.is-visible {
  visibility: visible;
  opacity: 1;
}
.book-intro__turn-sheet {
  z-index: 4;
  visibility: hidden;
  opacity: 0;
  transform: rotateY(0deg);
}
.book-intro__turn-sheet.is-turning {
  visibility: visible;
  opacity: 1;
  animation: book-page-turn 900ms cubic-bezier(.2,.75,.25,1) forwards;
}
.book-intro__inner-eyebrow {
  margin: 0 0 8px;
  color: #8a523d;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.5;
}
.book-intro__inner-title {
  margin: 0;
  color: #21372e;
  font-family: "Songti SC", "STSong", "Noto Serif SC", serif;
  font-size: clamp(20px, 2.4vw, 30px);
  font-weight: 600;
  line-height: 1.42;
}
.book-intro__inner-copy {
  margin: 10px 0 0;
  color: #4e5d52;
  font-size: clamp(10.5px, 1.05vw, 13px);
  line-height: 1.65;
}
.book-intro__inner-index {
  position: absolute;
  right: 8%;
  bottom: 9%;
  color: rgb(33 55 46 / 52%);
  font-family: Arial, sans-serif;
  font-size: 10px;
  letter-spacing: .08em;
}
.book-intro__pictures {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 10px;
  min-width: 0;
  padding-bottom: 8px;
  perspective: 700px;
  transform: translateY(-16px);
}
.book-intro__picture {
  display: block;
  height: auto;
  object-fit: contain;
  min-width: 0;
  opacity: 0;
  transform: rotateX(-85deg);
  transform-origin: center bottom;
  filter: drop-shadow(2px 5px 2px rgb(45 40 32 / 16%));
}
.book-intro__picture--goggles { width: 31%; --book-delay: 1350ms; }
.book-intro__picture--flask { width: 34%; --book-delay: 1510ms; }
.book-intro__picture--shield { width: 27%; --book-delay: 1670ms; }
.book-intro__words {
  min-width: 0;
  color: #21372e;
  opacity: 0;
  transform: translateY(12px);
  padding-bottom: 4px;
}
.book-intro__eyebrow {
  margin: 0 0 8px;
  color: #8a523d;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
}
.book-intro__title {
  font-family: "Songti SC", "STSong", "Noto Serif SC", serif;
  font-size: 30px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0;
}
.book-intro__copy {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.8;
  color: #4e5d52;
}
.book-intro__scene.is-playing .book-intro__picture {
  animation: book-picture-rise 750ms var(--book-delay) cubic-bezier(.2,.8,.2,1) both;
}
.book-intro__scene.is-playing .book-intro__words {
  animation: book-words-appear 750ms 1950ms ease-out both;
}
.book-intro__scene.is-paused .book-intro__picture,
.book-intro__scene.is-paused .book-intro__words { animation-play-state: paused; }

.book-intro__open {
  position: absolute;
  inset: 18% 28% 16%;
  display: block;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  z-index: 3;
}
.book-intro__close {
  position: absolute;
  right: 7%;
  top: 12%;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-1);
  cursor: pointer;
  z-index: 4;
}
.book-intro__open[hidden],
.book-intro__close[hidden] { display: none; }
.book-intro__close:hover { background: var(--surface-2); }
[data-theme="dark"] .book-intro__close img { filter: brightness(0) invert(1); }
.book-intro__replay {
  position: absolute;
  right: calc(7% + 54px);
  top: 12%;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-1);
  cursor: pointer;
  z-index: 4;
}
.book-intro__replay[hidden] { display: none; }
.book-intro__replay:hover { background: var(--surface-2); }
[data-theme="dark"] .book-intro__replay img { filter: brightness(0) invert(1); }

.book-intro__fallback {
  position: absolute;
  inset: 28% 29% 22%;
  display: flex;
  transform: perspective(900px) rotateX(30deg);
  background: #794b43;
  border: 3px solid #996e56;
  border-bottom: 8px solid #653b35;
  border-radius: 4px;
  box-shadow: 0 8px 12px rgb(25 40 31 / 15%);
  z-index: 1;
}
.book-intro__fallback strong {
  margin: auto;
  color: #f4e7cb;
  text-align: center;
  font-family: "Songti SC", serif;
  font-size: 24px;
  font-weight: 400;
}
.book-intro__fallback small { display: block; font: 10px/3 sans-serif; }
.book-intro__fallback span { display: none; }
.book-intro__scene.has-webgl .book-intro__fallback { display: none; }
.book-intro__scene.is-playing .book-intro__fallback,
.book-intro__scene.is-static .book-intro__fallback { inset-inline: 7%; }
.book-intro__scene.is-playing .book-intro__fallback strong,
.book-intro__scene.is-static .book-intro__fallback strong { display: none; }
.book-intro__scene.is-playing .book-intro__fallback span,
.book-intro__scene.is-static .book-intro__fallback span {
  display: block;
  width: 50%;
  background: #f7f4e9;
  border: 1px solid #dfd8c6;
  box-shadow: inset 0 -4px #e0d7c2;
}
.book-intro__scene.is-static .book-intro__picture,
.book-intro__scene.is-static .book-intro__words {
  opacity: 1;
  transform: none;
  animation: none;
}
@keyframes book-picture-rise {
  from { opacity: 0; transform: rotateX(-85deg) translateY(10px); }
  to { opacity: 1; transform: rotateX(0) translateY(0); }
}
@keyframes book-words-appear {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes book-page-turn {
  0% { opacity: 1; transform: rotateY(0deg); }
  100% { opacity: 0; transform: rotateY(-180deg); }
}
@media (max-width: 720px), (max-height: 540px) {
  .book-intro { padding: 8px; }
  .book-intro__title { font-size: 24px; }
  .book-intro__copy { font-size: 11px; margin-top: 6px; }
  .book-intro__eyebrow { font-size: 10px; }
  .book-intro__pictures { gap: 7px; transform: translateY(-12px); }
  .book-intro__ground-shadow { top: 59%; left: 6%; right: 6%; height: 24%; }
  .book-intro__page-reveal,
  .book-intro__turn-sheet { left: 49%; right: 8%; top: 24%; bottom: 19%; padding: 8% 7% 11%; }
  .book-intro__replay { right: calc(4% + 50px); top: 4%; }

  .book-watch-btn { padding-inline: 8px; }
}
@media (max-width: 480px), (max-height: 350px) {
  .book-intro__scene { aspect-ratio: 1.4; }
  .book-intro__spread { inset: 32% 11% 30%; gap: 9%; }
  .book-intro__title { font-size: 18px; line-height: 1.35; }
  .book-intro__eyebrow { font-size: 10px; margin-bottom: 5px; }
  .book-intro__copy { font-size: 10px; line-height: 1.6; }
  .book-intro__pictures { gap: 5px; padding-bottom: 5px; transform: translateY(-9px); }
  .book-intro__close { right: 4%; top: 4%; }
  .book-intro__replay { right: calc(4% + 42px); top: 4%; width: 36px; height: 36px; }
  .book-intro__inner-title { font-size: 16px; }
  .book-intro__inner-copy { font-size: 9px; line-height: 1.6; margin-top: 7px; }
  .book-intro__inner-eyebrow { font-size: 9px; margin-bottom: 4px; }
  .book-intro__fallback strong { font-size: 18px; }
  .book-intro__fallback small { font-size: 8px; }
}
@media (max-width: 360px) {
  .book-intro__title { font-size: 16px; }
  .book-intro__copy { font-size: 9px; }
}
@media (prefers-reduced-motion: reduce) {
  .book-intro__scene.is-playing .book-intro__picture,
  .book-intro__scene.is-playing .book-intro__words {
    opacity: 1;
    transform: none;
    animation: none;
  }
}
