/* ====================================================
   EL UMBRAL DE DIOS - Web-Libro
   Tema Oscuro & Místico
   ==================================================== */

/* ---------- RESET & BASE ---------- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Colores base */
    --fondo: #0a0a0f;
    --fondo-secundario: #111118;
    --fondo-terciario: #181825;
    --fondo-carta: rgba(20, 20, 35, 0.85);
    --texto: #e2dfdc;
    --texto-claro: #f7f4ef;
    --texto-medio: #b9b4bd;
    --texto-oscuro: #9c97a1;
    --texto-dorado: #d3b488;
    --texto-dorado-claro: #ecdcb8;
    --borde-dorado: rgba(211, 180, 136, 0.3);
    --sombra-dorada: rgba(211, 180, 136, 0.1);
    --destello: rgba(211, 180, 136, 0.14);

    /* Tipografía */
    --fuente-titulo: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
    --fuente-cuerpo: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    /* Espaciado */
    --espacio-base: 1rem;
    --espacio-grande: 2rem;
    --espacio-maximo: 4rem;

    /* Transiciones */
    --transicion: 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --transicion-lenta: 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);

    /* Tamaños de texto */
    --tamano-texto: 1.1rem;
    --tamano-titulo: 2.8rem;
    --tamano-subtitulo: 1.6rem;

    /* Anchos */
    --ancho-maximo: 820px;
    --ancho-lectura: 70ch;
}

/* Modo claro (opcional, se activa con JS) */
[data-tema="claro"] {
    --fondo: #f7f4ee;
    --fondo-secundario: #ece8e1;
    --fondo-terciario: #ddd8ce;
    --fondo-carta: rgba(247, 244, 238, 0.92);
    --texto: #2a2826;
    --texto-claro: #16140f;
    --texto-medio: #55504a;
    --texto-oscuro: #6d675e;
    --texto-dorado: #7a6640;
    --texto-dorado-claro: #8a7238;
    --borde-dorado: rgba(122, 102, 64, 0.3);
    --sombra-dorada: rgba(122, 102, 64, 0.12);
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--fuente-cuerpo);
    background: var(--fondo);
    color: var(--texto);
    line-height: 1.7;
    min-height: 100vh;
    transition: background var(--transicion), color var(--transicion);
    overflow-x: hidden;
}

/* ---------- ACCESIBILIDAD ---------- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

:focus-visible {
    outline: 2px solid var(--texto-dorado);
    outline-offset: 3px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ---------- SCROLLBAR ---------- */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: var(--fondo);
}
::-webkit-scrollbar-thumb {
    background: var(--texto-dorado);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--texto-dorado-claro);
}

/* ---------- LOADING SCREEN ---------- */
#loading-screen {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: var(--fondo);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

#loading-screen.oculto {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-ring {
    width: 60px;
    height: 60px;
    border: 2px solid rgba(201, 168, 124, 0.1);
    border-top-color: var(--texto-dorado);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loader-text {
    margin-top: 1.2rem;
    font-family: var(--fuente-titulo);
    font-size: 0.95rem;
    letter-spacing: 0.3em;
    color: var(--texto-oscuro);
    animation: pulse-text 1.8s ease-in-out infinite;
}

@keyframes pulse-text {
    0%,
    100% {
        opacity: 0.4;
    }
    50% {
        opacity: 1;
    }
}

/* ---------- PORTADA ---------- */
.portada {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: var(--espacio-grande);
    background: radial-gradient(ellipse at 50% 30%, #14141f 0%, #0a0a0f 70%);
    overflow: hidden;
}

.portada-container {
    position: relative;
    z-index: 2;
    max-width: 900px;
    width: 100%;
    text-align: center;
}

.portada-contenido {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--espacio-grande);
    padding: var(--espacio-grande) 0;
}

/* Decoración de portada */
.portada-decoracion {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 0.5rem;
}

.simbolo {
    font-family: var(--fuente-titulo);
    font-size: 2.2rem;
    color: var(--texto-dorado);
    opacity: 0.6;
    animation: pulse-simbolo 3s ease-in-out infinite;
}

