.heritage-book {
  --book-x: 0;
  --book-y: 0;
  position: relative;
  min-width: 0;
}

.heritage-book::before {
  content: "";
  position: absolute;
  inset: var(--book-art-top) 0 0;
}

.heritage-book:focus-visible {
  outline: 2px solid #525252;
  outline-offset: 5px;
}

.heritage-book__surface {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border: 1px solid #d4d4d4;
  border-radius: 15px 16px 15px 14px;
  background: linear-gradient(135deg, #e9e9e9, #c2c2c2);
  box-shadow: 0 4px 8px #00000014;
  transform: perspective(740px) rotateX(calc(-18deg * var(--book-y))) rotateY(calc(18deg * var(--book-x)));
}

.heritage-book__surface::before,
.heritage-book__surface::after {
  content: "";
  position: absolute;
}

.heritage-book__surface::before {
  inset: 7px 5px 6px 8px;
  border-radius: 8px 11px 10px 8px;
  background: repeating-linear-gradient(0deg, #d6d6d6 0 1px, #e9e9e9 1px 2px, #e1e1e1 2px 3px);
  box-shadow: 0 1px 2px #00000026;
}

.heritage-book__surface::after {
  inset: 5px 9px 11px 8px;
  border: 1px solid #fff;
  border-radius: 7px 10px 9px 7px;
  background: #fff;
  box-shadow: 0 2px 5px #00000024;
}

.heritage-book__art {
  position: absolute;
  display: block;
  width: var(--book-art-width, 100%);
  height: var(--book-art-height);
  inset: var(--book-art-top) 0 auto;
  margin-inline: auto;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(2px 5px 4px #00000029);
  transform: translate3d(calc(21px * var(--book-x)), calc(10px * var(--book-y)), 0);
}

.heritage-book--featured {
  --book-art-height: 108px;
  --book-art-top: -23px;
  --book-art-width: calc(100% - 12px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  min-height: 153px;
  padding: 91px 14px 26px;
  text-align: center;
}

.heritage-book__caption {
  position: relative;
  transform: translate3d(calc(-4px * var(--book-x)), calc(-3px * var(--book-y)), 0);
}

.heritage-book__caption .mono {
  display: block;
  margin-bottom: 3px;
  color: #737373;
  font-size: 10px;
  letter-spacing: .12em;
  line-height: 1.35;
}

.heritage-book__caption h3 {
  margin: 0;
  color: #0a0a0a;
  font-size: clamp(16px, 1.6vw, 21px);
  font-weight: 500;
  line-height: 1.15;
  text-wrap: balance;
}

@media (max-width: 520px) {
  .heritage-book--featured {
    --book-art-height: 95px;
    min-height: 139px;
    padding-top: 80px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .heritage-book__surface,
  .heritage-book__art,
  .heritage-book__caption {
    transform: none;
  }
}
