/* Otimizações de Performance para Galeria */

/* Placeholder enquanto carrega */
.portfolio-item {
    background: linear-gradient(135deg, rgba(237, 208, 110, 0.05) 0%, rgba(237, 208, 110, 0.02) 100%);
    position: relative;
    overflow: hidden;
}

.portfolio-item::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(237, 208, 110, 0.1) 50%,
        transparent 100%);
    animation: shimmer 2s infinite;
    pointer-events: none;
}

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

/* Imagem carregando */
.portfolio-item img {
    background-color: rgba(237, 208, 110, 0.03);
}

.portfolio-item img[data-loaded="false"] {
    background-image: linear-gradient(45deg,
        rgba(237, 208, 110, 0.1) 25%,
        transparent 25%,
        transparent 50%,
        rgba(237, 208, 110, 0.1) 50%,
        rgba(237, 208, 110, 0.1) 75%,
        transparent 75%,
        transparent);
    background-size: 20px 20px;
    animation: loading-stripes 0.5s linear infinite;
    filter: blur(5px);
    opacity: 0.5;
}

@keyframes loading-stripes {
    0% { background-position: 0 0; }
    100% { background-position: 20px 20px; }
}

/* Imagem carregada */
.portfolio-item img[data-loaded="true"] {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        filter: blur(10px);
    }
    to {
        opacity: 1;
        filter: blur(0);
    }
}

/* Desabilitar animações em redes lentas */
@media (prefers-reduced-motion: reduce) {
    .portfolio-item img[data-loaded="true"] {
        animation: none;
    }
}

/* Otimização para dispositivos móveis */
@media (max-width: 768px) {
    /* Reduzir animações em mobile */
    .portfolio-item::before {
        animation: none;
        display: none;
    }

    /* Lazy load mais agressivo em mobile */
    .portfolio-grid {
        --lazyload-margin: 1000px;
    }
}

/* Network Information API - ajustar qualidade conforme conexão */
@media (prefers-color-scheme: dark) {
    .portfolio-item {
        background: linear-gradient(135deg, rgba(237, 208, 110, 0.08) 0%, rgba(237, 208, 110, 0.03) 100%);
    }
}

/* Evitar layout shift durante carregamento */
.portfolio-item {
    aspect-ratio: auto;
    width: 100%;
}

.portfolio-item img {
    aspect-ratio: auto;
}
