/* ============================================================
   PAVI'S LAB — pages/our-story.css
   ============================================================ */

.story-section {
  position: relative;
  padding: 10px 0 56px;
  overflow: hidden;
}
.story-bg {
  position: absolute; inset: 0;
  background: url('https://ik.imagekit.io/umeshpranav/bg_xzjklr.png?tr=f-auto,w-1600') center / cover no-repeat;
  filter: brightness(0.2);
  z-index: 0;
}
.story-section .container { position: relative; z-index: 1; }

.story-heading {
  text-align: center;
  font-size: clamp(26px, 4vw, 44px);
  font-weight: 800;
  letter-spacing: 4px;
  color: var(--pink);
  margin: 0 0 20px;
  text-transform: uppercase;
}

/* ── Album viewer — wraps stage + nav buttons ── */
.book-viewer {
  position: relative;
  width: fit-content;
  padding: 0 68px;
  margin: 0 auto;
  user-select: none;
}

/* ── Stage — portrait 9:16 ── */
.book-stage {
  position: relative;
  height: min(80vh, 820px);
  aspect-ratio: 9 / 16;   /* width auto-computed from height */
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  box-shadow:
    0 0 52px rgba(255, 0, 127, 0.22),
    0 20px 60px rgba(0, 0, 0, 0.6);
}

/* Back page — destination image sits underneath */
.back-page {
  position: absolute; inset: 0; z-index: 1;
  background: #000;
}
.back-page img {
  width: 100%; height: 100%;
  object-fit: contain; display: block;
}

/* The turning page */
.turning-page {
  position: absolute; inset: 0; z-index: 2;
  transform-style: preserve-3d;
  transform-origin: left center;
  border-radius: 12px;
}

/* Front face — current image */
.page-front {
  position: absolute; inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
}
.page-front img {
  width: 100%; height: 100%;
  object-fit: contain; display: block;
}

/* Back face — paper texture visible mid-turn */
.page-back {
  position: absolute; inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform: rotateY(180deg);
  border-radius: 12px;
  background: linear-gradient(135deg, #f5ede4 0%, #e8dbd0 50%, #d8ccbf 100%);
}
.page-back::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(to right,
    rgba(0,0,0,0.2) 0%,
    rgba(0,0,0,0.06) 15%,
    transparent 40%);
}

/* ── Page turn animations ── */
.turning-page.flip-next {
  animation: albumFlipNext 0.95s cubic-bezier(0.38, 0, 0.18, 1) forwards;
  transform-origin: left center;
}
.turning-page.flip-prev {
  animation: albumFlipPrev 0.95s cubic-bezier(0.38, 0, 0.18, 1) forwards;
  transform-origin: right center;
}

@keyframes albumFlipNext {
  0%   { transform: perspective(900px) rotateY(0deg); }
  45%  { transform: perspective(900px) rotateY(-95deg)  skewY(-1deg); }
  55%  { transform: perspective(900px) rotateY(-105deg) skewY(-1deg); }
  100% { transform: perspective(900px) rotateY(-180deg) skewY(0deg); }
}
@keyframes albumFlipPrev {
  0%   { transform: perspective(900px) rotateY(0deg); }
  45%  { transform: perspective(900px) rotateY(95deg)  skewY(1deg); }
  55%  { transform: perspective(900px) rotateY(105deg) skewY(1deg); }
  100% { transform: perspective(900px) rotateY(180deg) skewY(0deg); }
}

/* Travelling shadow */
.curl-shadow {
  position: absolute; inset: 0; z-index: 3;
  pointer-events: none; opacity: 0;
}
.curl-shadow.show-next {
  animation: shadowNext 0.95s ease-in-out forwards;
}
.curl-shadow.show-prev {
  animation: shadowPrev 0.95s ease-in-out forwards;
}

@keyframes shadowNext {
  0%   { opacity: 0; background: linear-gradient(to left, rgba(0,0,0,0.45) 0%, transparent 35%); }
  30%  { opacity: 1; }
  50%  { background: linear-gradient(to right, rgba(0,0,0,0.4) 0%, rgba(255,255,255,0.05) 20%, transparent 55%); }
  70%  { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes shadowPrev {
  0%   { opacity: 0; background: linear-gradient(to right, rgba(0,0,0,0.45) 0%, transparent 35%); }
  30%  { opacity: 1; }
  50%  { background: linear-gradient(to left, rgba(0,0,0,0.4) 0%, rgba(255,255,255,0.05) 20%, transparent 55%); }
  70%  { opacity: 1; }
  100% { opacity: 0; }
}

/* ── Nav buttons ── */
.book-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 48px; height: 48px; border-radius: 50%; border: none;
  background: rgba(255, 0, 127, 0.82); color: #fff; font-size: 16px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.2s, transform 0.2s;
  z-index: 10; backdrop-filter: blur(6px);
  box-shadow: 0 4px 18px rgba(0,0,0,0.45);
}
.book-btn:hover    { background: var(--pink-deep); transform: translateY(-50%) scale(1.1); }
.book-btn:disabled { opacity: 0.25; cursor: default; }
.book-prev { left: 10px; }
.book-next { right: 10px; }

/* ── Footer ── */
.book-footer {
  display: flex; align-items: center;
  justify-content: center; gap: 20px; margin-top: 16px;
}
.book-counter {
  font-size: 13px; font-weight: 600;
  color: rgba(255,255,255,0.5);
  letter-spacing: 1px; min-width: 48px; text-align: center;
}
.book-dots { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: center; }
.book-dot {
  width: 7px; height: 7px; border-radius: 50%; border: none;
  background: rgba(255,255,255,0.22); cursor: pointer; padding: 0;
  transition: background 0.2s, transform 0.2s;
}
.book-dot.active { background: var(--pink); transform: scale(1.4); }

/* ── Quote Banner ── */
.story-quote {
  position: relative; padding: 72px 24px;
  text-align: center; overflow: hidden;
}
.story-quote-bg {
  position: absolute; inset: 0;
  background: url('https://ik.imagekit.io/umeshpranav/bg_xzjklr.png?tr=f-auto,w-1600') center / cover no-repeat;
  filter: brightness(0.25); z-index: 0;
}
.story-quote .container { position: relative; z-index: 1; }
.story-quote-text {
  font-size: clamp(17px, 2.2vw, 24px); font-weight: 600;
  font-style: italic; color: #fff;
  max-width: 820px; margin: 0 auto; line-height: 1.75;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .story-section { padding: 12px 0 36px; }
  .story-heading { font-size: 24px; margin-bottom: 14px; }
  .story-quote   { padding: 48px 16px; }

  /* Width-driven on mobile — image fills available screen width */
  .book-viewer {
    width: 100%;
    padding: 0 44px;
    box-sizing: border-box;
  }
  .book-stage {
    height: auto;
    width: 100%;
    aspect-ratio: 9 / 16;
  }
  .book-btn  { width: 36px; height: 36px; font-size: 13px; }
  .book-prev { left: 4px; }
  .book-next { right: 4px; }
  .book-footer { margin-top: 12px; }
}

@media (max-width: 400px) {
  .book-viewer { padding: 0 36px; }
  .book-btn    { width: 30px; height: 30px; font-size: 11px; }
}

/* ============================================================
   PAVI'S SPARKLES — light theme overrides
   ============================================================ */
[data-theme="sparkles"] .story-bg,
[data-theme="sparkles"] .story-quote-bg { background: #fff5f9; filter: none; }
[data-theme="sparkles"] .book-counter { color: rgba(61,26,46,0.5); }
[data-theme="sparkles"] .book-dot { background: rgba(61,26,46,0.2); }
