/* ============================================
   STANDIGO ANIMATION SYSTEM
   Micro-interactions & Delightful Motion
   ============================================ */

/* ============================================
   KEYFRAME DEFINITIONS
   ============================================ */

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

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

@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 fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

/* Scale Animations */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes scaleOut {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.9);
  }
}

@keyframes popIn {
  0% {
    opacity: 0;
    transform: scale(0.5);
  }
  70% {
    transform: scale(1.05);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Slide Animations */
@keyframes slideInUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

@keyframes slideInDown {
  from {
    transform: translateY(-100%);
  }
  to {
    transform: translateY(0);
  }
}

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

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

@keyframes slideOutUp {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-100%);
  }
}

@keyframes slideOutDown {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(100%);
  }
}

/* Bounce & Spring */
@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

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

@keyframes spring {
  0% {
    transform: scale(1);
  }
  30% {
    transform: scale(1.1);
  }
  60% {
    transform: scale(0.95);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes rubberBand {
  0% {
    transform: scale(1);
  }
  30% {
    transform: scaleX(1.25) scaleY(0.75);
  }
  40% {
    transform: scaleX(0.75) scaleY(1.25);
  }
  50% {
    transform: scaleX(1.15) scaleY(0.85);
  }
  65% {
    transform: scaleX(0.95) scaleY(1.05);
  }
  75% {
    transform: scaleX(1.05) scaleY(0.95);
  }
  100% {
    transform: scale(1);
  }
}

/* Pulse & Glow */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

@keyframes pulseSoft {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.02);
  }
}

@keyframes pulseRing {
  0% {
    box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4);
  }
  70% {
    box-shadow: 0 0 0 15px rgba(99, 102, 241, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(99, 102, 241, 0);
  }
}

@keyframes pulseRingAccent {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
  }
  70% {
    box-shadow: 0 0 0 15px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
  }
  50% {
    box-shadow: 0 0 40px rgba(99, 102, 241, 0.5);
  }
}

/* Spin & Rotate */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

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

@keyframes wiggle {
  0%, 100% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(-5deg);
  }
  75% {
    transform: rotate(5deg);
  }
}

/* Float & Levitate */
@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

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

@keyframes floatRotate {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  25% {
    transform: translateY(-5px) rotate(2deg);
  }
  50% {
    transform: translateY(-10px) rotate(0deg);
  }
  75% {
    transform: translateY(-5px) rotate(-2deg);
  }
}

/* Shimmer & Loading */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

@keyframes skeleton {
  0% {
    background-position: -200px 0;
  }
  100% {
    background-position: calc(200px + 100%) 0;
  }
}

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

/* Draw / Path Animations */
@keyframes drawCheck {
  0% {
    stroke-dashoffset: 100;
  }
  100% {
    stroke-dashoffset: 0;
  }
}

@keyframes drawLine {
  from {
    stroke-dashoffset: 1000;
  }
  to {
    stroke-dashoffset: 0;
  }
}

/* Shake */
@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  10%, 30%, 50%, 70%, 90% {
    transform: translateX(-5px);
  }
  20%, 40%, 60%, 80% {
    transform: translateX(5px);
  }
}

@keyframes shakeLight {
  0%, 100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-2px);
  }
  75% {
    transform: translateX(2px);
  }
}

/* Heartbeat */
@keyframes heartbeat {
  0%, 100% {
    transform: scale(1);
  }
  14% {
    transform: scale(1.1);
  }
  28% {
    transform: scale(1);
  }
  42% {
    transform: scale(1.1);
  }
  70% {
    transform: scale(1);
  }
}

/* Blob Morph (for decorative backgrounds) */
@keyframes blobMorph {
  0%, 100% {
    border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
  }
  50% {
    border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
  }
}

/* Gradient Shift */
@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Ripple */
@keyframes ripple {
  0% {
    transform: scale(0);
    opacity: 1;
  }
  100% {
    transform: scale(4);
    opacity: 0;
  }
}

/* ============================================
   ANIMATION UTILITY CLASSES
   ============================================ */

/* Base Animation Properties */
.animate {
  animation-duration: 0.3s;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  animation-fill-mode: both;
}

