/**
 * Lazy Loading Styles
 * Smooth transitions and placeholders for lazy-loaded images
 */

/* Blur placeholder effect */
.blur-placeholder {
    filter: blur(10px);
    transition: filter 0.3s ease-in-out;
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
}

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

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

/* Loading skeleton */
.image-skeleton {
    background: linear-gradient(
        90deg,
        #1a1a1a 0%,
        #2a2a2a 50%,
        #1a1a1a 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}

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

/* Error state for failed images */
img.image-error {
    opacity: 0.5;
    filter: grayscale(100%);
}

/* Lazy image container */
.lazy-image-container {
    position: relative;
    overflow: hidden;
    background-color: #1a1a1a;
}

/* Loading spinner overlay */
.lazy-image-container::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #ff4081;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    z-index: 1;
}

.lazy-image-container.loaded::before {
    display: none;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Responsive image optimization */
img[loading="lazy"] {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
}

/* Thumbnail optimization */
.model-card img[loading="lazy"],
.gallery-item img[loading="lazy"] {
    aspect-ratio: 2/3;
    object-fit: cover;
}

/* Progressive enhancement */
@supports (aspect-ratio: 1) {
    .lazy-image-container {
        aspect-ratio: var(--image-aspect-ratio, 2/3);
    }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .blur-placeholder,
    img.loaded {
        transition: none;
        animation: none;
    }

    .image-skeleton {
        animation: none;
        background: #1a1a1a;
    }
}

/* Print optimization */
@media print {
    .blur-placeholder {
        filter: none;
    }

    .lazy-image-container::before {
        display: none;
    }
}
