/* Overlay Layout */
.ipp-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    opacity: 0;
    transition: opacity var(--ipp-duration, 350ms) ease-in-out;
}

.ipp-overlay.ipp-show {
    opacity: 1;
}

/* Modal Window */
.ipp-modal {
    position: relative;
    width: 100%;
    margin: auto;
    overflow: hidden;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transform: scale(0.95);
    transition: transform var(--ipp-duration, 350ms) cubic-bezier(0.16, 1, 0.3, 1),
                opacity var(--ipp-duration, 350ms) ease-in-out;
}

/* Responsiveness Constraints */
.ipp-modal {
    max-width: min(92vw, var(--ipp-max-width, 600px));
}

.ipp-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

.ipp-popup-image {
    width: 100%;
    height: auto;
    max-height: calc(var(--ipp-max-height, 80) * 1vh);
    object-fit: contain;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
}

.ipp-popup-link {
    display: block;
    width: 100%;
    text-decoration: none;
    line-height: 0;
}

/* Close Button Styling */
.ipp-close-btn {
    position: absolute;
    width: var(--ipp-btn-size, 32px);
    height: var(--ipp-btn-size, 32px);
    color: var(--ipp-btn-color, #ffffff);
    background: var(--ipp-btn-bg, rgba(0, 0, 0, 0.5));
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: calc(var(--ipp-btn-size, 32px) * 0.65);
    line-height: 1;
    z-index: 10;
    padding: 0;
    margin: 0;
    transition: transform 0.2s ease, background-color 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.ipp-close-btn:hover {
    transform: scale(1.1);
}

.ipp-close-btn:focus-visible {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

/* Close Button Positions */
.ipp-close-btn.ipp-pos-top-right {
    top: 10px;
    right: 10px;
}

.ipp-close-btn.ipp-pos-top-left {
    top: 10px;
    left: 10px;
}

.ipp-close-btn.ipp-pos-outside-top-right {
    top: -40px;
    right: 0px;
}

/* Animations */
/* Scale In */
.ipp-anim-scale {
    transform: scale(0.9);
}
.ipp-overlay.ipp-show .ipp-anim-scale {
    transform: scale(1);
}

/* Fade */
.ipp-anim-fade {
    transform: scale(1);
}

/* Slide Up */
.ipp-anim-slide-up {
    transform: translateY(40px);
}
.ipp-overlay.ipp-show .ipp-anim-slide-up {
    transform: translateY(0);
}

/* Slide Down */
.ipp-anim-slide-down {
    transform: translateY(-40px);
}
.ipp-overlay.ipp-show .ipp-anim-slide-down {
    transform: translateY(0);
}

/* None */
.ipp-anim-none {
    transform: none !important;
}

/* Mobile Optimizations */
@media (max-width: 600px) {
    .ipp-close-btn.ipp-pos-outside-top-right {
        top: 8px;
        right: 8px;
        background: rgba(0,0,0,0.7);
    }
}