/* ===================== RESET / BASE ===================== */
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: #120a14;
  color: #fff8f0;
  font-family: "Poppins", system-ui, sans-serif;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ===================== COLOR TOKENS ===================== */
:root {
  --choco: #3a221a;
  --choco-deep: #2a1712;
  --choco-mid: #5b3a2e;
  --blush: #f7c9d3;
  --blush-soft: #fbe3e8;
  --blush-deep: #e79bab;
  --gold: #e6b566;
  --gold-amber: #f0a94c;
  --cream: #fff8f0;
  --night: #120a14;
}

.script-title {
  font-family: "Great Vibes", cursive;
  color: var(--blush);
  text-align: center;
  font-size: 3rem;
  line-height: 1.15;
  text-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.script-title.small { font-size: 2.4rem; }
.script-title.dark { color: var(--choco); }
.script-title.bengali {
  font-family: "Hind Siliguri", sans-serif;
  font-weight: 700;
  font-size: 2rem;
}

.section-title {
  font-family: "Playfair Display", serif;
  color: var(--blush);
  text-align: center;
  font-size: 1.6rem;
  margin-bottom: 2rem;
}

@media (min-width: 640px) {
  .script-title { font-size: 4rem; }
  .script-title.small { font-size: 3rem; }
  .section-title { font-size: 2rem; }
}

/* ===================== GLOBAL FX ===================== */
#scroll-progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--blush), var(--gold), var(--blush-deep));
  transform-origin: left;
  transform: scaleX(0);
  z-index: 100;
}

#snow-canvas {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  opacity: 0.4;
}

#music-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 100;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  background: rgba(58,34,26,0.8);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(230,181,102,0.4);
  color: white;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0,0,0,0.4);
}
#music-btn:active { transform: scale(0.9); }

