/* ===== VARIABLES ===== */
:root {
    --fondo: #faf7f2;
    --texto: #2c3e50;
    --header-footer: #2c3e50;
    --texto-header: #ecf0f1;
    --acento: #3498db;
    --acento-oscuro: #2980b9;
    --borde: #ddd;
    --sombra: rgba(0,0,0,0.1);
}

body.modo-oscuro {
    --fondo: #1e2b38;
    --texto: #e0e0e0;
    --header-footer: #0f1a24;
    --texto-header: #ecf0f1;
    --acento: #e67e22;
    --acento-oscuro: #d35400;
    --borde: #2c3e50;
    --sombra: rgba(0,0,0,0.5);
}

/* ===== GENERAL ===== */
body {
    font-family: 'Georgia', serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background: var(--fondo);
    color: var(--texto);
    transition: background-color 0.3s, color 0.3s;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== HEADER ===== */
header {
    background: var(--header-footer);
    padding: 1rem;
    box-shadow: 0 2px 5px var(--sombra);
}

nav ul {
    list-style: none;
    display: flex;
    gap: 2rem;
    justify-content: center;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
}

nav a {
    color: var(--texto-header);
    text-decoration: none;
    font-weight: bold;
    padding: 0.5rem 0;
    transition: color 0.2s;
}

nav a:hover {
    color: var(--acento);
    text-decoration: none;
}

/* Botón modo oscuro */
#modo-oscuro-btn {
    background: transparent;
    border: 1px solid var(--texto-header);
    color: var(--texto-header);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: bold;
    transition: all 0.2s;
}

#modo-oscuro-btn:hover {
    background: var(--texto-header);
    color: var(--header-footer);
}

/* ===== MAIN ===== */
main {
    max-width: 800px;
    margin: 2rem auto;
    padding: 2rem;
    background: var(--fondo);
    border-radius: 8px;
    box-shadow: 0 0 15px var(--sombra);
    flex: 1;
    width: 90%;
}

/* ===== FOOTER ===== */
footer {
    text-align: center;
    padding: 1.5rem;
    background: var(--header-footer);
    color: var(--texto-header);
    margin-top: auto;
    width: 100%;
    box-sizing: border-box;
}

footer a {
    color: var(--texto-header);
    text-decoration: underline;
}

footer a:hover {
    color: var(--acento);
}

/* ===== TÍTULOS ===== */
h1, h2, h3 {
    color: var(--texto);
}

h1 {
    border-bottom: 2px solid var(--acento);
    padding-bottom: 0.5rem;
}

/* ===== CAPÍTULOS (lista) ===== */
.capitulo {
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--borde);
    padding-bottom: 1rem;
}

.capitulo h2 a {
    color: var(--acento);
    text-decoration: none;
}

.capitulo h2 a:hover {
    text-decoration: underline;
}

/* ===== PÁGINA DE AVISO LEGAL ===== */
main section {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--borde);
}

main section:last-child {
    border-bottom: none;
}

main h2 {
    border-left: 4px solid var(--acento);
    padding-left: 1rem;
}

main ul {
    margin-left: 2rem;
    line-height: 1.8;
}

.fecha-actualizacion {
    text-align: right;
    font-style: italic;
    color: #777;
    margin-top: 2rem;
    border-top: 1px dashed var(--borde);
    padding-top: 1rem;
}

/* ===== NAVEGACIÓN ENTRE CAPÍTULOS ===== */
.nav-capitulo {
    margin-top: 2rem;
    text-align: center;
}

.nav-capitulo a {
    display: inline-block;
    background: var(--acento);
    color: white;
    padding: 0.5rem 1rem;
    text-decoration: none;
    border-radius: 4px;
    transition: background 0.2s;
}

.nav-capitulo a:hover {
    background: var(--acento-oscuro);
}

/* ===== MÓVIL ===== */
@media (max-width: 600px) {
    nav ul {
        flex-direction: column;
        align-items: center;
        gap: 0.8rem;
    }

    main {
        padding: 1.5rem;
        margin: 1rem auto;
        width: 95%;
    }

    h1 {
        font-size: 1.8rem;
    }

    .capitulo h2 {
        font-size: 1.3rem;
    }
}