/* ============================================
   OTIMIZAÇÃO DE IMAGENS - WebP COM FALLBACK
   ============================================ */

/* Lazy loading melhorado para imagens */
img {
    loading: lazy;
    decoding: async;
}

/* Imagens críticas above the fold */
.hero img,
.logo img,
.intro img {
    loading: eager;
}

/* Otimização de layout shift */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Container para picture elements com fallback */
.responsive-image {
    position: relative;
    overflow: hidden;
}

.responsive-image img {
    width: 100%;
    height: auto;
    transition: opacity 0.3s ease;
}

/* Placeholder enquanto carrega */
.responsive-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #f0f0f0 0%, #e0e0e0 50%, #f0f0f0 100%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    z-index: 1;
}

.responsive-image img:not([src=""]) + ::before {
    display: none;
}

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

/* Otimização para diferentes tamanhos de tela */
@media (max-width: 768px) {
    img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Suporte para aspect ratio em imagens */
.image.main img,
.image.fit img {
    aspect-ratio: 16/9;
    object-fit: cover;
}

.image.square img {
    aspect-ratio: 1/1;
    object-fit: cover;
}

/* WebP fallback automático via CSS quando possível */
.webp .jpg-fallback {
    display: none;
}

.no-webp .webp-image {
    display: none;
}