/* ==========================================================================
   Site-wide promo popup (#popupBannerModal), Bootstrap 5.1 modal.
   Loaded from resources/views/user/layouts/popup-banner.blade.php.
   Colours / font come ONLY from gateway-theme.css variables.

   Motion: Bootstrap 5 toggles .show on .modal (and on .modal-backdrop) and waits for
   the .modal element's transition-duration before hiding, so the durations below
   (200ms in, 150ms out) are also what Bootstrap waits for.
   ========================================================================== */

/* ---- Backdrop (body.pb-modal-open is set by the partial's JS while this modal is open) ---- */
body.pb-modal-open .modal-backdrop {
    background-color: rgba(var(--gw-navy-rgb), .72);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    transition: opacity 150ms ease-in;
}
body.pb-modal-open .modal-backdrop.show {
    opacity: 1;
    transition: opacity 200ms ease-out;
}

/* ---- Modal wrapper: opacity (exit 150ms, enter 200ms) ---- */
#popupBannerModal.fade {
    transition: opacity 150ms ease-in;
}
#popupBannerModal.fade.show {
    transition: opacity 200ms ease-out;
}

/* ---- Dialog: 8px rise + slight scale on enter ---- */
#popupBannerModal .modal-dialog {
    max-width: min(920px, calc(100vw - 32px));
    margin: 1.75rem auto;
}
#popupBannerModal.fade .modal-dialog {
    transform: translateY(8px) scale(.985);
    transition: transform 150ms ease-in;
}
#popupBannerModal.fade.show .modal-dialog {
    transform: none;
    transition: transform 200ms cubic-bezier(.2, .8, .2, 1);
}

/* ---- Card: navy, 22px radius, thin gold frame + soft gold glow ---- */
#popupBannerModal .modal-content {
    position: relative;
    overflow: hidden;
    border-radius: 22px;
    border: 1px solid rgba(var(--gw-gold-rgb), .55);
    background: var(--gw-navy);
    color: var(--gw-white);
    font-family: var(--gw-font);
    box-shadow:
        0 0 0 1px rgba(var(--gw-gold-rgb), .12),
        0 0 36px rgba(var(--gw-gold-rgb), .22),
        0 24px 64px rgba(var(--gw-navy-rgb), .55);
}

/* ---- Image (still clickable) ---- */
#popupBannerModal .popup-media {
    display: block;
    background: var(--gw-navy);
    line-height: 0;
}
#popupBannerModal .popup-media picture {
    display: block;
}
#popupBannerModal .popup-media img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 70vh;
    object-fit: contain;
    background: var(--gw-navy);
}
#popupBannerModal .popup-media:focus-visible {
    outline: 3px solid var(--gw-gold);
    outline-offset: -3px;
}

/* ---- Close: 40px navy circle, white x, sits over the image (never over the action bar) ---- */
#popupBannerModal .popup-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 5;
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid rgba(var(--gw-ice-rgb), .35);
    background: var(--gw-navy);
    color: var(--gw-white);
    line-height: 1;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    box-shadow: 0 2px 10px rgba(var(--gw-navy-rgb), .45);
    transition: background-color 150ms ease, border-color 150ms ease;
}
#popupBannerModal .popup-close span {
    font-size: 26px;
    margin-top: -2px;
}
#popupBannerModal .popup-close:hover {
    background: var(--gw-navy-light);
    border-color: rgba(var(--gw-gold-rgb), .7);
}
#popupBannerModal .popup-close:focus {
    outline: none;
}
#popupBannerModal .popup-close:focus-visible {
    outline: 3px solid var(--gw-gold);
    outline-offset: 2px;
}

