/* ==========================================================
   EFFECTS: petals, fireworks canvas, music button
   ========================================================== */

/* ---- PETALS ANIMATION ---- */
.petals {
  position: fixed;
  z-index: 90;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.petal {
  position: absolute;
  top: -40px;
  left: var(--left);
  width: var(--size);
  height: calc(var(--size) * .64);
  border-radius: 80% 10% 70% 20%;
  background: var(--petal-color);
  opacity: 0;
  will-change: transform;
  animation: petalFall var(--duration) linear var(--delay) infinite;
}

@keyframes petalFall {
  0% {
    opacity: 0;
    transform: translate3d(0, -5vh, 0) rotate(0);
  }

  10% {
    opacity: .65;
  }

  100% {
    opacity: 0;
    transform: translate3d(var(--drift), 110vh, 0) rotate(720deg);
  }
}

/* ---- FIREWORKS ---- */
.fireworks-canvas {
  position: fixed;
  z-index: 140;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.firework-button {
  position: fixed;
  z-index: 150;
  right: 24px;
  bottom: max(24px, env(safe-area-inset-bottom));
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 50px;
  padding: 12px 20px;
  border: 1.5px solid #f5e9cf;
  border-radius: 999px;
  color: white;
  background: linear-gradient(135deg, #9b2424, #5c1414 60%, #c89c5a);
  box-shadow: 0 14px 38px rgba(127, 29, 29, .35), inset 0 1px rgba(255, 255, 255, .28);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(22px) scale(.92);
  transition: transform .45s cubic-bezier(.22, .75, .22, 1), opacity .35s ease, box-shadow .25s ease;
}

body.has-entered .firework-button {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

.firework-button:hover,
.firework-button:focus-visible {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 18px 46px rgba(127, 29, 29, .45), 0 0 0 5px rgba(200, 156, 90, .2);
  outline: none;
}

.firework-button svg {
  width: 20px;
  height: 20px;
}

.firework-button span {
  font-family: var(--font-royal);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .15em;
  text-transform: uppercase;
}

/* ---- MUSIC BUTTON ---- */
.music-button {
  position: fixed;
  z-index: 150;
  left: 24px;
  bottom: max(24px, env(safe-area-inset-bottom));
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 50px;
  padding: 12px 20px;
  border: 1.5px solid #c89c5a;
  border-radius: 999px;
  color: #3b1812;
  background: rgba(255, 253, 249, 0.94);
  box-shadow: 0 14px 38px rgba(100, 40, 20, .14);
  backdrop-filter: blur(14px);
  cursor: pointer;
  font-family: var(--font-royal);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px);
  transition: opacity .6s ease, transform .6s ease, background .25s ease;
}

body.has-entered .music-button {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

.music-button:hover {
  background: rgba(255, 255, 255, 1);
  color: var(--crimson);
}

.music-button svg {
  width: 19px;
  height: 19px;
  color: var(--crimson);
}

.music-button .music-off {
  display: none;
}

.music-button.is-muted {
  color: var(--muted);
}

.music-button.is-muted .music-on {
  display: none;
}

.music-button.is-muted .music-off {
  display: block;
}

.music-button.is-playing svg {
  animation: musicPulse 2.4s ease-in-out infinite;
}

@keyframes musicPulse {
  50% {
    transform: scale(1.12);
  }
}
