.ht-popup-modal[hidden] {
    display: none;
}

.ht-popup-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    pointer-events: none;
}

.ht-popup-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.38);
    pointer-events: auto;
}

.ht-popup-modal__dialog {
    position: relative;
    z-index: 1;
    width: min(660px, calc(100vw - 48px));
    max-height: min(70vh, 720px);
    overflow: hidden;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 18px 46px rgba(0, 0, 0, 0.28);
    pointer-events: auto;
}

.ht-popup-modal__image {
    display: block;
    width: 100%;
    height: auto;
    max-height: 70vh;
    object-fit: contain;
}

.ht-popup-modal__close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.94);
    color: #111;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
}

.ht-popup-modal__close:focus-visible {
    outline: 3px solid #111;
    outline-offset: 3px;
}

@media (max-width: 767px) {
    .ht-popup-modal {
        align-items: flex-start;
        padding: 16vh 4vw 20px;
    }

    .ht-popup-modal__dialog {
        width: 92vw;
        max-height: 70vh;
        border-radius: 14px;
    }

    .ht-popup-modal__image {
        max-height: 70vh;
    }

    .ht-popup-modal__close {
        top: 8px;
        right: 8px;
    }
}
