.about-book {
  --book-turn: 1.36s cubic-bezier(.42, .02, .22, 1) .14s both;
  --cover-angle: -178deg;
  --book-paper: url('../assets/relics/about-book-parchment.webp');
  position: relative;
  width: min(100%, 1060px);
  margin: clamp(38px, 6vw, 86px) auto 0;
  perspective: 1600px;
  isolation: isolate;
}

.about-book::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: -19% max(-7%, -14px) -25%;
  background: radial-gradient(ellipse closest-side, #7a201c69, #370d1832 64%, transparent);
  pointer-events: none;
}

.about-book__spread {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  transform-style: preserve-3d;
}

.about-book[data-book-state="closed"] .about-book__spread { transform: translateX(-25%); }
.about-book:is([data-book-state="opening"], [data-book-state="closing"]) .about-book__spread {
  animation: spread-book var(--book-turn);
}
.about-book[data-book-state="closing"] .about-book__spread { animation-direction: reverse; }
.about-book[data-book-state="open"] .about-book__spread { cursor: pointer; }
.about-book[data-book-state="open"] .story-bio :is(h3, p) { cursor: text; }

.about-book__page {
  position: relative;
  display: grid;
  align-content: center;
  min-height: clamp(411px, 42vw, 556px);
  min-width: 0;
  padding: clamp(31px, 4.4vw, 67px);
  border: 1px solid #976849;
  background:
    var(--page-fold),
    var(--book-paper) center / 100% 100% no-repeat,
    #ebdcc2;
  box-shadow: 0 2px #ae8a61, 0 4px #dcc4a2, 0 6px #8c6449, 0 8px #b99876,
    0 11px #391019, 0 14px #660d18, 0 32px 44px #040103a1;
}

