/*--------------------------------------------------------------
# Stats Section Flying Airplane Animation
--------------------------------------------------------------*/

/* Stats image container with flying airplane animation */
.stats .about-image-container {
  max-width: 100%;
  margin: 0 auto 5px 0;
  position: relative;
  overflow: hidden;
  border: none; /* keep the generic blog-styles border (yellow on hover) off the planes */
  border-radius: 12px;
  /* No box-shadow: the reveal clip-path below cuts any shadow off anyway,
     and the leftover slivers showed up as dark lines in the bottom corners. */
  box-shadow: none;
  opacity: 0;
  /* "round 12px" makes the clip follow the rounded corners exactly */
  clip-path: inset(0 0 100% 0 round 12px);
  margin-bottom: 15px;
  /* avoid dark anti-aliasing fringes on the edges while the plane rotates */
  isolation: isolate;
  backface-visibility: hidden;
}

/* Transition only the reveal + hover shadow properties.
   Never transition transform here: the flying keyframe animation
   owns it, and a transform transition would override the animation
   mid-flight, snapping the plane down instantly on hover. */
.stats .about-image-container[data-aos] {
  transition: opacity 1.5s ease-out, clip-path 1.5s ease-out;
}

/* Add separation between left and right images */
.stats .stats-image-left {
  margin-right: 10px;
}

.stats .stats-image-right {
  margin-left: 10px;
}

.stats .about-image-container .about-image {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
}

/* Reveal animation when scrolled into view */
.stats .about-image-container.aos-animate {
  opacity: 1;
  clip-path: inset(0 0 0% 0 round 12px);
}

/* Left image animation - lead plane in formation */
.stats .stats-image-left.aos-animate {
  animation: flyingFormationLead 12s ease-in-out infinite;
}

/* Right image animation - wing plane in formation */
.stats .stats-image-right.aos-animate {
  animation: flyingFormationWing 12s ease-in-out infinite;
}

/* Formation flying animation for lead plane (left image) */
@keyframes flyingFormationLead {
  0% {
    transform: translateY(0) translateX(0) rotate(0deg) scale(1);
  }
  15% {
    transform: translateY(-12px) translateX(6px) rotate(1.2deg) scale(1.01);
  }
  30% {
    transform: translateY(-5px) translateX(10px) rotate(-0.3deg) scale(1.005);
  }
  45% {
    transform: translateY(-18px) translateX(4px) rotate(0.8deg) scale(1.012);
  }
  60% {
    transform: translateY(-8px) translateX(12px) rotate(-0.5deg) scale(1.008);
  }
  75% {
    transform: translateY(-15px) translateX(2px) rotate(0.6deg) scale(1.01);
  }
  90% {
    transform: translateY(-3px) translateX(5px) rotate(-0.2deg) scale(1.003);
  }
  100% {
    transform: translateY(0) translateX(0) rotate(0deg) scale(1);
  }
}

/* Formation flying animation for wing plane (right image) */
@keyframes flyingFormationWing {
  0% {
    transform: translateY(0) translateX(0) rotate(0deg) scale(1);
  }
  12% {
    transform: translateY(-8px) translateX(-5px) rotate(-0.8deg) scale(1.007);
  }
  28% {
    transform: translateY(-15px) translateX(-9px) rotate(0.4deg) scale(1.012);
  }
  42% {
    transform: translateY(-4px) translateX(-12px) rotate(-1.2deg) scale(1.006);
  }
  58% {
    transform: translateY(-12px) translateX(-6px) rotate(0.6deg) scale(1.01);
  }
  72% {
    transform: translateY(-6px) translateX(-10px) rotate(-0.3deg) scale(1.008);
  }
  88% {
    transform: translateY(-10px) translateX(-3px) rotate(0.2deg) scale(1.004);
  }
  100% {
    transform: translateY(0) translateX(0) rotate(0deg) scale(1);
  }
}

/* Subtle hover effect enhancement */
.stats .about-image-container:hover {
  /* Pin the underlying transform so the generic .about-image-container:hover
     rule in blog-styles.css can't fight the flying animation (instant jump). */
  transform: none;
  box-shadow: none;
}

.stats .about-image-container .about-image {
  transition: transform 0.3s ease;
}

.stats .about-image-container:hover .about-image {
  transform: scale(1.02);
}

/* Responsive adjustments for mobile devices */
@media (max-width: 768px) {
  .stats .about-image-container {
    margin-bottom: 20px;
  }
  
  /* Reduce separation on mobile */
  .stats .stats-image-left {
    margin-right: 5px;
  }

  .stats .stats-image-right {
    margin-left: 5px;
  }
  
  @keyframes flyingFormationLead {
    0% {
      transform: translateY(0) translateX(0) rotate(0deg) scale(1);
    }
    20% {
      transform: translateY(-8px) translateX(4px) rotate(0.6deg) scale(1.006);
    }
    40% {
      transform: translateY(-3px) translateX(7px) rotate(-0.2deg) scale(1.003);
    }
    60% {
      transform: translateY(-10px) translateX(3px) rotate(0.4deg) scale(1.008);
    }
    80% {
      transform: translateY(-5px) translateX(6px) rotate(-0.1deg) scale(1.004);
    }
    100% {
      transform: translateY(0) translateX(0) rotate(0deg) scale(1);
    }
  }
  
  @keyframes flyingFormationWing {
    0% {
      transform: translateY(0) translateX(0) rotate(0deg) scale(1);
    }
    18% {
      transform: translateY(-6px) translateX(-4px) rotate(-0.5deg) scale(1.005);
    }
    35% {
      transform: translateY(-10px) translateX(-7px) rotate(0.3deg) scale(1.008);
    }
    55% {
      transform: translateY(-4px) translateX(-9px) rotate(-0.7deg) scale(1.004);
    }
    75% {
      transform: translateY(-8px) translateX(-5px) rotate(0.2deg) scale(1.006);
    }
    92% {
      transform: translateY(-3px) translateX(-6px) rotate(-0.1deg) scale(1.002);
    }
    100% {
      transform: translateY(0) translateX(0) rotate(0deg) scale(1);
    }
  }
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  .stats .about-image-container.aos-animate {
    animation: none;
  }
}

/*--------------------------------------------------------------
# Cloud Particles Effect
--------------------------------------------------------------*/

/* Cloud particles wrapper positioning */
.cloud-particles-wrapper {
  position: relative;
  width: 100%;
  min-height: 300px;
  overflow: hidden;
}

/* Cloud particles container */
.cloud-particles-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  opacity: 0.7;
}

/* Cloud particles canvas */
.cloud-particles-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  position: absolute;
  top: 0;
  left: 0;
}

/* Ensure images stay above cloud particles */
.cloud-particles-wrapper .about-image-container {
  position: relative;
  z-index: 2;
}

/* Stats content should stay above cloud particles */
.stats .container:not(.cloud-particles-wrapper) {
  position: relative;
  z-index: 3;
}

/* Responsive adjustments for cloud particles */
@media (max-width: 768px) {
  .cloud-particles-wrapper {
    min-height: 200px;
  }
  
  .cloud-particles-container {
    opacity: 0.5;
  }
}

/* Performance optimization for lower-end devices */
@media (max-width: 480px) {
  .cloud-particles-container {
    opacity: 0.4;
  }
}