html.pib-popup-open,
html.pib-popup-open body {
    overflow: hidden;
}

.pib-popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.72);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.pib-popup-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

.pib-popup-dialog {
    position: relative;
    width: min(100%, var(--pib-max-width, 700px));
    max-height: calc(100vh - 40px);
    transform: translateY(16px) scale(0.98);
    transition: transform 0.25s ease;
}

.pib-popup-overlay.is-visible .pib-popup-dialog {
    transform: translateY(0) scale(1);
}

.pib-popup-image {
    display: block;
    width: 100%;
    max-height: calc(100vh - 40px);
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.pib-popup-link {
    display: block;
}

.pib-popup-close {
    position: absolute;
    top: -14px;
    right: -14px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 2px solid #fff;
    border-radius: 999px;
    background: #111;
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.pib-popup-close:hover,
.pib-popup-close:focus {
    background: #333;
    outline: none;
}

@media (max-width: 600px) {
    .pib-popup-overlay {
        padding: 16px;
    }

    .pib-popup-close {
        top: -10px;
        right: -8px;
        width: 36px;
        height: 36px;
    }
}
