/* ==========================================================================
   CURTAIN REVEAL MONOLITHIC FOOTER (Awwwards Noir & Gold Edition)
   Relatando.com — Opción B: Telón Fijo Desvelado con Espaciador Dinámico
   ========================================================================== */

/* 1. BASE Y ESPACIADOR */
body {
    background-color: #030705 !important;
}

/* Espaciador de telón: Oculto en móviles y activo en escritorio */
.crypt-footer-curtain-spacer {
    display: none;
    width: 100%;
    pointer-events: none;
    background: transparent;
}

/* Footer base por defecto (Móviles y Páginas Especiales como Oráculo o Secreto): Flujo natural relativo */
.curtain-reveal-footer-wrapper,
footer.site-footer {
    position: relative;
    width: 100%;
    z-index: 10;
    background-color: #030705;
    padding: 60px 24px 34px 24px;
    box-sizing: border-box;
    overflow: hidden;
    margin-top: 50px;
    clear: both;
}

/* ==========================================================================
   2. EFECTO TELÓN FIJO REAL (Solo en pantallas grandes >= 992px y páginas aptas)
   ========================================================================== */
@media (min-width: 992px) {
    /* Activar espaciador SOLAMENTE en la página de inicio */
    body.home .crypt-footer-curtain-spacer {
        display: block;
        height: 0; /* Dinámicamente medido y asignado por JS con ResizeObserver */
    }

    /* En la portada de inicio: main#primary es transparente para permitir ver el Hero sticky */
    body.home main#primary {
        background-color: transparent !important;
        box-shadow: none !important;
    }

    /* En la portada de inicio: .portal-curtain-sheet es el telón superior con z-index alto */
    body.home .portal-curtain-sheet {
        position: relative !important;
        z-index: 10 !important;
        background-color: #030705 !important;
        box-shadow: 0 -35px 80px rgba(0, 0, 0, 0.98), 0 45px 90px rgba(0, 0, 0, 0.98);
    }

    /* El pie se fija abajo en z-index: 1, oculto detrás de la lámina hasta que se hace scroll (SOLO HOME) */
    body.home .curtain-reveal-footer-wrapper {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 100% !important;
        z-index: 1 !important;
        background-color: #020503;
        padding: 50px 24px 34px 24px;
        box-sizing: border-box;
        overflow: hidden;
        margin-top: 0 !important;
        pointer-events: none;
        visibility: hidden;
        opacity: 0;
        transition: opacity 0.28s ease, visibility 0.28s ease;
    }

    /* Cuando el espaciador entra en el campo de visión cerca del final del scroll (SOLO HOME) */
    body.home .curtain-reveal-footer-wrapper.is-revealed {
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }
}

/* Niebla espectral de fondo bajo la lámina */
.curtain-reveal-footer-wrapper::before {
    content: '';
    position: absolute;
    top: -50px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 180px;
    background: radial-gradient(ellipse at center, rgba(0, 255, 136, 0.08) 0%, rgba(212, 175, 55, 0.05) 50%, transparent 75%);
    filter: blur(40px);
    pointer-events: none;
    z-index: 0;
}

/* 2. LA LÁMINA MONOLÍTICA SUSPENDIDA */
.monolithic-crypt-footer {
    position: relative;
    z-index: 2;
    max-width: 1220px;
    margin: 0 auto;
    background: linear-gradient(180deg, rgba(6, 14, 10, 0.94) 0%, rgba(3, 7, 5, 0.98) 100%);
    backdrop-filter: blur(28px) saturate(180%);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    border: 1px solid rgba(212, 175, 55, 0.32);
    border-radius: 28px;
    padding: 44px 48px 32px 48px;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.95), 
                0 0 35px rgba(0, 255, 136, 0.09), 
                inset 0 1px 0 rgba(255, 255, 255, 0.12);
    box-sizing: border-box;
}

/* 3. CABECERA EDITORIAL DEL PIE */
.crypt-footer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 24px;
    padding-bottom: 32px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.18);
    margin-bottom: 36px;
}

