/* ============================================
   TATEBI - Animations
   ============================================ */

/* === Scroll Reveal Animations === */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-on-scroll.animate-in {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children */
.animate-on-scroll.animate-in .category-card:nth-child(1),
.animate-on-scroll.animate-in .feature-card:nth-child(1),
.animate-on-scroll.animate-in .product-card:nth-child(1) { transition-delay: 0ms; }

.animate-on-scroll.animate-in .category-card:nth-child(2),
.animate-on-scroll.animate-in .feature-card:nth-child(2),
.animate-on-scroll.animate-in .product-card:nth-child(2) { transition-delay: 80ms; }

.animate-on-scroll.animate-in .category-card:nth-child(3),
.animate-on-scroll.animate-in .feature-card:nth-child(3),
.animate-on-scroll.animate-in .product-card:nth-child(3) { transition-delay: 160ms; }

.animate-on-scroll.animate-in .category-card:nth-child(4),
.animate-on-scroll.animate-in .feature-card:nth-child(4),
.animate-on-scroll.animate-in .product-card:nth-child(4) { transition-delay: 240ms; }

.animate-on-scroll.animate-in .category-card:nth-child(5) { transition-delay: 320ms; }
.animate-on-scroll.animate-in .category-card:nth-child(6) { transition-delay: 400ms; }

/* === Keyframe Animations === */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes slideInRight {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

@keyframes slideInLeft {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}

@keyframes scaleUp {
  from {
    transform: scale(0.95);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

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

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

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

/* === Utility Animation Classes === */
.animate-fade-in {
  animation: fadeIn 0.4s ease forwards;
}

.animate-fade-in-up {
  animation: fadeInUp 0.4s ease forwards;
}

.animate-scale-up {
  animation: scaleUp 0.3s ease forwards;
}

/* Cart badge pulse */
.cart-badge.pulse {
  animation: pulse 0.4s ease;
}

/* Button hover bounce */
.btn-bounce:hover {
  animation: bounce 0.4s ease;
}

/* Error shake */
.shake {
  animation: shake 0.4s ease;
}

/* Loading spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-border-light);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Floating animation */
.float {
  animation: float 3s ease-in-out infinite;
}

/* === Hero Animations === */
.hero__content {
  animation: fadeInUp 0.8s ease forwards;
}

.hero__image {
  animation: fadeIn 1s ease 0.3s forwards;
  opacity: 0;
}

/* === Toast Animation === */
.toast {
  animation: slideInRight 0.3s ease forwards;
}

/* === Cart Item Remove Animation === */
.cart-item.removing {
  animation: fadeOut 0.3s ease forwards;
}

@keyframes fadeOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(30px);
  }
}

/* === Page Transition === */
.page-enter {
  animation: fadeInUp 0.4s ease forwards;
}

/* === Reduce Motion === */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .animate-on-scroll {
    opacity: 1;
    transform: none;
  }

  html {
    scroll-behavior: auto;
  }
}