/* Fade Classes */
.animate-fadeIn { animation-name: fadeIn; }
.animate-fadeOut { animation-name: fadeOut; }
.animate-fadeInUp { animation-name: fadeInUp; }
.animate-fadeInDown { animation-name: fadeInDown; }
.animate-fadeInLeft { animation-name: fadeInLeft; }
.animate-fadeInRight { animation-name: fadeInRight; }

/* Scale Classes */
.animate-scaleIn { animation-name: scaleIn; }
.animate-scaleOut { animation-name: scaleOut; }
.animate-popIn { animation-name: popIn; }
.animate-bounceIn { animation-name: bounceIn; animation-duration: 0.5s; }

/* Slide Classes */
.animate-slideInUp { animation-name: slideInUp; }
.animate-slideInDown { animation-name: slideInDown; }
.animate-slideInLeft { animation-name: slideInLeft; }
.animate-slideInRight { animation-name: slideInRight; }
.animate-slideOutUp { animation-name: slideOutUp; }
.animate-slideOutDown { animation-name: slideOutDown; }

/* Continuous Animations */
.animate-bounce {
  animation: bounce 1s ease infinite;
}

.animate-bounceLight {
  animation: bounceLight 2s ease infinite;
}

.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

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

.animate-pulseRing {
  animation: pulseRing 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.animate-pulseRingAccent {
  animation: pulseRingAccent 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.animate-spin {
  animation: spin 1s linear infinite;
}

.animate-spinSlow {
  animation: spinSlow 3s linear infinite;
}

.animate-wiggle {
  animation: wiggle 1s ease-in-out infinite;
}

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

.animate-floatSlow {
  animation: floatSlow 6s ease-in-out infinite;
}

.animate-floatRotate {
  animation: floatRotate 4s ease-in-out infinite;
}

.animate-shimmer {
  animation: shimmer 2s linear infinite;
}

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

.animate-heartbeat {
  animation: heartbeat 1.5s ease-in-out infinite;
}

.animate-blobMorph {
  animation: blobMorph 8s ease-in-out infinite;
}

.animate-gradientShift {
  background-size: 200% 200%;
  animation: gradientShift 3s ease infinite;
}

/* One-time Animations */
.animate-spring {
  animation: spring 0.5s ease;
}

.animate-rubberBand {
  animation: rubberBand 0.75s ease;
}

.animate-shake {
  animation: shake 0.5s ease;
}

.animate-shakeLight {
  animation: shakeLight 0.3s ease;
}

/* ============================================
   ANIMATION DURATION MODIFIERS
   ============================================ */

.duration-75 { animation-duration: 75ms; }
.duration-100 { animation-duration: 100ms; }
.duration-150 { animation-duration: 150ms; }
.duration-200 { animation-duration: 200ms; }
.duration-300 { animation-duration: 300ms; }
.duration-500 { animation-duration: 500ms; }
.duration-700 { animation-duration: 700ms; }
.duration-1000 { animation-duration: 1000ms; }

/* ============================================
   ANIMATION DELAY MODIFIERS
   ============================================ */

.delay-75 { animation-delay: 75ms; }
.delay-100 { animation-delay: 100ms; }
.delay-150 { animation-delay: 150ms; }
.delay-200 { animation-delay: 200ms; }
.delay-300 { animation-delay: 300ms; }
.delay-500 { animation-delay: 500ms; }
.delay-700 { animation-delay: 700ms; }
.delay-1000 { animation-delay: 1000ms; }

/* Staggered Animation Delays (for lists) */
.stagger-1 { animation-delay: 50ms; }
.stagger-2 { animation-delay: 100ms; }
.stagger-3 { animation-delay: 150ms; }
.stagger-4 { animation-delay: 200ms; }
.stagger-5 { animation-delay: 250ms; }
.stagger-6 { animation-delay: 300ms; }
.stagger-7 { animation-delay: 350ms; }
.stagger-8 { animation-delay: 400ms; }

/* ============================================
   ANIMATION TIMING FUNCTIONS
   ============================================ */

.ease-linear { animation-timing-function: linear; }
.ease-in { animation-timing-function: cubic-bezier(0.4, 0, 1, 1); }
.ease-out { animation-timing-function: cubic-bezier(0, 0, 0.2, 1); }
.ease-in-out { animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1); }
.ease-bounce { animation-timing-function: cubic-bezier(0.68, -0.55, 0.265, 1.55); }
.ease-elastic { animation-timing-function: cubic-bezier(0.68, -0.6, 0.32, 1.6); }

/* ============================================
   HOVER ANIMATION TRIGGERS
   ============================================ */

/* Lift on Hover */
.hover-lift {
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.hover-lift-sm:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Scale on Hover */
.hover-scale {
  transition: transform var(--transition-normal);
}

.hover-scale:hover {
  transform: scale(1.02);
}

.hover-scale-lg:hover {
  transform: scale(1.05);
}

/* Glow on Hover */
.hover-glow {
  transition: box-shadow var(--transition-normal);
}

.hover-glow:hover {
  box-shadow: var(--shadow-primary-lg);
}

.hover-glow-accent:hover {
  box-shadow: 0 10px 30px -5px rgba(16, 185, 129, 0.35);
}

/* Brightness on Hover */
.hover-bright {
  transition: filter var(--transition-fast);
}

.hover-bright:hover {
  filter: brightness(1.1);
}

/* Rotate on Hover */
.hover-rotate {
  transition: transform var(--transition-normal);
}

.hover-rotate:hover {
  transform: rotate(5deg);
}

.hover-rotate-reverse:hover {
  transform: rotate(-5deg);
}

/* Bounce on Hover */
.hover-bounce:hover {
  animation: bounceLight 0.5s ease;
}

/* Wiggle on Hover */
.hover-wiggle:hover {
  animation: wiggle 0.5s ease;
}

/* Spring on Hover */
.hover-spring:hover {
  animation: spring 0.4s ease;
}

/* ============================================
   CLICK/ACTIVE ANIMATIONS
   ============================================ */

.active-scale:active {
  transform: scale(0.97);
}

.active-press:active {
  transform: translateY(1px);
}

/* ============================================
   FOCUS ANIMATIONS
   ============================================ */

.focus-ring {
  transition: box-shadow var(--transition-fast);
}

.focus-ring:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--color-primary-200);
}

