/* Popwise – Public Styles */

.pm-popup {
    position: fixed;
    z-index: 2147483001;
    box-sizing: border-box;
    max-width: 90vw;
    box-shadow: 0 24px 80px rgba(0,0,0,.25);
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease, transform .3s ease;
    /* Clips the edge-to-edge image (see .pm-image below) to the card's own
     * rounded corners instead of it sticking out as a square-cornered strip. */
    overflow: hidden;
    /* Also cancels the browser's own dialog:modal centering (inset:0;
     * margin:auto) for the <dialog> case. Deliberately placed here (same
     * specificity as, and before, the .pm-pos-* rules below) rather than on
     * a "dialog.pm-popup" selector — a selector combining the element type
     * with the class would out-specificity .pm-pos-center's top/left and
     * silently win regardless of source order, leaving the popup unpositioned. */
    inset: auto;
    margin: 0;
}
.pm-popup.pm-visible { opacity: 1; pointer-events: auto; }

/* Modal (center + overlay) popups render as <dialog>. Reset the browser's
 * default dialog chrome (border/padding/background/max-width) so it looks
 * identical to the plain-div popup, and use ::backdrop instead of a
 * separate overlay element — native top-layer, immune to z-index/transform
 * issues caused by ancestor elements (e.g. a "push" style side-cart). */
dialog.pm-popup {
    border: none;
    padding: 0;
    background: none;
    max-width: 90vw;
    max-height: 90vh;
}
dialog.pm-popup::backdrop {
    background: rgba(0,0,0,.55);
    opacity: 0;
    transition: opacity .3s ease;
}
dialog.pm-popup.pm-visible::backdrop { opacity: 1; }

/* Positions */
.pm-pos-center        { top: 50%; left: 50%; transform: translate(-50%, -50%) scale(.95); }
.pm-pos-center.pm-visible { transform: translate(-50%, -50%) scale(1); }

.pm-pos-bottom-left   { bottom: 24px; left: 24px; transform: translateY(20px); }
.pm-pos-bottom-left.pm-visible { transform: translateY(0); }

.pm-pos-bottom-right  { bottom: 24px; right: 24px; transform: translateY(20px); }
.pm-pos-bottom-right.pm-visible { transform: translateY(0); }

.pm-pos-slide-in-right { bottom: 24px; right: 24px; transform: translateX(120%); }
.pm-pos-slide-in-right.pm-visible { transform: translateX(0); }

.pm-pos-top-bar { top: 0; left: 0; right: 0; width: 100%; max-width: 100vw; transform: translateY(-100%); border-radius: 0 !important; display: flex; align-items: center; justify-content: center; gap: 16px; padding: 12px 48px 12px 24px !important; }
.pm-pos-top-bar.pm-visible { transform: translateY(0); }
.pm-pos-top-bar .pm-body, .pm-pos-top-bar .pm-image { display: none; }
.pm-pos-top-bar .pm-headline { font-size: 14px; margin: 0; }

/* Animations */
.pm-anim-zoom { transform: translate(-50%,-50%) scale(.8) !important; }
.pm-anim-zoom.pm-visible { transform: translate(-50%,-50%) scale(1) !important; }
.pm-anim-bounce.pm-visible { animation: pm-bounce .5s cubic-bezier(.36,.07,.19,.97) both; }
@keyframes pm-bounce {
    0%,100% { transform: translate(-50%,-50%) scale(1); }
    20% { transform: translate(-50%,-50%) scale(1.04); }
    40% { transform: translate(-50%,-50%) scale(.97); }
    60% { transform: translate(-50%,-50%) scale(1.02); }
    80% { transform: translate(-50%,-50%) scale(.99); }
}

/* Inner */
.pm-popup-inner { padding: 28px; }
.pm-pos-top-bar .pm-popup-inner { padding: 0; display: contents; }

.pm-image {
    display: block;
    /* Bleeds full-bleed to the card's edges (top corners included) instead
     * of sitting inset with the same padding as the text below — the usual
     * treatment for a banner-style hero image. The negative margins exactly
     * cancel .pm-popup-inner's padding; the mobile media query below updates
     * them to match its own smaller padding value. */
    width: calc(100% + 56px);
    margin: -28px -28px 16px -28px;
    max-height: 420px;
    object-fit: cover;
}
/* Image to the right of the text (a small logo or mark) instead of a banner.
 * Sits in its own column next to headline, body and form, vertically
 * centred; starts below the close button so the two never overlap. */
