/**
 * Lazy Loading Styles
 * 
 * Provides visual feedback for lazy-loaded images with blur-up effect
 */

/* Placeholder state - blur effect */
img.lazy-loading {
    filter: blur(10px);
    transform: scale(1.05);
    transition: filter 0.3s ease-out, transform 0.3s ease-out;
    background: linear-gradient(
        135deg,
        #f0f0f0 0%,
        #e0e0e0 50%,
        #f0f0f0 100%
    );
    background-size: 200% 200%;
    animation: shimmer 1.5s infinite;
}

/* Loaded state - clear and sharp */
img.lazy-loaded {
    filter: blur(0);
    transform: scale(1);
    animation: fadeIn 0.3s ease-out;
}

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

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

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

/* Ensure images maintain aspect ratio during loading */
img[data-src],
img[loading="lazy"] {
    display: block;
    width: 100%;
    height: auto;
}

/* Prevent layout shift by reserving space */
img[width][height] {
    aspect-ratio: attr(width) / attr(height);
}

/* Modern aspect-ratio support */
@supports (aspect-ratio: 16 / 9) {
    img[data-src],
    img[loading="lazy"] {
        aspect-ratio: var(--img-aspect-ratio, auto);
    }
}

/* Dark mode support */
[data-theme="dark"] img.lazy-loading {
    background: linear-gradient(
        135deg,
        #2a2a2a 0%,
        #1a1a1a 50%,
        #2a2a2a 100%
    );
}

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

/* Print styles - ensure all images are visible */
@media print {
    img.lazy-loading {
        filter: none;
        transform: none;
        animation: none;
    }
}