.focus-ring-accent:focus {
  box-shadow: 0 0 0 3px var(--color-accent-200);
}

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

.page-enter {
  opacity: 0;
  transform: translateY(10px);
}

.page-enter-active {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.page-exit {
  opacity: 1;
}

.page-exit-active {
  opacity: 0;
  transition: opacity 0.2s ease;
}

/* ============================================
   SCROLL-TRIGGERED ANIMATIONS
   (Use with Intersection Observer)
   ============================================ */

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

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

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

.scroll-animate-left.in-view {
  opacity: 1;
  transform: translateX(0);
}

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

.scroll-animate-right.in-view {
  opacity: 1;
  transform: translateX(0);
}

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

.scroll-animate-scale.in-view {
  opacity: 1;
  transform: scale(1);
}

/* ============================================
   SPECIAL EFFECTS
   ============================================ */

/* Ripple Effect */
.ripple {
  position: relative;
  overflow: hidden;
}

.ripple::after {
  content: '';
  position: absolute;
  width: 100px;
  height: 100px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transform: scale(0);
  pointer-events: none;
}

.ripple:active::after {
  animation: ripple 0.6s ease-out;
}

/* Gradient Text Animation */
.animate-gradient-text {
  background: linear-gradient(
    90deg,
    var(--color-primary-500),
    var(--color-secondary-500),
    var(--color-accent-500),
    var(--color-primary-500)
  );
  background-size: 300% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 4s ease infinite;
}

/* Skeleton Loading */
.skeleton-animate {
  background: linear-gradient(
    90deg,
    var(--color-slate-200) 0px,
    var(--color-slate-100) 40px,
    var(--color-slate-200) 80px
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* Number Counter (for stats) */
.count-up {
  display: inline-block;
  animation: fadeInUp 0.5s ease forwards;
}

/* Success Checkmark */
.checkmark-circle {
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  animation: drawCheck 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.checkmark-check {
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: drawCheck 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards;
}

/* ============================================
   REDUCED MOTION SUPPORT
   ============================================ */

@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;
  }

  .animate,
  .hover-lift,
  .hover-scale,
  .hover-bounce,
  .scroll-animate {
    animation: none !important;
    transition: none !important;
    transform: none !important;
  }
}

/* ============================================
   SVG FARM STAND ANIMATIONS
   For the custom farm stand scene generator
   ============================================ */

/* Sway Animation - for trees */
@keyframes sway {
  0%, 100% {
    transform: rotate(-2deg);
  }
  50% {
    transform: rotate(2deg);
  }
}

.animate-sway {
  animation: sway 4s ease-in-out infinite;
  transform-origin: bottom center;
  transform-box: fill-box; /* Required for SVG elements */
}

/* Windmill Rotation Animation - continuous 360deg spin */
@keyframes windmill-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.animate-windmill {
  animation: windmill-spin 4s linear infinite;
  transform-origin: center center;
  transform-box: fill-box; /* Required for SVG elements */
}

/* Flying Birds Animation - horizontal movement */
@keyframes fly {
  0% {
    transform: translateX(0) translateY(0);
  }
  25% {
    transform: translateX(50px) translateY(-10px);
  }
  50% {
    transform: translateX(100px) translateY(0);
  }
  75% {
    transform: translateX(50px) translateY(10px);
  }
  100% {
    transform: translateX(0) translateY(0);
  }
}

.animate-fly {
  animation: fly 8s linear infinite;
  transform-box: fill-box; /* Required for SVG elements */
}

/* Wave Animation - for flags */
@keyframes wave {
  0%, 100% {
    transform: skewX(0deg);
  }
  25% {
    transform: skewX(5deg);
  }
  75% {
    transform: skewX(-5deg);
  }
}

.animate-wave {
  animation: wave 2s ease-in-out infinite;
  transform-box: fill-box; /* Required for SVG elements */
}

/* Smoke Animation - for chimney */
@keyframes smoke {
  0% {
    opacity: 0.8;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-30px) scale(1.5);
  }
}

.animate-smoke {
  animation: smoke 3s ease-out infinite;
  transform-box: fill-box; /* Required for SVG elements */
}

/* Flutter Animation - for butterflies, bees */
@keyframes flutter {
  0%, 100% {
    transform: translateX(0) translateY(0) rotate(0deg);
  }
  25% {
    transform: translateX(15px) translateY(-5px) rotate(10deg);
  }
  50% {
    transform: translateX(30px) translateY(0) rotate(0deg);
  }
  75% {
    transform: translateX(15px) translateY(5px) rotate(-10deg);
  }
}

.animate-flutter {
  animation: flutter 6s ease-in-out infinite;
  transform-box: fill-box; /* Required for SVG elements */
}

/* Fall Animation - for rain, falling leaves */
@keyframes fall {
  0% {
    transform: translateY(-20px) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(320px) rotate(360deg);
    opacity: 0;
  }
}

.animate-fall {
  animation: fall 5s linear infinite;
  transform-box: fill-box; /* Required for SVG elements */
}

/* Snow Animation - gentle falling */
@keyframes snowFall {
  0% {
    transform: translateY(-30px) translateX(0);
    opacity: 1;
  }
  50% {
    transform: translateY(150px) translateX(10px);
  }
  100% {
    transform: translateY(320px) translateX(-10px);
    opacity: 0.3;
  }
}

.animate-snow {
  animation: snowFall 8s linear infinite;
  transform-box: fill-box; /* Required for SVG elements */
}

/* Twinkle Animation - for stars, string lights */
@keyframes twinkle {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

.animate-twinkle {
  animation: twinkle 2s ease-in-out infinite;
  transform-box: fill-box; /* Required for SVG elements */
}

/* Sparkle Animation - occasional bright flash */
@keyframes sparkle {
  0%, 90%, 100% {
    opacity: 0.6;
    transform: scale(1);
  }
  95% {
    opacity: 1;
    transform: scale(1.2);
  }
}

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

/* Gentle Bob - for animals */
@keyframes bob {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

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

/* SVG Animation Delays for natural staggering */
.svg-delay-1 { animation-delay: 0.2s; }
.svg-delay-2 { animation-delay: 0.5s; }
.svg-delay-3 { animation-delay: 0.8s; }
.svg-delay-4 { animation-delay: 1.1s; }
.svg-delay-5 { animation-delay: 1.4s; }
