/* static/css/capitulos.css */

/* --- GENERAL LAYOUT --- */
body.capitulos-page {
    background-color: #050505;
    color: #e0e0e0;
    overflow-x: hidden;
    margin: 0;
    font-family: 'Lora', serif;
}

/* --- CLIMA Y ATMÓSFERA --- */
#canvas-clima {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    margin: 0;
    padding: 0;
    pointer-events: none;
    z-index: -1; /* Trasladado detrás del contenido */
}

#bg-atmosfera {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    margin: 0;
    padding: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 1.5s ease;
    z-index: -2; /* Aún más atrás que las partículas */
    pointer-events: none;
}

.capitulos-header-simple {
    text-align: center;
    padding: 60px 20px 40px;
    background: radial-gradient(circle, #1a1a1a 0%, #050505 100%);
    border-bottom: 2px solid #e5ac44;
    position: relative;
    z-index: 2; /* Asegurar que el header esté arriba */
}

.btn-volver {
    position: absolute;
    top: 40px;
    left: 40px;
    color: #d4a373;
    font-family: 'Cinzel', serif;
    text-decoration: none;
    font-size: 1rem;
    letter-spacing: 2px;
    border: 1px solid #d4a373;
    padding: 10px 20px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.btn-volver:hover {
    background: #d4a373;
    color: #000;
}

.capitulos-header-simple h1 {
    font-family: 'Cinzel', serif;
    font-size: clamp(1.4rem, 1.2rem + 2vw, 3.5rem); /* Refinado: escala más lento */
    color: #d4a373;
    letter-spacing: clamp(1px, 1vw, 5px);
    text-transform: uppercase;
    text-shadow: 0 0 15px rgba(212, 163, 115, 0.4);
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(10px, 2vw, 20px);
}

.icono-titulo {
    display: inline-block;
    width: 60px;
    height: 60px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    filter: drop-shadow(0 0 8px rgba(212, 163, 115, 0.6));
}

/* --- CONTENEDOR DE ARCOS --- */
.arcos-container {
    max-width: 1000px;
    margin: 60px auto;
    padding: 0 20px 100px;
    display: flex;
    flex-direction: column;
    gap: 50px;
    position: relative;
    z-index: 1; /* El contenido principal sobre las partículas */
}

.arco-card {
    background: #0a0a0a;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.4s ease;
    box-shadow: 0 5px 20px rgba(0,0,0,0.5);
}

.arco-card.leido {
    box-shadow: -2px 0 15px rgba(229, 172, 68, 0.15);
}

.arco-banner {
    position: relative;
    width: 100%;
    height: 220px;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: filter 0.6s ease;
    filter: grayscale(80%) brightness(0.6);
}

.arco-card:hover .arco-banner, 
.arco-card.abierto .arco-banner,
.arco-card.leido .arco-banner {
    filter: grayscale(0%) brightness(0.9);
}

.arco-banner::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.8), rgba(0,0,0,0.2));
}

.arco-header-info {
    position: relative;
    z-index: 2;
    text-align: center;
    pointer-events: none;
    padding: 0 40px;
}

.arco-titulo {
    font-family: 'Cinzel', serif;
    font-size: clamp(1.3rem, 1.1rem + 2vw, 2.8rem); /* Refinado: más pequeño en móvil */
    color: #f3f0df;
    letter-spacing: clamp(1px, 0.5vw, 4px);
    text-shadow: 2px 2px 10px #000;
    margin: 0;
}

.arco-subtitulo {
    font-family: 'Lora', serif;
    font-size: 1.1rem;
    color: #fff; /* Blanco puro para contraste máximo */
    font-style: italic;
    margin: 0;
    text-shadow: 0 2px 15px #000, 0 0 5px #000;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.5s ease;
    max-width: 800px;
}

.arco-card.abierto .arco-subtitulo {
    opacity: 1;
    max-height: 200px;
    margin-top: 15px;
}

/* Indicador lateral de arco iniciado/completado */
.arco-card.leido .arco-banner::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 6px;
    height: 100%;
    background: #e5ac44;
    z-index: 3;
    box-shadow: 0 0 20px #e5ac44;
}

/* Indicador de acordeon (flechita) */
.arco-toggle-icon {
    position: absolute;
    bottom: 20px;
    color: #d4a373;
    z-index: 2;
    font-size: 1.5rem;
    transition: transform 0.4s ease;
}

