/* =========================================
   PERSISTE - Estilos Base (Vanilla CSS)
   Filosofía: Lo viejo funciona
   ========================================= */

/* VARIABLES DE DISEÑO */
:root {
    --primary: #003366;      /* Azul institucional sobrio */
    --accent: #4CAF50;       /* Verde sostenibilidad (detalles, bordes, hover sobre azul) */
    --accent-dark: #2E7D32;  /* Verde oscuro: fondos con texto blanco (contraste AA) */
    --accent-darker: #1B5E20;
    --bg: #ffffff;
    --text: #222222;
    --light-bg: #f9f9f9;
    --border: #dddddd;
}

/* RESET BÁSICO Y ACCESIBILIDAD */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    line-height: 1.6;
    color: var(--text);
    background-color: var(--bg);
    -webkit-font-smoothing: antialiased;
}

/* Foco visible para quienes navegan con teclado */
a:focus-visible,
summary:focus-visible,
.btn:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

nav a:focus-visible,
footer a:focus-visible {
    outline-color: #fff;
}

/* =========================================
   CABECERA RESPONSIVA (LIMITACIÓN ESTRICTA)
   ========================================= */
header {
    text-align: center;
    background: #fff;
    border-bottom: 3px solid var(--accent);
    padding: 1rem 0;
    overflow: hidden;
}

.logo-header {
    display: block;
    margin: 0 auto;

    /* No puede superar nunca los 280px de alto */
    max-height: 280px !important;
    height: auto !important;
    width: auto !important;
    max-width: 100%;

    object-fit: contain;
}

/* =========================================
   NAVEGACIÓN SIMPLE Y LIGERA
   ========================================= */
nav {
    background: var(--primary);
    text-align: center;
    padding: 0.8rem;
}

nav a {
    color: #fff;
    text-decoration: none;
    margin: 0 1rem;
    font-weight: bold;
    font-size: 1rem;
    display: inline-block;
}

nav a:hover {
    text-decoration: underline;
    color: var(--accent);
}

/* Indica la página actual */
nav a[aria-current="page"] {
    text-decoration: underline;
    text-decoration-color: var(--accent);
    text-decoration-thickness: 3px;
    text-underline-offset: 6px;
}

/* =========================================
   CONTENIDO PRINCIPAL
   ========================================= */
.container {
    max-width: 900px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.intro h1 {
    color: var(--primary);
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 2rem;
}

.intro p {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    max-width: 70ch; /* línea de lectura cómoda */
}

h1, h2, h3 {
    color: var(--primary);
    margin-top: 2rem;
    margin-bottom: 1rem;
}

p { margin-bottom: 1rem; }


.intro .destacado {
    color: var(--primary);
}

/* =========================================
   QUÉ OFRECE (CARDS EXPANDIBLES)
   Usan <details>/<summary>: funcionan sin JavaScript
   y son accesibles por teclado y lector de pantalla.
   ========================================= */
.ofrece { margin-top: 2.5rem; }

.ofrece > h2 {
    margin-top: 0;
    font-size: 1.5rem;
}

.ofertas {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    align-items: start; /* abrir una card no estira a las demás */
}

.oferta {
    border: 1px solid var(--border);
    border-top: 4px solid var(--accent);
    border-radius: 6px;
    background: var(--light-bg);
}

.oferta[open] {
    border-color: var(--accent);
    background: #fff;
}

.oferta summary {
    display: block;
    list-style: none;       /* quita el triángulo nativo */
    cursor: pointer;
    padding: 1.2rem 1.5rem;
}

.oferta summary::-webkit-details-marker { display: none; }

.oferta summary:hover h3 { text-decoration: underline; }

.oferta h3 {
    margin: 0 0 0.4rem;
    font-size: 1.2rem;
}

.oferta .resumen {
    display: block;
    color: #444;
}

/* Indicador que cambia según el estado */
.oferta summary::after {
    content: "Ver más +";
    display: block;
    margin-top: 0.8rem;
    font-weight: bold;
    font-size: 0.95rem;
    color: var(--accent-dark);
}

.oferta[open] summary::after { content: "Ver menos −"; }

.oferta .detalle {
    border-top: 1px solid var(--border);
    margin: 0 1.5rem;
    padding: 1rem 0 0.2rem;
}

.oferta .detalle p { font-size: 0.97rem; }

.resultado {
    margin-top: 1.5rem;
    padding-left: 1rem;
    border-left: 4px solid var(--accent);
    font-weight: 600;
    color: var(--primary);
}

/* =========================================
   TARJETAS DE PERFIL (BIFURCACIÓN)
   ========================================= */
.perfiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.card {
    border: 1px solid var(--border);
    padding: 1.5rem;
    border-radius: 6px;
    background: var(--light-bg);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.card h2 {
    color: var(--primary);
    margin-bottom: 0.8rem;
    font-size: 1.3rem;
    margin-top: 0;
}

.btn {
    display: inline-block;
    background: var(--accent-dark);
    color: #fff;
    padding: 0.6rem 1.2rem;
    text-decoration: none;
    border-radius: 4px;
    font-weight: bold;
    margin-top: 0.5rem;
    border: none;
    cursor: pointer;
}

.btn:hover { background: var(--accent-darker); }

/* =========================================
   TABLAS TÉCNICAS RESPONSIVAS (ANEXO VIII)
   ========================================= */
.table-responsive {
    overflow-x: auto;
    margin: 1.5rem 0;
    border: 1px solid var(--border);
    border-radius: 4px;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

th, td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

th {
    background: var(--light-bg);
    font-weight: bold;
    color: var(--primary);
    white-space: nowrap;
}

tr:last-child td { border-bottom: none; }

/* BADGES PARA VEREDICTOS TÉCNICOS */
.badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: bold;
    color: #fff;
    white-space: nowrap;
    display: inline-block;
}

.badge.success { background: var(--accent-dark); }
.badge.danger { background: #d32f2f; }
.badge.warning { background: #b85c00; } /* más oscuro para contraste con texto blanco */

/* BLOQUE DE CÓDIGO (PROMPT OFICIAL) */
pre {
    background: #f4f4f4;
    padding: 1rem;
    border-left: 4px solid var(--primary);
    overflow-x: auto;
    border-radius: 4px;
    margin: 1rem 0;
    font-size: 0.9rem;
}

code {
    font-family: "Courier New", Courier, monospace;
    word-break: break-word;
}

/* =========================================
   FOOTER INSTITUCIONAL
   ========================================= */
footer {
    text-align: center;
    padding: 2rem 1rem;
    background: var(--primary);
    color: #fff;
    margin-top: 3rem;
    font-size: 0.9rem;
}

footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: bold;
}

footer a:hover { text-decoration: underline; }

/* =========================================
   MEDIA QUERIES PARA LEGACY Y MÓVILES
   ========================================= */
@media (max-width: 600px) {
    nav a {
        display: block;
        margin: 0.5rem 0;
        padding: 0.5rem;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }

    .perfiles,
    .ofertas { grid-template-columns: 1fr; }

    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.2rem; }
    .ofrece > h2 { font-size: 1.3rem; }

    /* En móviles, reducimos aún más la cabecera para priorizar contenido */
    .logo-header { max-height: 180px !important; }
}

/* Respeta a quienes desactivan las animaciones en su sistema */
@media (prefers-reduced-motion: reduce) {
    .card { transition: none; }
    .card:hover { transform: none; }
}
