/**
 * Scroll Animations Styles
 * D O'BRIEN ELECTRICAL LIMITED
 */

/* Prepare elements for animation */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: none;
}

/* Animated state */
.animate-on-scroll.fade-in-up {
  animation: fadeInUp 0.6s ease-out forwards;
}

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

/* Fade in up animation */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Stats counter specific styles */
.stat-number {
  font-size: 3rem;
  font-weight: 800;
  color: var(--accent-gold);
  font-family: 'Poppins', sans-serif;
  line-height: 1;
  display: inline-block;
  transition: color 0.3s ease;
}

.stat-number.counted {
  animation: statPulse 0.5s ease-out;
}

@keyframes statPulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

/* Stagger delays for multiple elements in same container */
.service-grid .service-card:nth-child(1),
.features-grid .feature-card:nth-child(1),
.why-choose-grid .why-choose-card:nth-child(1) {
  animation-delay: 0s;
}

.service-grid .service-card:nth-child(2),
.features-grid .feature-card:nth-child(2),
.why-choose-grid .why-choose-card:nth-child(2) {
  animation-delay: 0.1s;
}

.service-grid .service-card:nth-child(3),
.features-grid .feature-card:nth-child(3),
.why-choose-grid .why-choose-card:nth-child(3) {
  animation-delay: 0.2s;
}

.service-grid .service-card:nth-child(4),
.features-grid .feature-card:nth-child(4),
.why-choose-grid .why-choose-card:nth-child(4) {
  animation-delay: 0.3s;
}

.service-grid .service-card:nth-child(5),
.features-grid .feature-card:nth-child(5),
.why-choose-grid .why-choose-card:nth-child(5) {
  animation-delay: 0.4s;
}

.service-grid .service-card:nth-child(6),
.features-grid .feature-card:nth-child(6),
.why-choose-grid .why-choose-card:nth-child(6) {
  animation-delay: 0.5s;
}

/* Smooth scroll behavior */
@media (prefers-reduced-motion: no-preference) {
  .animate-on-scroll {
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
  }
}

/* Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
  .animate-on-scroll {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  
  .stat-number {
    animation: none !important;
  }
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .animate-on-scroll {
    transform: translateY(20px); /* Less movement on mobile */
  }
  
  .stat-number {
    font-size: 2.5rem;
  }
}