.arco-card.abierto .arco-toggle-icon {
    transform: rotate(180deg);
}

/* --- ACORDEÓN --- */
.arco-contenido {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    background: #080808;
}

/* La altura máxima se controlará vía JS para que sea exacta al contenido, o le damos un valor muy alto */


.capitulos-lista {
    list-style: none;
    padding: 30px;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* --- ITEMS DE CAPÍTULO --- */
.capitulo-item {
    position: relative;
    padding: 25px 30px;
    background: #121212;
    border-left: 2px solid transparent; /* default invisible */
    border-radius: 0 6px 6px 0;
    transition: all 0.3s ease;
    border-bottom: 1px solid rgba(255,255,255,0.02);
}

.capitulo-item:hover {
    background: #181818;
    transform: translateX(10px);
}

.capitulo-item.leido {
    border-left: 4px solid #e5ac44;
    background: linear-gradient(90deg, rgba(229, 172, 68, 0.08) 0%, transparent 100%);
}

/* La animación que atrae la vista del usuario hacia el ultimo capitulo */
.capitulo-item.resplandor-oro {
    animation: brilloIntermitenteOro 2.5s ease-out forwards;
}

.capitulo-link {
    text-decoration: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    outline: none;
}

.capitulo-titulo {
    font-family: 'Cinzel', serif;
    font-size: 1.5rem;
    color: #b0b0b0;
    margin: 0;
    transition: color 0.3s ease;
}

.capitulo-item.leido .capitulo-titulo {
    color: #e5ac44;
}

.capitulo-item:hover .capitulo-titulo {
    color: #fff;
}

.capitulo-desc {
    font-family: 'Lora', serif;
    font-size: 1rem;
    color: #888;
    margin: 0;
    font-style: italic;
    line-height: 1.5;
}

@keyframes brilloIntermitenteOro {
    0% { 
        box-shadow: inset 0 0 0px transparent; 
        border-left-color: #e5ac44; 
    }
    15% { 
        box-shadow: inset 40px 0 50px rgba(229, 172, 68, 0.5); 
        border-left-color: #fff; 
    }
    100% { 
        box-shadow: inset 0 0 0px transparent; 
        border-left-color: #e5ac44; 
    }
}

/* --- SCROLL TO TOP --- */
.btn-subir {
    position: fixed;
    bottom: 40px;
    left: 40px;
    width: 50px;
    height: 50px;
    background: rgba(10, 10, 10, 0.8);
    border: 1px solid #d4a373;
    color: #d4a373;
    font-family: 'Cinzel', serif;
    font-size: 1.5rem;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
    transition: all 0.5s ease;
    z-index: 100;
    backdrop-filter: blur(5px);
}

.btn-subir.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
    animation: parpadeoSubir 2s infinite ease-in-out;
}

.btn-subir:hover {
    background: #d4a373;
    color: #050505;
    box-shadow: 0 0 15px rgba(212, 163, 115, 0.5);
    animation: none;
    transform: translateY(-3px);
}

@keyframes parpadeoSubir {
    0%, 100% { box-shadow: 0 0 2px rgba(212, 163, 115, 0.2); }
    50% { box-shadow: 0 0 15px rgba(212, 163, 115, 0.8); }
}

/* --- MEDIA QUERIES (REFINADO MÓVIL CAPÍTULOS) --- */
@media (max-width: 768px) {
    .capitulos-header-simple {
        padding: 80px 15px 30px;
    }

    .btn-volver {
        top: 20px;
        left: 20px;
        font-size: 0.85rem;
        padding: 6px 15px;
        letter-spacing: 1px;
    }

    .icono-titulo {
        width: 40px;
        height: 40px;
    }

    .arcos-container {
        margin: 30px auto;
        padding: 0 15px 80px;
        gap: 30px;
    }

    .arco-banner {
        height: 160px;
    }

    .arco-header-info {
        padding: 0 20px;
    }

    .capitulos-lista {
        padding: 15px;
    }

    .capitulo-item {
        padding: 15px 20px;
    }

    .capitulo-titulo {
        font-size: 1.2rem;
    }

    .capitulo-desc {
        font-size: 0.9rem;
    }

    .btn-subir {
        bottom: 25px;
        left: 25px;
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .arco-banner {
        height: 140px;
    }
    
    .arco-subtitulo {
        font-size: 0.9rem;
    }
}

/* Eliminación de cuadros azules en móviles */
* { -webkit-tap-highlight-color: transparent; }