.simbolo:first-child {
    animation-delay: 0s;
}
.simbolo:last-child {
    animation-delay: 1.5s;
}

@keyframes pulse-simbolo {
    0%,
    100% {
        opacity: 0.3;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.05);
    }
}

.linea {
    width: 80px;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--texto-dorado), transparent);
    opacity: 0.5;
}

/* Título */
.portada-titulo {
    font-family: var(--fuente-titulo);
    line-height: 1.05;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.titulo-sutil {
    font-size: clamp(1.2rem, 3vw, 1.8rem);
    font-weight: 300;
    letter-spacing: 0.4em;
    color: var(--texto-oscuro);
    text-transform: uppercase;
}

.titulo-fuerte {
    font-size: clamp(3.5rem, 12vw, 7.5rem);
    font-weight: 600;
    color: var(--texto-claro);
    letter-spacing: 0.06em;
    text-shadow: 0 0 60px rgba(201, 168, 124, 0.15);
    margin: -0.1em 0;
}

.portada-subtitulo {
    font-size: clamp(0.95rem, 1.4vw, 1.25rem);
    font-weight: 300;
    color: var(--texto-medio);
    letter-spacing: 0.06em;
    line-height: 1.6;
    max-width: 550px;
    margin: 0 auto;
}

.portada-firma {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    width: 100%;
    max-width: 300px;
}

.firma-linea {
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--texto-dorado), transparent);
    opacity: 0.4;
}

.firma-nombre {
    font-family: var(--fuente-titulo);
    font-size: 1rem;
    font-weight: 300;
    letter-spacing: 0.2em;
    color: var(--texto-dorado);
    white-space: nowrap;
}

.portada-epigrafe {
    font-family: var(--fuente-titulo);
    font-size: clamp(1rem, 1.4vw, 1.25rem);
    font-style: italic;
    color: var(--texto-medio);
    letter-spacing: 0.04em;
    padding: 0 var(--espacio-base);
    border-left: 1px solid var(--borde-dorado);
    border-right: 1px solid var(--borde-dorado);
    padding: 0.3rem 1.5rem;
}

/* Botón principal */
.btn-principal {
    display: inline-flex;
    align-items: center;
    gap: 1rem;
    padding: 0.9rem 2.8rem;
    background: transparent;
    border: 1px solid var(--borde-dorado);
    color: var(--texto-claro);
    font-family: var(--fuente-cuerpo);
    font-size: 0.95rem;
    font-weight: 300;
    letter-spacing: 0.2em;
    cursor: pointer;
    transition: all var(--transicion);
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
}

.btn-principal::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--texto-dorado);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform var(--transicion);
    opacity: 0.08;
}

.btn-principal:hover::before {
    transform: scaleX(1);
    transform-origin: left;
}

.btn-principal:hover {
    border-color: var(--texto-dorado-claro);
    box-shadow: 0 0 40px var(--sombra-dorada);
}

.btn-texto {
    position: relative;
    z-index: 1;
}

.btn-icono {
    position: relative;
    z-index: 1;
    font-size: 1.2rem;
    transition: transform var(--transicion);
}

.btn-principal:hover .btn-icono {
    transform: translateY(3px);
}

/* Partículas */
.particulas {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.particula {
    position: absolute;
    width: 2px;
    height: 2px;
    background: var(--texto-dorado);
    border-radius: 50%;
    opacity: 0;
    animation: flotar-particula var(--duracion, 15s) ease-in-out infinite;
}

@keyframes flotar-particula {
    0% {
        opacity: 0;
        transform: translate(0, 0) scale(0);
    }
    15% {
        opacity: 0.4;
    }
    85% {
        opacity: 0.3;
    }
    100% {
        opacity: 0;
        transform: translate(var(--dx, 50px), var(--dy, -100px)) scale(1);
    }
}

/* ---------- BARRA DE NAVEGACIÓN ---------- */
.nav-principal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(10, 10, 15, 0.85);
    backdrop-filter: blur(16px) saturate(1.2);
    border-bottom: 1px solid rgba(201, 168, 124, 0.08);
    padding: 0 var(--espacio-base);
    transition: background var(--transicion), transform var(--transicion);
    transform: translateY(-100%);
}