.crypt-footer-brand {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.crypt-footer-logo {
    font-family: 'Cinzel', 'Playfair Display', Georgia, serif;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: 3px;
    background: linear-gradient(135deg, #ffffff 0%, #d4af37 60%, #00ff88 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.crypt-footer-logo::after {
    content: '✦';
    font-size: 14px;
    color: #d4af37;
    -webkit-text-fill-color: #d4af37;
}

.crypt-footer-tagline {
    font-size: 12px;
    color: #a3b8ad;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-weight: 600;
}

.crypt-footer-quote-wrap {
    flex: 1;
    max-width: 480px;
    padding: 0 16px;
}
.crypt-footer-quote {
    font-family: 'Playfair Display', Georgia, serif;
    font-style: italic;
    font-size: 13px;
    line-height: 1.55;
    color: #c4d4cc;
    margin: 0;
    opacity: 0.88;
}

.crypt-footer-cta-wrap {
    display: flex;
    align-items: center;
    gap: 14px;
}

.crypt-footer-social-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    border-radius: 999px;
    background: rgba(212, 175, 55, 0.12);
    border: 1px solid rgba(212, 175, 55, 0.4);
    color: #f0f5f2;
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.crypt-footer-social-btn:hover {
    background: rgba(0, 255, 136, 0.18);
    border-color: #00ff88;
    color: #ffffff;
    box-shadow: 0 0 24px rgba(0, 255, 136, 0.4);
    transform: translateY(-2px);
}

/* 4. REJILLA EN 3 COLUMNAS PROPORCIONADAS */
.crypt-footer-grid {
    display: grid;
    grid-template-columns: 1.1fr 1.3fr 1.1fr;
    gap: 36px;
    margin-bottom: 36px;
}

.crypt-footer-col h4 {
    font-family: 'Cinzel', Georgia, serif;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1.8px;
    text-transform: uppercase;
    color: #d4af37;
    margin: 0 0 16px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.crypt-footer-col h4::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, rgba(212, 175, 55, 0.3), transparent);
}

/* Columna 1: Portales */
.crypt-portals-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.crypt-portals-list li a {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    color: #cbdad1;
    padding: 4px 0;
    transition: all 0.22s ease;
}
.crypt-portals-list li a:hover {
    color: #00ff88;
    transform: translateX(5px);
}

/* Columna 2: Códice & Diccionario de Sombras */
.crypt-shadow-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.crypt-shadow-tag {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #a3b8ad;
    text-decoration: none;
    font-size: 11.5px;
    font-weight: 500;
    letter-spacing: 0.3px;
    transition: all 0.25s ease;
}
.crypt-shadow-tag:hover {
    background: rgba(0, 255, 136, 0.12);
    border-color: rgba(0, 255, 136, 0.4);
    color: #00ff88;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 255, 136, 0.15);
}

/* Columna 3: Navegación Institucional & Legal */
.crypt-legal-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.crypt-legal-links li a {
    font-size: 12.5px;
    color: #8c9e94;
    text-decoration: none;
    transition: color 0.2s ease;
}
.crypt-legal-links li a:hover {
    color: #d4af37;
    text-decoration: underline;
}

/* 5. BARRA DE CIERRE Y BOTÓN SUBIR */
.crypt-footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.crypt-footer-copy {
    font-size: 11.5px;
    color: #6a7c72;
    margin: 0;
    line-height: 1.5;
}
.crypt-footer-copy strong {
    color: #a3b8ad;
    font-weight: 600;
}

.crypt-footer-actions {
    display: flex;
    align-items: center;
    gap: 18px;
}

.crypt-status-pulse {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #00ff88;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
}
.crypt-status-pulse::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #00ff88;
    box-shadow: 0 0 8px #00ff88;
    animation: statusBlink 2s infinite ease-in-out;
}
@keyframes statusBlink {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.35; transform: scale(0.85); }
}

.crypt-back-to-top-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(212, 175, 55, 0.3);
    color: #d4af37;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.25s ease;
}
.crypt-back-to-top-btn:hover {
    background: rgba(212, 175, 55, 0.2);
    border-color: #d4af37;
    color: #fff;
    box-shadow: 0 0 16px rgba(212, 175, 55, 0.35);
    transform: translateY(-2px);
}

