/* ==========================================================================
   1. VARIABLES Y COLORES INSTITUCIONALES (MANUAL UNAH 2022)
   ========================================================================== */
:root {
    /* Colores primarios oficiales */
    --primary-blue: #0F2C59; 
    --accent-yellow: #FFC72C;
    --unah-red: #A6192E;
    
    /* Grilla de colores de apoyo */
    --text-dark: #2D3748;
    --text-muted: #718096;
    --bg-light: #FFFFFF;
    --bg-light-alt: #F7FAFC;
    --border-color: #edf2f7;
    
    /* Configuración */
    --transition: 0.3s ease;
}

/* ==========================================================================
   2. RESET Y ESTILOS BASE (CORREGIDO PARA NO ROMPER ÍCONOS)
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
    overflow-x: hidden;
    /* Fuente general aplicada al body, no al asterisco (*) para proteger íconos */
    font-family: 'Helvetica Neue', Helvetica, Arial, 'Open Sans', sans-serif;
}

html {
    scroll-behavior: smooth;
}

h1, h2, h3, h4 {
    /* Tipografía para titulares basada en el manual */
    font-family: 'Futura', 'Montserrat', sans-serif;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Utilidades */
.section-padding { padding: 60px 0; }
.bg-light-alt { background-color: var(--bg-light-alt); }
.text-center { text-align: center; }
.mt-2 { margin-top: 15px; }

/* Títulos y Subrayados */
.section-header {
    text-align: center;
    margin-bottom: 60px;
}

.section-header h2 {
    color: var(--primary-blue);
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

.underline-title h2 {
    position: relative;
    display: inline-block;
    padding-bottom: 15px;
    color: var(--primary-blue);
}

.underline-title h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px; /* Un poco más grueso para que resalte el amarillo */
    background-color: var(--accent-yellow);
}

/* ==========================================================================
   3. NAVEGACIÓN Y HEADER (ADAPTADO AL MANUAL)
   ========================================================================== */
.main-header {
    background-color: var(--bg-light); 
    color: var(--primary-blue);
    padding: 25px 0; /* Más "aire" cuando estás arriba de la página */
    position: sticky;
    top: 0;
    z-index: 999;
    border-bottom: 4px solid var(--accent-yellow); 
    box-shadow: none; /* Sin sombra inicialmente */
    /* Transición suave para el padding y la sombra */
    transition: padding 0.4s ease, box-shadow 0.4s ease;
}

.main-header.scrolled {
    padding: 8px 0; /* Se hace más delgado */
    box-shadow: 0 10px 30px rgba(15, 44, 89, 0.15); /* Aparece la sombra flotante */
}

.main-header.scrolled .logo img {
    max-height: 50px; 
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Ajuste automático para el logo en imagen */
.logo img {
    max-height: 75px; /* Logo más grande inicialmente */
    width: auto;
    display: block;
    object-fit: contain;
    transition: max-height 0.4s ease; /* Transición suave de tamaño */
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 30px;
}

.nav-links a {
    color: var(--primary-blue); /* Texto azul sobre fondo blanco */
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: var(--transition);
}

.nav-links a:hover { color: var(--accent-yellow); }

/* Menú Hamburguesa Móvil (Azul) */
.menu-toggle {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 10px;
}

.hamburger {
    display: block;
    width: 25px;
    height: 3px;
    background: var(--primary-blue);
    position: relative;
    transition: var(--transition);
}

.hamburger::before, .hamburger::after {
    content: '';
    position: absolute;
    width: 25px;
    height: 3px;
    background: var(--primary-blue);
    left: 0;
    transition: var(--transition);
}

.hamburger::before { top: -8px; }
.hamburger::after { top: 8px; }

.menu-toggle.active .hamburger { background: transparent; }
.menu-toggle.active .hamburger::before { transform: rotate(45deg); top: 0; }
.menu-toggle.active .hamburger::after { transform: rotate(-45deg); top: 0; }

/* ==========================================================================
   4. COMPONENTES PRINCIPALES (HERO, CARDS, VIDEO, BOTONES)
   ========================================================================== */
.hero {
    padding: 50px 0 20px 0; /* Arriba 50px, Abajo 20px */
    background: linear-gradient(to right, #ffffff, #f0f4f8);
}

.hero-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
    align-items: center;
}

.hero-text h1 {
    font-size: 3rem;
    color: var(--primary-blue);
    line-height: 1.2;
    margin-bottom: 20px;
    font-weight: 700;
}

.hero-text p {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 30px;
}

.img-fluid {
    width: 100%;
    height: auto;
    display: block;
}

.rounded-shadow {
    border-radius: 20px; /* Bordes notablemente más redondos (antes era 16px) */
    box-shadow: 0 25px 50px rgba(15, 44, 89, 0.15); /* Sombra más amplia y suave */
    transition: transform var(--transition), box-shadow var(--transition); /* Animación suave */
}

/* Opcional: Pequeño efecto 3D al pasar el mouse por la imagen/video */
.rounded-shadow:hover {
    transform: translateY(-5px);
    box-shadow: 0 30px 60px rgba(15, 44, 89, 0.2);
}

.cta-button {
    background-color: var(--accent-yellow);
    color: var(--primary-blue);
    border: none;
    padding: 16px 32px;
    font-size: 1.1rem;
    font-weight: 800; /* Letra más gruesa */
    letter-spacing: 0.5px; /* Un poco más de espacio entre letras */
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    /* Sombra base del mismo color amarillo pero difuminada */
    box-shadow: 0 8px 20px rgba(255, 199, 44, 0.4); 
}

.cta-button:hover {
    background-color: #e6b327;
    transform: translateY(-4px); /* Sube un poco más */
    /* La sombra se expande al pasar el mouse */
    box-shadow: 0 12px 25px rgba(255, 199, 44, 0.6); 
}

/* Tarjetas Informativas */
.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.card {
    background: white;
    padding: 50px 40px; /* Más aire interno */
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(15, 44, 89, 0.08); /* Sombra más difuminada y elegante */
    text-align: center;
    transition: var(--transition);
    border: none; /* Quita el borde sólido si lo tiene */
}

.card:hover {
    transform: translateY(-8px); /* Levanta la tarjeta 8 pixeles */
    box-shadow: 0 15px 50px rgba(15, 44, 89, 0.15); /* Sombra más pronunciada al levantar */
}

.card-icon {
    font-size: 3.5rem;
    color: var(--primary-blue); /* Color inicial azul institucional */
    margin-bottom: 20px;
    transition: color var(--transition); /* Transición suave */
}

.card-icon-small {
    font-size: 2.5rem;
    color: var(--primary-blue); /* Color inicial azul institucional */
    margin-bottom: 15px;
    transition: color var(--transition); /* Transición suave */
}

.card:hover .card-icon,
.card:hover .card-icon-small {
    color: var(--accent-yellow);
}

.card h3 {
    color: var(--primary-blue);
    margin-bottom: 15px;
    font-weight: 600;
}

.card p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Contenedor de Video */
.video-container {
    position: relative;
    padding-bottom: 56.25%; 
    height: 0;
    overflow: hidden;
    max-width: 900px;
    margin: 0 auto;
    background-color: var(--primary-blue);
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* ==========================================================================
   5. FOOTER
   ========================================================================== */
.site-footer {
    background-color: #1A1A1A; 
    color: #FFFFFF;
    padding: 60px 0 20px 0;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-col h4 {
    font-size: 1.1rem;
    margin-bottom: 20px;
    font-weight: 600;
}

.brand-col h3 {
    font-size: 1.2rem;
    margin: 10px 0 5px 0;
}

.brand-col p {
    font-size: 0.9rem;
    color: #A0AEC0;
}

.footer-logo-circle {
    width: 60px;
    height: 60px;
    background-color: #2D3748;
    border: 2px solid var(--accent-yellow);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--accent-yellow);
}

.links-col ul, .contact-list {
    list-style: none;
    padding: 0;
}

.links-col ul li { margin-bottom: 10px; }

.links-col ul li a {
    color: #E2E8F0;
    text-decoration: none;
    font-size: 0.95rem;
    transition: color var(--transition);
}

.links-col ul li a:hover { color: var(--accent-yellow); }

.contact-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    font-size: 0.95rem;
    color: #E2E8F0;
}

.contact-list i { color: var(--accent-yellow); }

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #2D3748;
    font-size: 0.85rem;
    color: #718096;
}

/* ==========================================================================
   6. MODAL (DIALOG) DE AUTENTICACIÓN
   ========================================================================== */
dialog {
    margin: auto;
    border: none;
    border-radius: 16px;
    padding: 0;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

dialog::backdrop {
    background: rgba(15, 44, 89, 0.7); /* Azul institucional con opacidad */
    backdrop-filter: blur(5px);
}

.modal-content {
    padding: 40px;
    position: relative;
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
}

.modal-content h2 { color: var(--primary-blue); font-weight: 700; }
.modal-subtitle { color: var(--text-muted); margin-bottom: 25px; font-size: 0.9rem; }

.input-group { margin-bottom: 20px; text-align: left; }
.input-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--text-dark);
}

