.mh-popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--mh-overlay-bg, rgba(0, 0, 0, .33));
    font-family: var(--mh-font, Poppins, Arial, sans-serif);
    padding: 20px;
    box-sizing: border-box;
    backdrop-filter: blur(4px);
}

#mh-popup-overlay.mh-popup-hidden,
.mh-popup-overlay.mh-popup-hidden {
    display: none;
}

.mh-popup-card {
    position: relative;
    box-sizing: border-box;
    width: min(900px, 95vw);
    max-width: 95vw;
    min-height: 520px;
    background: var(--mh-bg, #fff);
    border: var(--mh-border-width, 1px) solid var(--mh-border-color, #e5e7eb);
    border-radius: var(--mh-radius, 16px);
    box-shadow: 0 30px 90px rgba(0, 0, 0, .25);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 42%);
    grid-auto-rows: minmax(0, 1fr);
    align-items: stretch;
    overflow: hidden;
    isolation: isolate;
    animation: mhPopupIn .35s ease;
}

.mh-popup-card > * {
    min-width: 0;
    min-height: 0;
}

.mh-popup-card.mh-image-left {
    grid-template-columns: minmax(320px, 42%) minmax(0, 1fr);
}

.mh-popup-card.mh-no-image {
    width: min(760px, 95vw);
    min-height: auto;
    display: block;
}

.mh-size-small {
    width: min(560px, 95vw);
    min-height: auto;
    display: block;
}

.mh-size-fullscreen {
    width: min(1200px, 96vw);
    min-height: min(760px, 92vh);
}

.mh-popup-text {
    min-width: 0;
    padding: 52px 44px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.mh-popup-sub {
    margin: 0 0 18px;
}

.mh-popup-sub span,
.mh-popup-text h2 span,
.mh-popup-text p span,
.mh-popup-cta span {
    display: inline;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
    padding: .12em .28em;
    border-radius: 6px;
}

.mh-popup-text h2 {
    margin: 0 0 18px;
}

.mh-popup-text p {
    margin: 0 0 28px;
}

.mh-popup-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: max-content;
    max-width: 100%;
    min-height: 46px;
    padding: 13px 24px;
    background: var(--mh-button-bg, #22a851);
    text-decoration: none !important;
    transition: background-color .2s ease, transform .2s ease;
}

.mh-popup-cta:hover {
    background: var(--mh-button-hover, #1a8040);
    transform: translateY(-1px);
}

.mh-popup-close {
    position: absolute;
    right: 16px;
    top: 14px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .86);
    color: var(--mh-close, #6b7280);
    font-size: 28px;
    line-height: 30px;
    cursor: pointer;
    z-index: 2;
}

.mh-popup-close:hover {
    color: var(--mh-close-hover, #111827);
}

.mh-popup-image {
    align-self: stretch;
    justify-self: stretch;
    position: relative;
    display: block;
    width: 100%;
    max-width: 100%;
    height: 100%;
    min-height: inherit;
    background-color: var(--mh-bg, #fff);
    overflow: hidden;
    box-sizing: border-box;
    border-radius: 0;
}

.mh-popup-card.mh-image-left .mh-popup-image {
    border-radius: var(--mh-radius, 16px) 0 0 var(--mh-radius, 16px);
}

.mh-popup-card.mh-image-right .mh-popup-image {
    border-radius: 0 var(--mh-radius, 16px) var(--mh-radius, 16px) 0;
}

.mh-popup-image img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    max-width: none;
    height: 100% !important;
    min-width: 100%;
    min-height: 100%;
    object-fit: var(--mh-image-fit, contain);
    object-position: center center;
    background-color: var(--mh-bg, #fff);
}

.mh-popup-branding {
    margin-top: 22px;
    text-decoration: none !important;
}

.mh-size-small .mh-popup-image {
    display: none;
}

@keyframes mhPopupIn {
    from {
        opacity: 0;
        transform: translateY(16px) scale(.97);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@media (max-width: 768px) {
    .mh-popup-overlay {
        align-items: center;
        justify-content: center;
        padding: 12px;
    }

    .mh-popup-card,
    .mh-popup-card.mh-image-left,
    .mh-popup-card.mh-image-right {
        grid-template-columns: 1fr;
        grid-auto-rows: auto;
        width: 92vw;
        max-width: 92vw;
        max-height: 90vh;
        min-height: 0;
        margin: auto;
        border-radius: 12px;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .mh-popup-image {
        position: relative;
        width: 100%;
        max-width: 100%;
        height: 220px;
        max-height: 220px;
        min-height: 0;
        margin: 0;
        order: -1;
        border-radius: 12px 12px 0 0;
    }

    .mh-popup-card.mh-image-left .mh-popup-image,
    .mh-popup-card.mh-image-right .mh-popup-image {
        border-radius: 12px 12px 0 0;
    }

    .mh-popup-image img {
        width: 100%;
        height: 220px !important;
        min-width: 0;
        min-height: 0;
        max-height: 220px;
    }

    .mh-popup-text {
        display: block;
        justify-content: flex-start;
        width: 100%;
        margin: 0;
        padding: 20px 20px 28px;
        text-align: left;
        box-sizing: border-box;
    }

    .mh-popup-text h2 span {
        font-size: min(24px, 8vw) !important;
    }

    .mh-popup-cta {
        display: block;
        width: 100%;
        margin-right: 0;
        margin-bottom: 12px;
        margin-left: 0;
        box-sizing: border-box;
        text-align: center;
    }

    .mh-popup-cta span {
        display: block;
        width: 100%;
        box-sizing: border-box;
        text-align: center;
    }

    .mh-popup-branding {
        display: inline-block;
        margin-top: 0;
        margin-bottom: 0;
    }

    .mh-popup-close {
        top: 10px;
        right: 10px;
        z-index: 10;
    }
}

@media (max-width: 480px) {
    .mh-popup-overlay {
        padding: 8px;
    }

    .mh-popup-card,
    .mh-popup-card.mh-image-left,
    .mh-popup-card.mh-image-right {
        width: 92vw;
        max-width: 92vw;
        max-height: 90vh;
    }

    .mh-popup-text {
        padding: 20px 20px 28px;
    }

    .mh-popup-sub {
        margin-bottom: 12px;
    }

    .mh-popup-text h2 {
        margin-bottom: 12px;
    }

    .mh-popup-text p {
        margin-bottom: 18px;
    }

    .mh-popup-cta {
        min-height: 44px;
        padding: 12px 18px;
        margin-bottom: 12px;
    }
}
