/**
 * Modern Image Formats CSS
 * Styles for WebP/AVIF images with fallbacks
 */

/* Picture element styling */
.gallery__picture {
    display: block;
    width: 100%;
    height: 100%;
}

.gallery__picture img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Image loading states */
.gallery__image {
    opacity: 0;
    transform: scale(1.05);
}

.gallery__image.loaded {
    opacity: 1;
    transform: scale(1);
}

.gallery__image.error {
    opacity: 0.5;
    background-color: #f8f9fa;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23dee2e6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='2' ry='2'/%3E%3Ccircle cx='8.5' cy='8.5' r='1.5'/%3E%3Cpolyline points='21,15 16,10 5,21'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 48px 48px;
}

/* Skeleton loading animation */
.gallery__image-skeleton {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    z-index: 1;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Hide skeleton when image is loaded */
.gallery__image.loaded + .gallery__image-skeleton,
.gallery__image.error + .gallery__image-skeleton {
    display: none;
}

/* Responsive image optimizations */
@media (max-width: 768px) {
    .gallery__picture img {
        /* Slightly faster transitions on mobile */
        transition: transform 0.2s ease, opacity 0.2s ease;
    }
}

/* High DPI display optimizations */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .gallery__picture {
        /* Ensure crisp images on retina displays */
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Prefers reduced motion */
@media (prefers-reduced-motion: reduce) {
    .gallery__image,
    .gallery__image-skeleton {
        animation: none;
        transition: none;
    }
}

/* Print styles */
@media print {
    .gallery__picture img {
        /* Ensure images print well */
        -webkit-print-color-adjust: exact;
        color-adjust: exact;
    }
}