/* Optimized Image Loading Styles */

/* Progressive image loading with blur-up effect */
.progressive-image {
  position: relative;
  overflow: hidden;
}

.progressive-image img {
  transition: filter 0.3s ease, opacity 0.3s ease;
  width: 100%;
  height: auto;
}

.progressive-image.loaded img {
  filter: blur(0);
  opacity: 1;
}

/* Lazy loading placeholder */
.image-placeholder {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
  width: 100%;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  font-size: 14px;
}

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

  100% {
    background-position: -200% 0;
  }
}

/* Optimized gallery grid images */
.gallery-item img {
  object-fit: cover;
  transition: transform 0.3s ease, filter 0.3s ease;
}

.gallery-item:hover img {
  transform: scale(1.05);
}

/* Thumbnail optimizations */
.thumbnail-image {
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  image-rendering: optimize-contrast;
}

/* Low-quality image placeholders */
.lqip {
  filter: blur(2px);
  transform: scale(1.1);
  transition: filter 0.3s ease, transform 0.3s ease;
}

.lqip.loaded {
  filter: blur(0);
  transform: scale(1);
}

/* Responsive image container */
.responsive-image-container {
  position: relative;
  width: 100%;
  height: 0;
  overflow: hidden;
}

.responsive-image-container.aspect-16-9 {
  padding-bottom: 56.25%;
  /* 16:9 */
}

.responsive-image-container.aspect-4-3 {
  padding-bottom: 75%;
  /* 4:3 */
}

.responsive-image-container.aspect-1-1 {
  padding-bottom: 100%;
  /* 1:1 */
}

.responsive-image-container img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* WebP support detection */
.webp .no-webp-fallback {
  display: none;
}

.no-webp .webp-image {
  display: none;
}

/* Critical images (above the fold) */
.critical-image {
  /* No lazy loading for critical images */
  content-visibility: visible;
}

/* Art gallery specific optimizations */
.artwork-thumbnail {
  background-color: #f8f9fa;
  background-image:
    radial-gradient(circle at 25% 25%, rgba(255, 255, 255, 0.2) 0%, transparent 50%),
    radial-gradient(circle at 75% 75%, rgba(0, 0, 0, 0.1) 0%, transparent 50%);
}

.artwork-thumbnail img {
  mix-blend-mode: multiply;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.artwork-thumbnail img.loaded {
  opacity: 1;
}

/* Mobile optimizations */
@media (max-width: 768px) {
  .gallery-item img {
    object-fit: cover;
    height: auto;
    max-height: 300px;
  }

}

/* Print optimizations */
@media print {

  .progressive-image img,
  .gallery-item img {
    filter: none;
    opacity: 1;
    transform: none;
  }
}

/* Prefers reduced motion */
@media (prefers-reduced-motion: reduce) {

  .progressive-image img,
  .gallery-item img,
  .lqip {
    transition: none;
  }

  .gallery-item:hover img {
    transform: none;
  }

  .image-placeholder {
    animation: none;
  }
}