/* ===========================================
   OPTIMIZACIONES CRÍTICAS PARA CLS
   Espinoza Negrete & Asociados
   =========================================== */

/* CRÍTICO: Prevención de CLS en elementos principales */

/* 1. Body con dimensiones fijas */
html {
    scroll-behavior: smooth;
}

body {
    /* Prevenir cambios de layout */
    min-height: 100vh;
    overflow-x: hidden;
    }

/* 2. Logo container con dimensiones exactas */
.logo-container {
    background-color: #092543 !important; /* Color de fondo de la marca */
    height: 170px !important; /* Aumentado de 140px */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
}

.logo-video {
    width: 600px !important; /* Aumentado de 500px */
    height: 120px !important; /* Aumentado de 100px */
    max-width: 80% !important;
    object-fit: contain !important;
}

/* 3. Header con altura fija */
header {
    height: 200px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    box-sizing: border-box !important;
}

header h1 {
    height: 80px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
}

header p {
    height: 60px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
}

/* 4. Navegación con altura exacta */
.main-nav {
    height: 60px !important;
    box-sizing: border-box !important;
}

/* 5. Sección de imagen con dimensiones fijas */
.image-display-section {
    height: 500px !important;
    width: 100% !important;
    position: relative !important;
    overflow: hidden !important;
}

.image-display-section picture {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
}

.image-display-section img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
}

/* 6. Grid de servicios con altura fija */
.services-grid {
    min-height: 500px !important;
}

.service-card-3d {
    height: 280px !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
}

/* 7. Footer con altura mínima */
.main-footer {
    min-height: 120px !important;
}

/* MOBILE: Ajustes específicos para pantallas pequeñas */
@media (max-width: 819px) {
    .logo-container {
        height: 120px !important; /* Aumentado de 100px */
    }
    
    .logo-video {
        width: 420px !important; /* Aumentado de 350px */
        height: 84px !important; /* Aumentado de 70px */
    }
    
    header {
        height: 160px !important;
    }
    
    header h1 {
        height: 65px !important;
        font-size: 2rem !important;
    }
    
    header p {
        height: 50px !important;
        font-size: 2rem !important;
    }
    
    .image-display-section {
        height: 300px !important;
    }
    
    .services-grid {
        min-height: 1400px !important; /* 6 cards × ~230px cada una */
    }
    
    .service-card-3d {
        height: 200px !important;
    }
}

/* PREVENCIÓ N DE FOUT (Flash of Unstyled Text) */
@font-face {
    font-family: 'EB Garamond';
    font-display: swap;
}

@font-face {
    font-family: 'Great Vibes';
    font-display: swap;
}

/* OPTIMIZACIONES DE PERFORMANCE */
* {
    box-sizing: border-box;
}

/* Forzar hardware acceleration en elementos animados */
.service-card-3d,
.hamburger-line,
.accordion-title {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000;
}

/* Optimizar transiciones */
.service-card-3d:hover {
    transform: translateY(-10px) rotateY(5deg) scale(1.05) translateZ(0);
}

/* LOADING STATES - Placeholders visuales */
.loading-placeholder {
    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;
    }
}

/* CRITICAL: Prevent layout shift from images */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* CRITICAL: Reserve space for dynamic content */
.dynamic-content {
    min-height: 1px; /* Prevents collapse */
}

/* ACCESSIBILITY: Focus management without CLS */
*:focus {
    outline: 2px solid var(--dorado-elegante);
    outline-offset: 2px;
}