.nav-principal.visible {
    transform: translateY(0);
}

.nav-principal.scrolled {
    background: rgba(10, 10, 15, 0.92);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: var(--texto-claro);
    font-family: var(--fuente-titulo);
    font-size: 1.1rem;
    letter-spacing: 0.1em;
    font-weight: 400;
}

.nav-simbolo {
    font-size: 1.4rem;
    color: var(--texto-dorado);
    opacity: 0.7;
}

.nav-titulo {
    font-weight: 300;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    list-style: none;
}

.nav-item {
    background: none;
    border: none;
    color: var(--texto-medio);
    font-family: var(--fuente-cuerpo);
    font-size: 0.82rem;
    font-weight: 400;
    letter-spacing: 0.05em;
    padding: 0.4rem 0.9rem;
    cursor: pointer;
    transition: color var(--transicion), background var(--transicion);
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    text-transform: uppercase;
}

.nav-item:hover {
    color: var(--texto-claro);
    background: rgba(201, 168, 124, 0.06);
}

.nav-item:focus-visible {
    outline: 2px solid var(--texto-dorado);
    outline-offset: 0;
}

.nav-icon {
    font-size: 0.9rem;
    opacity: 0.6;
}

#progreso-texto {
    font-variant-numeric: tabular-nums;
    min-width: 3ch;
}

/* Toggle menú móvil */
.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.3rem;
}

.toggle-line {
    display: block;
    width: 24px;
    height: 1.5px;
    background: var(--texto-claro);
    transition: all var(--transicion);
    transform-origin: center;
}

.nav-toggle[aria-expanded="true"] .toggle-line:nth-child(1) {
    transform: rotate(45deg) translate(4px, 4px);
}
.nav-toggle[aria-expanded="true"] .toggle-line:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}
.nav-toggle[aria-expanded="true"] .toggle-line:nth-child(3) {
    transform: rotate(-45deg) translate(4px, -4px);
}

/* ---------- ÍNDICE ---------- */
.indice {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 1100;
    width: 100%;
    max-width: 420px;
    background: var(--fondo-secundario);
    border-left: 1px solid var(--borde-dorado);
    padding: 0;
    transform: translateX(100%);
    transition: transform var(--transicion-lenta);
    overflow-y: auto;
    box-shadow: -10px 0 60px rgba(0, 0, 0, 0.5);
}

.indice.abierto {
    transform: translateX(0);
}

.indice-container {
    padding: var(--espacio-grande);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.indice-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1.2rem;
    border-bottom: 1px solid var(--borde-dorado);
    flex-shrink: 0;
}

.indice-titulo {
    font-family: var(--fuente-titulo);
    font-size: 1.4rem;
    font-weight: 400;
    color: var(--texto-claro);
    letter-spacing: 0.1em;
}

.indice-cerrar {
    background: none;
    border: none;
    color: var(--texto-oscuro);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0.3rem 0.6rem;
    transition: color var(--transicion);
}

.indice-cerrar:hover {
    color: var(--texto-claro);
}