/* ===================== SCENE WRAPPER ===================== */
.scene {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 1.5rem;
  text-align: center;
}
.scene-dark   { background: linear-gradient(to bottom, var(--night), var(--choco-deep), var(--choco)); }
.scene-night  { background: linear-gradient(to bottom, var(--choco), var(--night), #0a0410); min-height: auto; padding: 6rem 1.5rem; }
.scene-choco  { background: linear-gradient(to bottom, var(--choco), var(--choco-deep), var(--night)); }
.scene-gallery{ background: linear-gradient(to bottom, var(--night), var(--choco-deep), var(--choco)); padding: 5rem 1.2rem; }
.scene-letter { background: linear-gradient(to bottom, var(--choco), var(--blush-soft), var(--cream)); padding: 6rem 1.2rem; }
.scene-finale { background: linear-gradient(to bottom, var(--cream), var(--blush-soft), #1a0e14); overflow: hidden; }

/* ===================== SCENE 1: LANDING ===================== */
.cake-wrap {
  position: relative;
  width: 220px;
  height: 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}
.cake-layer, .candle, .plate {
  opacity: 0;
  transition: none;
}
.candle { position: relative; z-index: 30; margin-bottom: -4px; }
.candle-stick {
  width: 6px; height: 32px;
  background: linear-gradient(to bottom, var(--blush-soft), var(--blush));
  margin: 0 auto;
  border-radius: 999px;
}
.candle-stick.tall { height: 48px; width: 8px; }

.flame {
  width: 12px; height: 20px;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: linear-gradient(to top, var(--gold-amber), var(--gold), #fef9c3);
  box-shadow: 0 0 18px 6px rgba(240,169,76,0.6);
  margin: -34px auto 4px;
  transform-origin: bottom center;
}
.flicker { animation: flicker 0.25s infinite ease-in-out; }
@keyframes flicker {
  0%, 100% { transform: scale(1) skewX(0deg); opacity: 1; }
  25% { transform: scale(1.05, 0.95) skewX(3deg); opacity: 0.9; }
  50% { transform: scale(0.95, 1.08) skewX(-2deg); opacity: 1; }
  75% { transform: scale(1.03, 0.97) skewX(2deg); opacity: 0.95; }
}

.layer-top {
  z-index: 20;
  width: 96px; height: 56px;
  border-radius: 20px 20px 8px 8px;
  background: linear-gradient(to bottom, var(--choco-mid), var(--choco));
  border-bottom: 4px solid rgba(247,201,211,0.6);
  box-shadow: 0 8px 20px rgba(0,0,0,0.4);
}
.layer-mid {
  z-index: 10;
  width: 144px; height: 64px;
  margin-top: -4px;
  border-radius: 10px;
  background: linear-gradient(to bottom, var(--choco-mid), var(--choco-deep));
  border-bottom: 4px solid rgba(247,201,211,0.5);
  box-shadow: 0 8px 20px rgba(0,0,0,0.4);
}
.layer-bottom {
  width: 192px; height: 80px;
  margin-top: -4px;
  border-radius: 14px;
  background: linear-gradient(to bottom, var(--choco-mid), var(--choco-deep));
  border-bottom: 4px solid rgba(247,201,211,0.4);
  box-shadow: 0 12px 28px rgba(0,0,0,0.5);
}
.plate {
  width: 224px; height: 12px;
  border-radius: 999px;
  background: rgba(251,227,232,0.3);
  margin-top: 4px;
  filter: blur(1px);
}
.plate.small { width: 210px; }

.mini-cake {
  width: 176px; height: 64px;
  border-radius: 10px;
  margin-top: 4px;
  background: linear-gradient(to bottom, var(--choco-mid), var(--choco-deep));
  border-bottom: 4px solid rgba(247,201,211,0.5);
  box-shadow: 0 8px 20px rgba(0,0,0,0.4);
}

.sub-text {
  font-family: "Poppins", sans-serif;
  font-size: 0.85rem;
  color: rgba(255,248,240,0.7);
  margin-top: 1rem;
  opacity: 0;
}

.scroll-hint {
  position: absolute;
  bottom: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: rgba(255,248,240,0.6);
  opacity: 0;
}
.scroll-hint span:first-child {
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  margin-bottom: 0.25rem;
}
.bounce-arrow {
  font-size: 1.5rem;
  animation: bounceArrow 1.4s infinite ease-in-out;
}
@keyframes bounceArrow {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(10px); }
}

/* ===================== SCENE 2: CELEBRATION ===================== */
.celebrate-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10rem;
  min-height: 80vh;
  justify-content: center;
}
.celebrate-beat {
  font-family: "Playfair Display", serif;
  font-weight: 600;
  font-size: 1.8rem;
  background: linear-gradient(90deg, var(--gold), var(--blush), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 20px rgba(230,181,102,0.4));
  opacity: 0;
  transform: translateY(40px) scale(0.9);
}
@media (min-width: 640px) { .celebrate-beat { font-size: 2.4rem; } }

/* ===================== SCENE 3: BLOW CANDLE ===================== */
.blow-wrap {
  position: relative;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
#progress-ring {
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
}
#progress-circle {
  stroke-dasharray: 289;
  stroke-dashoffset: 289;
  transition: stroke-dashoffset 0.05s linear;
}
.flame-zone {
  height: 64px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.smoke {
  font-size: 1.5rem;
  animation: smokeRise 1.6s ease-out forwards;
}
@keyframes smokeRise {
  0% { opacity: 0.6; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-80px) scale(1.8); }
}
.hint-text {
  font-size: 0.85rem;
  color: rgba(255,248,240,0.7);
  margin-top: 2.5rem;
  max-width: 300px;
}

/* ===================== SCENE 4: CUT CAKE ===================== */
.cut-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.knife {
  position: absolute;
  top: -60px;
  left: 50%;
  transform: translateX(-50%) rotate(-25deg);
  font-size: 3rem;
  z-index: 30;
  transition: transform 0.6s ease, opacity 0.7s ease;
}
.knife.cutting {
  transform: translateX(-50%) rotate(0deg) translateY(50px);
  opacity: 0;
}
.half-cake {
  width: 96px; height: 80px;
  background: linear-gradient(to bottom, var(--choco-mid), var(--choco-deep));
  border-bottom: 4px solid rgba(247,201,211,0.5);
  box-shadow: 0 8px 20px rgba(0,0,0,0.4);
  transition: transform 0.5s cubic-bezier(.34,1.56,.64,1);
  display: inline-block;
}
.half-left { border-radius: 14px 0 0 14px; }
.half-right { border-radius: 0 14px 14px 0; margin-left: -1px; }
.cut-wrap.cut .half-left { transform: translateX(-22px) rotate(-6deg); }
.cut-wrap.cut .half-right { transform: translateX(22px) rotate(6deg); }

/* ===================== SCENE 5: GALLERY ===================== */
.gallery-grid {
  max-width: 640px;
  margin: 3rem auto 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
}
@media (min-width: 640px) {
  .gallery-grid { grid-template-columns: 1fr 1fr; gap: 2.4rem; }
}
.gallery-item {
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 24px 50px rgba(0,0,0,0.55), 0 2px 8px rgba(230,181,102,0.15);
  border: 1px solid rgba(247,201,211,0.25);
  background: rgba(42,23,18,0.7);
  transform-style: preserve-3d;
  backface-visibility: hidden;
}
.gallery-item .photo-box {
  position: relative;
  aspect-ratio: 3/4;
  background: rgba(91,58,46,0.4);
  overflow: hidden;
}
.gallery-item img {
  width: 100%;
  height: 115%;      /* extra height so parallax drift has room without exposing edges */
  object-fit: cover;
  display: block;
  will-change: transform;
}
/* Soft diagonal shine that sweeps once when the item enters view */
.gallery-item .photo-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg,
    transparent 30%,
    rgba(255,248,240,0.18) 48%,
    rgba(255,248,240,0.35) 50%,
    rgba(255,248,240,0.18) 52%,
    transparent 70%);
  transform: translateX(-120%);
  pointer-events: none;
  mix-blend-mode: overlay;
}
.gallery-item.shine-in .photo-shine {
  animation: shineSweep 1.4s ease-out 0.4s forwards;
}
@keyframes shineSweep {
  0%   { transform: translateX(-120%); }
  100% { transform: translateX(120%); }
}
.gallery-item .caption {
  font-family: "Great Vibes", "Playfair Display", cursive;
  font-size: 1.15rem;
  color: rgba(255,248,240,0.85);
  padding: 0.9rem 1rem 1.1rem;
  background: linear-gradient(to bottom, rgba(42,23,18,0.85), rgba(18,10,20,0.95));
  text-align: center;
  letter-spacing: 0.01em;
}

