/* lazy-images.css — Estilos para lazy-loading de imagens */

/* Placeholder durante carregamento */
img[data-src] {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  min-height: 200px;
  display: block;
  width: 100%;
}

/* Animação de carregamento (skeleton) */
@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Blur-up effect (fade em quando carregado) */
img[data-src]:not(.lazy-loaded) {
  filter: blur(10px);
  opacity: 0.8;
  transition: filter 0.3s ease-out, opacity 0.3s ease-out;
}

/* Imagem carregada */
img.lazy-loaded {
  filter: blur(0);
  opacity: 1;
}

/* Erro no carregamento */
img.lazy-error {
  opacity: 0.5;
  background: #f5f5f5;
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
}

img.lazy-error::after {
  content: '⚠ Erro ao carregar imagem';
  color: #999;
  font-size: 0.9rem;
}

/* Native lazy loading (fallback para navegadores modernos) */
img[loading="lazy"] {
  content-visibility: auto;
}

/* Picture elements */
picture[data-lazy] img[data-src] {
  display: block;
  width: 100%;
  height: auto;
}

/* Responsivo: reduzir placeholder em telas pequenas */
@media (max-width: 768px) {
  img[data-src] {
    min-height: 150px;
  }
}

/* Prevenção de layout shift durante lazy-load */
img, picture {
  aspect-ratio: attr(width) / attr(height);
}
