/*
 * aieo-popup.css — the storefront popup shell.
 *
 * The shell is only the scrim, the centring and the close button. The BOX is
 * whatever blocks the operator put in the popup post (normally
 * aieo/popup-panel, whose own styles ship with the block).
 *
 * ── Two rules that are load-bearing ─────────────────────────────────────────
 *
 * 1. Visibility is `display:none` + `.is-open`, NEVER the [hidden] attribute.
 *    docs/MODAL-CONSOLIDATION.md records that [hidden] loses to any explicit
 *    `display` rule, which is how .aieo-fb-foot stayed visible on 2026-08-02.
 *
 * 2. z-index is 99000, BELOW the GDPR consent banner's 99999. At an equal
 *    z-index the later DOM node wins, and this shell prints at wp_footer 40
 *    while the consent banner prints at wp_footer 5 — so an equal value would
 *    put a promotional overlay on top of a consent dialog, on a first visit,
 *    before consent. The runtime additionally waits for the banner to close.
 *
 * Source file: served as aieo-popup.min.css once `npm run build` has run
 * (includes/class-aieo-asset-min.php rewrites the URL), so edits here need a
 * rebuild before they reach the front end.
 */

.aieo-pop {
    position: fixed;
    inset: 0;
    z-index: 99000;
    display: none;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 24px;
    background: rgba(16, 16, 16, .72);
    overscroll-behavior: contain;
}

.aieo-pop.is-open { display: flex; }

/* Locks the page behind the modal. Scoped to a class the runtime adds and
   removes, so it can never strand a page unscrollable if the shell is absent. */
body.aieo-pop-open { overflow: hidden; }

.aieo-pop__box {
    position: relative;
    max-width: 100%;
    max-height: 100%;
    overflow: auto;
    /* Fade+lift on open. Honoured only when the visitor has not asked for
       reduced motion (see the media query at the end). */
    animation: aieo-pop-in .18s ease-out both;
}

.aieo-pop__close {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    background: none;
    color: currentColor;
    cursor: pointer;
    opacity: .85;
}
.aieo-pop__close:hover { opacity: 1; }
/* The close button is pinned to the top-right of the BOX, and the media pane
   occupies that corner on every layout — right on desktop, and `order: -1` puts
   it on top for mobile. So the X always lands on the operator's photograph, and
   a hairline white glyph on a bright sky is invisible. Whether the only way out
   of a modal can be seen must not depend on which image someone uploaded.
   A shadow keeps the chrome-less look while guaranteeing an edge on any image. */
.aieo-pop__close svg {
    display: block;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .55));
    stroke-width: 1.6;
}

/* The panel sets --aieo-pop-fg; without it (a popup built from other blocks)
   fall back to something visible on a dark scrim. */
.aieo-pop .aieo-popup-panel .aieo-pop__close,
.aieo-pop__close { color: var(--aieo-pop-fg, #fff); }

.aieo-pop :focus-visible {
    outline: 2px solid var(--aieo-pop-accent, #b7d21d);
    outline-offset: 2px;
}

@keyframes aieo-pop-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
}

@media (max-width: 767px) {
    /* A real gutter, not 0. The panel is a fixed 342px, so on a 360px handset
       `padding: 0` left 9px of scrim either side — which looks like a mistake
       rather than a decision. With a gutter the box shrink-to-fits to
       min(342px, available) instead, so the panel is 342 with 24px gutters on a
       390 screen and 328 with 16px gutters on a 360 one. */
    .aieo-pop { padding: 16px; }
    .aieo-pop__close { top: 12px; right: 12px; }
}

@media (prefers-reduced-motion: reduce) {
    .aieo-pop__box { animation: none; }
}

/* ── Test-mode badge ─────────────────────────────────────────────────────────
   Deliberately loud. A test mode you cannot see you left on is how a storefront
   ends up showing an unfinished popup to real customers on every page view. */
.aieo-pop__testbadge {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 3;
    padding: 4px 10px;
    background: #d97706;
    color: #fff;
    font: 600 10px/1.6 -apple-system, "Segoe UI", sans-serif;
    letter-spacing: .18em;
    pointer-events: none;
}
