/* ===========================================
   BIRTHDAY GIFT PAGE — STYLES
   Mobile-first, modern CSS animations
   =========================================== */

/* ---------- CSS Custom Properties ---------- */
:root {
  --clr-primary: #7c3aed;
  --clr-primary-light: #a78bfa;
  --clr-accent: #f472b6;
  --clr-accent-light: #fbcfe8;
  --clr-gold: #fbbf24;
  --clr-warm: #fb923c;
  --clr-bg-start: #a855f7;
  --clr-bg-mid1: #ec4899;
  --clr-bg-mid2: #f59e0b;
  --clr-bg-mid3: #06b6d4;
  --clr-bg-end: #6366f1;
  --clr-text: #1e1b4b;
  --clr-text-light: #6b7280;
  --clr-white: #ffffff;
  --clr-gift-box: #ec4899;
  --clr-gift-lid: #db2777;
  --clr-gift-ribbon: #fbbf24;
  --radius: 1rem;
  --radius-lg: 1.5rem;
  --shadow-soft: 0 4px 24px rgba(124, 58, 237, 0.15);
  --shadow-glow: 0 0 60px 20px rgba(244, 114, 182, 0.3);
  --transition-smooth: 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --font-main: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-fancy: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-script: 'Dancing Script', 'Brush Script MT', cursive;
}

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  color: var(--clr-text);
  overflow-x: hidden;
  min-height: 100dvh;
  /* Animated gradient background */
  background: linear-gradient(
    135deg,
    var(--clr-bg-start),
    var(--clr-bg-mid1),
    var(--clr-bg-mid2),
    var(--clr-bg-mid3),
    var(--clr-bg-end),
    var(--clr-bg-start)
  );
  background-size: 600% 600%;
  animation: gradientShift 15s ease infinite;
}

/* Smooth gradient animation for background */
@keyframes gradientShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ---------- Particles Canvas ---------- */
#particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

/* ---------- Screen Management ---------- */
.screen {
  display: none;
  min-height: 100dvh;
  position: relative;
  z-index: 2;
}

.screen.active {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Celebration screen scrolls instead of centering */
#celebration.active {
  justify-content: flex-start;
  padding: 2rem 1rem 4rem;
  animation: fadeInScreen 0.8s ease-out;
}

@keyframes fadeInScreen {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ---------- Landing Screen ---------- */
.landing-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  padding: 2rem 1.5rem;
  text-align: center;
  position: relative;
}

.landing-title {
  font-size: clamp(1.75rem, 6vw, 3rem);
  font-weight: 800;
  color: var(--clr-white);
  -webkit-text-fill-color: var(--clr-white);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.3), 0 0 40px rgba(255, 255, 255, 0.25);
  animation: titlePulse 3s ease-in-out infinite;
}

@keyframes titlePulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.03); }
}

.landing-prompt {
  font-size: clamp(1rem, 3.5vw, 1.25rem);
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.2);
  animation: promptBounce 2s ease-in-out infinite;
}

@keyframes promptBounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-5px); }
}

/* ---------- Floating Emoji Decorations ---------- */
.floating-emojis {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
}

.float-emoji {
  position: absolute;
  top: -2rem;
  left: var(--x);
  font-size: 1.5rem;
  animation: floatDown 6s var(--delay) ease-in-out infinite;
  opacity: 0.7;
}

@keyframes floatDown {
  0%   { transform: translateY(-10vh) rotate(0deg); opacity: 0; }
  10%  { opacity: 0.7; }
  90%  { opacity: 0.7; }
  100% { transform: translateY(100vh) rotate(360deg); opacity: 0; }
}

/* ============================================
   GIFT BOX — Pure CSS illustration
   ============================================ */
.gift-box {
  position: relative;
  cursor: pointer;
  background: none;
  border: none;
  outline: none;
  width: 160px;
  height: 180px;
  /* Gentle bounce animation before click */
  animation: giftBounce 2s ease-in-out infinite;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.2s ease;
}

.gift-box:hover {
  transform: scale(1.05);
}

.gift-box:focus-visible {
  outline: 3px solid var(--clr-primary-light);
  outline-offset: 8px;
  border-radius: var(--radius);
}

/* Bounce animation for idle gift */
@keyframes giftBounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-12px); }
}

