:root {
  --cream: #FBF3EF;
  --cream-deep: #F4E9E2;
  --blush: #F4D8DE;
  --rose: #E8B4C4;
  --lavender: #E8C4D8;
  --lavender-deep: #B79FD1;
  --gold: #D9A96C;
  --text: #4A3B4D;
  --text-soft: #7A6580;

  --font-display: "Playfair Display", serif;
  --font-body: "Cormorant Garamond", serif;
  --font-script: "Marck Script", cursive;
}

* { box-sizing: border-box; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: linear-gradient(180deg, var(--cream) 0%, var(--cream-deep) 50%, var(--cream) 100%);
  color: var(--text);
  font-family: var(--font-body);
  overflow-x: hidden;
}

section {
  position: relative;
  padding: 120px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.eyebrow {
  font-family: var(--font-script);
  font-size: 1.6rem;
  color: var(--lavender-deep);
  margin: 0 0 4px;
}

/* ===== Reveal on scroll ===== */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.9s ease var(--d, 0s), transform 0.9s ease var(--d, 0s);
}
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ===== Petals ===== */
.petals {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  overflow: hidden;
}
.petal {
  position: absolute;
  top: -5vh;
  font-size: 1.2rem;
  color: var(--rose);
  opacity: 0.75;
  animation: drift linear infinite;
  will-change: transform;
}
@keyframes drift {
  0%   { transform: translate(0, 0) rotate(0deg); }
  100% { transform: translate(var(--sway, 40px), 110vh) rotate(360deg); }
}

/* ===== Music toggle ===== */
.music-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 20;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid var(--lavender-deep);
  background: rgba(255,255,255,0.75);
  backdrop-filter: blur(6px);
  color: var(--lavender-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(183,159,209,0.35);
  transition: transform 0.3s ease, background 0.3s ease;
}
.music-toggle:hover { transform: scale(1.08); }
.icon-note { width: 22px; height: 22px; }
.music-bars {
  display: none;
  gap: 2px;
  align-items: flex-end;
  height: 14px;
  margin-left: -22px;
}
.music-toggle.playing .icon-note { display: none; }
.music-toggle.playing .music-bars { display: flex; margin-left: 0; }
.music-bars i {
  width: 3px;
  background: var(--lavender-deep);
  animation: bar 0.8s ease-in-out infinite;
}
.music-bars i:nth-child(1) { height: 6px; animation-delay: 0s; }
.music-bars i:nth-child(2) { height: 14px; animation-delay: 0.2s; }
.music-bars i:nth-child(3) { height: 9px; animation-delay: 0.4s; }
@keyframes bar {
  0%, 100% { transform: scaleY(0.5); }
  50% { transform: scaleY(1.2); }
}

/* ===== Hero ===== */
.hero {
  min-height: 100vh;
  justify-content: center;
  position: relative;
}
.hero-glow {
  position: absolute;
  top: 50%; left: 50%;
  width: 700px; height: 700px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(232,196,216,0.55) 0%, rgba(251,243,239,0) 70%);
  z-index: 0;
}
.hero-content { position: relative; z-index: 1; max-width: 720px; }

.hero-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1.25;
  margin: 0 0 28px;
  color: var(--text);
}
.hero-title span { display: block; }
.hero-title .name {
  font-style: italic;
  font-weight: 500;
  color: var(--lavender-deep);
  font-size: clamp(3rem, 9vw, 5.5rem);
  margin-top: 6px;
}

.age-reveal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin: 12px 0 40px;
}
.age-flourish {
  width: 180px;
  color: var(--gold);
  opacity: 0.8;
}
.age-number-wrap {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.age-number {
  font-family: var(--font-display);
  font-size: clamp(4.5rem, 12vw, 7rem);
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
}
.age-label {
  font-family: var(--font-script);
  font-size: 1.6rem;
  color: var(--text-soft);
}

.scroll-hint {
  font-size: 1.1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin: 0;
}
.scroll-arrow {
  margin-top: 8px;
  font-size: 1.4rem;
  color: var(--lavender-deep);
  animation: bounce 2.2s ease-in-out infinite;
}
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(10px); }
}

