/* ================= RESET & BASE ================= */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --pink: #ff8fab;
  --pink-deep: #e85d8f;
  --rose: #ffc2d1;
  --gold: #f4c869;
  --gold-deep: #d9a441;
  --cream: #fff6ef;
  --plum: #4a2545;
  --plum-deep: #2e1730;
  --purple: #b185db;
  --white: #fffaf7;
  --text: #4a2545;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Poppins', sans-serif;
  background: var(--cream);
  color: var(--text);
  overflow-x: hidden;
}

h1, h2 { font-family: 'Playfair Display', serif; }

#confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
}

.scene { position: relative; width: 100%; overflow: hidden; }

.section-title {
  text-align: center;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  color: var(--plum);
  padding-top: 4rem;
  font-weight: 700;
}

.section-sub {
  text-align: center;
  color: var(--pink-deep);
  font-size: 1rem;
  margin-top: 0.6rem;
  font-weight: 400;
  padding: 0 1rem;
}

/* ================= SCENE 0 : GIFT BOX ================= */
#gift-scene {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 30%, #3a1f52 0%, #1c0f2b 70%, #120a1c 100%);
  transition: opacity 1s ease, visibility 1s ease;
}
#gift-scene.opened { opacity: 0; visibility: hidden; pointer-events: none; }

.stars {
  position: absolute; inset: 0;
  background-image:
    radial-gradient(2px 2px at 20% 30%, #fff, transparent),
    radial-gradient(2px 2px at 70% 60%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 40% 80%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 85% 20%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 55% 45%, #fff, transparent),
    radial-gradient(2px 2px at 10% 70%, #fff, transparent),
    radial-gradient(1px 1px at 90% 85%, #fff, transparent);
  background-size: 100% 100%;
  opacity: 0.6;
  animation: twinkle 3s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: 0.3; } to { opacity: 0.8; } }

.gift-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.6rem;
  z-index: 2;
}

.gift-hint {
  color: var(--rose);
  font-family: 'Great Vibes', cursive;
  font-size: 1.8rem;
  letter-spacing: 1px;
}

.gift-box {
  --box: 180px;
  width: var(--box);
  height: var(--box);
  position: relative;
  cursor: pointer;
  perspective: 1000px;
  animation: floaty 3s ease-in-out infinite;
}
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }

.box-base {
  position: absolute;
  bottom: 0; left: 0;
  width: 100%;
  height: 65%;
  background: linear-gradient(135deg, var(--pink) 0%, var(--pink-deep) 100%);
  border-radius: 6px 6px 10px 10px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.45), inset 0 -6px 12px rgba(0,0,0,0.15);
}
.box-front {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(45deg, rgba(255,255,255,0.06) 0 6px, transparent 6px 12px);
}
.box-base .ribbon-v, .box-lid .ribbon-v {
  position: absolute;
  left: 50%; top: 0; bottom: 0;
  width: 22%;
  transform: translateX(-50%);
  background: linear-gradient(180deg, var(--gold) 0%, var(--gold-deep) 100%);
}
.box-lid {
  position: absolute;
  top: 0; left: -4%;
  width: 108%;
  height: 38%;
  background: linear-gradient(135deg, var(--pink-deep) 0%, var(--pink) 100%);
  border-radius: 8px;
  box-shadow: 0 10px 20px rgba(0,0,0,0.35);
  transform-origin: 50% 100%;
  transition: transform 1s cubic-bezier(.6,-0.2,.3,1.4), opacity 0.6s ease 0.4s;
  z-index: 3;
}
.gift-box.open .box-lid {
  transform: translateY(-140px) rotateX(-100deg);
  opacity: 0;
}

.bow {
  position: absolute;
  top: -34px; left: 50%;
  transform: translateX(-50%);
  width: 90px; height: 60px;
}
.bow span {
  position: absolute;
  top: 10px;
  width: 42px; height: 42px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-deep) 100%);
  border-radius: 50% 50% 50% 0;
}
.bow span:first-child { left: 0; transform: rotate(45deg); }
.bow span:last-child { right: 0; transform: rotate(-45deg) scaleX(-1); border-radius: 50% 50% 50% 0; }
.bow-knot {
  position: absolute;
  top: 18px; left: 50%;
  transform: translateX(-50%);
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--gold-deep);
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.gift-box.open { animation: none; }
.gift-box.open .box-base {
  animation: box-shake 0.5s ease;
}
@keyframes box-shake {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-3deg); }
  75% { transform: rotate(3deg); }
}

.gift-cta {
  color: var(--rose);
  font-size: 0.95rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  opacity: 0.85;
  animation: pulse-cta 1.8s ease-in-out infinite;
}
@keyframes pulse-cta { 0%,100% { opacity: 0.5; } 50% { opacity: 1; } }

