/* =====================================================
   KOTUVIA — Animations CSS
   Micro-animaciones y transiciones premium
   ===================================================== */

/* =====================================================
   1. SCROLL REVEAL (clase .reveal gestionada por JS)
   ===================================================== */
.reveal {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.75s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              transform 0.75s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Variantes de reveal */
.reveal--left  { transform: translateX(-32px); }
.reveal--right { transform: translateX(32px); }
.reveal--scale { transform: scale(0.92); }

.reveal--left.is-visible,
.reveal--right.is-visible,
.reveal--scale.is-visible {
  transform: none;
}

/* Delays escalonados */
.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; }
.reveal-delay-5 { transition-delay: 0.5s; }
.reveal-delay-6 { transition-delay: 0.6s; }

/* =====================================================
   2. PARTÍCULAS / BRILLOS DEL HERO
   ===================================================== */
.kotuvia-sparkles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

.kotuvia-sparkles__dot {
  position: absolute;
  border-radius: 50%;
  background: rgba(232, 213, 168, 0.6);
  animation: sparkle-float var(--dur, 4s) ease-in-out var(--del, 0s) infinite;
}

@keyframes sparkle-float {
  0%, 100% {
    opacity: 0;
    transform: translateY(0) scale(0.5);
  }
  30% { opacity: 0.8; }
  50% {
    opacity: 1;
    transform: translateY(-20px) scale(1);
  }
  70% { opacity: 0.6; }
}

/* Línea decorativa animada */
.kotuvia-deco-line {
  display: block;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--k-gold) 0%, var(--k-gold-light) 100%);
  transition: width 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  margin: 1.25rem 0;
}

.kotuvia-deco-line.is-visible { width: 60px; }

/* =====================================================
   3. HOVER SHIMMER EN TARJETAS
   ===================================================== */
.kotuvia-product-card,
.woocommerce ul.products li.product {
  position: relative;
  overflow: hidden;
}

.kotuvia-product-card::before {
  content: '';
  position: absolute;
  top: -100%;
  left: -100%;
  width: 80px;
  height: 200%;
  background: linear-gradient(
    105deg,
    transparent 40%,
    rgba(232, 213, 168, 0.25) 50%,
    transparent 60%
  );
  transform: rotate(-45deg);
  transition: none;
  z-index: 3;
  pointer-events: none;
}

.kotuvia-product-card:hover::before {
  animation: shimmer 0.75s ease forwards;
}

@keyframes shimmer {
  0%   { top: -100%; left: -100%; }
  100% { top: 100%;  left: 200%; }
}

/* =====================================================
   4. PULSE EN BOTONES (CTA PRINCIPAL)
   ===================================================== */
.kotuvia-btn-primary .wp-block-button__link,
.kotuvia-pulse {
  position: relative;
  overflow: visible;
}

.kotuvia-btn-primary .wp-block-button__link::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  border: 2px solid var(--k-gold);
  animation: pulse-ring 2.5s ease-out infinite;
  pointer-events: none;
}

@keyframes pulse-ring {
  0%   { transform: scale(1); opacity: 0.6; }
  70%  { transform: scale(1.12); opacity: 0; }
  100% { transform: scale(1.12); opacity: 0; }
}

/* =====================================================
   5. LOADER / SKELETON
   ===================================================== */
.kotuvia-skeleton {
  background: linear-gradient(
    90deg,
    var(--k-surface) 25%,
    var(--k-gold-light) 50%,
    var(--k-surface) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-wave 1.4s infinite ease;
  border-radius: var(--k-r-md);
}

@keyframes skeleton-wave {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* =====================================================
   6. ANIMACIÓN DEL LOGO
   ===================================================== */
.kotuvia-logo img,
.kotuvia-logo .custom-logo {
  transition: transform 0.4s var(--k-ease), filter 0.4s ease;
}

.kotuvia-logo:hover img,
.kotuvia-logo:hover .custom-logo {
  transform: scale(1.04);
  filter: brightness(1.05);
}

/* =====================================================
   7. SCROLL INDICATOR (cabecera)
   ===================================================== */
.kotuvia-scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--k-gold) 0%, var(--k-gold-light) 100%);
  z-index: 9999;
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 0.1s linear;
}

/* =====================================================
   8. TRANSICIÓN DE PÁGINA
   ===================================================== */
.kotuvia-page-transition {
  position: fixed;
  inset: 0;
  background: var(--k-dark);
  z-index: 9998;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.kotuvia-page-transition.is-active { opacity: 1; }

/* =====================================================
   9. ANIMACIÓN DE CARRITO
   ===================================================== */
@keyframes cart-bounce {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.35); }
  60%  { transform: scale(0.9); }
  100% { transform: scale(1); }
}

.cart-count.animate {
  animation: cart-bounce 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* =====================================================
   10. TOOLTIP
   ===================================================== */
[data-tooltip] {
  position: relative;
  cursor: help;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--k-dark);
  color: var(--k-cream);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.4em 0.75em;
  border-radius: var(--k-r-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateX(-50%) translateY(4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* =====================================================
   11. MODAL / LIGHTBOX OVERLAY
   ===================================================== */
.kotuvia-overlay {
  position: fixed;
  inset: 0;
  background: rgba(44, 36, 22, 0.7);
  backdrop-filter: blur(8px);
  z-index: var(--z-modal);
  opacity: 0;
  transition: opacity 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kotuvia-overlay.is-open { opacity: 1; }

.kotuvia-modal {
  background: var(--k-cream);
  border-radius: var(--k-r-xl);
  padding: 2.5rem;
  max-width: 520px;
  width: 90%;
  transform: scale(0.9) translateY(20px);
  transition: transform 0.4s var(--k-ease);
  position: relative;
}

.kotuvia-overlay.is-open .kotuvia-modal {
  transform: scale(1) translateY(0);
}

/* =====================================================
   12. TOAST NOTIFICATIONS
   ===================================================== */
.kotuvia-toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 320px;
}

.kotuvia-toast {
  background: var(--k-dark);
  color: var(--k-cream);
  border-radius: var(--k-r-md);
  padding: 1rem 1.25rem;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: var(--k-shadow-lg);
  transform: translateX(120%);
  transition: transform 0.4s var(--k-ease);
  border-left: 4px solid var(--k-gold);
}

.kotuvia-toast.is-visible { transform: translateX(0); }

.kotuvia-toast__icon { font-size: 1.2rem; flex-shrink: 0; }

/* =====================================================
   13. ANIMACIÓN DE ESTRELLAS (rating)
   ===================================================== */
.kotuvia-star-animate {
  display: inline-block;
  animation: star-pop 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
  opacity: 0;
  transform: scale(0);
}

@keyframes star-pop {
  to { opacity: 1; transform: scale(1); }
}

/* =====================================================
   14. PREFERS REDUCED MOTION
   ===================================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
