/* ============================================
   MATTEOS PIZZAS — ANIMATIONS CSS
   ============================================ */

/* ============================================
   KEYFRAMES
   ============================================ */

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

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

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-32px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

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

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

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

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
    animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
  }
  50% {
    transform: translateY(-8px);
    animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
  }
}

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

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

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

@keyframes growWidth {
  from { width: 0; }
  to { width: 100%; }
}

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

@keyframes ripple {
  from {
    transform: scale(0);
    opacity: 0.5;
  }
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* ============================================
   INTERSECTION OBSERVER — SCROLL ANIMATIONS
   Elements start invisible, JS adds .is-visible
   ============================================ */

.animate-on-scroll {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

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

.animate-fade-in {
  opacity: 0;
  transition: opacity 0.7s ease;
}

.animate-fade-in.is-visible {
  opacity: 1;
}

.animate-slide-left {
  opacity: 0;
  transform: translateX(-40px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-slide-left.is-visible {
  opacity: 1;
  transform: translateX(0);
}

.animate-slide-right {
  opacity: 0;
  transform: translateX(40px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-slide-right.is-visible {
  opacity: 1;
  transform: translateX(0);
}

.animate-scale {
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.animate-scale.is-visible {
  opacity: 1;
  transform: scale(1);
}

/* Staggered children animations */
.stagger-children > * {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.stagger-children.is-visible > *:nth-child(1) { transition-delay: 0s; opacity: 1; transform: translateY(0); }
.stagger-children.is-visible > *:nth-child(2) { transition-delay: 0.1s; opacity: 1; transform: translateY(0); }
.stagger-children.is-visible > *:nth-child(3) { transition-delay: 0.2s; opacity: 1; transform: translateY(0); }
.stagger-children.is-visible > *:nth-child(4) { transition-delay: 0.3s; opacity: 1; transform: translateY(0); }
.stagger-children.is-visible > *:nth-child(5) { transition-delay: 0.4s; opacity: 1; transform: translateY(0); }
.stagger-children.is-visible > *:nth-child(6) { transition-delay: 0.5s; opacity: 1; transform: translateY(0); }
.stagger-children.is-visible > *:nth-child(7) { transition-delay: 0.6s; opacity: 1; transform: translateY(0); }
.stagger-children.is-visible > *:nth-child(8) { transition-delay: 0.7s; opacity: 1; transform: translateY(0); }

/* ============================================
   HERO ANIMATIONS
   ============================================ */

.hero__tag {
  animation: fadeInDown 0.5s ease both;
  animation-delay: 0.2s;
}

.hero__title {
  animation: fadeInUp 0.7s ease both;
  animation-delay: 0.35s;
}

.hero__subtitle {
  animation: fadeInUp 0.7s ease both;
  animation-delay: 0.5s;
}

.hero__actions {
  animation: fadeInUp 0.7s ease both;
  animation-delay: 0.65s;
}

/* ============================================
   SKELETON LOADING
   ============================================ */

.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-grey-200) 25%,
    var(--color-grey-100) 50%,
    var(--color-grey-200) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--border-radius-sm);
}

.skeleton-text {
  height: 16px;
  margin-bottom: 8px;
  border-radius: 4px;
}

.skeleton-text--sm { height: 12px; }
.skeleton-text--lg { height: 24px; }

.skeleton-image {
  height: 220px;
  border-radius: var(--border-radius-md) var(--border-radius-md) 0 0;
}

.skeleton-btn {
  height: 44px;
  width: 140px;
  border-radius: var(--border-radius-full);
}

/* ============================================
   LOADING SPINNER
   ============================================ */

.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid rgba(211,47,47,0.2);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner--sm { width: 16px; height: 16px; border-width: 2px; }
.spinner--lg { width: 40px; height: 40px; border-width: 4px; }
.spinner--white {
  border-color: rgba(255,255,255,0.3);
  border-top-color: white;
}

/* ============================================
   BUTTON RIPPLE EFFECT
   ============================================ */

.btn {
  position: relative;
  overflow: hidden;
}

.btn .ripple-circle {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.35);
  transform: scale(0);
  animation: ripple 0.6s linear;
  pointer-events: none;
}

/* ============================================
   HOVER EFFECTS
   ============================================ */

/* Shine effect on cards */
.shine {
  position: relative;
  overflow: hidden;
}

.shine::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -75%;
  width: 50%;
  height: 200%;
  background: linear-gradient(
    to right,
    rgba(255,255,255,0) 0%,
    rgba(255,255,255,0.12) 50%,
    rgba(255,255,255,0) 100%
  );
  transform: skewX(-20deg);
  transition: left 0.6s ease;
  pointer-events: none;
}

.shine:hover::after {
  left: 125%;
}

/* ============================================
   FLOATING ANIMATION
   ============================================ */

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

.float--slow {
  animation-duration: 5s;
}

/* ============================================
   PULSE ANIMATION (for badges, CTAs)
   ============================================ */

.pulse {
  animation: pulse 2s ease-in-out infinite;
}

/* ============================================
   BOUNCE (for scroll indicators)
   ============================================ */

.bounce {
  animation: bounce 1.2s infinite;
}

/* ============================================
   COUNT-UP NUMBERS
   ============================================ */

.count-number {
  animation: countUp 0.8s ease both;
}

/* ============================================
   NAV ANIMATION
   ============================================ */

.nav {
  animation: fadeInDown 0.5s ease both;
}

/* ============================================
   PAGE TRANSITION
   ============================================ */

.page-enter {
  animation: fadeIn 0.4s ease both;
}

/* ============================================
   TOAST ANIMATION
   ============================================ */

.toast {
  animation: slideInRight 0.3s ease both;
}

/* ============================================
   MODAL ANIMATION
   ============================================ */

.modal-overlay {
  animation: fadeIn 0.25s ease both;
}

.modal-content {
  animation: scaleIn 0.3s ease both;
}

/* ============================================
   PROMO BANNER ELEMENTS
   ============================================ */

.promo-card {
  animation: fadeInUp 0.6s ease both;
}

.promo-card:nth-child(2) {
  animation-delay: 0.15s;
}

/* ============================================
   TRUST BAR ITEMS
   ============================================ */

.trust-item {
  animation: fadeInUp 0.5s ease both;
}

.trust-item:nth-child(1) { animation-delay: 0.0s; }
.trust-item:nth-child(2) { animation-delay: 0.1s; }
.trust-item:nth-child(3) { animation-delay: 0.2s; }
.trust-item:nth-child(4) { animation-delay: 0.3s; }

/* ============================================
   SCROLL PROGRESS BAR ANIMATION
   ============================================ */

#scroll-progress {
  transition: width 0.1s linear;
}

/* ============================================
   IMAGE REVEAL
   ============================================ */

.img-reveal {
  overflow: hidden;
}

.img-reveal img {
  transform: scale(1.1);
  transition: transform 1s ease;
}

.img-reveal.is-visible img {
  transform: scale(1);
}

/* ============================================
   CART BOUNCE (when item added)
   ============================================ */

@keyframes cartBounce {
  0% { transform: scale(1); }
  25% { transform: scale(1.3); }
  50% { transform: scale(0.9); }
  75% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.cart-bounce {
  animation: cartBounce 0.5s ease;
}

/* ============================================
   STAR RATING
   ============================================ */

@keyframes starPop {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.3); }
  100% { transform: scale(1); opacity: 1; }
}

.star-rating span {
  display: inline-block;
  animation: starPop 0.3s ease both;
}

.star-rating span:nth-child(1) { animation-delay: 0.0s; }
.star-rating span:nth-child(2) { animation-delay: 0.1s; }
.star-rating span:nth-child(3) { animation-delay: 0.2s; }
.star-rating span:nth-child(4) { animation-delay: 0.3s; }
.star-rating span:nth-child(5) { animation-delay: 0.4s; }
