/* === Variables === */
:root {
    --primary-dark: #111827;
    --primary-blue: #1e40af;
    --accent-blue: #60a5fa;
    --bg-dark: #0f172a;
    --bg-light: #f8fafc;
    --bs-gray-300: #dee2e6;
}

/* === Reset básico (compatible con Bootstrap reboot) === */
*, *::before, *::after {
    box-sizing: border-box;
}

/* === Fuentes auto-alojadas (anti-CLS) === */
/* Open Sans — variable 400–700 */
@font-face {
    font-family: 'Open Sans';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url(/assets/fonts/opensans-latin.woff2) format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Open Sans';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url(/assets/fonts/opensans-latinext.woff2) format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* Poppins — 500 / 600 / 700 */
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 500; font-display: swap; src: url(/assets/fonts/poppins-500-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 500; font-display: swap; src: url(/assets/fonts/poppins-500-latinext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 600; font-display: swap; src: url(/assets/fonts/poppins-600-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 600; font-display: swap; src: url(/assets/fonts/poppins-600-latinext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 700; font-display: swap; src: url(/assets/fonts/poppins-700-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 700; font-display: swap; src: url(/assets/fonts/poppins-700-latinext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

/* Fallbacks con métricas ajustadas (Arial) — evitan el reflujo al cargar la fuente */
@font-face {
    font-family: 'Open Sans Fallback';
    src: local('Arial');
    size-adjust: 116.81%;
    ascent-override: 91.50%;
    descent-override: 25.08%;
    line-gap-override: 0%;
}
@font-face {
    font-family: 'Poppins Fallback';
    src: local('Arial');
    size-adjust: 128.23%;
    ascent-override: 81.89%;
    descent-override: 27.30%;
    line-gap-override: 0%;
}

/* === Tipografía inicial === */
body {
    font-family: 'Open Sans', 'Open Sans Fallback', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.5;
    margin: 0;
    -webkit-font-smoothing: antialiased;
}

/* Encabezados con Poppins + fallback métrico (se aplica antes de que cargue main.css) */
h1, h2, h3, h4, h5, h6, .hero-title {
    font-family: 'Poppins', 'Poppins Fallback', system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* === Preloader (debe estar en critical path) === */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    z-index: 999999;
    background-color: var(--bg-light);
}

.preloader-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.preloader-icon {
    width: 70px;
    height: 60px;
}

.loading-bar {
    width: 120px;
    height: 3px;
    margin-top: 30px;
    position: relative;
    overflow: hidden;
    background: #fff;
}

.loading-bar::before {
    content: "";
    width: 35px;
    height: 3px;
    background: var(--primary-dark);
    position: absolute;
    left: -34px;
    animation: bluebar 1.5s infinite ease;
}

@keyframes bluebar {
    50% { left: 96px; }
}

/* === Layout crítico === */
.container {
    width: 100%;
    padding-right: 1rem;
    padding-left: 1rem;
    margin-right: auto;
    margin-left: auto;
    max-width: 1140px;
}

/* === Header y navegación === */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    background-color: var(--bg-light);
    padding: 1rem 0;
    transition: padding 0.3s ease;
}

/* === Hero section (LCP) === */
.page-header-hero,
.hero-section {
    background: linear-gradient(90deg, var(--bg-dark) 0%, var(--primary-blue) 100%);
    position: relative;
    min-height: 75vh;
    display: flex;
    align-items: center;
    padding-top: 6rem;
    color: #fff;
}

.page-header-hero h1,
.hero-section h1 {
    color: #fff;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1.5rem;
}

/* === Utilidades críticas === */
.text-center {
    text-align: center;
}

.mt-5 {
    margin-top: 3rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.py-5 {
    padding-top: 3rem;
    padding-bottom: 3rem;
}

.position-relative {
    position: relative;
}

.overflow-hidden {
    overflow: hidden;
}

.text-white {
    color: #fff;
}

/* === Botones críticos === */
.btn {
    display: inline-block;
    font-weight: 600;
    text-align: center;
    vertical-align: middle;
    cursor: pointer;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: 0.25rem;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-light {
    background: var(--bg-light);
    color: var(--primary-dark);
    border: none;
}

.btn-light:hover {
    background: var(--accent-blue);
    color: #fff;
    transform: translateY(-2px);
}

/* === Media queries críticos === */
@media (max-width: 992px) {
    .page-header-hero,
    .hero-section {
        text-align: center;
        min-height: auto;
        padding-top: 4rem;
        padding-bottom: 4rem;
    }

    .page-header-hero h1,
    .hero-section h1 {
        font-size: 2rem;
    }
}

@media (min-width: 576px) {
    .container {
        max-width: 540px;
    }
}

@media (min-width: 768px) {
    .container {
        max-width: 720px;
    }
}

@media (min-width: 992px) {
    .container {
        max-width: 960px;
    }
}

@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }
}

/* === Estado de carga de fuentes === */
.fonts-loading {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.fonts-loaded {
    font-family: "Open Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* === Animaciones críticas === */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-in {
    animation: fadeIn 0.6s ease-out;
}
