/* Otimizações de Performance e SEO */

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

/* Otimização de fontes */
@font-display: swap;

/* Preload de recursos críticos */
.preload-font {
    font-display: swap;
}

/* Melhorias de acessibilidade */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary-blue);
    color: var(--white);
    padding: 8px;
    text-decoration: none;
    border-radius: 0 0 4px 4px;
    z-index: 10001;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 0;
}

/* Melhor contraste para acessibilidade */
.high-contrast {
    filter: contrast(150%);
}

/* Focus visível melhorado */
*:focus {
    outline: 2px solid var(--secondary-blue);
    outline-offset: 2px;
}

/* Otimizações para impressão */
@media print {
    .header,
    .footer,
    .btn,
    .mobile-menu-toggle {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
    }
    
    h1, h2, h3 {
        page-break-after: avoid;
    }
    
    .section {
        padding: 20px 0;
    }
}

/* Otimizações para telas de alta densidade */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .logo img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Melhorias para modo escuro (se suportado pelo sistema) */
@media (prefers-color-scheme: dark) {
    :root {
        --text-dark: #f3f4f6;
        --text-light: #d1d5db;
        --white: #1f2937;
        --light-gray: #374151;
    }
}

/* Redução de movimento para usuários sensíveis */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Otimizações para conexões lentas */
@media (prefers-reduced-data: reduce) {
    .hero::before {
        display: none;
    }
    
    .card:hover {
        transform: none;
    }
    
    .btn:hover {
        transform: none;
    }
}

/* Melhorias para telas pequenas */
@media (max-width: 320px) {
    .container {
        padding: 0 0.5rem;
    }
    
    .hero h1 {
        font-size: 1.75rem;
    }
    
    .btn {
        padding: 8px 16px;
        font-size: 0.875rem;
    }
    
    .card {
        padding: 1rem;
    }
}

/* Otimizações para tablets */
@media (min-width: 769px) and (max-width: 1024px) {
    .col-4 {
        flex: 0 0 50%;
    }
    
    .hero h1 {
        font-size: 3rem;
    }
}

/* Melhorias para telas muito grandes */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
    
    .hero h1 {
        font-size: 4rem;
    }
}

/* Otimizações de performance */
.will-change-transform {
    will-change: transform;
}

.will-change-opacity {
    will-change: opacity;
}

/* Contenção de layout */
.contain-layout {
    contain: layout;
}

.contain-paint {
    contain: paint;
}

/* Melhorias para formulários */
.form-control:invalid {
    border-color: #dc2626;
}

.form-control:valid {
    border-color: #10b981;
}

/* Estados de carregamento */
.loading-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

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

/* Melhorias de tipografia */
.text-balance {
    text-wrap: balance;
}

.text-pretty {
    text-wrap: pretty;
}

/* Otimizações para touch */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .nav-link {
        padding: 12px 16px;
    }
}

/* Melhorias para orientação landscape em mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        padding: 60px 0 40px;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
}

/* Otimizações para PWA (se implementado no futuro) */
.pwa-install-prompt {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: var(--primary-blue);
    color: var(--white);
    padding: 1rem;
    border-radius: 10px;
    box-shadow: var(--shadow-heavy);
    z-index: 1000;
}

/* Melhorias de SEO para rich snippets */
.breadcrumb {
    display: none; /* Oculto visualmente mas presente para SEO */
}

/* Otimizações de imagem */
img {
    height: auto;
    max-width: 100%;
}

.img-responsive {
    width: 100%;
    height: auto;
    object-fit: cover;
}

/* Melhorias para screen readers */
.sr-only-focusable:focus {
    position: static;
    width: auto;
    height: auto;
    padding: 0;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* Otimizações de scroll */
.smooth-scroll {
    scroll-behavior: smooth;
}

/* Melhorias para animações */
.fade-in {
    opacity: 0;
    animation: fadeIn 0.6s ease-out forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

.slide-up {
    transform: translateY(20px);
    opacity: 0;
    animation: slideUp 0.6s ease-out forwards;
}

@keyframes slideUp {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Otimizações para Core Web Vitals */
.critical-resource {
    font-display: swap;
}

.non-critical {
    loading: lazy;
}

/* Melhorias de contraste */
.high-contrast-mode {
    filter: contrast(150%) brightness(110%);
}

/* Otimizações para dispositivos com pouca memória */
@media (max-device-memory: 1) {
    .hero::before {
        display: none;
    }
    
    .card:hover {
        transform: none;
        box-shadow: var(--shadow-light);
    }
}
