/**
 * Lazy Loading Styles for HPQ
 * Optimized for smooth loading experience on mobile and desktop
 */

/* Base lazy loading class */
.lazy {
  opacity: 0;
  transition: opacity 0.4s ease-in-out;
}

/* Loading state */
.lazy-loading {
  opacity: 0.5;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* Loaded state */
.lazy-loaded {
  opacity: 1;
}

/* Error state */
.lazy-error {
  opacity: 0.3;
  filter: grayscale(100%);
}

/* Shimmer animation for loading */
@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Prevent layout shift - maintain aspect ratio */
.lazy[data-src],
.lazy[data-bg-src] {
  min-height: 200px;
  background-color: #f5f5f5;
}

/* Video specific lazy loading */
video.lazy {
  background-color: #000;
}

/* Picture element support */
picture.lazy {
  display: block;
  opacity: 0;
  transition: opacity 0.4s ease-in-out;
}

picture.lazy-loaded {
  opacity: 1;
}

/* Responsive image handling */
@media (max-width: 768px) {
  .lazy {
    transition: opacity 0.3s ease-in-out;
  }
  
  .lazy[data-src],
  .lazy[data-bg-src] {
    min-height: 150px;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .lazy,
  picture.lazy {
    transition: none;
  }
  
  .lazy-loading {
    animation: none;
    background: #f0f0f0;
  }
}

/* Gallery and slider specific */
.swiper-slide .lazy {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Hero images - no minimum height needed */
.hero-bg.lazy {
  min-height: auto;
  width: 100%;
  height: 100%;
}

/* Feature icons - smaller placeholder */
.feature-icon .lazy {
    min-height: 60px;
    width: 60px;
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Gallery images - maintain aspect ratio */
.gallery-image.lazy {
  min-height: 400px;
  width: 100%;
  object-fit: cover;
}

@media (max-width: 768px) {
  .gallery-image.lazy {
    min-height: 250px;
  }
}

/* Video thumbnail styling */
.video-thumbnail.lazy {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Prevent flash of unstyled content */
.lazy:not(.lazy-loaded):not(.lazy-error) {
  background-color: #f5f5f5;
}

/* Smooth fade for background images */
[data-bg-src].lazy-loaded {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
