.book-popup {
  position: fixed;
  z-index: 70;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  animation: book-popup-in 180ms ease-out;
}
.book-popup[hidden] { display: none; }
.book-popup-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 22, 40, .62);
}
.book-popup-panel {
  position: relative;
  z-index: 1;
  width: min(960px, calc(100vw - 32px));
  height: min(88vh, 780px);
  overflow: hidden;
  border-radius: 16px;
  background: var(--canvas);
  box-shadow: 0 24px 72px rgba(15, 22, 40, .28);
}
.book-popup-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}
.book-popup-close {
  position: absolute;
  z-index: 2;
  top: 12px;
  right: 12px;
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--canvas);
  color: var(--ink);
  cursor: pointer;
  font-size: 1.75rem;
  line-height: 1;
}
.book-popup-close:focus-visible {
  outline: 3px solid var(--mint-deep);
  outline-offset: 3px;
}
.book-popup-loading {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  align-content: start;
  gap: 18px;
  padding: clamp(28px, 5vw, 56px);
  background: var(--canvas-2);
  color: var(--ink-2);
}
.book-popup-loading strong {
  margin-bottom: 12px;
  font-family: var(--font-body);
  font-size: .9rem;
  font-weight: 600;
}
.book-popup-loading span {
  display: block;
  width: min(100%, 480px);
  height: 58px;
  border-radius: 12px;
  background: linear-gradient(100deg, #e9edf1 20%, #f5f7f9 40%, #e9edf1 60%);
  background-size: 200% 100%;
  animation: book-popup-shimmer 1.4s ease-in-out infinite;
}
.book-popup-loading span:nth-of-type(2) { width: min(82%, 390px); }
.book-popup-loading span:nth-of-type(3) { width: min(92%, 440px); }
.book-popup.is-loaded .book-popup-loading { display: none; }
html.book-popup-open { overflow: hidden; }

@keyframes book-popup-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes book-popup-shimmer { to { background-position: -200% 0; } }

@media (max-width: 720px) {
  .book-popup { padding: 0; }
  .book-popup-panel {
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .book-popup { animation: none; }
  .book-popup-loading span { animation: none; }
}
