/* static/css/capitulos.css */

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

/* Bloqueo de scroll cuando el modal está abierto */
body.modal-open {
    overflow: hidden !important;
}

/* --- 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 {
    height: 180px;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    overflow: hidden; /* Para las cadenas del arco */
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    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);
    overflow: hidden; /* Las cadenas no deben salir de aquí */
}

.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; }

/* --- CAPÍTULOS BLOQUEADOS (PAYWALL Y CADENAS CSS) --- */
.capitulo-item.bloqueado {
    opacity: 0.6;
    filter: grayscale(80%);
    background: rgba(18, 18, 18, 0.5);
    position: relative;
    overflow: hidden;
}

.capitulo-item.bloqueado:hover {
    opacity: 1;
    filter: grayscale(0%);
    transform: translateX(10px);
}

.bloqueo-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; /* Permite hacer clic a través hacia el li */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.cadena {
    position: absolute;
    height: 20px;
    /* Patrón SVG idéntico al estilo dibujado con bordes negros y relleno dorado */
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='20'%3E%3Crect x='-20' y='7' width='24' height='6' rx='3' fill='%23000' /%3E%3Crect x='-19' y='8' width='22' height='4' rx='2' fill='%23f4b41a' /%3E%3Crect x='20' y='7' width='24' height='6' rx='3' fill='%23000' /%3E%3Crect x='21' y='8' width='22' height='4' rx='2' fill='%23f4b41a' /%3E%3Crect x='4' y='4' width='20' height='12' rx='6' fill='none' stroke='%23000' stroke-width='5' /%3E%3Crect x='4' y='4' width='20' height='12' rx='6' fill='none' stroke='%23f4b41a' stroke-width='3' /%3E%3C/svg%3E");
    background-repeat: repeat-x;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.9));
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
}

.cadena-izq {
    width: 110%;
    top: 50%; left: -5%;
    transform: translateY(-50%) rotate(10deg);
}

.cadena-der {
    width: 110%;
    top: 50%; left: -5%;
    transform: translateY(-50%) rotate(-10deg);
}