/* burst light when opened */
.gift-box.open::after {
  content: "";
  position: absolute;
  left: 50%; top: 30%;
  width: 10px; height: 10px;
  background: radial-gradient(circle, #fff 0%, rgba(255,255,255,0) 70%);
  transform: translate(-50%, -50%);
  animation: burst 0.8s ease-out forwards;
}
@keyframes burst {
  0% { width: 10px; height: 10px; opacity: 1; }
  100% { width: 600px; height: 600px; opacity: 0; }
}

/* ================= SCENE 1 : HERO ================= */
#hero {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #fff0f4 0%, #ffe3ea 45%, #ffd6e6 100%);
}
.hidden { opacity: 0; }

.balloons { position: absolute; inset: 0; pointer-events: none; }
.balloon {
  position: absolute;
  bottom: -200px;
  width: 60px; height: 76px;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  animation: rise linear infinite;
  opacity: 0.85;
}
.balloon::after {
  content: "";
  position: absolute;
  bottom: -22px; left: 50%;
  width: 1px; height: 22px;
  background: rgba(74,37,69,0.3);
}
.b1 { left: 8%;  background: var(--pink);   animation-duration: 14s; animation-delay: 0s; }
.b2 { left: 24%; background: var(--gold);   animation-duration: 18s; animation-delay: 3s; width:48px; height:60px; }
.b3 { left: 55%; background: var(--purple); animation-duration: 16s; animation-delay: 1.5s; }
.b4 { left: 75%; background: var(--rose);   animation-duration: 20s; animation-delay: 4s; width:52px; height:66px; }
.b5 { left: 90%; background: var(--pink-deep); animation-duration: 15s; animation-delay: 2s; }
@keyframes rise {
  0% { transform: translateY(0) translateX(0); }
  50% { transform: translateY(-60vh) translateX(20px); }
  100% { transform: translateY(-115vh) translateX(-10px); }
}

.hero-content { text-align: center; z-index: 2; }
.eyebrow {
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--pink-deep);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.8rem;
}
.hero-name {
  font-size: clamp(3rem, 10vw, 6.5rem);
  color: var(--plum);
  font-weight: 700;
  line-height: 1.05;
}
.hero-name span {
  display: block;
  font-family: 'Great Vibes', cursive;
  color: var(--pink-deep);
  font-size: clamp(3.5rem, 12vw, 7.5rem);
  font-weight: 400;
}
.hero-age {
  margin-top: 1.2rem;
  font-size: 1.2rem;
  color: var(--plum);
  opacity: 0.75;
}

.scroll-down {
  margin-top: 3.5rem;
  display: flex; flex-direction: column; align-items: center; gap: 0.6rem;
  color: var(--pink-deep);
  font-size: 0.8rem;
  letter-spacing: 1px;
}
.mouse {
  width: 24px; height: 38px;
  border: 2px solid var(--pink-deep);
  border-radius: 14px;
  display: flex; justify-content: center; padding-top: 6px;
}
.wheel { width: 4px; height: 8px; background: var(--pink-deep); border-radius: 2px; animation: scrollwheel 1.6s ease infinite; }
@keyframes scrollwheel { 0% { transform: translateY(0); opacity:1; } 100% { transform: translateY(10px); opacity:0; } }

/* ================= SCENE 2 : CAKE ================= */
#cake-scene {
  min-height: 100vh;
  background: linear-gradient(180deg, #ffe3ea 0%, #fff6ef 30%);
  padding-bottom: 5rem;
  display: flex; flex-direction: column; align-items: center;
}

.cake-wrap {
  position: relative;
  margin-top: 3.5rem;
  display: flex; flex-direction: column; align-items: center;
}

