/**
 * Exit popup for the case registration form.
 *
 * Sized so the heading, body and both buttons stay above the fold on a 375px
 * viewport — the body copy limit in the admin depends on this staying true.
 */

.gpn-exit-popup {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.gpn-exit-popup[hidden] {
    display: none;
}

/**
 * Astra styles bare `button` (including `button:focus`) and Gravity Forms styles
 * `[type="button"]` from a sheet that loads after this one, so both reach into the
 * dialog and paint it brand purple. Every button rule below is scoped one level
 * deeper and spells out its own hover, focus and active states — a single class is
 * not enough to outrank `button:focus`.
 */
.gpn-exit-popup button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
    border: 0;
    box-shadow: none;
    font-family: inherit;
    letter-spacing: normal;
    text-transform: none;
}

.gpn-exit-popup button:focus-visible {
    outline: 2px solid #1d4ed8;
    outline-offset: 2px;
}

.gpn-exit-popup__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    opacity: 0;
    transition: opacity 200ms ease;
}

.gpn-exit-popup.is-open .gpn-exit-popup__backdrop {
    opacity: 1;
}

.gpn-exit-popup__dialog {
    position: relative;
    width: 100%;
    max-width: 460px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    padding: 36px 28px 28px;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.3);
    text-align: center;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 200ms ease, transform 200ms ease;
}

.gpn-exit-popup.is-open .gpn-exit-popup__dialog {
    opacity: 1;
    transform: translateY(0);
}

/* Flex rather than line-height so the glyph sits in the middle of its hover
   target instead of riding its own baseline. */
.gpn-exit-popup .gpn-exit-popup__close {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    background: none;
    color: #64748b;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: background 150ms ease, color 150ms ease;
}

.gpn-exit-popup .gpn-exit-popup__close:hover,
.gpn-exit-popup .gpn-exit-popup__close:focus,
.gpn-exit-popup .gpn-exit-popup__close:focus-visible {
    background: #f1f5f9;
    color: #0f172a;
}

.gpn-exit-popup .gpn-exit-popup__close:active {
    background: #e2e8f0;
}

/* Astra sets headings to Barlow Condensed 200, which reads lighter than the
   16px body text underneath it. */
.gpn-exit-popup .gpn-exit-popup__heading {
    margin: 0 0 12px;
    font-size: 23px;
    font-weight: 600;
    line-height: 1.3;
    color: #0f172a;
}

.gpn-exit-popup__body {
    margin: 0 0 22px;
    font-size: 16px;
    line-height: 1.55;
    color: #334155;
}

/* Centred, not stretched: only the primary button is meant to span the dialog. */
.gpn-exit-popup__actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.gpn-exit-popup .gpn-exit-popup__resume {
    display: block;
    width: 100%;
    padding: 15px 20px;
    border-radius: 6px;
    background: #1d4ed8;
    color: #fff;
    font-size: 17px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: background 150ms ease;
}

.gpn-exit-popup .gpn-exit-popup__resume:hover,
.gpn-exit-popup .gpn-exit-popup__resume:focus,
.gpn-exit-popup .gpn-exit-popup__resume:focus-visible {
    background: #1e40af;
    color: #fff;
}

.gpn-exit-popup .gpn-exit-popup__resume:active {
    background: #1e3a8a;
}

.gpn-exit-popup__phone {
    display: block;
    padding: 6px 0;
    color: #1d4ed8;
    font-size: 16px;
    line-height: 1.4;
    text-decoration: none;
}

.gpn-exit-popup__phone:hover,
.gpn-exit-popup__phone:focus-visible {
    text-decoration: underline;
}

.gpn-exit-popup__phone-label {
    display: block;
    color: #475569;
    font-size: 14px;
}

.gpn-exit-popup__phone-number {
    display: block;
    font-size: 19px;
    font-weight: 600;
}

/* A quiet text link, so it stays as wide as its words rather than filling the
   dialog and lighting up as a second full-width button. Underlines on hover only,
   matching the phone link above it. */
.gpn-exit-popup .gpn-exit-popup__dismiss {
    width: auto;
    padding: 4px 8px;
    background: none;
    color: #64748b;
    font-size: 14px;
    text-decoration: none;
    text-underline-offset: 2px;
    cursor: pointer;
    transition: color 150ms ease;
}

.gpn-exit-popup .gpn-exit-popup__dismiss:hover,
.gpn-exit-popup .gpn-exit-popup__dismiss:focus,
.gpn-exit-popup .gpn-exit-popup__dismiss:focus-visible,
.gpn-exit-popup .gpn-exit-popup__dismiss:active {
    background: none;
    color: #0f172a;
    text-decoration: underline;
}

/* The dismiss and leave buttons swap places, so the hidden one has to stay hidden
   even though the actions row is a flex container. */
.gpn-exit-popup__actions [hidden] {
    display: none;
}

@media (max-width: 480px) {
    .gpn-exit-popup {
        padding: 12px;
    }

    .gpn-exit-popup__dialog {
        padding: 32px 20px 22px;
        max-height: calc(100vh - 24px);
    }

    .gpn-exit-popup__heading {
        font-size: 20px;
    }

    .gpn-exit-popup__body {
        font-size: 15px;
        margin-bottom: 18px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .gpn-exit-popup__backdrop,
    .gpn-exit-popup__dialog {
        transition: none;
    }

    .gpn-exit-popup__dialog {
        transform: none;
    }
}