.indice-capitulos {
    flex: 1;
    overflow-y: auto;
    padding: 1.2rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.indice-capitulo {
    display: block;
    padding: 0.7rem 0.8rem;
    color: var(--texto-medio);
    text-decoration: none;
    font-family: var(--fuente-cuerpo);
    font-size: 0.95rem;
    font-weight: 400;
    border-radius: 4px;
    transition: all var(--transicion);
    cursor: pointer;
    background: none;
    border: none;
    text-align: left;
    width: 100%;
}

.indice-capitulo:hover {
    background: rgba(201, 168, 124, 0.06);
    color: var(--texto-claro);
}

.indice-capitulo.activo {
    color: var(--texto-dorado);
    background: rgba(201, 168, 124, 0.08);
}

.indice-capitulo .capitulo-numero {
    opacity: 0.5;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    display: block;
    font-weight: 400;
}

.indice-capitulo .capitulo-titulo {
    font-weight: 300;
}

.indice-footer {
    flex-shrink: 0;
    padding-top: 1.2rem;
    border-top: 1px solid var(--borde-dorado);
}

.indice-progreso {
    font-size: 0.85rem;
    color: var(--texto-medio);
    margin-bottom: 0.5rem;
}

.indice-barra {
    width: 100%;
    height: 2px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    overflow: hidden;
}

.indice-barra-llena {
    display: block;
    height: 100%;
    background: var(--texto-dorado);
    transition: width 0.6s ease;
    border-radius: 4px;
}

/* ---------- LIBRO / CONTENIDO ---------- */
.libro {
    padding-top: 80px;
    padding-bottom: var(--espacio-maximo);
    min-height: 100vh;
    background: var(--fondo);
    transition: background var(--transicion);
}

.libro-contenedor {
    max-width: var(--ancho-maximo);
    margin: 0 auto;
    padding: 0 var(--espacio-base);
}

/* Capítulos */
.capitulo {
    display: none;
    animation: aparecer-capitulo 0.6s ease forwards;
}

.capitulo.activo {
    display: block;
}

@keyframes aparecer-capitulo {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.capitulo-header {
    margin-bottom: var(--espacio-grande);
    padding-bottom: var(--espacio-base);
    border-bottom: 1px solid var(--borde-dorado);
}

.capitulo-numero {
    font-family: var(--fuente-titulo);
    font-size: 0.95rem;
    font-weight: 400;
    color: var(--texto-dorado);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    display: block;
    margin-bottom: 0.3rem;
}

.capitulo-titulo {
    font-family: var(--fuente-titulo);
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    font-weight: 400;
    color: var(--texto-claro);
    letter-spacing: 0.02em;
}

.capitulo-cuerpo {
    font-size: var(--tamano-texto);
    line-height: 1.85;
    color: var(--texto);
    max-width: var(--ancho-lectura);
}

.capitulo-cuerpo p {
    margin-bottom: 1.2rem;
}

.capitulo-cuerpo p:last-child {
    margin-bottom: 0;
}

/* El diálogo es la mayor parte del texto de la novela: se mantiene
   con peso y estilo normal (sin cursiva forzada) para no fatigar la
   vista en lecturas largas. Solo se distingue con un tono más cálido. */
.capitulo-cuerpo .dialogo {
    color: var(--texto-claro);
}

/* Voces interiores / el Todo hablando: uso puntual, sí en cursiva */
.capitulo-cuerpo .voz-interior {
    font-family: var(--fuente-titulo);
    font-style: italic;
    font-size: 1.15em;
    font-weight: 400;
    color: var(--texto-dorado-claro);
    text-align: center;
    max-width: 46ch;
    margin: 1.8rem auto;
    line-height: 1.6;
    letter-spacing: 0.01em;
}

/* Fórmulas / números insertados en el texto */
.capitulo-cuerpo .formula {
    text-align: center;
    font-family: var(--fuente-titulo);
    font-size: 1.3em;
    letter-spacing: 0.08em;
    color: var(--texto-dorado);
    margin: 1.6rem 0;
}

/* Marca de "FIN" al cierre del cuerpo principal */
.capitulo-cuerpo .fin-marca {
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.4em;
    font-size: 0.9rem;
    color: var(--texto-oscuro);
    margin: 2.5rem 0 1rem;
}

.capitulo-cuerpo .metafora {
    font-family: var(--fuente-titulo);
    font-size: 1.15rem;
    font-weight: 300;
    font-style: italic;
    color: var(--texto-dorado);
    padding: 0.8rem 0;
    border-top: 1px solid var(--borde-dorado);
    border-bottom: 1px solid var(--borde-dorado);
    margin: 1.8rem 0;
}

/* Separador */
.separador-capitulo {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.2rem;
    margin: 2.5rem 0;
    color: var(--texto-oscuro);
    font-size: 1.2rem;
    opacity: 0.6;
}

/* Páginas de "Movimiento" (divisores de parte, al estilo de un libro
   impreso: poco texto, pero con jerarquía y presencia propia) */
.pagina-movimiento {
    min-height: 40vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 1.6rem;
    padding: 3rem 0;
}

.pagina-movimiento .simbolo-movimiento {
    font-family: var(--fuente-titulo);
    font-size: 2rem;
    color: var(--texto-dorado);
    opacity: 0.75;
}

.pagina-movimiento .linea-movimiento {
    width: 60px;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--texto-dorado), transparent);
}

