/* Exit-intent popup styles.
   Loaded by cdrp_exit_popup_assets() in functions.php. The HTML is in js/exit-intent.js.
   Uses a native <dialog>, so it sits above everything on the page (Divi's fixed header,
   the call-now button) without z-index rules.
   Colors match the site: header blue #5f74a5, button tan #ddbe87. */

html.cdrp-exit-open {
    overflow: hidden;            /* stop the page behind from scrolling */
    scrollbar-gutter: stable;    /* and from shifting sideways when its scrollbar goes away */
}

.cdrp-exit {
    --cdrp-blue: #5f74a5;
    --cdrp-blue-deep: #4f6396;
    --cdrp-tan: #ddbe87;
    --cdrp-tan-light: #e6cc9c;
    --cdrp-tan-dark: #c9a463;
    --cdrp-cream: #faf6ef;
    --cdrp-ink: #1f2430;
    --cdrp-text: #4a4f5a;

    box-sizing: border-box;
    width: min(600px, calc(100vw - 32px));
    max-width: none;
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    margin: auto;
    padding: 0;
    border: 0;
    border-radius: 14px;
    background: #fff;
    color: var(--cdrp-text);
    box-shadow: 0 24px 60px rgba(20, 28, 48, 0.35), 0 2px 8px rgba(20, 28, 48, 0.15);
    overflow: hidden;            /* the panel inside scrolls instead */
}

.cdrp-exit[open] {
    display: flex;
    flex-direction: column;
    animation: cdrp-exit-in 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.cdrp-exit::backdrop {
    background: rgba(24, 32, 52, 0.6);
    backdrop-filter: blur(2px);
}

.cdrp-exit[open]::backdrop {
    animation: cdrp-exit-fade 0.28s ease-out;
}

@keyframes cdrp-exit-in {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.98);
    }
}

@keyframes cdrp-exit-fade {
    from {
        opacity: 0;
    }
}

.cdrp-exit [hidden] {
    display: none !important;
}

.cdrp-exit__panel {
    box-sizing: border-box;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* Close button: a dark see-through circle, readable over the blue band or white */
.cdrp-exit__close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.22);
    color: #fff;
    font-family: inherit;
    font-size: 28px;
    line-height: 44px;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.15s;
}

.cdrp-exit__close:hover {
    background: rgba(0, 0, 0, 0.4);
}

/* Blue band at the top of each step */
.cdrp-exit__hero {
    padding: 28px 68px 24px 32px;
    background: linear-gradient(135deg, var(--cdrp-blue) 0%, var(--cdrp-blue-deep) 100%);
    border-bottom: 4px solid var(--cdrp-tan);
    color: #fff;
}

.cdrp-exit__title {
    display: block;
    margin: 0;
    padding: 0;
    color: #fff;
    font-size: 26px;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.01em;
}

.cdrp-exit__title:focus {
    outline: none;               /* focused by script so screen readers announce it */
}

.cdrp-exit__title label {
    color: inherit;
    font: inherit;
    cursor: inherit;
}

.cdrp-exit__lead {
    margin: 8px 0 0;
    padding: 0;
    color: #fff;
    font-size: 17px;
    line-height: 1.5;
    text-wrap: pretty;           /* avoid a lone word on the last line */
}

.cdrp-exit__back {
    display: inline-block;
    margin: -6px 0 10px -2px;
    padding: 6px 2px;
    border: 0;
    background: none;
    color: #fff;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
}

.cdrp-exit__back:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* White area below the band */
.cdrp-exit__body {
    padding: 24px 32px 28px;
}

.cdrp-exit__body--form {
    padding: 14px;
    background: var(--cdrp-cream);
}

.cdrp-exit__intro {
    margin: 0 0 20px;
    padding: 0;
    color: var(--cdrp-text);
    font-size: 16px;
    line-height: 1.6;
    text-wrap: pretty;
}

.cdrp-exit__signoff {
    margin: 20px 0 0;
    padding: 0;
    color: #6b7080;
    font-size: 15px;
    font-style: italic;
    text-align: center;
}

/* The two choices */
.cdrp-exit__options {
    display: grid;
    gap: 12px;
}