.candles { display: flex; gap: 26px; z-index: 5; margin-bottom: -6px; }
.candle {
  width: 10px; height: 46px;
  background: repeating-linear-gradient(180deg, #fff 0 6px, var(--purple) 6px 12px);
  border-radius: 3px;
  position: relative;
  cursor: pointer;
}
.flame {
  position: absolute;
  top: -22px; left: 50%;
  transform: translateX(-50%);
  width: 14px; height: 22px;
  background: radial-gradient(circle at 50% 70%, #fff59d 0%, var(--gold) 45%, #ff7b54 100%);
  border-radius: 50% 50% 50% 50% / 65% 65% 35% 35%;
  animation: flicker 0.4s ease-in-out infinite alternate;
  transition: opacity 0.3s ease, transform 0.3s ease;
  filter: drop-shadow(0 0 8px rgba(255,180,60,0.8));
}
@keyframes flicker {
  0% { transform: translateX(-50%) rotate(-4deg) scale(1); }
  100% { transform: translateX(-50%) rotate(4deg) scale(1.08); }
}
.candle.blown .flame { opacity: 0; transform: translateX(-50%) scaleY(0); }
.candle.blown::after {
  content: "";
  position: absolute;
  top: -20px; left: 50%;
  width: 3px; height: 14px;
  background: linear-gradient(180deg, rgba(150,150,150,0.6), transparent);
  transform: translateX(-50%);
  animation: smoke 1.2s ease-out forwards;
}
@keyframes smoke {
  0% { opacity: 0.7; transform: translateX(-50%) translateY(0) scaleY(1); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-24px) scaleY(2); }
}

.cake { position: relative; width: 260px; }
.layer { border-radius: 10px 10px 6px 6px; position: relative; }
.layer-top {
  height: 46px;
  background: linear-gradient(180deg, #fff0f4 0%, var(--rose) 100%);
  margin: 0 18px;
}
.icing {
  position: absolute; top: -10px; left: -4px; right: -4px; height: 20px;
  background: var(--white);
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
}
.drip {
  position: absolute; top: 6px; width: 16px; height: 26px;
  background: var(--white);
  border-radius: 0 0 50% 50%;
}
.d1 { left: 6%; } .d2 { left: 32%; height: 34px; } .d3 { left: 60%; } .d4 { left: 84%; height: 30px; }

.layer-mid {
  height: 62px;
  background: linear-gradient(180deg, var(--pink) 0%, var(--pink-deep) 100%);
  margin: 0 6px;
  box-shadow: inset 0 -10px 14px rgba(0,0,0,0.12);
}
.layer-base {
  height: 74px;
  width: 100%;
  background: linear-gradient(180deg, var(--purple) 0%, #8f5fc4 100%);
  box-shadow: inset 0 -12px 16px rgba(0,0,0,0.15);
}
.plate {
  width: 300px; height: 16px;
  margin-left: -20px;
  background: linear-gradient(180deg, #f1e2ea, #d8c4d3);
  border-radius: 50%;
  box-shadow: 0 10px 20px rgba(0,0,0,0.15);
}

.wish-msg {
  margin-top: 2.4rem;
  font-family: 'Great Vibes', cursive;
  font-size: 1.8rem;
  color: var(--pink-deep);
  min-height: 2.4rem;
  opacity: 0;
  transition: opacity 0.6s ease;
}
.wish-msg.show { opacity: 1; }

/* ================= SCENE 3 : GALLERY ================= */
#gallery-scene {
  min-height: 100vh;
  background: linear-gradient(180deg, #fff6ef 0%, #ffeef5 100%);
  display: flex; flex-direction: column; align-items: center;
  padding-bottom: 5rem;
}
.polaroid-stack {
  margin-top: 3.5rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2.5rem;
  padding: 0 1.5rem;
}
.polaroid {
  background: var(--white);
  padding: 14px 14px 20px;
  width: 240px;
  box-shadow: 0 15px 30px rgba(0,0,0,0.15);
  border-radius: 4px;
  transition: transform 0.35s ease, box-shadow 0.35s ease;
  cursor: default;
}
.p1 { transform: rotate(-6deg); }
.p2 { transform: rotate(4deg); }
.p3 { transform: rotate(-2deg); }
.polaroid:hover { transform: rotate(0deg) scale(1.06) translateY(-8px); box-shadow: 0 25px 40px rgba(0,0,0,0.22); z-index: 5; }
.polaroid img { width: 100%; height: 260px; object-fit: cover; border-radius: 2px; }
.polaroid p { text-align: center; margin-top: 12px; font-family: 'Great Vibes', cursive; font-size: 1.25rem; color: var(--plum); }
.polaroid.empty { display: flex; flex-direction: column; }
.placeholder {
  width: 100%; height: 260px;
  border-radius: 2px;
  background: linear-gradient(135deg, #ffe3ea, #ffd0dd);
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem;
}

/* ================= SCENE 4 : LETTER ================= */
#letter-scene {
  min-height: 100vh;
  background: linear-gradient(180deg, #ffeef5 0%, #f3e6f9 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 5rem 1.5rem;
}
.envelope-wrap { display: flex; flex-direction: column; align-items: center; gap: 1.4rem; }

.envelope {
  --w: 320px; --h: 210px;
  width: var(--w); height: var(--h);
  position: relative;
  cursor: pointer;
}
.envelope-back {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, #f3d9e6, #e9c4dc);
  border-radius: 8px;
  box-shadow: 0 20px 40px rgba(74,37,69,0.25);
  z-index: 0;
}
/* kertas kecil yang mengintip keluar saat amplop dibuka (dekoratif saja) */
.letter-peek {
  position: absolute;
  left: 12%; right: 12%;
  bottom: 10%;
  height: 70%;
  background: var(--white);
  border-radius: 4px;
  box-shadow: 0 10px 20px rgba(0,0,0,0.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
  transform: translateY(0);
  transition: transform 0.9s cubic-bezier(.5,-0.2,.2,1.2);
  z-index: 1;
}
.envelope.open .letter-peek { transform: translateY(-72px); z-index: 3; }

/* ---- MODAL SURAT ---- */
.letter-modal {
  position: fixed;
  inset: 0;
  z-index: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(46, 23, 48, 0.55);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}
.letter-modal.show { opacity: 1; visibility: visible; }

.letter-card {
  position: relative;
  width: min(620px, 100%);
  max-height: 85vh;
  overflow-y: auto;
  background: linear-gradient(180deg, #fffdfb 0%, var(--white) 100%);
  border-radius: 14px;
  padding: 3rem 2.6rem 2.6rem;
  box-shadow: 0 30px 70px rgba(46,23,48,0.4);
  transform: translateY(30px) scale(0.94);
  transition: transform 0.5s cubic-bezier(.2,.9,.3,1.2);
  border-top: 6px solid var(--pink);
}
.letter-modal.show .letter-card { transform: translateY(0) scale(1); }

.letter-close {
  position: absolute;
  top: 12px; right: 16px;
  background: none;
  border: none;
  font-size: 2rem;
  line-height: 1;
  color: var(--pink-deep);
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 50%;
  transition: background 0.25s ease;
}
.letter-close:hover { background: rgba(232,93,143,0.12); }

.letter-greeting {
  font-family: 'Great Vibes', cursive;
  font-size: 2.2rem;
  color: var(--pink-deep);
  margin-bottom: 1.4rem;
}
.letter-body {
  font-size: 1.05rem;
  line-height: 1.95;
  color: var(--text);
  margin-bottom: 1.2rem;
}
.letter-signature {
  margin-top: 1.4rem;
  font-family: 'Great Vibes', cursive;
  font-size: 1.8rem;
  color: var(--purple);
  text-align: right;
}

.envelope-front {
  position: absolute; inset: 0;
  pointer-events: none;
}
.envelope-pocket {
  position: absolute;
  inset: 0;
  background: var(--pink-deep);
  border-radius: 8px;
  z-index: 2;
  box-shadow: inset 0 8px 12px rgba(74,37,69,0.15);
}
.envelope-flap {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 0; width: 0;
  margin: 0 auto;
  border-left: 160px solid transparent;
  border-right: 160px solid transparent;
  border-top: 110px solid var(--pink);
  filter: drop-shadow(0 6px 10px rgba(74,37,69,0.2));
  transform-origin: top center;
  transition: transform 0.9s cubic-bezier(.6,-0.2,.3,1.3);
  z-index: 4;
}
.heart-seal {
  position: absolute;
  top: 34%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.8rem;
  z-index: 5;
  filter: drop-shadow(0 3px 4px rgba(0,0,0,0.25));
}

.envelope.open .envelope-flap { transform: rotateX(180deg); }
.envelope.open .heart-seal { opacity: 0; transition: opacity 0.3s ease; }

/* ================= FOOTER ================= */
#footer-scene {
  position: relative;
  min-height: 60vh;
  background: linear-gradient(180deg, #f3e6f9 0%, #2e1730 100%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  overflow: hidden;
  padding: 3rem 1.5rem;
}
.footer-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  color: var(--white);
  text-align: center;
  z-index: 2;
}
.footer-sub {
  margin-top: 0.6rem;
  color: var(--rose);
  font-family: 'Great Vibes', cursive;
  font-size: 1.3rem;
  z-index: 2;
}
.floating-hearts { position: absolute; inset: 0; pointer-events: none; }
.floating-hearts span {
  position: absolute;
  bottom: -40px;
  font-size: 1.4rem;
  opacity: 0.8;
  animation: floatHeart linear infinite;
}
@keyframes floatHeart {
  0% { transform: translateY(0) translateX(0) rotate(0deg); opacity: 0.9; }
  100% { transform: translateY(-70vh) translateX(20px) rotate(20deg); opacity: 0; }
}

/* ================= RESPONSIVE ================= */
@media (max-width: 480px) {
  .gift-box { --box: 140px; }
  .cake { width: 210px; }
  .plate { width: 250px; margin-left: -20px; }
  .envelope { --w: 92vw; --h: 190px; }
  .envelope-flap { border-left-width: 46vw; border-right-width: 46vw; border-top-width: 95px; }
  .envelope::before { border-left-width: 46vw; border-right-width: 46vw; }
}