.sello-bloqueo {
    position: relative;
    width: 35px; /* Más pequeño según petición */
    height: auto; 
    z-index: 2;
    filter: drop-shadow(0 0 15px rgba(0,0,0,0.9));
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.sello-arco {
    width: 60px; /* Candado del arco más imponente */
}

/* Indicador de candado discreto en la esquina del banner */
.indicador-bloqueo-discreto {
    position: absolute;
    bottom: 15px;
    right: 20px;
    z-index: 5;
    cursor: pointer;
    transition: all 0.3s ease;
}

.icono-candado-mini {
    width: 25px;
    height: auto;
    filter: drop-shadow(0 0 10px rgba(0,0,0,0.8));
    transition: transform 0.3s ease;
}

.indicador-bloqueo-discreto:hover .icono-candado-mini {
    transform: scale(1.2) rotate(10deg);
    filter: drop-shadow(0 0 12px #e5ac44);
}

/* Caja de Próximamente al final del arco */
.proximamente-box {
    background: linear-gradient(90deg, rgba(20, 20, 20, 0.5) 0%, rgba(10, 10, 10, 0.3) 100%);
    border-left: 2px dashed #444;
    opacity: 0.8;
    cursor: default;
}

.proximamente-box:hover {
    transform: none; /* No se mueve como los capítulos */
    background: linear-gradient(90deg, rgba(30, 30, 30, 0.5) 0%, rgba(10, 10, 10, 0.3) 100%);
}

.proximamente-content {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    text-align: center;
}

.pluma-animada {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    background-image: url("../images/glifo_pluma.9140cae0af0b.png");
    background-size: contain;
    background-repeat: no-repeat;
    opacity: 0.2;
    animation: escrituraFlotante 3s infinite ease-in-out;
}

@keyframes escrituraFlotante {
    0%, 100% { transform: translateY(-50%) rotate(0deg); opacity: 0.1; }
    50% { transform: translateY(-60%) rotate(10deg); opacity: 0.3; }
}

.titulo-proximamente {
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    color: #666;
    margin: 0;
}

.desc-proximamente {
    font-family: 'Lora', serif;
    font-size: 0.85rem;
    color: #444;
    margin: 0;
    font-style: italic;
}

/* Paywall Disclaimer */
.paywall-disclaimer {
    font-size: 0.95rem;
    color: #d4a373;
    margin: 15px 0 20px;
    line-height: 1.4;
    font-style: italic;
    background: rgba(212, 163, 115, 0.05);
    padding: 10px;
    border-radius: 4px;
    border: 1px solid rgba(212, 163, 115, 0.1);
}

@media (max-width: 768px) {
    .modal-paywall-content {
        padding: 25px 20px;
    }
    .paywall-disclaimer {
        font-size: 0.85rem;
    }
}

.capitulo-item.bloqueado:hover .cadena-izq {
    transform: translateY(-50%) rotate(13deg) scaleX(1.02);
}

.capitulo-item.bloqueado:hover .cadena-der {
    transform: translateY(-50%) rotate(-13deg) scaleX(1.02);
}

.capitulo-item.bloqueado:hover .sello-bloqueo {
    transform: scale(1.15) rotate(5deg);
}

/* --- MODAL PAYWALL --- */
.modal-paywall {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: flex-start; /* Empezar desde arriba para permitir scroll */
    justify-content: center;
    z-index: 9999;
    display: none;
    overflow-y: auto; /* Habilitar scroll vertical */
    padding: 40px 0; /* Espacio para que no choque arriba/abajo */
}

/* --- ANIMACIÓN DESBLOQUEO DE ARCO --- */
.desbloqueando {
    animation: des-grisar 2s ease forwards;
    animation-delay: 1s; /* Espera a que explote el candado */
    filter: grayscale(80%);
    opacity: 0.6;
}

@keyframes des-grisar {
    0% { filter: grayscale(80%); opacity: 0.6; }
    100% { filter: grayscale(0%); opacity: 1; }
}

.animacion-romper .sello-bloqueo {
    animation: explotar-candado 1s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    animation-delay: 0.5s;
}

.animacion-romper .cadena-izq {
    animation: romper-cadena-izq 1s ease-in forwards;
    animation-delay: 0.8s;
}

.animacion-romper .cadena-der {
    animation: romper-cadena-der 1s ease-in forwards;
    animation-delay: 0.8s;
}

.animacion-romper {
    animation: fade-out 1s forwards;
    animation-delay: 1.5s;
}

@keyframes explotar-candado {
    0% { transform: scale(1) translateY(0) rotate(0deg); opacity: 1; filter: drop-shadow(0 0 0px rgba(229,172,68,0)); }
    20% { transform: scale(1.1) translateY(-10px) rotate(-10deg); filter: drop-shadow(0 0 20px rgba(229,172,68,1)); }
    100% { transform: scale(1) translateY(300px) rotate(40deg); opacity: 0; filter: drop-shadow(0 0 0px rgba(229,172,68,0)); }
}

@keyframes romper-cadena-izq {
    0% { transform: translateY(-50%) rotate(10deg); opacity: 1; }
    100% { transform: translateY(-50%) rotate(10deg); opacity: 0; }
}

@keyframes romper-cadena-der {
    0% { transform: translateY(-50%) rotate(-10deg); opacity: 1; }
    100% { transform: translateY(-50%) rotate(-10deg); opacity: 0; }
}

@keyframes fade-out {
    to { opacity: 0; visibility: hidden; }
}

.modal-paywall-content {
    background: #0f0f0f;
    border: 2px solid #e5ac44;
    border-radius: 8px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    position: relative;
    box-shadow: 0 0 30px rgba(229,172,68,0.3);
    margin: auto; /* Centrado horizontal y vertical si hay espacio */
}
.modal-paywall-content h2 {
    font-family: 'Cinzel', serif;
    color: #e5ac44;
    margin-top: 0;
}
.close-paywall {
    position: absolute;
    top: 15px; right: 20px;
    color: #888;
    font-size: 30px;
    cursor: pointer;
}
.close-paywall:hover { color: #fff; }
.paywall-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 25px;
}
.btn-mistico {
    background: transparent;
    color: #e5ac44;
    border: 1px solid #e5ac44;
    padding: 10px 20px;
    font-family: 'Cinzel', serif;
    text-decoration: none;
    border-radius: 4px;
    transition: 0.3s;
}
.btn-mistico:hover {
    background: #e5ac44;
    color: #000;
}
#paypal-button-container {
    margin-top: 20px;
}
