/* ==========================================================================
   LAS HIJAS DEL SILENCIO — Sistema visual compartido
   Se carga DESPUÉS de los estilos propios de cada página, por lo que
   unifica la paleta, la tipografía, la navegación y el responsive.
   ========================================================================== */

:root {
    /* Negros con un velo violeta: más gótico, más profundo */
    --black: #050307;
    --deep: #09060c;
    --charcoal: #110c15;
    --ash: #1a121f;
    --fog: #2d2233;
    --silver: #978d9d;
    --pearl: #d0c7d5;
    --white: #efe8ef;

    /* Wendia */
    --wendia: #7b2d8b;
    --wendia-light: #a855c8;
    --wendia-pale: #d4a0e8;
    --wendia-deep: #3a1145;
    --wendia-glow: rgba(123, 45, 139, 0.45);
    --wendia-faint: rgba(168, 85, 200, 0.10);

    /* Sangre de vino, para contrastes */
    --sangre: #6e1430;
    --sangre-light: #b03a5b;

    --hairline: rgba(212, 160, 232, 0.10);
    --hairline-soft: rgba(212, 160, 232, 0.06);
    --nav-h: 64px;

    --f-display: 'Cinzel Decorative', 'Cinzel', serif;
    --f-title: 'Cinzel', 'Cinzel Decorative', serif;
    --f-body: 'Cormorant Garamond', Georgia, serif;
    --f-fell: 'IM Fell English', Georgia, serif;

    /* Ornamentos */
    --flor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-12 -12 24 24'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='0' y2='-11' gradientUnits='userSpaceOnUse'%3E%3Cstop offset='0' stop-color='%233a1145'/%3E%3Cstop offset='1' stop-color='%23b673d6'/%3E%3C/linearGradient%3E%3Cpath id='p' d='M0 0C-3.4-2.6-4-8 0-11.2C4-8 3.4-2.6 0 0Z' fill='url(%23g)' stroke='%23d4a0e8' stroke-width='.35'/%3E%3C/defs%3E%3Cuse href='%23p'/%3E%3Cuse href='%23p' transform='rotate(72)'/%3E%3Cuse href='%23p' transform='rotate(144)'/%3E%3Cuse href='%23p' transform='rotate(216)'/%3E%3Cuse href='%23p' transform='rotate(288)'/%3E%3Ccircle r='2.1' fill='%23050307' stroke='%23d4a0e8' stroke-width='.5'/%3E%3C/svg%3E");
    --esquina: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40' fill='none' stroke='%23a855c8' stroke-width='1' stroke-linecap='round'%3E%3Cpath d='M2 38V8Q2 2 8 2h30' opacity='.55'/%3E%3Cpath d='M6 30V12q0-6 6-6h18' opacity='.35'/%3E%3Cpath d='M2 14q8 0 9-6q1 5 6 5' opacity='.6'/%3E%3Ccircle cx='11' cy='11' r='1.6' fill='%23d4a0e8' stroke='none'/%3E%3C/svg%3E");
}

/* ---------- Base ---------- */
html {
    -webkit-text-size-adjust: 100%;
    background: var(--black);
    overflow-x: clip;
}

body { overflow-x: clip !important; }

.vinilo-contenedor { max-width: 60vw; max-height: 60vw; }

body {
    background:
        radial-gradient(ellipse 120% 60% at 50% -10%, rgba(58, 17, 69, 0.35) 0%, transparent 60%),
        radial-gradient(ellipse 80% 50% at 50% 110%, rgba(110, 20, 48, 0.10) 0%, transparent 60%),
        var(--black) !important;
    background-attachment: fixed !important;
    color: var(--white);
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

img, video, canvas {
    max-width: 100%;
}

::selection {
    background: var(--wendia);
    color: var(--white);
}

::-webkit-scrollbar { width: 8px; height: 6px; }
::-webkit-scrollbar-track { background: var(--black); }
::-webkit-scrollbar-thumb { background: linear-gradient(var(--wendia-deep), var(--wendia)); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--wendia-light); }

:focus-visible {
    outline: 1px solid var(--wendia-light);
    outline-offset: 3px;
}