/* ===== Letter ===== */
.letter-card {
  max-width: 640px;
  background: rgba(255,255,255,0.55);
  border: 1px solid rgba(183,159,209,0.35);
  border-radius: 28px;
  padding: 56px 44px;
  backdrop-filter: blur(4px);
  box-shadow: 0 20px 60px rgba(183,159,209,0.18);
}
.quote-mark {
  display: block;
  font-size: 1.6rem;
  color: var(--gold);
  margin-bottom: 18px;
}
.letter-text {
  font-size: 1.4rem;
  line-height: 1.75;
  color: var(--text);
  margin: 0 0 22px;
}
.letter-signature {
  font-family: var(--font-script);
  font-size: 1.7rem;
  color: var(--lavender-deep);
  margin-top: 10px;
}

/* ===== Wishes ===== */
.section-title {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin-bottom: 56px;
  color: var(--text);
}
.wishes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 28px;
  max-width: 980px;
  width: 100%;
}
.wish-card {
  background: rgba(255,255,255,0.6);
  border: 1px solid rgba(232,180,196,0.4);
  border-radius: 20px;
  padding: 36px 24px;
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}
.wish-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 40px rgba(232,180,196,0.3);
}
.wish-icon {
  display: block;
  font-size: 1.8rem;
  color: var(--rose);
  margin-bottom: 14px;
}
.wish-card p {
  font-size: 1.2rem;
  line-height: 1.5;
  margin: 0;
  color: var(--text);
}

/* ===== Finale ===== */
.finale {
  min-height: 100vh;
  justify-content: center;
}
.candle-scene {
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.candle-scene.blown {
  opacity: 0;
  transform: translateY(-20px) scale(0.95);
  pointer-events: none;
  position: absolute;
}
.cake { width: 360px; max-width: 82vw; height: auto; margin-bottom: 28px; position: relative; }
.flame {
  transform-origin: bottom center;
  animation: flicker 1.4s ease-in-out infinite;
}
@keyframes flicker {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.12, 0.92) rotate(-2deg); }
}
.candle[data-lit="false"] .flame-group { opacity: 0; transition: opacity 0.4s ease; }

.smoke {
  opacity: 0;
  transform-origin: bottom center;
}
.candle[data-lit="false"] .smoke {
  animation: smokeRise 1.6s ease-out forwards;
}
@keyframes smokeRise {
  0%   { opacity: 0.7; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-22px) scale(1.6); }
}

.candle-scene.shaking {
  animation: shake 0.5s ease-in-out;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px) rotate(-0.5deg); }
  40% { transform: translateX(5px) rotate(0.5deg); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}

.blow-flash {
  position: absolute;
  top: 0; left: 50%;
  width: 260px; height: 260px;
  transform: translate(-50%, -30%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,244,224,0.9) 0%, rgba(255,244,224,0) 70%);
  opacity: 0;
  pointer-events: none;
}
.blow-flash.flash {
  animation: flashPulse 0.7s ease-out forwards;
}
@keyframes flashPulse {
  0%   { opacity: 0; transform: translate(-50%, -30%) scale(0.6); }
  35%  { opacity: 1; transform: translate(-50%, -30%) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -30%) scale(1.4); }
}

.finale-hint {
  font-size: 1.3rem;
  color: var(--text-soft);
  margin: 0 0 26px;
}
.blow-btn {
  font-family: var(--font-body);
  font-size: 1.15rem;
  padding: 16px 38px;
  border-radius: 999px;
  border: 1px solid var(--lavender-deep);
  background: var(--lavender-deep);
  color: #fff;
  cursor: pointer;
  transition: transform 0.3s ease, background 0.3s ease;
}
.blow-btn:hover { transform: translateY(-3px); background: #A489C4; }

.finale-message {
  display: none;
  max-width: 620px;
  animation: fadeUp 1s ease forwards;
}
.finale-message.show { display: block; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}
.finale-title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.7rem, 4vw, 2.5rem);
  color: var(--text);
  margin: 6px 0 20px;
}
.finale-text {
  font-size: 1.35rem;
  line-height: 1.6;
  color: var(--text-soft);
}
.finale-heart {
  font-size: 2rem;
  color: var(--rose);
  margin-top: 18px;
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* ===== Confetti hearts (JS-injected) ===== */
.confetti-heart {
  position: fixed;
  top: -5vh;
  z-index: 15;
  pointer-events: none;
  font-size: 1.4rem;
  color: var(--rose);
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  to { transform: translateY(110vh) rotate(540deg); opacity: 0.2; }
}

@media (max-width: 600px) {
  section { padding: 90px 18px; }
  .letter-card { padding: 40px 26px; }
}