.input-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    transition: var(--transition);
}

.input-group input:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(15, 44, 89, 0.1);
}

/* Clase para validación (Error en rojo UNAH) */
.input-group input.error-border {
    border-color: var(--unah-red);
    box-shadow: 0 0 0 3px rgba(166, 25, 46, 0.1);
}

.submit-btn { width: 100%; margin-top: 10px; }

/* ==========================================================================
   7. ANIMACIONES Y WIDGET DE ACCESIBILIDAD
   ========================================================================== */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}
.fade-in.visible { opacity: 1; transform: translateY(0); }
.delay-1 { transition-delay: 0.2s; }

/* Menú Accesibilidad Flotante */
.a11y-widget { position: fixed; bottom: 25px; left: 25px; z-index: 9999; }

.a11y-toggle-btn {
    background-color: var(--primary-blue);
    color: white;
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    font-size: 1.8rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(15, 44, 89, 0.4);
    transition: transform var(--transition);
}

.a11y-toggle-btn:hover { transform: scale(1.05); }

.a11y-menu {
    position: absolute;
    bottom: 75px;
    left: 0;
    background: white;
    border-radius: 12px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    width: 220px;
    border: 1px solid var(--border-color);
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s, visibility 0.3s, transform 0.3s;
    transform: translateY(0);
}

