/* Shared content lightbox + zoom chrome (also reused by catalog viewer). */

.ygp-lightbox {
    position: fixed;
    inset: 0;
    height: 100dvh;
    max-height: -webkit-fill-available;
    background: #17161A;
    z-index: 10060;
    display: none;
    flex-direction: column;
}

.ygp-lightbox.is-open {
    display: flex;
}

body.ygp-lightbox-open {
    overflow: hidden;
}

body.ygp-lightbox-open .bottom-bar {
    display: none;
}

.ygp-lightbox__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: max(14px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 14px max(16px, env(safe-area-inset-left, 0px));
    border-bottom: 1px solid #2C2A27;
    flex-shrink: 0;
}

.ygp-lightbox__meta {
    min-width: 0;
    flex: 1;
}

.ygp-lightbox__counter {
    font: 500 12px var(--mono, system-ui, sans-serif);
    color: #98938B;
    letter-spacing: .5px;
}

.ygp-lightbox__close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(244, 240, 234, 0.08);
    border: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #F4F0EA;
    font-size: 18px;
    flex-shrink: 0;
}

.ygp-lightbox__close:hover {
    background: rgba(244, 240, 234, 0.16);
}

.ygp-lightbox__stage {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    padding: 0;
    touch-action: none;
    cursor: zoom-in;
    --ygp-lb-inset-t: 12px;
    --ygp-lb-inset-r: 64px;
    --ygp-lb-inset-b: 56px;
    --ygp-lb-inset-l: 64px;
}

.ygp-lightbox__stage.is-zoomed,
.catalog-viewer__stage.is-zoomed,
.ygp-zoom-stage.is-zoomed {
    cursor: grab;
}

.ygp-lightbox__stage.is-zoomed:active,
.catalog-viewer__stage.is-zoomed:active,
.ygp-zoom-stage.is-zoomed:active {
    cursor: grabbing;
}

.ygp-lightbox__frame {
    position: absolute;
    top: var(--ygp-lb-inset-t);
    right: var(--ygp-lb-inset-r);
    bottom: var(--ygp-lb-inset-b);
    left: var(--ygp-lb-inset-l);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.ygp-lightbox__img,
.ygp-lightbox__zoomable {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transform-origin: center center;
    will-change: transform;
    user-select: none;
    -webkit-user-drag: none;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
    background: #fff;
}

.ygp-lightbox__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(244, 240, 234, 0.08);
    color: #F4F0EA;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 0;
    font-size: 22px;
    z-index: 2;
}

.ygp-lightbox__nav:hover {
    background: rgba(244, 240, 234, 0.18);
}

.ygp-lightbox__nav--prev {
    left: 16px;
}

.ygp-lightbox__nav--next {
    right: 16px;
}

.ygp-lightbox__nav.is-disabled,
.ygp-lightbox__nav:disabled {
    opacity: .25;
    pointer-events: none;
}

.ygp-lightbox__zoom {
    position: absolute;
    right: max(16px, env(safe-area-inset-right, 0px));
    bottom: max(16px, env(safe-area-inset-bottom, 0px));
    display: flex;
    gap: 8px;
    z-index: 3;
}

.ygp-lightbox__zoom-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 0;
    background: rgba(244, 240, 234, 0.1);
    color: #F4F0EA;
    font: 600 16px/1 var(--mono, system-ui, sans-serif);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ygp-lightbox__zoom-btn:hover {
    background: rgba(244, 240, 234, 0.2);
}

.ygp-lightbox__bottom {
    padding: 12px max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
    flex-shrink: 0;
    min-height: 20px;
}

.ygp-lightbox__caption {
    margin: 0;
    text-align: center;
    font: 400 13px/1.45 var(--font, system-ui, sans-serif);
    color: #CFCAC2;
}

/* Content affordance */
.entry-content .wp-block-image img,
.entry-content .wp-block-gallery img,
.entry-content figure img {
    cursor: zoom-in;
}

@media (max-width: 720px) {
    .ygp-lightbox__stage {
        --ygp-lb-inset-t: 8px;
        --ygp-lb-inset-r: 12px;
        --ygp-lb-inset-b: 56px;
        --ygp-lb-inset-l: 12px;
    }

    .ygp-lightbox__nav--prev {
        left: 8px;
    }

    .ygp-lightbox__nav--next {
        right: 8px;
    }

    .ygp-lightbox__zoom {
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        bottom: max(12px, env(safe-area-inset-bottom, 0px));
    }
}