.pagina-movimiento h3 {
    font-family: var(--fuente-titulo);
    font-weight: 400;
    font-style: italic;
    font-size: clamp(1.8rem, 5vw, 2.6rem);
    color: var(--texto-dorado-claro);
    letter-spacing: 0.02em;
    max-width: 16ch;
    line-height: 1.3;
}

.separador-capitulo .linea {
    width: 40px;
    height: 1px;
    background: var(--texto-oscuro);
    flex-shrink: 0;
}

/* Controles de navegación */
.controles-navegacion {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: var(--ancho-maximo);
    margin: 3rem auto 0;
    padding: 1.2rem 0;
    border-top: 1px solid var(--borde-dorado);
    gap: var(--espacio-base);
    flex-wrap: wrap;
}

.btn-nav {
    background: none;
    border: 1px solid var(--borde-dorado);
    color: var(--texto-medio);
    font-family: var(--fuente-cuerpo);
    font-size: 0.9rem;
    font-weight: 400;
    padding: 0.6rem 1.2rem;
    cursor: pointer;
    transition: all var(--transicion);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    letter-spacing: 0.04em;
    border-radius: 4px;
}

.btn-nav:hover:not(:disabled) {
    border-color: var(--texto-dorado);
    color: var(--texto-claro);
    background: rgba(201, 168, 124, 0.05);
}

.btn-nav:disabled {
    opacity: 0.25;
    cursor: not-allowed;
}

.btn-nav:focus-visible {
    outline: 2px solid var(--texto-dorado);
    outline-offset: 2px;
}

.nav-info {
    font-size: 0.85rem;
    color: var(--texto-medio);
    font-weight: 400;
    letter-spacing: 0.04em;
    font-variant-numeric: tabular-nums;
}