.a11y-menu.hidden {
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
}

.a11y-menu button {
    background: transparent;
    border: none;
    padding: 10px 15px;
    text-align: left;
    cursor: pointer;
    width: 100%;
    font-size: 0.95rem;
    color: var(--text-dark);
    border-radius: 8px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* --- Corrección para los enlaces de mailto y tel en el Footer --- */
.contact-list li a {
    color: #E2E8F0; /* Mantiene el color gris muy claro/blanco */
    text-decoration: none; /* Le quita el subrayado azul por defecto */
    transition: color var(--transition); /* Aplica la transición suave */
}

/* Efecto al pasar el cursor sobre el correo o el teléfono */
.contact-list li a:hover {
    color: var(--accent-yellow); /* Se pinta del amarillo institucional de la UNAH */
}

.a11y-menu button:hover { background: #f0f4f8; color: var(--primary-blue); }
.a11y-menu button.btn-reset { border-top: 1px solid var(--border-color); border-radius: 0 0 8px 8px; margin-top: 5px; color: var(--unah-red); }


/* ==========================================================================
   8. CLASES DINÁMICAS JS - ACCESIBILIDAD 
   ========================================================================== */

/* Fuente Legible (Aplicada sólo a textos, protegiendo FontAwesome) */
body.readable-font,
body.readable-font h1, 
body.readable-font h2, 
body.readable-font h3, 
body.readable-font h4, 
body.readable-font p, 
body.readable-font a, 
body.readable-font button, 
body.readable-font input {
    font-family: Arial, Helvetica, sans-serif !important;
    letter-spacing: 0.05em !important;
    word-spacing: 0.1em !important;
}

/* Alto Contraste */
body.high-contrast {
    --primary-blue: #000000;
    --accent-yellow: #FFFF00;
    --bg-light: #000000;
    --bg-light-alt: #111111;
    --text-dark: #FFFFFF;
    --text-muted: #FFFFFF;
    --border-color: #FFFF00;
}

body.high-contrast .hero { background: #000000; border-bottom: 1px solid #333333; }
body.high-contrast .card { 
    background-color: #111111; /* Gris ultra oscuro en vez de negro puro */
    border: 1px solid #222222; /* Borde sutil, no amarillo brillante */
    /* Quitamos el borde amarillo tosco y usamos una sombra ligerísima */
    box-shadow: 0 10px 30px rgba(255, 255, 0, 0.05); 
}
body.high-contrast .card:hover {
    border-color: #FFFF00; /* Solo se pinta de amarillo al pasar el mouse */
    box-shadow: 0 15px 40px rgba(255, 255, 0, 0.15);
}
body.high-contrast .card-icon, body.high-contrast .card-icon-small { color: #FFFF00; }
body.high-contrast .site-footer { border-top: 1px solid #333333; }

/* Menú flotante en alto contraste */
body.high-contrast .a11y-menu { background-color: #000; border: 2px solid #FFFF00; }
body.high-contrast .a11y-menu button { color: #FFF; }
body.high-contrast .a11y-menu button:hover { background-color: #333; color: #FFFF00; }

/* Textos y botones en alto contraste */
body.high-contrast h1, body.high-contrast h2, body.high-contrast h3,
body.high-contrast .section-header h2, body.high-contrast .card h3,
body.high-contrast .underline-title h2 { color: #FFFF00 !important; }

body.high-contrast p, body.high-contrast label, body.high-contrast li,
body.high-contrast .subtitle { color: #FFFFFF !important; }

body.high-contrast .cta-button { background-color: #FFFF00 !important; color: #000000 !important; border: 2px solid #FFFF00; }



/* Corrección: Hacer visibles los enlaces del menú en Alto Contraste */
body.high-contrast .nav-links a {
    color: #FFFFFF !important; /* Texto blanco */
}

body.high-contrast .nav-links a:hover {
    color: #FFFF00 !important; /* Texto amarillo al pasar el cursor */
}

/* Opcional pero recomendado: Hacer que el ícono de menú móvil (hamburguesa) también sea visible en alto contraste */
body.high-contrast .hamburger,
body.high-contrast .hamburger::before,
body.high-contrast .hamburger::after {
    background: #FFFFFF !important;
}

/* ==========================================================================
   9. MEDIA QUERIES (RESPONSIVE MÓVIL)
   ========================================================================== */
@media (max-width: 768px) {
    .menu-toggle { display: block; }

    .nav-menu {
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: var(--bg-light); /* Menú blanco en móvil */
        
        /* --- CORRECCIÓN DEL BUG --- */
        opacity: 0;
        visibility: hidden;
        transform: translateY(-15px); /* Solo sube un poquito para dar el efecto */
        transition: all 0.3s ease-in-out;
        /* -------------------------- */
        
        z-index: -1;
        padding: 20px 0;
        box-shadow: 0 10px 20px rgba(0,0,0,0.1);
        border-bottom: 3px solid var(--accent-yellow);
    }

    body.high-contrast .nav-menu { background-color: #000; border-bottom: 3px solid #FFFF00; }

    /* --- CORRECCIÓN: Estado Activo --- */
    .nav-menu.active { 
        opacity: 1;
        visibility: visible;
        transform: translateY(0); 
    }

    .nav-links { flex-direction: column; align-items: center; gap: 20px; }

    .hero-grid { grid-template-columns: 1fr; text-align: center; }
    .hero-text h1 { font-size: 2.2rem; }
    .hero { padding: 40px 0; }
    
    .footer-grid { text-align: center; }
    .footer-logo-circle { margin: 0 auto; }
    .contact-list li { justify-content: center; }
}

/* ==========================================================================
   INTERCAMBIO DE LOGOS (NORMAL VS ALTO CONTRASTE)
   ========================================================================== */
/* Ocultar el logo blanco por defecto */
.logo-hc {
    display: none !important;
}

/* Cuando se activa el alto contraste, ocultamos el normal y mostramos el blanco */
body.high-contrast .logo-normal {
    display: none !important;
}

body.high-contrast .logo-hc {
    display: block !important;
}