.cdrp-exit__option {
    display: flex;
    align-items: center;
    gap: 16px;
    box-sizing: border-box;
    width: 100%;
    margin: 0;
    padding: 16px 18px;
    border: 1px solid #e4dccd;
    border-radius: 10px;
    background: #fff;
    color: var(--cdrp-ink);
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(20, 28, 48, 0.06);
    transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.cdrp-exit__option:hover {
    border-color: var(--cdrp-tan);
    background: var(--cdrp-cream);
    box-shadow: 0 6px 16px rgba(20, 28, 48, 0.12);
    transform: translateY(-1px);
}

.cdrp-exit__option--primary {
    border-color: var(--cdrp-tan);
    background: var(--cdrp-tan);
}

.cdrp-exit__option--primary:hover {
    border-color: var(--cdrp-tan-dark);
    background: var(--cdrp-tan-light);
}

.cdrp-exit__icon {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: #efe8db;
    color: var(--cdrp-blue);
}

.cdrp-exit__option--primary .cdrp-exit__icon {
    background: #fff;
}

.cdrp-exit__option-text {
    flex: 1;
    min-width: 0;
}

.cdrp-exit__option-title {
    display: block;
    color: var(--cdrp-ink);
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
}

.cdrp-exit__option-sub {
    display: block;
    margin-top: 3px;
    color: #555b66;
    font-size: 15px;
    font-weight: 400;
    line-height: 1.4;
}

.cdrp-exit__option--primary .cdrp-exit__option-sub {
    color: #3a3226;
}

.cdrp-exit__chevron {
    display: flex;
    flex: none;
    color: var(--cdrp-blue);
    transition: transform 0.15s;
}

.cdrp-exit__option--primary .cdrp-exit__chevron {
    color: var(--cdrp-ink);
}

.cdrp-exit__option:hover .cdrp-exit__chevron {
    transform: translateX(3px);
}

/* Buttons */
.cdrp-exit__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 20px;
    margin-top: 16px;
}

.cdrp-exit__button {
    box-sizing: border-box;
    margin: 0;
    padding: 13px 30px;
    border: 0;
    border-radius: 8px;
    background: var(--cdrp-tan);
    color: #1a1a1a;
    font-family: inherit;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
    box-shadow: 0 2px 0 var(--cdrp-tan-dark);
    transition: background-color 0.15s, transform 0.1s, box-shadow 0.1s;
}

.cdrp-exit__button:hover {
    background: var(--cdrp-tan-light);
}

.cdrp-exit__button:active {
    transform: translateY(1px);
    box-shadow: 0 1px 0 var(--cdrp-tan-dark);
}

.cdrp-exit__button:disabled {
    opacity: 0.6;
    cursor: default;
}

.cdrp-exit__link {
    margin: 0;
    padding: 8px 0;
    border: 0;
    background: none;
    color: var(--cdrp-blue);
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.cdrp-exit__link:hover {
    color: var(--cdrp-blue-deep);
}

.cdrp-exit button:focus-visible {
    outline: 3px solid var(--cdrp-blue);
    outline-offset: 2px;
}

.cdrp-exit__hero button:focus-visible,
.cdrp-exit__close:focus-visible {
    outline-color: #fff;
}

/* Callback option */
.cdrp-exit__loading {
    margin: 0;
    padding: 48px 0;
    color: #777;
    text-align: center;
}

.cdrp-exit__jotform {
    display: block;
    width: 100%;
    min-width: 100%;
    height: 540px;               /* until JotForm's script sets the real height */
    border: 0;
}

/* Feedback option */
.cdrp-exit__textarea {
    display: block;
    box-sizing: border-box;
    width: 100%;
    min-height: 150px;
    margin: 0;
    padding: 12px 14px;
    border: 1px solid #cfc6b6;
    border-radius: 8px;
    background: #fff;
    color: var(--cdrp-ink);
    font-family: inherit;
    font-size: 16px;             /* 16px or larger stops iPhones zooming in on focus */
    line-height: 1.5;
    resize: vertical;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.cdrp-exit__textarea:focus {
    border-color: var(--cdrp-blue);
    outline: none;
    box-shadow: 0 0 0 3px rgba(95, 116, 165, 0.3);
}

.cdrp-exit__error {
    margin: 12px 0 0;
    padding: 0;
    color: #b00020;
    font-size: 16px;
}

@media (max-width: 600px) {
    .cdrp-exit {
        width: calc(100vw - 20px);
        max-height: calc(100vh - 20px);
        max-height: calc(100dvh - 20px);
        border-radius: 12px;
    }

    .cdrp-exit__hero {
        padding: 22px 64px 20px 20px;
    }

    .cdrp-exit__title {
        font-size: 23px;
    }

    .cdrp-exit__lead {
        font-size: 16px;
    }

    .cdrp-exit__body {
        padding: 20px 18px 22px;
    }

    .cdrp-exit__body--form {
        padding: 8px;
    }

    .cdrp-exit__option {
        gap: 12px;
        padding: 14px;
    }

    .cdrp-exit__icon {
        width: 40px;
        height: 40px;
    }

    .cdrp-exit__option-title {
        font-size: 17px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cdrp-exit[open],
    .cdrp-exit[open]::backdrop {
        animation: none;
    }

    .cdrp-exit *,
    .cdrp-exit *::before {
        transition: none !important;
    }
}
