/* =========================================================
   HUNAVA HANDICRAFT — "Old Book on a Table" product catalog
   ========================================================= */

.book-scene {
  position: relative;
  padding: 60px 16px 90px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(0,0,0,.15), transparent 60%),
    repeating-linear-gradient(90deg, var(--wood-mid) 0px, var(--wood-light) 3px, var(--wood-mid) 6px, var(--wood-dark) 40px),
    linear-gradient(var(--wood-dark), var(--wood-dark));
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: inset 0 0 90px rgba(0,0,0,.55);
}
.book-scene::before {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(circle at 50% 30%, rgba(255,220,160,.10), transparent 60%);
  pointer-events: none;
}

.book-toolbar {
  position: relative;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 34px;
}
.book-toolbar .chip {
  padding: 8px 18px;
  border-radius: 999px;
  background: rgba(255,238,208,.14);
  border: 1px solid rgba(255,238,208,.35);
  color: var(--cream-soft);
  font-size: .82rem;
  font-weight: 600;
}
.book-toolbar .chip:hover, .book-toolbar .chip.active {
  background: var(--gold);
  color: var(--ink-deep);
  border-color: var(--gold);
}

.book-stage {
  position: relative;
  z-index: 2;
  max-width: 980px;
  margin: 0 auto;
  perspective: 2600px;
}

.book {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 11.5;
  margin: 0 auto;
}

/* the closed "cover" edge / spine shadow beneath the book to sit it on the table */
.book-shadow {
  position: absolute;
  left: 6%; right: 6%; bottom: -26px; height: 40px;
  background: radial-gradient(ellipse, rgba(0,0,0,.55), transparent 72%);
  filter: blur(4px);
  z-index: 0;
}

.book-spread {
  position: absolute; inset: 0;
  display: flex;
  background: var(--paper);
  border-radius: 8px;
  box-shadow:
    0 30px 60px rgba(0,0,0,.45),
    0 2px 0 rgba(0,0,0,.15);
  overflow: hidden;
  backface-visibility: hidden;
  transform-origin: left center;
  transform: rotateY(0deg);
  transition: transform 1s cubic-bezier(.65,0,.35,1);
  opacity: 0;
  pointer-events: none;
  z-index: 1;
}
.book-spread::before { /* center spine shadow */
  content: "";
  position: absolute; top: 0; bottom: 0; left: 50%;
  width: 60px; margin-left: -30px;
  background: linear-gradient(90deg, transparent, rgba(0,0,0,.16), transparent);
  z-index: 5; pointer-events: none;
}
.book-spread.is-active { opacity: 1; pointer-events: auto; z-index: 6; }
.book-spread.is-under { opacity: 1; pointer-events: none; z-index: 4; }
.book-spread.is-flipping-next { transform-origin: left center; transform: rotateY(-150deg); z-index: 7; }
.book-spread.is-flipping-prev { transform-origin: right center; transform: rotateY(150deg); z-index: 7; }

.book-page {
  width: 50%;
  height: 100%;
  position: relative;
  padding: clamp(18px, 3vw, 40px);
  background: var(--paper);
  background-image:
    repeating-linear-gradient(rgba(0,0,0,0.015) 0 1px, transparent 1px 26px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.book-page.left {
  border-right: 1px solid rgba(0,0,0,.06);
  align-items: center;
  justify-content: center;
  text-align: center;
}
.book-page.right {
  justify-content: center;
}

.page-photo-frame {
  width: 100%;
  height: 100%;
  border: 10px solid #fff;
  outline: 1px solid var(--cream-deep);
  box-shadow: 0 8px 22px rgba(0,0,0,.18);
  border-radius: 4px;
  overflow: hidden;
  background: var(--cream-deep);
}
.page-photo-frame img {
  width: 100%; height: 100%; object-fit: cover;
}
.page-caption {
  margin-top: 14px;
  font-family: var(--font-script);
  font-style: italic;
  color: var(--ink-soft);
  font-size: 1rem;
}

.page-kicker {
  font-family: var(--font-script);
  font-style: italic;
  color: var(--gold);
  font-size: 1.05rem;
  margin-bottom: 6px;
}
.page-title {
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 2.4vw, 1.7rem);
  color: var(--ink-deep);
  margin-bottom: 10px;
  line-height: 1.25;
}
.page-meta {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 14px;
}
.page-meta span {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
  font-weight: 700; color: var(--maroon);
  background: var(--gold-pale);
  padding: 4px 10px; border-radius: 999px;
}
.page-desc {
  font-size: clamp(.85rem, 1.6vw, .96rem);
  color: var(--ink-soft);
  margin-bottom: 14px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
}
.page-detail-row {
  font-size: .82rem;
  margin-bottom: 6px;
  color: var(--ink);
}
.page-detail-row b { color: var(--ink-deep); }
.page-price {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--maroon);
  margin: 12px 0;
}
.page-number {
  position: absolute; bottom: 14px;
  font-family: var(--font-script); font-style: italic;
  color: var(--ink-soft); font-size: .8rem;
}
.book-page.left .page-number { left: 24px; }
.book-page.right .page-number { right: 24px; }

/* legacy leaf classes intentionally removed — flip is handled on .book-spread directly */

/* controls */
.book-controls {
  position: relative; z-index: 3;
  display: flex; align-items: center; justify-content: center;
  gap: 18px;
  margin-top: 34px;
}
.book-nav-btn {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--gold-light);
  color: var(--ink-deep);
  border: none;
  font-size: 1.3rem;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-soft);
  transition: transform .15s ease, background .15s ease;
}
.book-nav-btn:hover { background: var(--gold); transform: translateY(-2px); }
.book-nav-btn:disabled { opacity: .4; cursor: default; transform: none; }

.book-play-toggle {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: 999px;
  background: rgba(255,238,208,.14);
  border: 1px solid rgba(255,238,208,.4);
  color: var(--cream-soft);
  font-size: .85rem; font-weight: 600;
}
.book-play-toggle.is-paused .icon-play { display: inline; }
.book-play-toggle.is-paused .icon-pause { display: none; }
.book-play-toggle .icon-play { display: none; }
.book-play-toggle .icon-pause { display: inline; }

.book-dots {
  position: relative; z-index: 3;
  display: flex; justify-content: center; flex-wrap: wrap; gap: 8px;
  margin-top: 20px;
}
.book-dots button {
  width: 9px; height: 9px; border-radius: 50%;
  background: rgba(255,238,208,.35);
  border: none; padding: 0;
}
.book-dots button.active { background: var(--gold); width: 22px; border-radius: 5px; }

.book-hint {
  text-align: center; margin-top: 16px;
  color: rgba(255,238,208,.65); font-size: .82rem;
  position: relative; z-index: 3;
}

@media (max-width: 760px) {
  .book { aspect-ratio: 3 / 4; }
  .book-spread { flex-direction: column; }
  .book-spread::before { display: none; }
  .book-page { width: 100%; height: 50%; padding: 16px; }
  .book-page.left { border-right: none; border-bottom: 1px solid rgba(0,0,0,.06); }
  .page-desc { -webkit-line-clamp: 3; display: -webkit-box; -webkit-box-orient: vertical; }
}

/* Alternate grid view (accessibility / fallback listing under the book) */
.catalog-grid-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 26px; flex-wrap: wrap; gap: 10px;
}
