/* Image Optimization CSS */
/* Optimize image loading and display */

/* Lazy loading placeholder styles */
img[loading="lazy"] {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading-shimmer 1.5s infinite;
}

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

/* Optimized image display */
img {
    max-width: 100%;
    height: auto;
    object-fit: cover;
    transition: opacity 0.3s ease;
}

img.loaded {
    opacity: 1;
}

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

/* Picture element for WebP support */
picture {
    display: contents;
}

/* Logo optimization */
.logo img {
    width: auto;
    height: 36px;
    object-fit: contain;
}

/* Portfolio image optimization */
.portfolio-img {
    width: 100%;
    height: 300px;
    object-fit: cover;
    border-radius: 8px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.portfolio-img:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

/* Blog image optimization */
.blog-img {
    width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 1.5rem 0;
}

/* Hero image optimization */
.hero-img {
    width: 100%;
    height: 400px;
    object-fit: cover;
    border-radius: 16px;
}

/* Avatar optimization */
.avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--green);
}

/* Icon optimization */
.icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

/* Favicon optimization */
.favicon {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

/* Image loading states */
.img-loading {
    opacity: 0.7;
    filter: blur(2px);
}

.logo img.img-loading,
.logo img.img-loaded,
.logo img.img-error {
    opacity: 1;
    filter: none;
}

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

.img-error {
    opacity: 0.5;
    filter: grayscale(100%);
}

/* Performance optimization */
img {
    contain: layout;
    will-change: transform;
}

/* Dark theme image optimization */
@media (prefers-color-scheme: dark) {
    img {
        filter: brightness(0.95) contrast(1.05);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    img {
        transition: none;
        animation: none;
    }
    
    .portfolio-img:hover {
        transform: none;
    }
}