/* 6. RESPONSIVE ADAPTATION */
@media (max-width: 900px) {
    /* En pantallas medianas y móviles, fluidez natural sin touch traps */
    .curtain-reveal-footer-wrapper {
        position: relative;
        padding: 30px 14px 24px 14px;
    }
    .monolithic-crypt-footer {
        padding: 28px 20px 24px 20px;
        border-radius: 20px;
    }
    .crypt-footer-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    .crypt-footer-quote-wrap {
        padding: 0;
        max-width: 100%;
    }
    .crypt-footer-grid {
        grid-template-columns: 1fr;
        gap: 28px;
    }
    .crypt-footer-bottom {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
    }
}

/* =========================================================
   COMMAND CENTER (INTERNAL PAGES FOOTER)
   ========================================================= */
.crypt-minimal-command-bar {
    display: none; /* Only visible on internal pages */
}
body:not(.home) .crypt-minimal-command-bar {
    display: block;
    position: relative;
    z-index: 10;
    background: #030705;
    border-top: 1px solid rgba(212, 175, 55, 0.2);
    padding: 20px 0;
}
.crypt-mcb-container {
    max-width: 1220px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}
.crypt-mcb-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.crypt-mcb-copy {
    color: #6a7c72;
    font-size: 11px;
    margin: 0;
    line-height: 1.5;
}
.crypt-mcb-copy strong {
    color: #a3b8ad;
}
.crypt-mcb-trigger {
    background: transparent;
    border: 1px solid rgba(212, 175, 55, 0.4);
    color: #d4af37;
    padding: 10px 24px;
    border-radius: 999px;
    font-family: 'Cinzel', serif;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}
.crypt-mcb-trigger:hover {
    background: rgba(212, 175, 55, 0.1);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.2);
}
.crypt-mcb-legal {
    display: flex;
    gap: 12px;
    align-items: center;
}
.crypt-mcb-legal a {
    color: #a3b8ad;
    font-size: 12px;
    text-decoration: none;
    transition: color 0.2s;
}
.crypt-mcb-legal a:hover {
    color: #d4af37;
}
.crypt-mcb-sep {
    color: rgba(255, 255, 255, 0.1);
    font-size: 12px;
}

/* OVERLAY MODE FOR INTERNAL PAGES */
body:not(.home) .curtain-reveal-footer-wrapper {
    display: none; /* Hidden by default on internal pages */
}
body:not(.home) .curtain-reveal-footer-wrapper.is-overlay-active {
    display: flex !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100vh !important;
    z-index: 99999 !important;
    background: rgba(3, 7, 5, 0.92) !important;
    backdrop-filter: blur(25px) !important;
    -webkit-backdrop-filter: blur(25px) !important;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    padding: 40px 20px;
    opacity: 0;
    animation: fadeInOverlay 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes fadeInOverlay {
    from { opacity: 0; transform: scale(0.98) translateY(15px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* OVERLAY CLOSE BUTTON */
.crypt-overlay-close {
    display: none;
}
body:not(.home) .curtain-reveal-footer-wrapper.is-overlay-active .crypt-overlay-close {
    display: flex;
    position: absolute;
    top: 30px;
    right: 30px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.3s;
    z-index: 999999;
}
body:not(.home) .curtain-reveal-footer-wrapper.is-overlay-active .crypt-overlay-close:hover {
    background: rgba(212, 175, 55, 0.2);
    border-color: #d4af37;
    transform: rotate(90deg);
}

body:not(.home) .monolithic-crypt-footer {
    width: 100%;
    max-width: 1000px;
    margin: auto;
    box-shadow: 0 30px 100px rgba(0, 0, 0, 0.8), 0 0 40px rgba(0, 255, 136, 0.05);
}
@media (max-width: 768px) {
    .crypt-mcb-container {
        flex-direction: column-reverse;
        justify-content: center;
        text-align: center;
        gap: 20px;
    }
    .crypt-mcb-legal {
        justify-content: center;
    }
}
