/* =========================================
   VARIABLES Y RESET (no changes needed)
   ========================================= */
:root {
    --primary: #0087bf;          /* Existing main blue */
    --primary-light: #eaf4fc;    /* Existing light blue (can keep for underlines) */
    --accent: #ffb700;           /* Existing orange accent */
    --dark: #1a1a1a;             /* Existing dark grey/black */
    --text-grey: #666;           /* New: darker grey for unactive links/text */
    --light: #f4f4f4;
    --success: #00c853;
    --hero-text: #0d2e4e;
    --azul-flojo: #a2daf3;
    --fondo-suave: #f8fbfd;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /* Fixing font family typo and setting Montserrat as primary for header feel */
    font-family: 'Montserrat', sans-serif;
}

body {
    color: var(--dark);
    line-height: 1.6;
    overflow-x: hidden;
    font-family: 'Montserrat', sans-serif;
    font-display: swap;
}

a {
    text-decoration: none;
}

ul {
    list-style: none;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* =========================================
   HEADER Y NAVEGACIÓN (UPDATED LAYOUT)
   ========================================= */
/* =========================================
   HEADER BASE (FIJO Y TRANSPARENTE)
   ========================================= */
/* =========================================
   HEADER BASE (FIJO Y TRANSPARENTE)
   ========================================= */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 5%;
    
    /* Lo fijamos para que persiga al usuario */
    position: fixed; 
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    height: 85px;
    background: transparent;
    
    /* Transición suave para que no dé un pantallazo al cambiar a blanco */
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

/* Ocultar el selector de idioma móvil en escritorio */
.mobile-lang-group {
    display: none;
}

/* =========================================
   EFECTO SCROLL (FONDO BLANCO)
   ========================================= */
/* Esta clase se añadirá con JavaScript al bajar */
header.header-scrolled {
    background-color: #ffffff; 
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05); 
}

/* Los textos del menú pasan de blanco a oscuro para leerse sobre el fondo blanco */
header.header-scrolled .nav-link,
header.header-scrolled .lang-current,
header.header-scrolled .lang-link {
    color: var(--hero-text); 
}

/* Efectos hover en modo blanco */
header.header-scrolled .nav-link:hover,
header.header-scrolled .lang-link:hover {
    color: var(--primary);
}

/* El enlace activo recupera tu azul */
header.header-scrolled .nav-link.active {
    color: var(--primary);
}

/* Si usas menú hamburguesa en móvil, sus rayas se vuelven oscuras */
header.header-scrolled .hamburger span {
    background-color: var(--dark);
}

/* =========================================
   MENÚ HAMBURGUESA Y ANIMACIÓN A CRUZ (LIMPIO)
   ========================================= */

.hamburger {
    display: none; /* Oculto en escritorio */
    width: 30px;
    height: 22px;
    position: relative;
    cursor: pointer;
    z-index: 1001;
}

.hamburger span {
    display: block;
    position: absolute;
    height: 3px;
    width: 100%;
    background: var(--hero-text); /* Color adaptado a tus variables */
    border-radius: 3px;
    opacity: 1;
    left: 0;
    transform: rotate(0deg); 
    transform-origin: center center; 
    transition: all 0.3s ease-in-out;
}

.hamburger span:nth-child(1) { top: 0px; }
.hamburger span:nth-child(2) { top: 9px; }
.hamburger span:nth-child(3) { top: 9px; }
.hamburger span:nth-child(4) { top: 18px; }

.hamburger.active span:nth-child(1),
.hamburger.active span:nth-child(4) {
    top: 9px !important;
    width: 0% !important;
    left: 50% !important;
    opacity: 0 !important;
}

.hamburger.active span:nth-child(2) {
    transform: rotate(45deg) !important;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) !important;
}

/* Ocultar el botón CTA del menú desplegable en la versión de escritorio */
.mobile-cta-group {
    display: none;
}
/* =========================================
   HEADER PÁGINAS INTERIORES (SIEMPRE BLANCO)
   ========================================= */
header.header-solid {
    /* Usamos sticky en vez de fixed para que empuje el contenido hacia abajo 
       y no te tape los títulos de tus páginas interiores */
    position: sticky; 
    background-color: #ffffff; 
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05); 
}

/* Forzamos que los textos sean oscuros desde el principio */
header.header-solid .nav-link,
header.header-solid .lang-current,
header.header-solid .lang-link {
    color: var(--dark); 
}

/* Efectos hover */
header.header-solid .nav-link:hover,
header.header-solid .lang-link:hover {
    color: var(--primary);
}

/* Color azul para el enlace de la página en la que estás */
header.header-solid .nav-link.active {
    color: var(--primary);
}

/* Rayas del menú móvil en oscuro */
header.header-solid .hamburger span {
    background-color: var(--dark);
}

.logo {
    display: inline-flex;
    flex-direction: column;
    width: fit-content;
    text-align: left;
    flex: 0 0 auto; /* Ensure logo size is stable */
}

.logo img {
    height: 70px;
    display: block;
}

/* Navigation: Centered in the header */
nav {
    flex: 1; /* nav takes available space */
    display: flex;
    justify-content: center; /* center the content horizontally */
}

nav ul {
    color: #ffff;
    display: flex;
    gap: 1.5rem; /* Wider gap like image */
    align-items: center;
}

.nav-link {
    /* Updated: dark text, semi-bold */
    color: #ffff;
    font-weight: 500;
    font-size: 1.1rem;
    padding: 0.6rem 0.2rem; /* reduced padding */
    border-radius: 0; /* Removing pill shape */
    transition: all 0.3s ease;
    border-bottom: 2px solid transparent; /* Prepare for underline */
}