/* ===================== SCENE 6: LETTER ===================== */
.letter-card {
  max-width: 560px;
  margin: 0 auto;
  background: rgba(255,248,240,0.85);
  backdrop-filter: blur(6px);
  border-radius: 26px;
  box-shadow: 0 20px 60px rgba(58,34,26,0.25);
  border: 1px solid rgba(247,201,211,0.4);
  padding: 3rem 1.75rem;
}
.letter-p {
  font-family: "Hind Siliguri", "Playfair Display", serif;
  color: rgba(58,34,26,0.9);
  font-size: 1.1rem;
  line-height: 1.9;
  margin-bottom: 1.6rem;
  opacity: 0;
  transform: translateY(24px);
}
.letter-sign {
  font-family: "Hind Siliguri", "Great Vibes", cursive;
  font-weight: 600;
  font-size: 1.4rem;
  color: var(--blush-deep);
  text-align: right;
  margin-top: 1.2rem;
  opacity: 0;
}

/* ===================== SCENE 7: FINALE ===================== */
.hearts-float {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.heart-particle {
  position: absolute;
  bottom: -20px;
  font-size: 1.5rem;
  opacity: 0;
  animation-name: floatUp;
  animation-timing-function: ease-out;
  animation-iteration-count: infinite;
}
@keyframes floatUp {
  0% { transform: translateY(-10px); opacity: 0; }
  15% { opacity: 0.9; }
  85% { opacity: 0.9; }
  100% { transform: translateY(-420px); opacity: 0; }
}

.love-you {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.15rem;
  margin-bottom: 2.5rem;
}
.love-letter {
  font-family: "Playfair Display", serif;
  font-weight: 700;
  font-size: 2.6rem;
  background: linear-gradient(to bottom, var(--blush-deep), var(--choco));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  opacity: 0;
  transform: scale(0.4) rotate(-20deg) translateY(40px);
  animation: heartbeat 1.8s infinite ease-in-out;
}
@media (min-width: 640px) { .love-letter { font-size: 4.2rem; } }
@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  15% { transform: scale(1.06); }
  30% { transform: scale(1); }
  45% { transform: scale(1.04); }
}

.couple-photo-frame {
  width: 100%;
  max-width: 600px;
  border-radius: 26px;
  overflow: hidden;
  box-shadow: 0 25px 70px rgba(0,0,0,0.5);
  border: 4px solid rgba(255,248,240,0.6);
  background: var(--choco-deep);
  opacity: 0;
  transform: scale(0.9);
}
@media (min-width: 1024px) { .couple-photo-frame { max-width: 900px; } }
.couple-photo-frame img {
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
}

.thankyou-text {
  font-family: "Playfair Display", serif;
  font-size: 1.3rem;
  color: var(--cream);
  margin-top: 2.5rem;
  opacity: 0;
}
@media (min-width: 640px) { .thankyou-text { font-size: 1.6rem; } }

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
