/* ============================================================
   CONFIGURACIÓN PARA MÓVILES (Menos de 768px)
   ============================================================ */
@media (max-width: 768px) {

    /* --- EL BOTÓN HAMBURGUESA --- */
    .hamburger-menu {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        width: 30px;
        height: 22px;
        background: transparent;
        border: none;
        cursor: pointer;
        padding: 0;
        z-index: 1100;
        position: absolute; 
        top: -46px;   
        left: 42px;  
    }

    .line {
        display: block;
        width: 100%;
        height: 3px;
        background-color: white;
        border-radius: 5px;
        transition: all 0.3s ease;
    }

    /* --- EL CONTENEDOR --- */
    .nav-links {
        display: flex;
        flex-direction: column;
        gap: 12px;
        padding: 20px;
        list-style: none;
        background: transparent; 
        position: fixed; 
        width: 46%;
        max-width: 300px;
        top: 100px;
        left: 36px;
        height: auto;
        z-index: 999;
        
        transition: opacity 0.4s ease; 
        opacity: 0;
        pointer-events: none;
    }

    .nav-links.active {
        opacity: 1;
        pointer-events: auto;
    }

    /* --- LOS BOTONES (Estado base / Salida "Efecto Humo") --- */
    .nav-links li a {
        display: block;
        padding: 8px 20px;
        color: white !important;
        text-decoration: none;
        font-weight: bold;
        text-align: left;
        border-radius: 15px;
        border: none; 
        outline: 2.5px solid rgba(255, 255, 255, 0.8);
        outline-offset: -5px;

        background: linear-gradient(to right, rgba(1, 153, 255, 0.7), rgba(1, 69, 255, 0.7));
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
        text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);

        /* Estado al desaparecer: se disuelven rápido hacia la derecha */
        transform: translateX(50px);
        opacity: 0;
        
        /* Transición de salida: todas juntas, sin delays */
        transition: transform 0.3s ease-in, opacity 0.3s ease-in;
    }

    /* --- LOS BOTONES (Estado activo / Entrada Escalonada) --- */
    .nav-links.active li a {
        transform: translateX(0);
        opacity: 1;
        /* Transición de entrada: con rebote */
        transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.4s ease;
    }

    .nav-links li a:active {
        transform: scale(1.1);
    }

    /* BOTÓN ACTIVO */
    .nav-links li a.active {
        background: linear-gradient(to right, rgba(255, 72, 0, 0.8), rgba(255, 158, 0, 0.8));
        outline: 2.5px solid rgba(255, 255, 255, 0.9);
        outline-offset: -5px;
        font-weight: 900;
        box-shadow: 0 4px 15px rgba(255, 72, 0, 0.3);
    }

    /* --- DELAYS SOLO PARA LA ENTRADA (Clase .active) --- */
    .nav-links.active li:nth-child(1) a { transition-delay: 0.1s; }
    .nav-links.active li:nth-child(2) a { transition-delay: 0.15s; }
    .nav-links.active li:nth-child(3) a { transition-delay: 0.2s; }
    .nav-links.active li:nth-child(4) a { transition-delay: 0.25s; }
    .nav-links.active li:nth-child(5) a { transition-delay: 0.3s; }
    .nav-links.active li:nth-child(6) a { transition-delay: 0.35s; } /* Agregado */
    .nav-links.active li:nth-child(7) a { transition-delay: 0.4s; }  /* Agregado */

    /* --- ANIMACIÓN DE LA "X" --- */
    .hamburger-menu.open .line:nth-child(1) { transform: rotate(45deg) translate(6px, 7px); }
    .hamburger-menu.open .line:nth-child(2) { opacity: 0; transform: translateX(-20px); }
    .hamburger-menu.open .line:nth-child(3) { transform: rotate(-45deg) translate(6px, -7px); }
}

/* ============================================================
   3. MODO HORIZONTAL (Celular acostado)
   ============================================================ */
@media (max-width: 932px) and (orientation: landscape) {
    
    .nav-links {
        display: grid !important;
        /* Creamos 3 columnas del mismo tamaño */
        grid-template-columns: repeat(3, 1fr); 
        
        /* Ajustamos el ancho del contenedor para que quepan las 3 columnas */
        width: 85% !important; 
        max-width: 900px;
        
        /* Subimos un poco el menú porque en horizontal hay menos espacio arriba/abajo */
        top: 50px; 
        left: 50%;
        transform: translateX(-50%); /* Lo centramos en la pantalla */
        gap: 15px; /* Espacio entre los botones */
    }

    /* Mantenemos el tamaño original de los botones */
    .nav-links li a {
        padding: 8px 20px;
        font-size: 1rem; /* Tu tamaño original */
        text-align: center; /* En 3 columnas se ve mejor centrado */
    }

    /* Mantenemos el efecto de disolución al cerrar */
    .nav-links.active {
        transform: translateX(-50%); /* Mantiene el centrado al estar activo */
        opacity: 1;
    }
}