/* 
 * CSS para Otimizações de SEO e Mobile
 * Tema Reobote - Melhorias para Core Web Vitals
 */

/* SEO - H1 Oculto para indexadores */
.seo-hidden-h1 {
    position: absolute !important;
    left: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Melhorias para Core Web Vitals */
img {
    max-width: 100%;
    height: auto;
    display: block;
    aspect-ratio: attr(width) / attr(height);
}

/* Lazy loading otimizado - garante que imagens apareçam quando carregadas */
img[loading="lazy"]:not(.loaded) {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

img[loading="lazy"].loaded,
img[loading="lazy"][data-loaded="true"] {
    opacity: 1;
}

/* Otimizações para CLS (Cumulative Layout Shift) */
.logo-container {
    width: 90px;
    height: 90px;
    display: inline-block;
}

.navbar-brand img {
    width: 90px;
    height: 90px;
    object-fit: contain;
}

/* Melhorias para mobile */
@media (max-width: 768px) {
    .navbar-brand img {
        width: 70px;
        height: 70px;
    }
    
    .logo-container {
        width: 70px;
        height: 70px;
    }
    
    /* Otimizar espaçamento mobile */
    .container {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    /* Melhorar touch targets */
    .btn, .nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Animações performáticas (usando transform/opacity) */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out forwards;
}

/* Otimizações para AMP */
.amp-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

.amp-responsive {
    width: 100%;
    height: auto;
}

/* Prevenção de FOUC (Flash of Unstyled Content) */
.loading {
    visibility: hidden;
}

.loaded {
    visibility: visible;
}

/* Otimizações de performance para primeiro carregamento */
.critical-above-fold {
    display: block;
    visibility: visible;
}

.below-fold {
    content-visibility: auto;
    contain-intrinsic-size: 200px;
}

/* Melhorar renderização de texto */
body {
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Focus states para acessibilidade e SEO */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid #ffc107;
    outline-offset: 2px;
}

/* Skip link para acessibilidade */
.skip-link {
    position: absolute;
    left: -9999px;
    z-index: 999999;
    padding: 8px 16px;
    background: #000;
    color: #fff;
    text-decoration: none;
}

.skip-link:focus {
    left: 6px;
    top: 6px;
}

/* Breadcrumbs SEO-friendly */
.breadcrumb-nav {
    margin-bottom: 1rem;
}

.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    padding: 0.5rem 0;
    margin: 0;
    list-style: none;
    background-color: transparent;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: ">";
    padding: 0 0.5rem;
    color: #6c757d;
}

.breadcrumb-item.active {
    color: #6c757d;
}

/* Structured data helpers */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Performance otimizations */
* {
    box-sizing: border-box;
}

/* Reduce paint complexity */
.card,
.btn,
.navbar {
    will-change: auto;
}

/* Optimize animations */
@media (prefers-reduced-motion: reduce) {
    *,
    ::before,
    ::after {
        animation-delay: -1ms !important;
        animation-duration: 1ms !important;
        animation-iteration-count: 1 !important;
        background-attachment: initial !important;
        scroll-behavior: auto !important;
        transition-duration: 0s !important;
        transition-delay: 0s !important;
    }
}

/* Print styles for SEO */
@media print {
    .navbar,
    .btn,
    .whatsapp-float {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.3;
    }
    
    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
    }
    
    .seo-hidden-h1 {
        position: static !important;
        left: auto !important;
        width: auto !important;
        height: auto !important;
        overflow: visible !important;
        clip: auto !important;
        white-space: normal !important;
        font-size: 18pt;
        font-weight: bold;
        margin-bottom: 1rem;
    }
}