:root {
  --gold: #b89d7e;
  --dark: #1a1a1a;
  --ivory: #ffffff;
  --transition-speed: 0.9s;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: #f8f8f8;
  color: var(--dark);
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  font-family: "Montserrat", sans-serif;
}

/* --- Premium Entrance --- */
#intro-overlay {
  position: fixed;
  inset: 0;
  background: #fff;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  transition: clip-path 1.2s cubic-bezier(0.8, 0, 0.2, 1);
  clip-path: circle(150% at 50% 50%);
}

#intro-overlay.hide {
  clip-path: circle(0% at 50% 50%);
}

.wedding-title {
  font-family: "Playfair Display", serif;
  font-size: 3rem;
  font-weight: 400;
  letter-spacing: -1px;
}
.wedding-subtitle {
  letter-spacing: 5px;
  font-size: 0.7rem;
  margin-top: 10px;
  color: var(--gold);
}

#start-btn {
  margin-top: 50px;
  background: none;
  border: 1px solid #ddd;
  padding: 15px 40px;
  font-size: 0.8rem;
  letter-spacing: 3px;
  cursor: pointer;
  transition: 0.4s;
}

#start-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
}

/* --- Magazine Engine --- */
.app-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.magazine-viewport {
  width: 90vw;
  height: 75vh;
  perspective: 2000px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.book {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 400px; /* Base single-page width */
  transform-style: preserve-3d;
  transition: transform var(--transition-speed) cubic-bezier(0.6, 0, 0.4, 1);
}

.leaf {
  position: absolute;
  width: 89%;
  height: 100%;
  top: 0;
  left: 0;
  transform-style: preserve-3d;
  transition: transform var(--transition-speed) cubic-bezier(0.6, 0, 0.4, 1), opacity var(--transition-speed);
}

.page-side {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
}

.page-side img {
  width: 100%;
  height: 100%;
  object-fit: contain; /* Full image visible */
}

.back {
  transform: rotateY(180deg);
}

/* --- Mobile Animation: The "Soft Peel" --- */
@media (max-width: 1023px) {
  .leaf {
    width: 100%;
  }

  .leaf.flipped {
    transform: translateX(-120%) rotateZ(-10deg);
    opacity: 0;
    pointer-events: none;
  }
}

/* --- Desktop: The "Spread" --- */
@media (min-width: 1024px) {
  .book {
    max-width: 450px;
  }
  .book.open {
    transform: translateX(50%);
  }
  .leaf {
    transform-origin: left center;
  }
  .leaf.flipped {
    transform: rotateY(-180deg);
  }
}

/* --- UI Styling --- */
/* ===========================
   Footer navigation buttons
   =========================== */
.ui-footer {
  position: absolute;
  bottom: 40px;
  width: 100%;
  max-width: 520px;
  padding: 0 18px;
  text-align: center;
}

.nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.progress-wrap {
  flex: 1;
  min-width: 160px;
}

.nav-btn {
  pointer-events: auto;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  padding: 10px 14px;
  border-radius: 999px;

  font-family: "Montserrat", sans-serif;
  font-size: 0.62rem;
  letter-spacing: 3px;
  text-transform: uppercase;

  color: rgba(0, 0, 0, 0.65);
  cursor: pointer;

  transition: 0.25s ease;
}

.nav-btn:hover {
  border-color: rgba(184, 157, 126, 0.55);
  color: var(--gold);
  transform: translateY(-1px);
}

/* Disabled state */
.nav-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
}

/* Mobile tighten */
@media (max-width: 480px) {
  .ui-footer {
    bottom: 24px;
  }
  .nav-btn {
    padding: 9px 11px;
    letter-spacing: 2px;
    font-size: 0.58rem;
  }
}

/* ===========================
   MOBILE MODE (1 page at a time)
   =========================== */
.mobile-stack {
  display: none;
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 400px;
  border-radius: 6px;
  overflow: hidden;
  perspective: 1400px;
}

/* Show mobile stack only on mobile */
@media (max-width: 1023px) {
  .book {
    display: none; /* hide the desktop engine */
  }
  .mobile-stack {
    display: block;
  }
}

/* Each page in mobile */
.mobile-page {
  position: absolute;
  inset: 0;
  transform-origin: left center;
  backface-visibility: hidden;
  transform-style: preserve-3d;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  will-change: transform, opacity, filter;
  transition: transform 0.75s cubic-bezier(0.22, 0.61, 0.36, 1), opacity 0.5s ease, filter 0.75s ease;
}

.mobile-page img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Soft-peel flip */
.mobile-page.flipped {
  transform: rotateY(-150deg) translateX(-10px);
  opacity: 0;
  filter: blur(1px);
  pointer-events: none;
}

/* Adds a subtle shadow to make it premium */
.mobile-page::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, rgba(0, 0, 0, 0.12), transparent 40%);
  opacity: 0;
  transition: opacity 0.75s ease;
  pointer-events: none;
}

.mobile-page.flipped::after {
  opacity: 1;
}
