/* Visor individual de fotografías: controles y pie contenidos en el viewport. */
.cendi-lightbox {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: 100vw;
    max-height: 100dvh;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
    background: rgba(12, 30, 48, 0.92);
    z-index: 100000;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.cendi-lightbox.active {
    display: flex;
}

.lightbox-content {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    max-width: 1200px;
    max-height: 900px;
    min-width: 0;
    min-height: 0;
    box-sizing: border-box;
    overflow: hidden;
    background: transparent;
    text-align: center;
    animation: lightboxFadeIn 0.25s ease-out;
}

.lightbox-content.is-swipe-closing {
    transition: transform 0.18s ease, opacity 0.18s ease;
}

@keyframes lightboxFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.lightbox-image {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 0;
    min-height: 0;
    min-width: 0;
    height: 100%;
    width: 100%;
    overflow: hidden;
    touch-action: none;
    cursor: zoom-in;
}

.lightbox-image.is-zoomed {
    cursor: grab;
}

.lightbox-image.is-dragging {
    cursor: grabbing;
}

.lightbox-image img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 6px;
    user-select: none;
    -webkit-user-drag: none;
    transform: translate3d(0, 0, 0) scale(1);
    transform-origin: center center;
    will-change: transform;
}

.lightbox-image.is-zoom-animating img {
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.lightbox-close {
    position: fixed;
    top: 78px;
    right: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    box-sizing: border-box;
    padding: 0;
    border: 2px solid rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.48);
    color: #fff;
    font-size: 31px;
    font-family: Arial, sans-serif;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.lightbox-close:hover,
.lightbox-close:focus-visible {
    background: #ff633c;
    border-color: #ff633c;
    outline: none;
}

.lightbox-caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    flex: 0 0 auto;
    width: min(100%, 760px);
    margin: 0 auto;
    padding: 10px 56px calc(10px + env(safe-area-inset-bottom));
    box-sizing: border-box;
    max-height: min(28vh, 150px);
    overflow-y: auto;
    border-radius: 12px 12px 0 0;
    background: rgba(0, 0, 0, 0.45);
}

.lightbox-title {
    margin: 0;
    color: #fff;
    font-family: 'Lobster Two', cursive;
    font-size: 23px;
    line-height: 1.2;
    overflow-wrap: anywhere;
    hyphens: auto;
}

@media (max-width: 768px) {
    .cendi-lightbox {
        padding: 0;
    }

    .lightbox-content {
        max-width: none;
        max-height: none;
    }

    .lightbox-close {
        top: calc(12px + env(safe-area-inset-top));
        right: max(14px, env(safe-area-inset-right));
        width: 42px;
        height: 42px;
        font-size: 29px;
    }

    .lightbox-caption {
        width: 100%;
        margin: 0;
        padding: 10px 20px calc(10px + env(safe-area-inset-bottom));
        border-radius: 12px 12px 0 0;
    }

    .lightbox-title {
        font-size: clamp(18px, 5.4vw, 24px) !important;
        line-height: 1.15;
    }
}

@media (prefers-reduced-motion: reduce) {
    .lightbox-content,
    .lightbox-close {
        animation: none;
        transition: none;
    }
}