/* Viñeta de vela: bordes que se hunden en la oscuridad */
.lhs-vineta {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9996;
    background: radial-gradient(ellipse 85% 75% at 50% 45%, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
}

/* ---------- Cursor (solo con ratón) ---------- */
.cursor, .cursor-ring { display: none; }

@media (hover: hover) and (pointer: fine) {
    body.lhs-cursor, body.lhs-cursor a, body.lhs-cursor button, body.lhs-cursor [onclick] { cursor: none !important; }
    body.lhs-cursor input, body.lhs-cursor textarea { cursor: text !important; }
    body.lhs-cursor .cursor, body.lhs-cursor .cursor-ring { display: block; }
    body.lhs-cursor .cursor {
        position: fixed; top: 0; left: 0; width: 8px; height: 8px; border-radius: 50%;
        background: var(--wendia-pale); box-shadow: 0 0 12px var(--wendia-glow), 0 0 2px #fff;
        pointer-events: none; z-index: 2147483647; transition: width .2s, height .2s, margin .2s;
        margin: -4px 0 0 -4px;
    }
    body.lhs-cursor .cursor-ring {
        position: fixed; top: 0; left: 0; width: 30px; height: 30px; border-radius: 50%;
        border: 1px solid rgba(168, 85, 200, 0.6); pointer-events: none; z-index: 2147483646;
        margin: -15px 0 0 -15px; transition: width .25s, height .25s, margin .25s, opacity .25s, border-color .25s;
    }
    body.lhs-cursor.cursor-hover .cursor { width: 4px; height: 4px; margin: -2px 0 0 -2px; }
    body.lhs-cursor.cursor-hover .cursor-ring { width: 46px; height: 46px; margin: -23px 0 0 -23px; border-color: var(--wendia-pale); opacity: .7; }
}

/* ==========================================================================
   NAVEGACIÓN UNIFICADA
   ========================================================================== */
.volver-index,
body > .nav,
.salir-sistema,
.back-link { display: none !important; }

.lhs-nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--nav-h);
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 clamp(16px, 4vw, 40px);
    background: linear-gradient(to bottom, rgba(5, 3, 7, 0.96) 0%, rgba(5, 3, 7, 0.75) 60%, transparent 100%);
    transition: background .4s, box-shadow .4s;
    font-family: var(--f-body);
}

.lhs-nav.scrolled {
    background: rgba(5, 3, 7, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 1px 0 var(--hairline), 0 10px 30px rgba(0, 0, 0, .5);
}

.lhs-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--wendia-pale);
    font-family: var(--f-display);
    font-size: .82rem;
    letter-spacing: .22em;
    white-space: nowrap;
}

.lhs-logo .flor {
    width: 26px; height: 26px;
    background: var(--flor) center/contain no-repeat;
    filter: drop-shadow(0 0 6px var(--wendia-glow));
    transition: transform 1.2s cubic-bezier(.2, .8, .2, 1);
}

.lhs-logo:hover .flor { transform: rotate(72deg); }

.lhs-nav-centro {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--f-fell);
    font-style: italic;
    font-size: .95rem;
    color: var(--silver);
    letter-spacing: .08em;
    white-space: nowrap;
    pointer-events: none;
}

.lhs-nav-centro::before, .lhs-nav-centro::after { content: '—'; margin: 0 .6em; color: var(--wendia); }

.lhs-menu-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    background: transparent;
    border: 1px solid var(--hairline);
    color: var(--pearl);
    font-family: var(--f-body);
    font-size: .72rem;
    letter-spacing: .32em;
    text-transform: uppercase;
    padding: 9px 14px 9px 18px;
    cursor: pointer;
    transition: border-color .3s, color .3s, background .3s;
}

.lhs-menu-btn:hover { border-color: var(--wendia-light); color: var(--white); background: var(--wendia-faint); }

.lhs-burger { width: 18px; height: 10px; position: relative; }
.lhs-burger::before, .lhs-burger::after {
    content: ''; position: absolute; left: 0; right: 0; height: 1px; background: currentColor; transition: transform .4s, top .4s, bottom .4s;
}
.lhs-burger::before { top: 0; }
.lhs-burger::after { bottom: 0; left: 6px; }
.lhs-menu-abierto .lhs-burger::before { top: 4.5px; transform: rotate(45deg); }
.lhs-menu-abierto .lhs-burger::after { bottom: 4.5px; left: 0; transform: rotate(-45deg); }

/* Panel del menú */
.lhs-menu {
    position: fixed;
    inset: 0;
    z-index: 899;
    background:
        radial-gradient(ellipse 70% 60% at 50% 40%, rgba(58, 17, 69, .55), transparent 70%),
        #050307;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: calc(var(--nav-h) + 20px) 20px 40px;
    opacity: 0;
    visibility: hidden;
    transition: opacity .5s, visibility .5s;
    overflow-y: auto;
}

