:root {
  --page-bg: #0d0714;
  --surface: rgba(30, 17, 43, 0.72);
  --surface-strong: rgba(42, 22, 55, 0.82);
  --rose: #f472b6;
  --rose-light: #fbcfe8;
  --purple: #a78bfa;
  --gold: #facc15;
  --text: #f8fafc;
  --muted: #cbd5e1;
  --border: rgba(251, 113, 133, 0.2);
  --shadow: 0 24px 64px rgba(4, 2, 9, 0.42);
}

html {
  scroll-behavior: smooth;
  background: var(--page-bg);
}

* {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

body {
  min-width: 320px;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  font-family: "Hind Siliguri", sans-serif;
  text-rendering: optimizeLegibility;
  background:
    radial-gradient(circle at 8% 4%, rgba(244, 114, 182, 0.17), transparent 28rem),
    radial-gradient(circle at 92% 26%, rgba(167, 139, 250, 0.12), transparent 26rem),
    radial-gradient(circle at 48% 92%, rgba(190, 24, 93, 0.1), transparent 32rem),
    var(--page-bg);
}

body::before {
  position: fixed;
  z-index: 0;
  inset: 0;
  pointer-events: none;
  content: "";
  opacity: 0.34;
  background-image: radial-gradient(rgba(255, 255, 255, 0.13) 0.6px, transparent 0.7px);
  background-size: 7px 7px;
  mask-image: linear-gradient(to bottom, black, transparent 75%);
}

.font-tiro {
  font-family: "Tiro Bangla", serif;
}

.font-outfit {
  font-family: "Outfit", sans-serif;
}

.font-bengali {
  font-family: "Hind Siliguri", sans-serif;
}

::selection {
  color: #fff;
  background: #db2777;
}

:focus-visible {
  outline: 3px solid rgba(253, 164, 175, 0.9);
  outline-offset: 4px;
}

.content-layer {
  position: relative;
  z-index: 10;
}

.content-layer > section {
  scroll-margin-top: 5.75rem;
}

/* Frosted surfaces */
.glass-card {
  position: relative;
  isolation: isolate;
  border: 1px solid var(--border);
  background: linear-gradient(140deg, rgba(55, 31, 72, 0.8), var(--surface));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(125%);
  -webkit-backdrop-filter: blur(18px) saturate(125%);
}

.glass-card::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  content: "";
  opacity: 0.55;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.1),
    transparent 30%,
    transparent 72%,
    rgba(244, 114, 182, 0.08)
  );
}

.glass-card-hover,
#interactive-card,
#envelope-box,
#cake-container,
#music-btn {
  transition:
    transform 280ms cubic-bezier(0.2, 0.8, 0.2, 1),
    border-color 280ms ease,
    box-shadow 280ms ease,
    background-color 280ms ease;
}

@media (hover: hover) {
  .glass-card-hover:hover,
  #interactive-card:hover,
  #envelope-box:hover {
    transform: translateY(-5px);
    border-color: rgba(251, 113, 133, 0.56);
    box-shadow: 0 28px 64px -24px rgba(244, 114, 182, 0.62);
  }

  #cake-container:hover {
    transform: translateY(-3px) scale(1.02);
  }

  #music-btn:hover {
    transform: translateY(-2px);
    border-color: rgba(251, 113, 133, 0.62);
    box-shadow: 0 18px 35px rgba(105, 16, 61, 0.38);
  }
}

/* Bengali glyphs need generous vertical breathing room. */
.text-gradient-rose,
.text-gradient-gold {
  display: inline-block;
  padding-block: 0.13em 0.08em;
  line-height: 1.34;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.text-gradient-rose {
  background-image: linear-gradient(135deg, #ffe4f0 0%, #f472b6 46%, #fb7185 100%);
}

.text-gradient-gold {
  background-image: linear-gradient(135deg, #fef9c3 0%, #facc15 52%, #fb923c 100%);
}

.rose-glow {
  box-shadow: 0 0 32px rgba(236, 72, 153, 0.38);
}

.gold-glow {
  box-shadow: 0 0 28px rgba(250, 204, 21, 0.32);
}

@keyframes floatSlow {
  0%,
  100% {
    transform: translate3d(0, 0, 0) rotate(0);
  }

  50% {
    transform: translate3d(0, -9px, 0) rotate(1.5deg);
  }
}

.animate-float {
  animation: floatSlow 5s ease-in-out infinite;
}

@keyframes flameFlicker {
  0%,
  100% {
    opacity: 0.95;
    transform: scale(1) rotate(-1deg);
  }

  25% {
    opacity: 1;
    transform: scale(1.08) rotate(1deg);
  }

  50% {
    opacity: 0.86;
    transform: scale(0.94) rotate(-2deg);
  }

  75% {
    opacity: 0.98;
    transform: scale(1.05) rotate(2deg);
  }
}

.flame-active {
  transform-origin: center bottom;
  filter: drop-shadow(0 0 8px #f59e0b) drop-shadow(0 0 18px #ef4444);
  animation: flameFlicker 0.85s ease-in-out infinite;
}

#candle-flame {
  transition:
    opacity 420ms ease,
    transform 420ms cubic-bezier(0.2, 0.8, 0.2, 1),
    filter 420ms ease;
}

#candle-flame.is-extinguished {
  opacity: 0 !important;
  filter: none;
  transform: scale(0.15) translateY(-18px) !important;
  animation: none;
}

@keyframes cakeCelebrate {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }

  40% {
    transform: translateY(-7px) scale(1.045);
  }

  70% {
    transform: translateY(1px) scale(0.985);
  }
}

#cake-container.is-celebrating {
  animation: cakeCelebrate 640ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes revealLetter {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#tap-text {
  transition:
    opacity 220ms ease,
    transform 220ms ease;
}

#letter-content:not(.hidden) {
  animation: revealLetter 520ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

#interactive-card,
#cake-container,
#envelope-box {
  outline: none;
  user-select: none;
  -webkit-user-select: none;
}

#music-btn {
  border-color: rgba(251, 113, 133, 0.32);
  background: rgba(35, 20, 48, 0.78);
}

#music-icon-container {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

#cake-container {
  transform-origin: center bottom;
}

img[id^="photo-"] {
  display: block;
  filter: saturate(1.07) contrast(1.03);
}

/* Floating background canvas */
#particle-canvas {
  position: fixed;
  z-index: 20;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #120a1c;
}

::-webkit-scrollbar-thumb {
  border: 2px solid #120a1c;
  border-radius: 999px;
  background: linear-gradient(#7e2258, #ec4899);
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(#a92b6e, #fb7185);
}

@media (max-width: 639px) {
  .content-layer {
    padding-inline: 0.125rem;
  }

  #music-btn {
    padding-inline: 0.875rem;
  }
}

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