/* --- Gift Lid --- */
.gift-lid {
  position: absolute;
  top: 0;
  left: -8px;
  width: 176px;
  height: 50px;
  z-index: 3;
  transition: all 0.6s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

.gift-lid-top {
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, var(--clr-gift-lid), #be185d);
  border-radius: 10px 10px 4px 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.gift-lid-ribbon {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 100%;
  background: var(--clr-gift-ribbon);
  border-radius: 2px;
}

/* Bow on top of lid */
.gift-lid::before,
.gift-lid::after {
  content: '';
  position: absolute;
  top: -20px;
  width: 40px;
  height: 28px;
  background: var(--clr-gift-ribbon);
  border-radius: 50% 50% 0 50%;
}

.gift-lid::before {
  left: calc(50% - 38px);
  transform: rotate(-15deg);
  border-radius: 50% 50% 50% 0;
}

.gift-lid::after {
  right: calc(50% - 38px);
  transform: rotate(15deg);
}

/* --- Gift Base --- */
.gift-base {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 160px;
  height: 120px;
  background: linear-gradient(180deg, var(--clr-gift-box), #db2777);
  border-radius: 4px 4px 12px 12px;
  box-shadow: 0 8px 24px rgba(236, 72, 153, 0.3);
  z-index: 2;
}

.gift-base-ribbon {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 100%;
  background: var(--clr-gift-ribbon);
}

/* --- Glow behind gift box --- */
.gift-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(244, 114, 182, 0.35) 0%, transparent 70%);
  border-radius: 50%;
  z-index: 0;
  animation: glowPulse 2.5s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.6; }
  50%      { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
}

/* ============================================
   GIFT BOX OPEN STATE
   Applied via .opened class on #gift-box
   ============================================ */
.gift-box.opened {
  animation: none;
}

/* Lid flies up and off */
.gift-box.opened .gift-lid {
  transform: translateY(-120px) rotate(-25deg) scale(0.8);
  opacity: 0;
}

/* Base shakes briefly */
.gift-box.opened .gift-base {
  animation: boxShake 0.4s ease-in-out;
}

@keyframes boxShake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-6px) rotate(-2deg); }
  40%      { transform: translateX(6px) rotate(2deg); }
  60%      { transform: translateX(-4px) rotate(-1deg); }
  80%      { transform: translateX(4px) rotate(1deg); }
}

/* Glow intensifies on open */
.gift-box.opened .gift-glow {
  animation: glowBurst 0.6s ease-out forwards;
}

@keyframes glowBurst {
  0%   { transform: translate(-50%, -50%) scale(1); opacity: 0.6; }
  50%  { transform: translate(-50%, -50%) scale(2.5); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(3); opacity: 0; }
}

/* ============================================
   CELEBRATION SCREEN
   ============================================ */

/* --- Birthday Message --- */
.birthday-message {
  text-align: center;
  max-width: 600px;
  margin: 0 auto 2rem;
  padding: 2rem 1.5rem;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(255, 255, 255, 0.4);
  opacity: 0;
  transform: translateY(30px);
  animation: messageReveal 1s 0.3s ease-out forwards;
}

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

.message-sparkle {
  font-size: 2rem;
  margin: 0.5rem 0;
}

.message-title {
  font-size: clamp(1.75rem, 7vw, 2.75rem);
  font-weight: 800;
  background: linear-gradient(135deg, var(--clr-primary), var(--clr-accent), var(--clr-gold));
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmerText 3s linear infinite;
  margin-bottom: 0.75rem;
}

@keyframes shimmerText {
  to { background-position: 200% center; }
}

.message-body {
  font-family: var(--font-fancy);
  font-size: clamp(1.05rem, 3.8vw, 1.25rem);
  line-height: 1.8;
  color: var(--clr-text);
  font-style: italic;
}

/* --- Slideshow Container --- */
.slideshow-container {
  width: 100%;
  max-width: 640px;
  margin: 0 auto 2rem;
  opacity: 0;
  transform: translateY(20px);
  animation: slideIn 0.8s 1.2s ease-out forwards;
}

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

/* Swiper customization */
.swiper {
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.92);
}

.slide-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 0.5rem 1rem;
}