/* Volver arriba */
.btn-volver-arriba {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 500;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--fondo-terciario);
    border: 1px solid var(--borde-dorado);
    color: var(--texto-dorado);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all var(--transicion);
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-volver-arriba.visible {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

.btn-volver-arriba:hover {
    background: var(--texto-dorado);
    color: var(--fondo);
    border-color: var(--texto-dorado);
    box-shadow: 0 0 30px var(--sombra-dorada);
}

/* ---------- PIE DE PÁGINA ---------- */
.footer {
    background: var(--fondo-secundario);
    border-top: 1px solid var(--borde-dorado);
    padding: var(--espacio-grande) var(--espacio-base);
    text-align: center;
}

.footer-container {
    max-width: var(--ancho-maximo);
    margin: 0 auto;
}

.footer-texto {
    font-family: var(--fuente-titulo);
    font-size: 1.1rem;
    color: var(--texto-claro);
    letter-spacing: 0.12em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
}

.footer-simbolo {
    color: var(--texto-dorado);
    opacity: 0.75;
    font-size: 0.9rem;
}

.footer-subtexto {
    font-size: 0.85rem;
    color: var(--texto-medio);
    font-weight: 400;
    letter-spacing: 0.05em;
    margin-top: 0.3rem;
}

.footer-lectura {
    font-size: 0.8rem;
    color: var(--texto-medio);
    font-weight: 400;
    margin-top: 0.9rem;
    letter-spacing: 0.03em;
}

.footer-copyright {
    font-size: 0.78rem;
    color: var(--texto-oscuro);
    font-weight: 400;
    margin-top: 1rem;
    letter-spacing: 0.04em;
}

/* ---------- RESPONSIVE ---------- */

/* Tablets y móviles grandes */
@media (max-width: 1024px) {
    :root {
        --tamano-texto: 1.05rem;
        --espacio-maximo: 3rem;
        --ancho-maximo: 720px;
    }

    .portada-titulo .titulo-fuerte {
        font-size: clamp(3rem, 10vw, 5.5rem);
    }
}

/* Móviles */
@media (max-width: 768px) {
    :root {
        --tamano-texto: 1rem;
        --espacio-grande: 1.5rem;
        --espacio-maximo: 2.5rem;
        --ancho-maximo: 100%;
    }

    .nav-menu {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        background: rgba(10, 10, 15, 0.96);
        backdrop-filter: blur(16px);
        flex-direction: column;
        padding: 1.5rem;
        gap: 0.5rem;
        border-bottom: 1px solid var(--borde-dorado);
        transform: translateY(-100%);
        transition: transform var(--transicion);
        pointer-events: none;
    }

    .nav-menu.abierto {
        transform: translateY(0);
        pointer-events: auto;
    }

    .nav-item {
        width: 100%;
        justify-content: center;
        padding: 0.8rem;
        font-size: 0.9rem;
    }

    .nav-toggle {
        display: flex;
    }

    .indice {
        max-width: 100%;
        border-left: none;
        border-right: none;
    }

    .indice-container {
        padding: 1.2rem;
    }

    .portada {
        padding: var(--espacio-base);
    }

    .portada-titulo .titulo-fuerte {
        font-size: clamp(2.8rem, 12vw, 4rem);
    }

    .portada-decoracion {
        gap: 1rem;
    }

    .portada-decoracion .linea {
        width: 40px;
    }

    .portada-epigrafe {
        padding: 0.3rem 1rem;
        font-size: 0.95rem;
    }

    .btn-principal {
        padding: 0.8rem 2rem;
        font-size: 0.85rem;
    }

    .controles-navegacion {
        flex-direction: column;
        gap: 0.8rem;
        padding: 1rem 0;
    }

    .btn-nav {
        width: 100%;
        justify-content: center;
        padding: 0.8rem;
    }

    .nav-info {
        order: -1;
    }

    .btn-volver-arriba {
        bottom: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .footer-texto {
        font-size: 0.9rem;
        gap: 0.8rem;
        flex-wrap: wrap;
    }

    .footer-lectura {
        font-size: 0.7rem;
    }
}

/* Móviles muy pequeños */
@media (max-width: 380px) {
    :root {
        --tamano-texto: 0.95rem;
    }

    .portada-titulo .titulo-fuerte {
        font-size: 2.4rem;
    }

    .portada-subtitulo {
        font-size: 0.85rem;
    }

    .capitulo-titulo {
        font-size: 1.4rem;
    }

    .nav-logo .nav-titulo {
        display: none;
    }
}

/* Pantallas grandes */
@media (min-width: 1400px) {
    :root {
        --tamano-texto: 1.2rem;
        --ancho-maximo: 920px;
        --tamano-titulo: 3.2rem;
    }
}

/* Preferencia de alto contraste */
@media (prefers-contrast: high) {
    :root {
        --texto: #ffffff;
        --texto-claro: #ffffff;
        --texto-oscuro: #cccccc;
        --texto-dorado: #f0d080;
        --borde-dorado: rgba(240, 208, 128, 0.6);
    }

    .btn-principal {
        border-width: 2px;
    }

    .nav-item {
        border: 1px solid transparent;
    }

    .nav-item:hover {
        border-color: var(--texto-dorado);
    }
}

/* Preferencia de movimiento reducido */
@media (prefers-reduced-motion: reduce) {
    .particula {
        animation: none !important;
        display: none !important;
    }

    .loader-ring {
        animation: none !important;
        border-color: var(--texto-dorado);
    }

    .loader-text {
        animation: none !important;
    }

    .simbolo {
        animation: none !important;
    }
}