/* Updated: active link gets underline with your primary blue color */
.nav-link.active {
    background-color: transparent; /* Remove background pill */
    color: var(--primary); /* Use primary blue for active text */
    border-bottom: 2px solid var(--primary); /* Add primary blue underline */
}

/* Updated hover effect */
.nav-link:hover {
    color: var(--primary);
    background-color: transparent;
}

/* Right Actions Area: Languages + CTA */
.header-actions {
    display: flex;
    align-items: center;
    gap: 2rem;
    flex: 0 0 auto; /* stable size */
}

/* Updated Language Group Style (Replaces complex selector) */
.lang-group {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-grey);
}

.lang-link {
    color: #fff;
    transition: 0.3s;
}

.lang-link.active {
    color: var(--primary);
    font-weight: 600;
}

.lang-link:hover {
    color: var(--primary);
}

.lang-separator {
    color: #ccc; /* subtle color for separator bars */
}

/* CTA Button Modifications */
.btn-cta {
    text-decoration: none;
    background: var(--primary); /* Keep your primary blue */
    color: white;
    padding: 0.8rem 1.8rem; /* wider like image */
    border-radius: 50px; /* Fully rounded pill shape */
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    /* box-shadow: 0 4px 6px rgba(0, 86, 179, 0.2); Removing shadow for flat look */
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase; /* Ensure all caps */
}

/* Keep colors on hover, subtle background change */
.btn-cta:hover {
    background: #0077aa; /* slightly darker blue on hover */
    transform: translateY(-1px);
}

/* PRE-FOOTER CTA styles (unchanged) */
.pre-cta {
    background: var(--hero-text);
    padding: 60px 60px 60px 60px;
    text-align: center;
}

.pre-cta h2 {
    color: white;
    margin-bottom: 25px;
    font-size: 1.8rem;
}

/* FOOTER styles (unchanged) */
footer {
    background: var(--hero-text);
    color: white;
    padding: 3rem 5%;
    width: 100%;
}

.footer-horizontal {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2rem;
}

.brand-col {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 200px;
}

.brand-col img {
    height: 55px;
    margin-bottom: 0.5rem;
}

.copyright {
    font-size: 0.9rem;
    color: #aaa;
    margin: 0;
}

.footer-col h4 {
    color: white;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    border-left: 3px solid var(--primary);
    padding-left: 10px;
}

.footer-col a {
    color: white;
}

.footer-col a:hover {
    color: var(--primary);
}

/* =========================================
   RESPONSIVE GLOBAL (HEADER Y FOOTER)
   ========================================= */
@media (max-width: 1024px) {

    /* Mostrar el CTA en el menú móvil y centrarlo */
    .mobile-cta-group {
        display: flex;
        justify-content: center;
        width: 100%;
        margin-top: 1rem; 
    }

    /* Ajustar el ancho del botón para que no se vea minúsculo ni desproporcionado */
    .mobile-cta-group .btn-cta {
        width: 80%; /* Ajusta este porcentaje si lo quieres más ancho o más estrecho */
        text-align: center;
    }


    .desktop-lang-group {
        display: none;
    }

    /* 2. Mostrar y estilizar el selector de idioma dentro del menú */
    .mobile-lang-group {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 15px;
        /* Espacio entre los enlaces ES | CA | EN */
        margin-top: 2rem;
        padding-top: 1.5rem;
        border-top: 1px solid rgba(0, 0, 0, 0.1);
        /* Línea sutil para separarlo de los enlaces */
        width: 100%;
    }

    header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 1rem 5%;

        position: sticky;
        background-color: #ffffff;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
        top: 0;
        left: 0;
        width: 100%;
        z-index: 1000;
        height: 85px;

        /* Transición suave para que no dé un pantallazo al cambiar a blanco */
        transition: background-color 0.3s ease, box-shadow 0.3s ease;
    }

    .nav-link,
    .lang-current,
    .lang-link {
        color: var(--dark);
    }

    .logo img {
        height: 40px;
        display: block;
    }
    .hamburger {
        display: block;
    }
    .desktop-cta {
        display: none;
    }
    /* Updated Mobile Navigation styles */
    nav {
        display: block; /* override flex behavior on mobile */
        justify-content: flex-start;
        position: fixed;
        left: -100%;
        top: 0;
        width: 100%;
        height: 100vh;
        background-color: white;
        transition: 0.3s;
        text-align: center;
        box-shadow: 0 10px 10px rgba(0, 0, 0, 0.1);
        padding-top: 100px;
        z-index: 999;
        overflow-y: auto;
    }
    nav.active {
        left: 0;
    }
    nav ul {
        flex-direction: column;
        gap: 1.5rem;
    }
    .nav-link {
        font-size: 1.3rem;
        padding: 1rem 2rem;
        width: 100%;
        display: block;
        border-bottom: none; /* remove underline for mobile */
    }
    .nav-link.active {
        color: var(--primary);
        border-bottom: none;
    }
}

/* Ensure actions like language selector look okay on smaller desktops */
@media (max-width: 1100px) {
    .header-actions {
        gap: 1rem;
    }
}

@media (max-width: 768px) {
    .header-actions {
        gap: 1rem;
    }
    .footer-horizontal {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .brand-col {
        align-items: center;
        margin-bottom: 1.5rem;
    }
    .footer-col {
        width: 100%;
        margin-bottom: 1.5rem;
    }
    .footer-col h4 {
        border-left: none;
        padding-left: 0;
    }
}