.ps2lb-open {
    overflow: hidden !important;
}

.ps2lb-overlay {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, var(--ps2lb-overlay-opacity, .92));
    padding: 18px;
    box-sizing: border-box;
}

.ps2lb-overlay.is-open {
    display: flex;
}

.ps2lb-stage {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
}

.ps2lb-image {
    display: block;
    max-width: min(var(--ps2lb-image-max-width, 96vw), 1800px);
    max-height: var(--ps2lb-image-max-height, 88vh);
    width: auto;
    height: auto;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
    box-shadow: 0 8px 40px rgba(0,0,0,.35);
}

.ps2lb-toolbar {
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    pointer-events: none;
}

.ps2lb-counter,
.ps2lb-caption {
    color: #fff;
    font-size: 14px;
    line-height: 1.35;
    text-shadow: 0 1px 3px rgba(0,0,0,.75);
}

.ps2lb-counter {
    padding: 8px 10px;
    background: rgba(0,0,0,.35);
    border-radius: 999px;
}

.ps2lb-close,
.ps2lb-prev,
.ps2lb-next {
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    background: rgba(0,0,0,.45);
    color: #fff;
    width: 46px;
    height: 46px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    pointer-events: auto;
    transition: background-color .15s ease, transform .15s ease;
}

.ps2lb-close:hover,
.ps2lb-prev:hover,
.ps2lb-next:hover,
.ps2lb-close:focus-visible,
.ps2lb-prev:focus-visible,
.ps2lb-next:focus-visible {
    background: rgba(255,255,255,.22);
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.ps2lb-close {
    font-size: 30px;
}

.ps2lb-prev,
.ps2lb-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}

.ps2lb-prev { left: 8px; }
.ps2lb-next { right: 8px; }

.ps2lb-prev:hover,
.ps2lb-prev:focus-visible,
.ps2lb-next:hover,
.ps2lb-next:focus-visible {
    transform: translateY(-50%) scale(1.05);
}

.ps2lb-caption {
    position: absolute;
    left: 50%;
    bottom: 10px;
    transform: translateX(-50%);
    max-width: min(90vw, 1000px);
    padding: 7px 10px;
    text-align: center;
    background: rgba(0,0,0,.4);
    border-radius: 6px;
}

.ps2lb-hidden {
    display: none !important;
}

/* Dyskretny sygnał, że obraz jest klikalny — tylko gdy włączono go w ustawieniach. */
.ps2lb-zoom-cursor-enabled .wp-block-gallery img,
.ps2lb-zoom-cursor-enabled .gallery img,
.ps2lb-zoom-cursor-enabled figure.wp-block-image img {
    cursor: zoom-in;
}

@media (max-width: 782px) {
    .ps2lb-overlay { padding: 8px; }
    .ps2lb-image {
        max-width: min(var(--ps2lb-image-max-width, 100vw), 100vw);
        max-height: min(var(--ps2lb-image-max-height, 84vh), 92vh);
    }
    .ps2lb-close,
    .ps2lb-prev,
    .ps2lb-next {
        width: 42px;
        height: 42px;
    }
    .ps2lb-prev { left: 2px; }
    .ps2lb-next { right: 2px; }
    .ps2lb-caption {
        bottom: 4px;
        font-size: 13px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ps2lb-close,
    .ps2lb-prev,
    .ps2lb-next {
        transition: none;
    }
}
