/* Image Loading Optimization */
img[loading="lazy"] {
    transition: opacity 0.3s ease;
}

img[data-src] {
    opacity: 0;
}

img.loaded {
    opacity: 1;
}

/* Blur effect for lazy loading */
.lazy-load {
    filter: blur(5px);
    transition: filter 0.3s ease;
}

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

/* Progressive image loading */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Image container for better aspect ratio handling */
.image-container {
    position: relative;
    overflow: hidden;
    background: linear-gradient(90deg, #f0f0f0 25%, transparent 25%);
    background-size: 20px 20px;
    background-color: #f8f9fa;
    border-radius: var(--border-radius);
}

.image-container::before {
    content: '';
    display: block;
    padding-top: 56.25%; /* 16:9 aspect ratio */
}

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

/* Skeleton loading */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, transparent 25%);
    background-size: 20px 20px;
    background-color: #f8f9fa;
    animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

/* Responsive images */
.responsive-img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Image optimization for mobile */
@media (max-width: 768px) {
    img {
        max-width: 100%;
        height: auto;
    }
    
    .hero-image img {
        max-height: 300px;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}