/**
 * Image Optimization Styles
 * Blur-up effect for lazy loading with LQIP (Low Quality Image Placeholders)
 */

/* Blur-up placeholder styles */
.blur-up {
    filter: blur(10px);
    transition: filter 400ms ease;
}

.blur-up.lazyloaded {
    filter: blur(0);
}

/* Loading state indicator */
.lazyloading {
    opacity: 0.7;
}

.lazyloaded {
    opacity: 1;
    transition: opacity 300ms ease;
}

/* Aspect ratio containers to prevent layout shift (CLS) */
.img-wrapper {
    position: relative;
    overflow: hidden;
    background-color: #f0f0f0;
}

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

/* Common aspect ratios */
.img-wrapper--16-9 {
    padding-bottom: 56.25%; /* 9/16 = 0.5625 */
}

.img-wrapper--4-3 {
    padding-bottom: 75%; /* 3/4 = 0.75 */
}

.img-wrapper--1-1 {
    padding-bottom: 100%;
}

.img-wrapper--3-2 {
    padding-bottom: 66.67%; /* 2/3 */
}

/* Hero image specific styles */
.hero-image-container {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.hero-image-container picture {
    display: block;
    width: 100%;
}

.hero-image-container img {
    width: 100%;
    height: auto;
    display: block;
}

/* Product card image optimization */
.product-card-image {
    width: 100%;
    height: auto;
    object-fit: cover;
    background-color: #f8f9fa;
}

/* Category icon optimization */
.category-icon {
    width: 100%;
    height: auto;
    object-fit: contain;
}

/* Skeleton loading placeholder */
.img-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

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

/* Fallback for browsers without blur support */
@supports not (filter: blur(10px)) {
    .blur-up {
        opacity: 0;
    }
    .blur-up.lazyloaded {
        opacity: 1;
    }
}
