/* ============================================================
   AMSTES Book Preview — round dot navigation + fullscreen zoom
   (vanilla CSS/JS, no dependencies)
   ============================================================
   Behaviour:
   - Two round dots (Front / Back) rotate the 3D book.
   - Front = 0°, Back = 180°. The rotation always passes through
     +90°, where the SPINE faces the viewer (the spine is on the
     left edge: transform rotateY(-90deg), origin left center).
   - Clicking the book opens a fullscreen zoom modal for the
     currently shown cover. Clicking the dark area around the cover
     closes it.
   ============================================================ */

/* ---------- Round dot navigation ---------- */
.amstes-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: none;
  padding: 0;
  cursor: pointer;
  background: rgba(45, 90, 63, 0.25);
  transition: all 0.3s cubic-bezier(0.65, 0, 0.35, 1);
}
.amstes-dot:hover {
  background: rgba(45, 90, 63, 0.55);
  transform: scale(1.15);
}
.amstes-dot.active {
  width: 32px;
  background: #2d5a3f;
  box-shadow: 0 0 0 4px rgba(45, 90, 63, 0.12);
}
.amstes-dot:focus-visible {
  outline: 2px solid #2d5a3f;
  outline-offset: 3px;
}

/* The book itself is clickable */
.book-3d[data-book-preview] {
  cursor: pointer;
  transition: transform 1.1s cubic-bezier(0.65, 0, 0.35, 1);
}

/* ---------- Fullscreen zoom modal ---------- */
.bz-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.92);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  color: #fff;
  font-family: 'Inter', sans-serif;
  animation: bz-fade 0.25s ease;
}
@keyframes bz-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.bz-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.bz-topbar-title {
  font-family: 'Merriweather', Georgia, serif;
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bz-topbar-sub {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 2px;
}
.bz-close {
  display: grid;
  place-items: center;
  height: 2.5rem;
  width: 2.5rem;
  border-radius: 999px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}
.bz-close:hover { background: rgba(255, 255, 255, 0.2); }

.bz-tabs {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
}
.bz-tab {
  padding: 0.375rem 1rem;
  border-radius: 999px;
  border: none;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.7);
  transition: all 0.2s;
}
.bz-tab:hover { background: rgba(255, 255, 255, 0.2); }
.bz-tab.active {
  background: #10b981;
  color: #fff;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

.bz-stage {
  position: relative;
  flex: 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 1rem 1.5rem;
  user-select: none;
}
.bz-img-wrap {
  position: relative;
  height: 100%;
  max-height: 100%;
  aspect-ratio: 2.3 / 3;
}
.bz-img-wrap img {
  height: 100%;
  width: 100%;
  object-fit: contain;
  border-radius: 0.5rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  transform-origin: center center;
  transition: transform 0.18s ease-out;
  -webkit-user-drag: none;
  user-drag: none;
  pointer-events: none; /* clicks pass to the stage for backdrop close */
}

.bz-hint {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.4);
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.75rem;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  pointer-events: none;
  white-space: nowrap;
}

.bz-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.bz-btn {
  display: grid;
  place-items: center;
  height: 2.75rem;
  width: 2.75rem;
  border-radius: 999px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s;
}
.bz-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.2); }
.bz-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.bz-zoom-label {
  min-width: 4.5rem;
  text-align: center;
  font-weight: 600;
  font-size: 0.85rem;
}

/* ---------- Responsive: keep the 3D book a good size on phones ---------- */
@media (max-width: 992px) {
  .book-scene { width: 100%; max-width: 320px; margin: 0 auto 2rem auto; }
  .book-3d { max-width: 300px; }
}
@media (max-width: 480px) {
  .book-scene { width: 100%; max-width: 300px; margin: 0 auto 2rem auto; }
  .book-3d { max-width: 300px; --book-depth: 30px; }
}
