.book {
  position: relative;
  width: var(--book-width);
  height: var(--book-height);
  transform-style: preserve-3d;
  box-shadow: var(--shadow-ambient);
  transition: transform var(--timing-page-turn) var(--easing-page-turn);
}

.state-cover-front .book {
  transform: translateX(-25%);
}

.state-opened .book {
  transform: translateX(0);
}

.state-cover-back .book {
  transform: translateX(25%);
}

.spine {
  position: absolute;
  top: 0;
  left: 50%;
  width: 1%;
  height: 100%;
  transform: translateX(-50%) translateZ(0.1cqw);
  background: linear-gradient(to right,
      var(--color-spine-dark) 0%,
      rgba(255, 255, 255, 0.1) 40%,
      var(--color-spine-dark) 50%,
      rgba(255, 255, 255, 0.1) 60%,
      var(--color-spine-dark) 100%);
  box-shadow: inset 0.1cqw 0 0.2cqw rgba(0, 0, 0, 0.8), inset -0.1cqw 0 0.2cqw rgba(0, 0, 0, 0.8);
  z-index: 100;
  pointer-events: none;
}

.page-stack {
  position: absolute;
  top: 1%;
  width: 49%;
  height: 98%;
  background: var(--color-page-background);
  transition: box-shadow var(--timing-page-turn) var(--easing-page-turn);
  pointer-events: none;
  z-index: 0;
}

.page-stack-left {
  left: 1%;
  border-top-left-radius: 0.5cqw;
  border-bottom-left-radius: 0.5cqw;
  transform-origin: right center;
  transform: rotateY(-5deg) translateZ(-0.2cqw);
}

.page-stack-right {
  right: 1%;
  border-top-right-radius: 0.5cqw;
  border-bottom-right-radius: 0.5cqw;
  transform-origin: left center;
  transform: rotateY(5deg) translateZ(-0.2cqw);
}

.sheet {
  position: absolute;
  top: 0;
  left: 50%;
  width: 50%;
  height: 100%;
  transform-origin: left center;
  transform-style: preserve-3d;
  transition: transform var(--timing-page-turn) var(--easing-page-turn);
  pointer-events: none;
  z-index: 1;
  container-type: inline-size;
}

.sheet.active {
  pointer-events: auto;
}

.face {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform-style: preserve-3d;
  overflow: hidden;
}

.face.front {
  transform: rotateY(0deg);
  z-index: 2;
}

.face.back {
  transform: rotateY(180deg);
  z-index: 1;
}

.left-page {
  background-color: var(--color-page-background);
  background-image: url('../assets/images/book/pages.webp');
  background-size: cover;
  border-top-left-radius: 0.8cqw;
  border-bottom-left-radius: 0.8cqw;
  box-shadow: inset -1cqw 0 2cqw rgba(0, 0, 0, 0.05);
}

.right-page {
  background-color: var(--color-page-background);
  background-image: url('../assets/images/book/pages.webp');
  background-size: cover;
  border-top-right-radius: 0.8cqw;
  border-bottom-right-radius: 0.8cqw;
  box-shadow: inset 1cqw 0 2cqw rgba(0, 0, 0, 0.05);
}

.cover-front {
  background-image: url('../assets/images/book/cover.webp');
  background-size: cover;
  background-position: center;
  border-top-right-radius: 1cqw;
  border-bottom-right-radius: 1cqw;
  box-shadow: inset 0.5cqw 0 1cqw rgba(255, 255, 255, 0.1), inset -0.5cqw 0 1cqw rgba(0, 0, 0, 0.5);
}

.cover-back {
  background-image: url('../assets/images/book/back.webp');
  background-size: cover;
  background-position: center;
  border-top-left-radius: 1cqw;
  border-bottom-left-radius: 1cqw;
  box-shadow: inset -0.5cqw 0 1cqw rgba(255, 255, 255, 0.1), inset 0.5cqw 0 1cqw rgba(0, 0, 0, 0.5);
}

.page-border {
  position: absolute;
  width: 15cqw;
  height: 15cqw;
  background-image: url('../assets/images/book/Border.webp');
  background-size: contain;
  background-repeat: no-repeat;
  pointer-events: none;
  z-index: 10;
}

.corner-top-left {
  top: 1.5cqw;
  left: 1.5cqw;
}

.corner-top-right {
  top: 1.5cqw;
  right: 1.5cqw;
  transform: scaleX(-1);
}

.corner-bottom-left {
  bottom: 1.5cqw;
  left: 1.5cqw;
  transform: scaleY(-1);
}

.corner-bottom-right {
  bottom: 1.5cqw;
  right: 1.5cqw;
  transform: scale(-1, -1);
}