/* --- RESET Y VARIABLES --- */
* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box !important; 
}

:root {
    --bg-negro: #000a14;
    --bg-tarjeta: #001326;
    --azul-brillante: #3b82f6;
    --azul-boton: #4d7cff;
    --rayas: rgba(0, 212, 255, 0.1);
}

body {
    background-color: var(--bg-negro);
    background-image: 
        linear-gradient(var(--rayas) 1px, transparent 1px),
        linear-gradient(90deg, var(--rayas) 1px, transparent 1px);
    background-size: 45px 45px;
    color: white;
    font-family: 'Segoe UI', Tahoma, sans-serif;
    padding-top: 110px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* --- HEADER --- */
.main-header {
    position: sticky; /* En lugar de fixed */
    top: 0;
    width: 100%;
    height: 80px;
    background: #000d1a;
    z-index: 10000;
}

.article section {
    /* Crea un margen interno para que el scroll se detenga antes de llegar al borde superior */
    scroll-margin-top: 100px; 
}

.header-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    flex-wrap: wrap; /* Permite que el menú baje si no cabe */
}

.logo-wrapper a { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.logo-wrapper img { height: 40px; width: auto; }
.logo-text { color: white; font-weight: bold; font-size: 20px; letter-spacing: 1px; }

.nav-links { 
    display: flex; 
    gap: 20px; 
    list-style: none; 
}
.nav-links a { 
    color: #00d4ff; 
    text-decoration: none; 
    font-size: 13px; 
    font-weight: bold; 
    text-transform: uppercase; 
}

/* --- GRID Y CONTENIDO --- */
.hero-section { text-align: center; margin-bottom: 40px; padding: 0 20px; }
.hero-section h1 { font-size: clamp(1.8rem, 5vw, 3rem); } /* Tamaño fluido */

.main-content { flex: 1; width: 100%; }

.grid-container {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 25px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* --- TARJETAS --- */
.legis-card {
    background: var(--bg-tarjeta);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.05);
    padding-bottom: 30px;
    transition: transform 0.3s ease;
}

.card-thumb { width: 100%; height: 180px; overflow: hidden; margin-bottom: 20px; }
.card-thumb img { width: 100%; height: 100%; object-fit: cover; }

.legis-card h3, .legis-card p { padding: 0 25px; }

.legis-card h3 {
    color: var(--azul-brillante);
    font-size: 1.4rem;
    font-weight: 800;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 15px;
    margin: 0 25px 15px 25px;
    padding-left: 0;
}

.legis-card p {
    color: #cbd5e1;
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 25px;
    flex-grow: 1;
}

.btn-view-data {
    background: var(--azul-boton);
    color: white;
    text-decoration: none;
    padding: 12px 25px;
    border-radius: 50px;
    font-weight: bold;
    text-align: center;
    align-self: flex-start;
    margin-left: 25px;
    font-size: 13px;
}

/* --- FOOTER --- */
.main-footer {
    background: #000d1a;
    border-top: 1px solid var(--rayas);
    padding: 40px 20px;
    margin-top: 60px;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

/* --- MEDIA QUERIES CORREGIDAS --- */

@media (max-width: 1024px) {
    .grid-container { grid-template-columns: repeat(2, 1fr) !important; }
}

@media (max-width: 768px) {
    body { padding-top: 140px; } /* Más espacio arriba porque el header crece */
    
    .header-container {
        flex-direction: column; /* Logo arriba, menú abajo */
        gap: 15px;
    }

    .nav-links { 
        display: flex; /* CAMBIO: Ahora sí se ve */
        gap: 15px; 
        justify-content: center;
        width: 100%;
        padding-bottom: 10px;
    }

    .nav-links a { font-size: 11px; }

    .grid-container { 
        grid-template-columns: 1fr !important; 
        padding: 15px;
    }

    .footer-container { flex-direction: column; text-align: center; }
    .footer-copy { text-align: center; }
}

/* Estilos generales */
body, html {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
}

.navbar {
    background-color: #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
}

.navbar .logo {
    display: flex;
    align-items: center;
}

.navbar .logo img {
    width: 50px;
    height: 50px;
    margin-right: 10px;
}

.navbar .logo span {
    color: white;
    font-size: 24px;
    font-weight: bold;
}

/* Estilo del menú */
.navbar .menu {
    list-style: none;
    display: flex;
    margin: 0;
    padding: 0;
}

.navbar .menu li {
    margin: 0 15px;
    position: relative;
}

.navbar .menu li a {
    color: white;
    text-decoration: none;
    padding: 10px;
}

/* Submenú */
.submenu {
    display: none;
    list-style: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #333;
    min-width: 150px;
    padding: 0;
}

.submenu li a {
    padding: 10px;
    color: white;
    text-decoration: none;
}

.navbar .menu li:hover .submenu {
    display: block;
}

/* Menú hamburguesa en móvil */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 20px;
    cursor: pointer;
}

.menu-toggle div {
    height: 4px;
    background-color: white;
    border-radius: 5px;
}

/* Estilos para móviles */
@media (max-width: 768px) {
    .navbar .menu {
        display: none;
        flex-direction: column;
        width: 100%;
        position: absolute;
        top: 60px;
        left: 0;
        background-color: #333;
        padding: 10px 0;
    }

    .navbar .menu.active {
        display: flex;
    }

    .navbar .menu li {
        margin: 10px 0;
        text-align: center;
    }

    .submenu {
        display: none;
        position: static;
    }

    .navbar .menu li:hover .submenu {
        display: block;
    }

    .menu-toggle {
        display: flex;
    }
}