/**
 * Image Optimization Styles for Ramani Composites
 */

/* Fade-in effect for lazy-loaded images */
img.lazy {
    opacity: 0;
    transition: opacity 0.3s ease-in;
}

img.lazy.loaded {
    opacity: 1;
}

/* Background image placeholders */
.banner-carousel-item {
    background-color: #f5f5f5; /* Placeholder color while loading */
    transition: background-image 0.5s ease-in;
    position: relative;
}

/* Banner image loading animation */
.banner-carousel-item::before {
    content: "";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    animation: loading-shimmer 1.5s infinite;
    transform: translateX(-100%);
    z-index: 1;
}

.banner-carousel-item.loaded-background::before {
    animation: none;
    opacity: 0;
}

@keyframes loading-shimmer {
    100% {
        transform: translateX(100%);
    }
}

/* Blur-up effect for progressive image loading */
.blur-up {
    filter: blur(5px);
    transition: filter 0.4s ease-in;
}

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

/* Prevent layout shifts - apply aspect ratio containers */
.image-container {
    position: relative;
    width: 100%;
    height: 0;
    overflow: hidden;
}

/* Common aspect ratios */
.aspect-16-9 {
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
}

.aspect-4-3 {
    padding-bottom: 75%; /* 4:3 aspect ratio */
}

.aspect-1-1 {
    padding-bottom: 100%; /* Square */
}

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

/* Specific handling for banner images */
.banner-carousel-item {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}