/* Custom Animations for MapSoil Homepage */

/* Wave path animation for SVG */
@keyframes wave-path-dash {
  0% {
    stroke-dashoffset: 1080;
  }
  100% {
    stroke-dashoffset: 0;
  }
}

.animate-wave-path-dash {
  animation: wave-path-dash 30s linear infinite;
}

/* Background gradient shift animation */
@keyframes background-shift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.animate-background-shift {
  animation: background-shift 10s ease infinite;
}

/* Vibrate animation for icons */
@keyframes vibrate {
  0%, 100% {
    transform: translateX(0);
  }
  10%, 30%, 50%, 70%, 90% {
    transform: translateX(-2px);
  }
  20%, 40%, 60%, 80% {
    transform: translateX(2px);
  }
}

.animate-vibrate {
  animation: vibrate 0.3s ease-in-out infinite;
}

/* Wave animation for hand icon */
@keyframes wave {
  0% {
    transform: rotate(0deg);
  }
  10% {
    transform: rotate(14deg);
  }
  20% {
    transform: rotate(-8deg);
  }
  30% {
    transform: rotate(14deg);
  }
  40% {
    transform: rotate(-4deg);
  }
  50% {
    transform: rotate(10deg);
  }
  60% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(0deg);
  }
}

.animate-wave {
  animation: wave 2s ease-in-out infinite;
  transform-origin: 70% 70%;
}

/* Enhanced starting animations (for elements with `starting:` utility) */
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .starting\\:opacity-0 {
      animation: fadeInView linear both;
      animation-timeline: view();
      animation-range: entry 0% cover 30%;
    }
    
    .starting\\:blur-md {
      animation: blurInView linear both;
      animation-timeline: view();
      animation-range: entry 0% cover 30%;
    }
    
    .starting\\:scale-105,
    .starting\\:scale-110,
    .starting\\:scale-120 {
      animation: scaleInView linear both;
      animation-timeline: view();
      animation-range: entry 0% cover 30%;
    }
    
    .starting\\:translate-x-\\[-2rem\\] {
      animation: slideInLeftView linear both;
      animation-timeline: view();
      animation-range: entry 0% cover 30%;
    }
    
    .starting\\:translate-x-\\[2rem\\] {
      animation: slideInRightView linear both;
      animation-timeline: view();
      animation-range: entry 0% cover 30%;
    }
    
    .starting\\:translate-y-4 {
      animation: slideInBottomView linear both;
      animation-timeline: view();
      animation-range: entry 0% cover 30%;
    }
  }
}

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

@keyframes blurInView {
  from {
    filter: blur(8px);
  }
  to {
    filter: blur(0);
  }
}

@keyframes scaleInView {
  from {
    transform: scale(1.1);
  }
  to {
    transform: scale(1);
  }
}

@keyframes slideInLeftView {
  from {
    transform: translateX(-2rem);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideInRightView {
  from {
    transform: translateX(2rem);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideInBottomView {
  from {
    transform: translateY(1rem);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
