/* ================================
   LIGHTBOX (Opción B — navegación completa)
   ================================ */

/* Cursor pointer en miniaturas (indica enlace clickable → lightbox) */
.hi-gallery-link,
.hi-archivo-link {
    cursor: pointer;
    display: block;
}

/* Diálogo modal */
.hi-lightbox {
    position: fixed;
    inset: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    overflow: hidden;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.hi-lightbox[open] {
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    opacity: 1;
}

/* Fondo oscuro nativo */
.hi-lightbox::backdrop {
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* Escenario central */
.hi-lightbox-stage {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: 90vw;
    max-height: 85vh;
    z-index: 1;
}

/* Imagen a tamaño completo */
.hi-lightbox-img {
    max-width: 90vw;
    max-height: 75vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 4px 40px rgba(0, 0, 0, 0.5);
    transition: opacity 0.25s ease, transform 0.25s ease;
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
}

.hi-lightbox-img.loading {
    opacity: 0.3;
}

/* Pie de imagen */
.hi-lightbox-caption {
    margin-top: 1rem;
    font-family: var(--hi-serif);
    font-size: 1rem;
    font-style: italic;
    color: rgba(255, 255, 255, 0.75);
    text-align: center;
    max-width: 80vw;
    min-height: 1.4em;
}

/* Contador */
.hi-lightbox-counter {
    margin-top: 0.35rem;
    font-family: var(--hi-mono);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.4);
    text-align: center;
}

/* Botón cerrar */
.hi-lightbox-close {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 10001;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.hi-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Botones prev/next */
.hi-lightbox-prev,
.hi-lightbox-next {
    position: fixed;
    top: 50%;
    z-index: 10001;
    width: 50px;
    height: 80px;
    margin-top: -40px;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 2.2rem;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.hi-lightbox-prev { left: 0.5rem; }
.hi-lightbox-next { right: 0.5rem; }

.hi-lightbox-prev:hover,
.hi-lightbox-next:hover {
    background: rgba(255, 255, 255, 0.2);
}

.hi-lightbox-prev:disabled,
.hi-lightbox-next:disabled {
    opacity: 0.2;
    cursor: default;
    pointer-events: none;
}

/* Preloader spinner */
.hi-lightbox-img {
    transition: opacity 0.25s ease;
}

/* Responsive */
@media (max-width: 768px) {
    .hi-lightbox-img {
        max-width: 95vw;
        max-height: 70vh;
    }

    .hi-lightbox-caption {
        font-size: 0.9rem;
        max-width: 90vw;
    }

    .hi-lightbox-prev,
    .hi-lightbox-next {
        width: 40px;
        height: 60px;
        font-size: 1.6rem;
    }

    .hi-lightbox-close {
        top: 0.75rem;
        right: 0.75rem;
        width: 36px;
        height: 36px;
        font-size: 1.3rem;
    }
}

/* Prevenir scroll del body cuando el lightbox está abierto */
body.lightbox-open {
    overflow: hidden;
}

