/* Performance & Lazy Loading Utilities */

/* Lazy loading for images */
img[loading="lazy"] {
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}

img[loading="lazy"].loaded {
  opacity: 1;
}

/* Critical above-the-fold optimization */
.hero-section {
  contain: layout style paint;
}

/* Defer non-critical animations */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Font display optimization */
@font-face {
  font-family: 'Roboto';
  font-display: swap;
}

/* Skeleton loading states */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Performance hints */
.will-animate {
  will-change: transform, opacity;
}

.will-animate.done {
  will-change: auto;
}

/* GPU acceleration for animations */
.animate-fade-in,
.animate-slide-up,
.animate-slide-down {
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* Reduce paint for hover effects */
.card-hover {
  transform: translateZ(0);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Optimize large lists */
.virtual-list-item {
  contain: layout style paint;
}

/* Reduce layout thrashing */
.no-layout-shift {
  min-height: 100vh;
  contain: layout;
}