.lhs-menu-abierto .lhs-menu { opacity: 1; visibility: visible; }
body.lhs-menu-abierto { overflow: hidden; }

.lhs-menu::before {
    content: '';
    position: absolute;
    width: min(70vw, 520px); aspect-ratio: 1;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%) rotate(0deg);
    background: var(--flor) center/contain no-repeat;
    opacity: .05;
    pointer-events: none;
    animation: lhsGirar 120s linear infinite;
}

@keyframes lhsGirar { to { transform: translate(-50%, -50%) rotate(360deg); } }

.lhs-menu ol {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 48px;
    max-width: 820px;
    width: 100%;
    position: relative;
    counter-reset: item;
}

.lhs-menu li {
    counter-increment: item;
    opacity: 0;
    transform: translateY(14px);
    transition: opacity .5s, transform .5s;
}

.lhs-menu-abierto .lhs-menu li { opacity: 1; transform: none; }
.lhs-menu-abierto .lhs-menu li:nth-child(2) { transition-delay: .04s; }
.lhs-menu-abierto .lhs-menu li:nth-child(3) { transition-delay: .08s; }
.lhs-menu-abierto .lhs-menu li:nth-child(4) { transition-delay: .12s; }
.lhs-menu-abierto .lhs-menu li:nth-child(5) { transition-delay: .16s; }
.lhs-menu-abierto .lhs-menu li:nth-child(6) { transition-delay: .2s; }
.lhs-menu-abierto .lhs-menu li:nth-child(7) { transition-delay: .24s; }
.lhs-menu-abierto .lhs-menu li:nth-child(8) { transition-delay: .28s; }

.lhs-menu ol a {
    display: grid;
    grid-template-columns: 2.4em 1fr;
    align-items: baseline;
    padding: 16px 0;
    text-decoration: none;
    border-bottom: 1px solid var(--hairline-soft);
    transition: padding-left .4s;
}

.lhs-menu ol a::before {
    content: counter(item, upper-roman);
    font-family: var(--f-fell);
    font-style: italic;
    color: var(--wendia);
    font-size: .95rem;
}

.lhs-menu .t {
    font-family: var(--f-display);
    font-size: clamp(1.15rem, 2.4vw, 1.5rem);
    color: var(--white);
    letter-spacing: .06em;
    transition: color .3s, text-shadow .3s;
}

.lhs-menu .d {
    grid-column: 2;
    font-family: var(--f-fell);
    font-style: italic;
    color: var(--silver);
    font-size: .92rem;
    margin-top: 4px;
}

.lhs-menu ol a:hover { padding-left: 10px; }
.lhs-menu ol a:hover .t, .lhs-menu ol a[aria-current] .t { color: var(--wendia-pale); text-shadow: 0 0 24px var(--wendia-glow); }
.lhs-menu ol a[aria-current]::before { color: var(--wendia-pale); }

.lhs-menu-pie {
    margin-top: 36px;
    font-family: var(--f-fell);
    font-style: italic;
    color: var(--silver);
    font-size: .95rem;
    text-align: center;
    position: relative;
}

.lhs-menu-pie a { color: var(--wendia-pale); text-decoration: none; border-bottom: 1px solid rgba(212,160,232,.3); }

/* ==========================================================================
   ORNAMENTOS
   ========================================================================== */
.divider-icon {
    display: inline-block;
    width: 24px; height: 24px;
    font-size: 0 !important;
    color: transparent !important;
    background: var(--flor) center/contain no-repeat;
    filter: drop-shadow(0 0 8px var(--wendia-glow));
}

.divider-ornament::before, .divider-ornament::after {
    width: clamp(50px, 14vw, 120px) !important;
    background: linear-gradient(90deg, transparent, var(--wendia), var(--wendia-pale)) !important;
    height: 1px;
}

.divider-ornament::after { background: linear-gradient(90deg, var(--wendia-pale), var(--wendia), transparent) !important; }

/* Separador gótico reutilizable */
.lhs-sep {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin: 0 auto;
    color: var(--wendia);
}

.lhs-sep::before, .lhs-sep::after {
    content: '';
    height: 1px;
    width: clamp(40px, 12vw, 110px);
    background: linear-gradient(90deg, transparent, currentColor);
}

.lhs-sep::after { transform: scaleX(-1); }
.lhs-sep i { width: 18px; height: 18px; background: var(--flor) center/contain no-repeat; display: block; }

