/**
 * Lazy Loading Styles
 *
 * Provides visual feedback for images that are loading lazily.
 * Includes smooth transitions and placeholder effects.
 */

/* Base lazy image styles */
img.lazy {
  /* Blur placeholder image while loading */
  filter: blur(5px);
  transition: filter 0.3s ease-in-out, opacity 0.3s ease-in-out;
  opacity: 0.7;
  /* Prevent layout shift by maintaining image dimensions */
  background-color: #f0f0f0;
}

/* Loaded state */
img.lazy-loaded {
  filter: blur(0);
  opacity: 1;
  animation: fadeIn 0.3s ease-in-out;
}

/* Error state */
img.lazy-error {
  filter: grayscale(100%);
  opacity: 0.5;
  border: 2px dashed #ff0000;
}

/* Fade in animation */
@keyframes fadeIn {
  from {
    opacity: 0.7;
  }
  to {
    opacity: 1;
  }
}

/* Shimmer loading effect (optional, for better UX) */
img.lazy::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.3) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* Responsive image support */
img.lazy,
img.lazy-loaded {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Print styles: show all images */
@media print {
  img.lazy {
    filter: none;
    opacity: 1;
  }
}
