/**
 * Emex Cars — Header
 * Header fijo, logo dinámico, nav desktop y menú móvil hamburger
 */

/* === HEADER MODERNO === */
.emex-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    /* Transición suave para el fondo y el padding */
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 15px 0;
    color: var(--emex-white);
}

/* Estado Scrolled (cuando bajas la página) */
.emex-header.scrolled {
    background-color: rgba(76, 6, 14, 0.95); /* Un poco más opaco para legibilidad */
    backdrop-filter: blur(10px);
    padding: 10px 0;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.emex-header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* --- LOGOTIPOS (SISTEMA DINÁMICO) --- */

/* 1. Contenedor Base (ESTADO INICIAL - TRANSPARENTE DESKTOP) */
.emex-logo-container {
    position: relative;
    display: block;
    
    /* TUS MEDIDAS: 150px ancho x 75px alto */
    width: 150px; 
    height: 75px; 
    
    /* Transición fluida del tamaño */
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 2. Contenedor Scrolled (ESTADO BAJANDO - DESKTOP) */
/* Cuando el header tiene la clase .scrolled, el contenedor crece */
.emex-header.scrolled .emex-logo-container {
    /* TUS MEDIDAS: 300px ancho x 90px alto */
    width: 300px;
    height: 90px;
}

/* Imágenes dentro del contenedor */
.emex-logo-img {
    position: absolute;
    top: 0; left: 0; 
    width: 100%; height: 100%;
    
    /* Aseguramos que la imagen no se deforme y respete el contenedor */
    object-fit: contain; 
    object-position: left center; /* Crece hacia la derecha */
    
    transition: opacity 0.4s ease-in-out;
}

/* Clases de visibilidad (React las activa/desactiva) */
.emex-logo-img.visible { opacity: 1; }
.emex-logo-img.hidden  { opacity: 0; }


/* --- MEDIA QUERY MÓVIL (MEDIDAS ESPECÍFICAS) --- */
@media (max-width: 768px) {
    
    /* 1. Móvil Inicial (Sin Scroll) */
    .emex-logo-container {
        /* TUS MEDIDAS: 80px ancho x 20px alto */
        width: 80px;
        height: 20px;
    }

    /* 2. Móvil Scrolled (Bajando) */
    .emex-header.scrolled .emex-logo-container {
        /* TUS MEDIDAS: 160px ancho x 30px alto */
        width: 160px;
        height: 30px;
    }
}


/* --- NAV DESKTOP --- */
.emex-nav-desktop {
    display: flex;
    gap: 30px;
    align-items: center;
}

.emex-nav-link {
    color: var(--emex-white);
    text-decoration: none;
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 1px;
    position: relative;
    padding: 5px 0;
}

/* Efecto de subrayado animado */
.emex-nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: var(--emex-punch-red);
    transition: width 0.3s ease;
}

.emex-nav-link:hover::after {
    width: 100%;
}

@media (max-width: 768px) {
    .emex-nav-desktop { display: none; }
}

/* --- MENU MOVIL (HAMBURGER) --- */
.emex-hamburger {
    display: none;
    background: none;
    border: none;
    color: var(--emex-white);
    font-size: 1.8rem;
    cursor: pointer;
}
@media (max-width: 768px) {
    .emex-hamburger { display: block; }
}

/* Overlay Menú Móvil */
.emex-mobile-menu {
    position: fixed;
    top: 0;
    right: -100%; /* Oculto a la derecha */
    width: 80%;
    max-width: 300px;
    height: 100vh;
    background-color: var(--emex-coffee-beam);
    z-index: 1001;
    transition: right 0.4s cubic-bezier(0.77, 0, 0.175, 1);
    padding: 80px 40px;
    box-shadow: -5px 0 15px rgba(0,0,0,0.3);
}

.emex-mobile-menu.open {
    right: 0; /* Visible */
}

.emex-mobile-link {
    display: block;
    color: var(--emex-white);
    font-size: 1.2rem;
    margin-bottom: 20px;
    text-decoration: none;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 10px;
}

/* Botón cerrar menú móvil */
.emex-close-menu {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: var(--emex-white);
    font-size: 2rem;
    cursor: pointer;
}
