/* CSS Animations for website */

/* Fade In Up Animation */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade In Animation */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Slide In From Left Animation */
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Slide In From Right Animation */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Pulse Animation for CTA buttons */
@keyframes pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(255, 111, 89, 0.7);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 0 10px rgba(255, 111, 89, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(255, 111, 89, 0);
  }
}

/* Rotate Animation */
@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Staggered Animations for Scroll Reveal */
.animate-on-scroll {
  opacity: 0;
}

.animate-on-scroll.animated {
  animation: fadeInUp 0.6s ease forwards;
}

/* Apply staggered delay to children */
.stagger-children > *:nth-child(1) {
  animation-delay: 0.1s;
}

.stagger-children > *:nth-child(2) {
  animation-delay: 0.3s;
}

.stagger-children > *:nth-child(3) {
  animation-delay: 0.5s;
}

.stagger-children > *:nth-child(4) {
  animation-delay: 0.7s;
}

/* Animation for service cards */
.service-card:hover .service-icon {
  animation: rotate 0.8s ease-in-out;
}

/* Animation for CTA buttons */
.btn-primary {
  position: relative;
  overflow: hidden;
}

.btn-primary:after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.2);
  transform: translateX(-100%);
  transition: transform 0.3s ease-out;
}

.btn-primary:hover:after {
  transform: translateX(0);
}

/* Testimonial slider animation */
.testimonial-slide {
  animation: fadeIn 0.5s ease both;
}

@keyframes testimonialSlide {
  0%, 20% {
    opacity: 0;
    transform: translateX(50px);
  }
  25%, 95% {
    opacity: 1;
    transform: translateX(0);
  }
  100% {
    opacity: 0;
    transform: translateX(-50px);
  }
}

.testimonial-slide:nth-child(1) {
  animation: testimonialSlide 15s infinite 0s;
}

.testimonial-slide:nth-child(2) {
  animation: testimonialSlide 15s infinite 5s;
}

.testimonial-slide:nth-child(3) {
  animation: testimonialSlide 15s infinite 10s;
}

/* CSS for intersection observer to trigger animations on scroll */
.reveal {
  position: relative;
  opacity: 0;
}

.reveal.active {
  opacity: 1;
}

.active.fade-in {
  animation: fadeIn 1s ease-in-out forwards;
}

.active.fade-in-up {
  animation: fadeInUp 0.6s ease-in-out forwards;
}

.active.slide-in-left {
  animation: slideInLeft 0.6s ease-in-out forwards;
}

.active.slide-in-right {
  animation: slideInRight 0.6s ease-in-out forwards;
}

/* Animation for the header when scrolling */
.site-header {
  transition: background 0.3s, box-shadow 0.3s;
}

.site-header.scrolled {
  background-color: rgba(255, 255, 255, 0.95);
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

/* Animation for hamburger menu */
.menu-icon {
  transition: transform 0.3s;
}

.menu-checkbox:checked ~ .menu-icon {
  transform: rotate(90deg);
}

/* Simple CSS-only loading spinner */
.loading-spinner {
  width: 40px;
  height: 40px;
  margin: 30px auto;
  border: 4px solid rgba(168, 230, 207, 0.3);
  border-top-color: var(--aqua);
  border-radius: 50%;
  animation: rotate 1s infinite linear;
}

/* Form submission animation */
@keyframes formSuccess {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }
  50% {
    transform: scale(1.2);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.form-success {
  animation: formSuccess 0.5s ease-out forwards;
}
