/* ==========================================================================
   ELIL & ELITE - Animations, Micro-Interactions & View Transitions
   ========================================================================== */

/* 1. View Transitions API (Fluid Smooth Navigation Across Clean URLs) */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-8px);
  }
}

::view-transition-old(root) {
  animation: 0.25s cubic-bezier(0.16, 1, 0.3, 1) both fadeOut;
}

::view-transition-new(root) {
  animation: 0.35s cubic-bezier(0.16, 1, 0.3, 1) both fadeIn;
}

/* 2. Floating Animation for Badges & Cards */
@keyframes floatSlow {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
  }
  50% {
    transform: translateY(-8px) rotate(0.5deg);
  }
}

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

.hero-floating-card.card-top {
  animation: floatSlow 6s ease-in-out infinite;
}

.hero-floating-card.card-bottom {
  animation: floatSlow 7s ease-in-out infinite 1s;
}

/* 3. WhatsApp Pulsing Animation */
@keyframes pulseGlow {
  0% {
    box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7);
  }
  70% {
    box-shadow: 0 0 0 14px rgba(37, 211, 102, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(37, 211, 102, 0);
  }
}

@keyframes dotPulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.4;
    transform: scale(0.85);
  }
}

.floating-whatsapp {
  animation: pulseGlow 2.5s infinite;
}

.whatsapp-pulse-dot {
  animation: dotPulse 1.5s infinite ease-in-out;
}

/* 4. Gold Shimmer Effect for Luxury Buttons */
@keyframes goldShimmer {
  0% {
    background-position: -200% center;
  }
  100% {
    background-position: 200% center;
  }
}

.btn-gold-shimmer {
  background: linear-gradient(
    90deg, 
    #D6B056 0%, 
    #FFF3D1 25%, 
    #D6B056 50%, 
    #FFF3D1 75%, 
    #D6B056 100%
  );
  background-size: 200% auto;
  animation: goldShimmer 4s linear infinite;
  color: #171918;
  font-weight: 700;
}

/* 5. Luxury Background Radial Halo Glows */
@keyframes haloGlow {
  0%, 100% {
    opacity: 0.6;
    transform: scale(1);
  }
  50% {
    opacity: 0.9;
    transform: scale(1.1);
  }
}

.hero-glow-halo {
  position: absolute;
  top: 15%;
  right: 5%;
  width: 480px;
  height: 480px;
  background: radial-gradient(circle, rgba(201, 162, 77, 0.18) 0%, rgba(229, 180, 178, 0.12) 50%, transparent 70%);
  border-radius: 50%;
  filter: blur(50px);
  z-index: 0;
  pointer-events: none;
  animation: haloGlow 8s ease-in-out infinite alternate;
}

/* 6. Modern Dialog Top-Layer Animations */
dialog#productModal {
  transition: 
    opacity 0.35s ease-out,
    transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
    display 0.35s allow-discrete,
    overlay 0.35s allow-discrete;
  opacity: 0;
  transform: scale(0.95) translateY(15px);
}

dialog#productModal[open] {
  opacity: 1;
  transform: scale(1) translateY(0);
}

@starting-style {
  dialog#productModal[open] {
    opacity: 0;
    transform: scale(0.95) translateY(15px);
  }
}

dialog#productModal::backdrop {
  transition: 
    display 0.35s allow-discrete,
    overlay 0.35s allow-discrete,
    background-color 0.35s ease-out,
    backdrop-filter 0.35s ease-out;
  background-color: rgba(13, 22, 18, 0);
  backdrop-filter: blur(0px);
}

dialog#productModal[open]::backdrop {
  background-color: rgba(13, 22, 18, 0.75);
  backdrop-filter: blur(8px);
}

@starting-style {
  dialog#productModal[open]::backdrop {
    background-color: rgba(13, 22, 18, 0);
    backdrop-filter: blur(0px);
  }
}

/* 7. Scroll Reveal Classes (IntersectionObserver) */
.reveal-item {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.reveal-item.revealed {
  opacity: 1;
  transform: translateY(0);
}

.reveal-delay-1 {
  transition-delay: 0.1s;
}

.reveal-delay-2 {
  transition-delay: 0.2s;
}

.reveal-delay-3 {
  transition-delay: 0.3s;
}

.reveal-delay-4 {
  transition-delay: 0.4s;
}

/* 8. Spinner Animation */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #FFF;
  animation: spin 0.8s linear infinite;
}

/* 9. Reduced Motion Accessibility */
@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;
  }

  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none !important;
  }

  .hero-floating-card.card-top,
  .hero-floating-card.card-bottom,
  .floating-whatsapp,
  .whatsapp-pulse-dot,
  .hero-glow-halo {
    animation: none !important;
  }

  dialog#productModal,
  dialog#productModal[open],
  .reveal-item {
    transition: opacity 0.1s ease !important;
    transform: none !important;
  }
}