/* Títulos con brillo de vela */
.header h1, .hero-title, .section-title, .footer-logo {
    text-shadow: 0 0 30px rgba(168, 85, 200, .28), 0 2px 2px rgba(0, 0, 0, .9);
}

.section-title { position: relative; }

.section-title::after {
    content: '';
    display: block;
    width: 120px;
    height: 14px;
    margin: 14px auto 0;
    background:
        var(--flor) center/14px 14px no-repeat,
        linear-gradient(90deg, transparent, var(--wendia) 40%, transparent 40%, transparent 60%, var(--wendia) 60%, transparent) center/100% 1px no-repeat;
}

/* Marcos góticos: doble filete y esquinas de filigrana */
.lhs-marco {
    position: relative;
    isolation: isolate;
}

.lhs-marco > .lhs-esq {
    position: absolute;
    width: 30px; height: 30px;
    background: var(--esquina) center/contain no-repeat;
    pointer-events: none;
    z-index: 5;
    opacity: .55;
    transition: opacity .4s;
}

.lhs-marco:hover > .lhs-esq { opacity: 1; }
.lhs-esq.tl { top: 5px; left: 5px; }
.lhs-esq.tr { top: 5px; right: 5px; transform: scaleX(-1); }
.lhs-esq.bl { bottom: 5px; left: 5px; transform: scaleY(-1); }
.lhs-esq.br { bottom: 5px; right: 5px; transform: scale(-1); }

/* Tarjetas: fondo con más profundidad, filete interior */
.book-card, .char-card, .personaje-card, .family-card, .timeline-card, .gallery-item {
    box-shadow: inset 0 0 0 1px rgba(212, 160, 232, .04), 0 10px 30px rgba(0, 0, 0, .45);
}

.personaje-card, .family-card, .timeline-card {
    background: linear-gradient(180deg, #140e19 0%, #0a070d 100%) !important;
}

/* Modales: más oscuros, con borde violeta */
.modal-contenido, .modal-documento {
    border-color: rgba(168, 85, 200, .22) !important;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .8), 0 30px 90px rgba(0, 0, 0, .9), 0 0 80px rgba(123, 45, 139, .12) !important;
}

.modal-overlay, .lightbox-overlay {
    background: radial-gradient(ellipse at center, rgba(25, 10, 32, .94), rgba(3, 2, 5, .98)) !important;
}

/* Capa de pétalos */
.lhs-petalos {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 3;
    overflow: hidden;
}

.lhs-petalo {
    position: absolute;
    top: -30px;
    width: 10px; height: 14px;
    background: radial-gradient(ellipse at 40% 30%, #c27ee0 0%, #7b2d8b 55%, #3a1145 100%);
    border-radius: 80% 0 80% 0;
    opacity: 0;
    filter: drop-shadow(0 0 4px rgba(123, 45, 139, .5));
    animation: lhsCaer linear infinite;
}

@keyframes lhsCaer {
    0% { transform: translate3d(0, 0, 0) rotate(0deg); opacity: 0; }
    10% { opacity: .55; }
    50% { transform: translate3d(var(--dx, 40px), 50vh, 0) rotate(260deg); }
    90% { opacity: .3; }
    100% { transform: translate3d(calc(var(--dx, 40px) * -0.5), 105vh, 0) rotate(540deg); opacity: 0; }
}

/* ---------- Pie unificado ---------- */
footer { border-top-color: rgba(168, 85, 200, .14) !important; }

.lhs-pie-orn {
    display: block;
    width: min(320px, 80%);
    height: 34px;
    margin: 0 auto 26px;
    position: relative;
    z-index: 1;
}

.lhs-pie-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 22px;
    list-style: none;
    margin: 26px auto 6px;
    max-width: 760px;
    position: relative;
    z-index: 1;
}

.lhs-pie-links a {
    font-family: var(--f-body);
    font-size: .74rem;
    letter-spacing: .26em;
    text-transform: uppercase;
    color: var(--silver);
    text-decoration: none;
    transition: color .3s;
}

