.dip-popup-overlay,
.dip-popup-overlay * {
    box-sizing: border-box;
}

.dip-popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 32px;
    background-color: rgba(0, 0, 0, 0.65);
    opacity: 0;
    visibility: hidden;
    transition:
        opacity 180ms ease,
        visibility 180ms ease;
}

.dip-popup-overlay.dip-is-visible {
    display: flex;
    opacity: 1;
    visibility: visible;
}

.dip-popup-container {
    position: relative;
    width: var(--dip-popup-width, 60%);
    max-width: calc(100vw - 64px);
    max-height: calc(100vh - 64px);
    margin: 0;
    padding: 0;
    line-height: 0;
    transform: scale(0.96);
    transition: transform 180ms ease;
}

.dip-popup-overlay.dip-is-visible .dip-popup-container {
    transform: scale(1);
}

.dip-popup-link {
    display: block;
    width: 100%;
    max-height: calc(100vh - 64px);
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: var(--dip-border-radius, 8px);
    line-height: 0;
    text-decoration: none;
    outline: none;
}

.dip-popup-link:focus-visible {
    outline: 3px solid #ffffff;
    outline-offset: 4px;
}

.dip-popup-image {
    display: block;
    width: 100%;
    height: auto;
    max-height: calc(100vh - 64px);
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: var(--dip-border-radius, 8px);
    object-fit: contain;
    box-shadow: 0 12px 45px rgba(0, 0, 0, 0.35);
}

.dip-popup-close {
    position: absolute;
    top: -15px;
    right: -15px;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin: 0;
    padding: 0 0 3px;
    border: 0;
    border-radius: 50%;
    background-color: #ffffff;
    color: #111111;
    font-family: Arial, sans-serif;
    font-size: 28px;
    font-weight: 400;
    line-height: 1;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3);
    appearance: none;
}

.dip-popup-close:hover {
    background-color: #f0f0f0;
    color: #000000;
}

.dip-popup-close:focus-visible {
    outline: 3px solid #2271b1;
    outline-offset: 2px;
}

body.dip-popup-open {
    overflow: hidden;
}

@media (max-width: 782px) {
    .dip-popup-overlay {
        padding: 20px;
    }

    .dip-popup-container {
        max-width: calc(100vw - 40px);
        max-height: calc(100vh - 40px);
    }

    .dip-popup-link,
    .dip-popup-image {
        max-height: calc(100vh - 40px);
    }

    .dip-popup-close {
        top: -13px;
        right: -13px;
        width: 34px;
        height: 34px;
        font-size: 26px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .dip-popup-overlay,
    .dip-popup-container {
        transition: none;
    }
}