/* ---- Action bar (real HTML, under the image) ---- */
#popupBannerModal .popup-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px 18px;
    padding: 14px 20px 16px;
    background: var(--gw-navy);
    border-top: 1px solid rgba(var(--gw-gold-rgb), .25);
}
#popupBannerModal .popup-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 12px 30px;
    border-radius: 999px;
    border: 0;
    background: var(--gw-gold);
    background-image: var(--gw-gold-shine);
    color: var(--gw-navy);
    font-family: var(--gw-font);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    box-shadow: var(--gw-gold-glow);
    transition: transform 150ms ease, filter 150ms ease;
}
#popupBannerModal .popup-cta:hover,
#popupBannerModal .popup-cta:focus {
    color: var(--gw-navy);
    text-decoration: none;
}
#popupBannerModal .popup-cta:hover {
    transform: translateY(-1px);
    filter: brightness(1.04);
}
#popupBannerModal .popup-cta:focus-visible {
    outline: 3px solid var(--gw-white);
    outline-offset: 3px;
}
#popupBannerModal .popup-later {
    min-height: 44px;
    padding: 8px 12px;
    border: 0;
    background: transparent;
    color: var(--gw-ice);
    font-family: var(--gw-font);
    font-size: 14px;
    font-weight: 500;
    opacity: .85;
    cursor: pointer;
    border-radius: 8px;
}
#popupBannerModal .popup-later:hover {
    opacity: 1;
    text-decoration: underline;
    text-underline-offset: 3px;
}
#popupBannerModal .popup-later:focus {
    outline: none;
}
#popupBannerModal .popup-later:focus-visible {
    opacity: 1;
    outline: 2px solid var(--gw-gold);
    outline-offset: 2px;
}

/* ---- Phones: bottom sheet ---- */
@media (max-width: 767px) {
    #popupBannerModal .modal-dialog,
    #popupBannerModal .modal-dialog.modal-dialog-centered {
        width: 100%;
        max-width: none;
        margin: 0;
        min-height: 100%;
        display: flex;
        align-items: flex-end;
    }
    #popupBannerModal .modal-content {
        border-radius: 22px 22px 0 0;
        border-bottom: 0;
    }
    #popupBannerModal.fade .modal-dialog {
        transform: translateY(100%);
    }
    #popupBannerModal.fade.show .modal-dialog {
        transform: none;
    }
    #popupBannerModal .popup-media img {
        max-height: 62vh;
        max-height: 62svh;
    }
    #popupBannerModal .popup-close {
        top: 10px;
        right: 10px;
    }
    #popupBannerModal .popup-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        padding: 14px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    }
    #popupBannerModal .popup-cta,
    #popupBannerModal .popup-later {
        width: 100%;
    }
}

/* ---- Reduced motion: opacity only, no transform ---- */
@media (prefers-reduced-motion: reduce) {
    #popupBannerModal.fade .modal-dialog,
    #popupBannerModal.fade.show .modal-dialog {
        transform: none;
        transition: none;
    }
    #popupBannerModal .popup-cta,
    #popupBannerModal .popup-cta:hover {
        transform: none;
        transition: none;
    }
}

/* ---- v2 (20 Nov 2026): no "Maybe later"; the CTA sits inside the creative, in the empty navy space
   under the copy (desktop: under the right-hand text block; phones: centred at the bottom). ---- */
#popupBannerModal .modal-content { position: relative; }
#popupBannerModal .popup-actions {
    position: absolute;
    left: 37%;
    right: 4%;
    bottom: 9%;
    z-index: 4;
    justify-content: flex-start;
    padding: 0;
    background: none;
    border: 0;
    pointer-events: none;
}
#popupBannerModal .popup-cta { pointer-events: auto; min-height: 50px; padding: 12px 32px; font-size: 16.5px; }
#popupBannerModal .popup-later { display: none; }
@media (max-width: 767px) {
    #popupBannerModal .popup-actions {
        left: 0; right: 0;
        bottom: calc(4% + env(safe-area-inset-bottom, 0px));
        flex-direction: row;
        justify-content: center;
        padding: 0 16px;
    }
    #popupBannerModal .popup-cta { width: auto; min-width: 70%; }
}


/* ---- Gateway logo chip (21 Nov 2026): a real logo over the creative, in a navy tab on the top-left corner ---- */
#popupBannerModal .popup-logo {
    position: absolute; top: 0; left: 0; z-index: 4; display: flex; align-items: center; justify-content: center;
    padding: 9px 16px 10px 14px; background: var(--gw-navy); pointer-events: none;
    border-top-left-radius: 24px; border-bottom-right-radius: 20px;
    border-right: 1px solid rgba(var(--gw-gold-rgb), .55); border-bottom: 1px solid rgba(var(--gw-gold-rgb), .55);
    box-shadow: 0 8px 22px rgba(0, 0, 0, .3);
}
#popupBannerModal .popup-logo img { display: block; height: 58px; width: auto; }
@media (max-width: 767px) {
    #popupBannerModal .popup-logo { padding: 7px 13px 8px 11px; border-top-left-radius: 22px; border-bottom-right-radius: 16px; }
    #popupBannerModal .popup-logo img { height: 46px; }
}
