/* Image Loading Placeholders */

/* Skeleton shimmer animation */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

/* Image placeholder - shows while loading */
img[loading="lazy"] {
    background: linear-gradient(
        90deg,
        #f0f0f0 0%,
        #e0e0e0 20%,
        #f0f0f0 40%,
        #f0f0f0 100%
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite linear;
}

/* Remove shimmer once image is loaded */
img[loading="lazy"].loaded {
    animation: none;
    background: transparent;
}

/* Smooth fade-in effect when image loads */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

img[loading="lazy"].loaded {
    opacity: 1;
}

/* Aspect ratio containers to prevent layout shift */
.img-container {
    position: relative;
    overflow: hidden;
    background: #f5f5f5;
}

/* Common aspect ratios */
.img-container.aspect-square {
    aspect-ratio: 1 / 1;
}

.img-container.aspect-video {
    aspect-ratio: 16 / 9;
}

.img-container.aspect-portrait {
    aspect-ratio: 3 / 4;
}

.img-container.aspect-landscape {
    aspect-ratio: 4 / 3;
}

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

/* Alternative: Blur placeholder (if you want to use low-res preview) */
.img-blur-placeholder {
    filter: blur(10px);
    transition: filter 0.3s ease-in-out;
}

.img-blur-placeholder.loaded {
    filter: blur(0);
}

/* Spinner overlay (optional - for critical images) */
.img-loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #ce1126;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    opacity: 0.7;
    pointer-events: none;
}

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

/* Hide spinner once image loads */
.img-container.loaded .img-loading-spinner {
    display: none;
}