.slide-img {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 65vh;
  object-fit: contain;
  display: block;
  /* Picture frame effect */
  border: 6px solid #c9a96e;
  border-radius: 4px;
  outline: 3px solid #a07c4a;
  outline-offset: -1px;
  box-shadow:
    /* Inner bevel highlight */
    inset 0 0 0 1px rgba(255, 255, 255, 0.35),
    inset 0 2px 4px rgba(255, 255, 255, 0.2),
    inset 0 -2px 4px rgba(0, 0, 0, 0.15),
    /* Outer frame shadow */
    0 4px 12px rgba(0, 0, 0, 0.2),
    0 2px 4px rgba(0, 0, 0, 0.15);
  /* Subtle gold gradient on the border via background-clip trick */
  background:
    linear-gradient(145deg, #dfc087, #b8924a, #dfc087) padding-box,
    linear-gradient(145deg, #e8d5a3, #9a7235, #e8d5a3) border-box;
  padding: 4px;
}

.slide-caption {
  font-family: var(--font-script);
  margin-top: 0.75rem;
  font-size: clamp(1.1rem, 3.5vw, 1.4rem);
  color: var(--clr-text-light);
  font-weight: 700;
  text-align: center;
}

/* ============================================
   PER-SLIDE ENTRANCE ANIMATIONS
   Each slide gets a unique entrance via a
   data-anim attribute set by JS on transition.
   ============================================ */
.slide-inner {
  opacity: 0;
  transition: none;
}

/* Active slide plays its assigned animation */
.swiper-slide-active .slide-inner {
  opacity: 1;
}

/* 1 — Zoom in from small + fade */
.swiper-slide-active .slide-inner[data-anim="zoom-in"] {
  animation: animZoomIn 1s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}
@keyframes animZoomIn {
  from { opacity: 0; transform: scale(0.6); }
  to   { opacity: 1; transform: scale(1); }
}

/* 2 — Slide up from below + fade */
.swiper-slide-active .slide-inner[data-anim="slide-up"] {
  animation: animSlideUp 1s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}
@keyframes animSlideUp {
  from { opacity: 0; transform: translateY(60px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* 3 — Rotate in from slight tilt */
.swiper-slide-active .slide-inner[data-anim="rotate-in"] {
  animation: animRotateIn 1.1s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}
@keyframes animRotateIn {
  from { opacity: 0; transform: rotate(-8deg) scale(0.85); }
  to   { opacity: 1; transform: rotate(0deg) scale(1); }
}

/* 4 — Flip in on Y axis */
.swiper-slide-active .slide-inner[data-anim="flip-in"] {
  animation: animFlipIn 1.1s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
  perspective: 800px;
}
@keyframes animFlipIn {
  from { opacity: 0; transform: perspective(800px) rotateY(-60deg); }
  to   { opacity: 1; transform: perspective(800px) rotateY(0deg); }
}

/* 5 — Pop in with overshoot bounce */
.swiper-slide-active .slide-inner[data-anim="pop-in"] {
  animation: animPopIn 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes animPopIn {
  from { opacity: 0; transform: scale(0.3); }
  50%  { opacity: 1; transform: scale(1.08); }
  to   { opacity: 1; transform: scale(1); }
}

/* 6 — Slide in from the left */
.swiper-slide-active .slide-inner[data-anim="slide-left"] {
  animation: animSlideLeft 1s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}
@keyframes animSlideLeft {
  from { opacity: 0; transform: translateX(-80px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* 7 — Slide in from the right */
.swiper-slide-active .slide-inner[data-anim="slide-right"] {
  animation: animSlideRight 1s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}
@keyframes animSlideRight {
  from { opacity: 0; transform: translateX(80px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* 8 — Fade + blur reveal */
.swiper-slide-active .slide-inner[data-anim="blur-in"] {
  animation: animBlurIn 1.1s ease-out forwards;
}
@keyframes animBlurIn {
  from { opacity: 0; filter: blur(12px); transform: scale(1.05); }
  to   { opacity: 1; filter: blur(0); transform: scale(1); }
}

/* 9 — Drop in from above */
.swiper-slide-active .slide-inner[data-anim="drop-in"] {
  animation: animDropIn 1s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes animDropIn {
  from { opacity: 0; transform: translateY(-70px) scale(0.9); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Swiper pagination dots */
.swiper-pagination-bullet {
  background: var(--clr-accent) !important;
  opacity: 0.4 !important;
  width: 10px !important;
  height: 10px !important;
  transition: all 0.3s ease !important;
}

.swiper-pagination-bullet-active {
  opacity: 1 !important;
  transform: scale(1.3) !important;
  background: var(--clr-primary) !important;
}

/* Swiper nav arrows */
.swiper-button-prev,
.swiper-button-next {
  color: var(--clr-primary) !important;
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

.swiper-button-prev:hover,
.swiper-button-next:hover {
  opacity: 1;
}

/* Hide arrows on very small screens — use swipe instead */
@media (max-width: 480px) {
  .swiper-button-prev,
  .swiper-button-next {
    display: none !important;
  }
}

/* --- Closing Message --- */
.closing-message {
  text-align: center;
  padding: 1.5rem;
  opacity: 0;
  animation: slideIn 0.8s 2s ease-out forwards;
}

.closing-message p {
  font-size: clamp(1rem, 3.5vw, 1.2rem);
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.25);
}

/* --- Replay Button --- */
.replay-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 1rem auto;
  padding: 0.75rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--clr-white);
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  opacity: 0;
  animation: slideIn 0.6s 2.5s ease-out forwards;
  -webkit-tap-highlight-color: transparent;
}

.replay-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(124, 58, 237, 0.4);
}

.replay-btn:active {
  transform: scale(0.97);
}

/* --- Secret Message Button --- */
.secret-msg-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem auto 1rem;
  padding: 0.65rem 1.75rem;
  font-family: var(--font-script);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--clr-white);
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 2px dashed rgba(53, 75, 235, 0.6);
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  opacity: 0;
  animation: slideIn 0.6s 3s ease-out forwards;
  -webkit-tap-highlight-color: transparent;
}

.secret-msg-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 18px rgba(244, 114, 182, 0.35);
  border-color: var(--clr-primary);
}

.secret-msg-btn:active {
  transform: scale(0.97);
}

/* ============================================
   SOUND TOGGLE
   ============================================ */
.sound-toggle {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 100;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  /* Hidden until audio starts */
  opacity: 0;
  pointer-events: none;
}

.sound-toggle.visible {
  opacity: 1;
  pointer-events: auto;
  animation: fadeInBounce 0.4s ease-out;
}

@keyframes fadeInBounce {
  0%   { opacity: 0; transform: scale(0.5); }
  70%  { transform: scale(1.1); }
  100% { opacity: 1; transform: scale(1); }
}

.sound-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* Toggle icon visibility based on mute state */
.sound-toggle .sound-off {
  display: none;
}

.sound-toggle.muted .sound-on {
  display: none;
}

.sound-toggle.muted .sound-off {
  display: inline;
}

/* ============================================
   EASTER EGG OVERLAY
   ============================================ */
.easter-egg {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.easter-egg.visible {
  opacity: 1;
  pointer-events: auto;
}

.easter-egg-content {
  background: var(--clr-white);
  padding: 2.5rem 2rem;
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
  max-width: 340px;
  text-align: center;
  position: relative;
  transform: scale(0.85);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.easter-egg.visible .easter-egg-content {
  transform: scale(1);
}

.easter-egg-text {
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--clr-text);
}

.easter-egg-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #f3e8ff;
  color: var(--clr-text);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.easter-egg-close:hover {
  background: #fbcfe8;
}

/* ============================================
   UTILITY & RESPONSIVE
   ============================================ */

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  body {
    animation: none;
  }
}

/* Desktop enhancements */
@media (min-width: 768px) {
  .gift-box {
    width: 200px;
    height: 220px;
  }

  .gift-lid {
    width: 216px;
    height: 60px;
  }

  .gift-base {
    width: 200px;
    height: 150px;
  }

  .gift-lid-ribbon,
  .gift-base-ribbon {
    width: 36px;
  }

  .gift-lid::before,
  .gift-lid::after {
    width: 48px;
    height: 32px;
    top: -24px;
  }

  .birthday-message {
    padding: 3rem 2.5rem;
  }

  #celebration.active {
    padding: 3rem 2rem 5rem;
  }
}

/* Very small screens */
@media (max-width: 360px) {
  .landing-content {
    padding: 1.5rem 1rem;
  }

  .birthday-message {
    padding: 1.5rem 1rem;
  }
}