.about-book__page--portrait {
  --page-fold: linear-gradient(90deg, #47231124, transparent 13% 83%, #542c1854 96%, #3a1d156e);
  grid-column: 1;
  justify-items: center;
  border-right: 0;
  border-radius: 12px 3px 0 16px / 8px 8px 3px 10px;
}

.about-book__page--portrait .portrait-frame {
  border-color: #74503c;
  outline: 1px solid #9474528c;
  outline-offset: 5px;
  background: #210f12;
}

.about-book__page--portrait .portrait-placeholder {
  background: url('../assets/grain.png'), radial-gradient(ellipse at 48% 46%, #4f201a, #281218 69%, #190d10);
}

.about-book__page--bio {
  --page-fold: linear-gradient(90deg, #3a1d156f, #542c182c 10%, transparent 22% 91%, #47231120);
  grid-column: 2;
  display: block;
  align-content: center;
  border-left: 0;
  border-radius: 3px 12px 16px 0 / 8px 8px 10px 3px;
  padding-inline-start: clamp(42px, 5.3vw, 80px);
}

.about-book__page--bio .eyebrow { color: #76202a; }
.about-book__page--bio h3 {
  color: #29181b;
  font-size: clamp(2.3rem, 4.2vw, 4.35rem);
  overflow-wrap: anywhere;
}
.about-book__page--bio .story-copy { color: #35241f; }

.about-book__page--bio::after {
  content: '';
  position: absolute;
  right: clamp(38px, 5vw, 66px);
  bottom: clamp(17px, 2.5vw, 37px);
  width: clamp(30px, 3.4vw, 49px);
  aspect-ratio: 1;
  border: 1px solid #76202d;
  border-radius: 48% 53% 42% 51% / 48% 44% 54% 52%;
  background: radial-gradient(ellipse at 34% 25%, #c265603a, transparent 60%),
    radial-gradient(circle, #7c1e2b 35%, #510c18 44%, #ac3842 52%, #691521 62%, #380b16);
  box-shadow: inset 1px 2px 4px #e7907466, 2px 4px 6px #4f201a64;
  transform: rotate(-12deg);
  pointer-events: none;
}

.about-book__spine {
  position: absolute;
  z-index: 2;
  inset: 2px auto 1px 50%;
  width: clamp(20px, 3.2vw, 42px);
  transform: translateX(-50%);
  border-radius: 60% / 12%;
  background: linear-gradient(to right, transparent, #5b382248 36%, #35150b8c 50%, #5b382248 64%, transparent);
  pointer-events: none;
}

.about-book__spine::after {
  content: '';
  position: absolute;
  inset: 0 49%;
  background: repeating-linear-gradient(180deg, transparent 0 21px, #723d2b8f 22px 26px, transparent 27px 38px);
  mask-image: linear-gradient(transparent 6%, #000 20% 80%, transparent 94%);
}

.about-book__cover {
  position: absolute;
  inset: -2px -2px -8px 50%;
  z-index: 3;
  transform-origin: left center;
  transform: rotateY(var(--cover-angle));
  transform-style: preserve-3d;
  visibility: hidden;
  pointer-events: none;
}

.about-book[data-book-state="closed"] .about-book__cover {
  visibility: visible;
  transform: rotateY(0);
}

.about-book:is([data-book-state="opening"], [data-book-state="closing"]) .about-book__cover {
  visibility: visible;
  animation: turn-book-cover var(--book-turn);
}
.about-book[data-book-state="closing"] .about-book__cover { animation-direction: reverse; }

.about-book__cover-front, .about-book__cover-inside {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 5px 12px 14px 6px;
}

.about-book__cover-front {
  transform: rotateY(0);
  border: 1px solid #9a5338;
  background:
    linear-gradient(90deg, #170508d8, transparent 8% 94%, #180407a8),
    url('../assets/relics/about-book-cover.webp') center / 100% 100% no-repeat,
    url('../assets/grain.png'),
    radial-gradient(ellipse at 50% 43%, #ab261c, #67121a 58%, #2c0710);
  box-shadow: inset 3px 0 #c677583e, inset 9px 0 12px #11050699, 0 22px 38px #070103ab;
}

.about-book__cover-front::after {
  content: '';
  position: absolute;
  inset: 7%;
  border: 1px double #d2926370;
  outline: 1px solid #25090e;
  outline-offset: 4px;
  border-radius: 3px;
}

.about-book__cover-inside {
  transform: rotateY(180deg);
  border: 1px solid #91684c;
  background:
    linear-gradient(90deg, #42231a4f, transparent 18% 88%, #4f2a1842),
    var(--book-paper) center / 100% 100% no-repeat,
    #e7d6b8;
  box-shadow: inset -3px 0 #9d673d39;
}

/* Fade the endpaper, since opacity on the hinge flattens both 3D faces. */
.about-book:is([data-book-state="opening"], [data-book-state="closing"]) .about-book__cover-inside {
  animation: settle-book-endpaper var(--book-turn);
}
.about-book[data-book-state="closing"] .about-book__cover-inside { animation-direction: reverse; }

.about-book[data-book-state="closed"] :is(.about-book__page--portrait, .about-book__spine) { opacity: 0; }
.about-book[data-book-state="opening"] :is(.about-book__page--portrait, .about-book__spine) {
  animation: book-page-reveal .58s ease .62s both;
}
.about-book[data-book-state="closed"] .about-book__page--bio { opacity: 0; }
.about-book[data-book-state="opening"] .about-book__page--bio {
  animation: book-page-reveal .62s ease .48s both;
}
.about-book[data-book-state="closing"] :is(.about-book__page--portrait, .about-book__spine) {
  animation: book-page-reveal .48s ease .27s both reverse;
}
.about-book[data-book-state="closing"] .about-book__page--bio {
  animation: book-page-reveal .43s ease .71s both reverse;
}

.about-book__eye {
  position: absolute;
  left: 50%;
  top: 50%;
  isolation: isolate;
  display: block;
  width: min(37%, 188px);
  aspect-ratio: 560 / 839;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.about-book__eye::before {
  content: '';
  position: absolute;
  inset: 30% -7% 29%;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(ellipse closest-side, #140307b5 32%, #1a050888 60%, #390d1348 80%, #68282326 91%, transparent);
}

.about-book__eye > :is(img, canvas) {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: sepia(.69) saturate(.91) hue-rotate(-13deg) brightness(.75) contrast(1.12)
    drop-shadow(0 1px 1.5px #190409dc);
}

.about-book__eye canvas,
.about-book__eye.has-tracking img { display: none; }
.about-book__eye.has-tracking canvas { display: block; }

.about-book__trigger {
  position: absolute;
  z-index: 4;
  inset: -2px 25% -8px;
  display: block;
  appearance: none;
  border: 0;
  border-radius: 5px 12px 14px 6px;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.about-book[data-book-state="open"] .about-book__trigger {
  inset: 0;
  height: auto;
  pointer-events: none;
}
.about-book:is([data-book-state="opening"], [data-book-state="closing"]) .about-book__trigger {
  opacity: 0;
  pointer-events: none;
}

@keyframes spread-book {
  from { transform: translateX(-25%); }
  to { transform: translateX(0); }
}

@keyframes turn-book-cover {
  from { transform: rotateY(0); }
  to { transform: rotateY(var(--cover-angle)); }
}

@keyframes settle-book-endpaper {
  0%, 78% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes book-page-reveal { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 760px) {
  .about-book {
    --portrait-leaf-height: clamp(260px, 82vw, 430px);
    --front-height: clamp(318px, 105vw, 480px);
    --cover-angle: -92deg;
    width: min(100%, 526px);
  }
  .about-book[data-book-state="closed"] { height: var(--front-height); }
  .about-book__spread { grid-template-columns: minmax(0, 1fr); }
  .about-book[data-book-state="closed"] .about-book__spread { transform: none; }
  .about-book:is([data-book-state="opening"], [data-book-state="closing"]) .about-book__spread { animation: none; }
  .about-book__page { min-height: 0; padding: 32px clamp(26px, 7vw, 46px); }
  .about-book__page--portrait {
    --page-fold: linear-gradient(0deg, #512e1f59, transparent 19%);
    height: var(--portrait-leaf-height);
    padding-bottom: 38px;
    border-right: 1px solid #92533a;
    border-bottom: 0;
    border-radius: 11px 12px 2px 2px;
  }
  .about-book__page--portrait .portrait-frame { width: min(68%, 245px); }
  .about-book__page--portrait img { max-height: calc(var(--portrait-leaf-height) - 70px); }
  .about-book__page--bio {
    --page-fold: linear-gradient(180deg, #512e1f4d, transparent 22%);
    grid-column: 1;
    border-left: 1px solid #92533a;
    border-top: 0;
    border-radius: 2px 2px 14px 12px;
    padding-block: 60px 64px;
  }
  .about-book__spine {
    inset: var(--portrait-leaf-height) 2px auto;
    width: auto;
    height: 24px;
    transform: translateY(-50%);
    background: linear-gradient(transparent, #512e1980 50%, transparent);
  }
  .about-book__spine::after {
    inset: 46% 0;
    background: repeating-linear-gradient(90deg, transparent 0 18px, #bc704e57 19px 23px, transparent 24px 33px);
    mask-image: linear-gradient(to right, transparent, #000 17% 83%, transparent);
  }
  .about-book__cover { inset: -2px 0 auto; height: var(--front-height); }
  .about-book__trigger { inset: -2px 0 auto; height: var(--front-height); }
}

:where(html:not([data-motion="full"])) .about-book:is([data-book-state="opening"], [data-book-state="closing"]) * {
  animation: none;
  transition: none;
}