.pm-img-right .pm-popup-inner { position: relative; padding-right: 202px; }
.pm-img-right .pm-image {
    position: absolute;
    top: 48px; right: 28px;
    width: 150px; height: calc(100% - 76px);
    margin: 0;
    max-height: none;
    object-fit: contain;
    object-position: 50% 50%;
}
.pm-headline { font-size: 22px; font-weight: 700; margin: 0 0 10px; line-height: 1.3; color: inherit !important; }
.pm-body { font-size: 15px; margin: 0 0 20px; line-height: 1.6; color: inherit; }
.pm-body b, .pm-body strong { font-weight: 700; }
.pm-body i, .pm-body em { font-style: italic; }
.pm-body u { text-decoration: underline; }
.pm-body ul { margin: 6px 0 6px 18px; padding: 0; }
.pm-body a { color: inherit; text-decoration: underline; }
.pm-body p { margin: 0 0 8px; }

/* On narrow screens the popup card itself is much narrower (capped to
 * window width), so the same fixed 300px image height reads as far more
 * dominant/tall relative to the card — scale it and the surrounding
 * spacing down so the whole card stays compact and doesn't force scrolling
 * or push the button toward the bottom edge of the screen. */
@media (max-width: 480px) {
    .pm-popup-inner { padding: 18px; }
    .pm-image { width: calc(100% + 36px); margin: -18px -18px 12px -18px; max-height: 200px; }
    .pm-img-right .pm-popup-inner { padding-right: 18px; }
    .pm-img-right .pm-image { position: static; float: right; width: 64px; height: auto; margin: 22px 0 8px 12px; }
    .pm-headline { font-size: 19px; margin-bottom: 6px; }
    .pm-body { font-size: 14px; margin-bottom: 14px; }
    .pm-btn { padding: 10px 18px; font-size: 14px; }
}

.pm-btn {
    display: inline-block;
    padding: 11px 22px;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: filter .15s, transform .1s;
}
.pm-btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.pm-btn:active { transform: translateY(0); }

/* Sign-up form. Inherits font and text colour from the popup, so it follows
 * the theme; only spacing and the input frame are set here. */
.pm-form { margin: 0; }
.pm-form-label { display: block; font-size: 14px; font-weight: 700; margin: 0 0 4px; color: inherit; }
.pm-form-input {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin: 0 0 14px;
    padding: 10px 12px;
    border: 1px solid currentColor;
    border-radius: 4px;
    background: #fff;
    color: #1a1a1a;
    font: inherit;
    font-size: 15px;
}
.pm-form-input:focus { outline: 2px solid currentColor; outline-offset: 1px; }
.pm-form-submit { width: 100%; }
.pm-form-submit:disabled { opacity: .6; cursor: wait; transform: none; }
.pm-form-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.pm-form-message { margin: 10px 0 0; font-size: 14px; }
.pm-form-message:empty { display: none; }
.pm-form-error { font-weight: 600; }
.pm-form-success { margin: 0; font-size: 16px; font-weight: 600; }
.pm-pos-top-bar .pm-form { display: none; }

.pm-close-btn {
    position: absolute;
    top: 10px; right: 10px;
    width: 28px; height: 28px;
    background: #1a1a1a;
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
    transition: background .15s, transform .15s;
    z-index: 2;
}
.pm-close-btn:hover {
    background: #31753b;
    transform: scale(1.1);
}

/* Offer (WooCommerce): price, optional variation choice, Yes/No */
.pm-offer { margin: 0; }
.pm-offer-price { margin: 0 0 14px; font-size: 20px; font-weight: 700; color: inherit; }
.pm-offer-price del { opacity: .6; font-weight: 400; font-size: .8em; margin-right: 6px; color: inherit; }
.pm-offer-price ins { text-decoration: none; color: inherit; }
.pm-offer-view { margin: -8px 0 14px; font-size: 14px; }
.pm-offer-view a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.pm-offer-view a:hover { text-decoration-thickness: 2px; }
.pm-image-link { display: block; }
.pm-offer-choice {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin: 0 0 14px;
    padding: 10px 12px;
    border: 1px solid currentColor;
    border-radius: 4px;
    background: #fff;
    color: #1a1a1a;
    font: inherit;
    font-size: 15px;
}
.pm-offer-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.pm-offer-actions .pm-btn { flex: 1 1 auto; text-align: center; }
.pm-offer-yes:disabled { opacity: .6; cursor: wait; transform: none; }
.pm-offer-no { background: transparent; color: inherit; box-shadow: inset 0 0 0 2px currentColor; }
.pm-offer-success { margin: 0; font-size: 16px; font-weight: 600; }
.pm-pos-top-bar .pm-offer { display: none; }