.lhs-pie-links a:hover { color: var(--wendia-pale); }
.footer-phrase { color: #6d6372 !important; }

/* Revelado al hacer scroll */
.lhs-revelar { opacity: 0; transform: translateY(26px); transition: opacity 1s ease, transform 1s ease; }
.lhs-revelar.visto { opacity: 1; transform: none; }

/* ==========================================================================
   AJUSTES COMUNES DE CABECERAS Y FILTROS
   ========================================================================== */
.header {
    padding-top: calc(var(--nav-h) + 40px) !important;
    min-height: min(56vh, 560px) !important;
}

.timeline-contenedor { padding-top: 30px !important; }

.filter-bar-wrap { top: var(--nav-h) !important; }

.btn-filtro, .filter-btn {
    border-color: rgba(168, 85, 200, .22);
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 900px) {
    .lhs-nav-centro { display: none; }
}

@media (max-width: 720px) {
    :root { --nav-h: 56px; }

    .lhs-logo .txt { display: none; }
    .lhs-menu-btn .txt { display: none; }
    .lhs-menu-btn { padding: 10px 12px; }

    .lhs-menu { justify-content: flex-start; }
    .lhs-menu ol { grid-template-columns: 1fr; gap: 0; }
    .lhs-menu ol a { padding: 13px 0; }

    .header {
        min-height: auto !important;
        padding: calc(var(--nav-h) + 34px) 18px 30px !important;
    }

    .header h1 { font-size: clamp(1.7rem, 8.5vw, 2.6rem) !important; overflow-wrap: break-word; }
    .header-subtitle { font-size: 1rem !important; letter-spacing: .06em !important; }
    .header-label { letter-spacing: .38em !important; }
    .classification-tag { margin-bottom: 22px !important; max-width: 100%; }
    .classification-tag span { letter-spacing: .18em !important; }

    /* Filtros en una sola fila deslizable */
    .filtros-contenedor, .filter-bar {
        flex-wrap: nowrap !important;
        justify-content: flex-start !important;
        overflow-x: auto;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding: 14px 18px !important;
        gap: 8px !important;
        mask-image: linear-gradient(90deg, transparent 0, #000 18px, #000 calc(100% - 28px), transparent 100%);
        -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 18px, #000 calc(100% - 28px), transparent 100%);
    }

    .filtros-contenedor::-webkit-scrollbar, .filter-bar::-webkit-scrollbar { display: none; }

    .btn-filtro, .filter-btn {
        flex: 0 0 auto;
        white-space: nowrap;
        scroll-snap-align: start;
        padding: 9px 16px !important;
        font-size: .72rem !important;
    }

    /* Modales a pantalla completa, con la X siempre visible */
    .modal-overlay { padding: 0 !important; align-items: stretch !important; }

    .modal-contenido, .modal-documento {
        max-width: 100% !important;
        width: 100% !important;
        max-height: none !important;
        height: 100% !important;
        height: 100dvh !important;
        border: 0 !important;
        border-top: 1px solid rgba(168, 85, 200, .3) !important;
    }

    .modal-cerrar {
        position: fixed !important;
        top: 12px !important;
        right: 12px !important;
        width: 42px !important;
        height: 42px !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        background: rgba(5, 3, 7, .85) !important;
        border: 1px solid rgba(168, 85, 200, .35) !important;
        border-radius: 50% !important;
        z-index: 50 !important;
        line-height: 1;
        font-size: 1.4rem !important;
    }

    .modal-body { padding: 64px 22px 40px !important; }
    .modal-titulo { font-size: 1.55rem !important; }

    footer { padding: 46px 20px !important; }

    /* Galería: dos columnas reales en celular */
    .gallery-container { padding: 0 12px 60px !important; }
    .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px !important; }
    .section-heading { padding-left: 14px !important; padding-right: 14px !important; }
    .cat-tag { font-size: .48rem !important; padding: 3px 8px !important; top: 8px !important; left: 8px !important; }
    .img-numero { font-size: .62rem !important; padding: 2px 6px !important; top: 8px !important; right: 8px !important; }

    /* Álbum */
    .visualizador-overlay { font-size: .8rem !important; letter-spacing: .2em !important; text-align: center; padding: 0 12px; }
    .app { padding-left: 14px !important; padding-right: 14px !important; }

    /* Personajes y familias: tarjetas con menos relleno */
    .personajes-grid, .families-container { padding-left: 14px !important; padding-right: 14px !important; }
    .families-grid { grid-template-columns: 1fr !important; }
    .intro-section { padding: 20px 20px 40px !important; }
    .intro-section .quote { padding-left: 16px !important; }
    .lhs-pie-links { gap: 8px 16px; }

    .lhs-esq { width: 22px !important; height: 22px !important; }
}

@media (prefers-reduced-motion: reduce) {
    .lhs-petalos { display: none; }
    .lhs-revelar { opacity: 1; transform: none; }
    .lhs-menu::before { animation: none; }
}
