.form-modal,
.form-modal *,
.form-modal *::before,
.form-modal *::after {
    box-sizing: border-box;
}

.form-modal__trigger {
    cursor: pointer;
}

.form-modal__overlay {
    position: fixed;
    z-index: 2147483647;
    inset: 0;
    width: 90vw;
    max-width: none;
    height: 90dvh;
    max-height: none;
    margin: 2rem auto;
    padding: 0;
    border: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: white;
}

.form-modal__overlay:not([open]) {
    display: none;
}

/* Lets any ordinary link to #quote-form open the modal before JavaScript runs. */
.form-modal__overlay:target {
    display: block;
}

.form-modal__overlay::backdrop {
    background: #4b4848d6;
}

.form-modal__close {
    position: fixed;
    z-index: 1;
    top: clamp(1rem, 2.5vw, 2rem);
    right: clamp(1rem, 2.5vw, 2rem);
    display: inline-flex;
    width: 2.75rem;
    height: 2.75rem;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: #002b3e;
    color: #ffffff;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 160ms ease, transform 160ms ease;
}

.form-modal__close:hover {
    background: #72c100;
    transform: scale(1.05);
}

.form-modal__close:focus-visible,
.form-modal__trigger:focus-visible {
    outline: 3px solid #72c100;
    outline-offset: 3px;
}

.form-modal__close svg {
    width: 1.35rem;
    height: 1.35rem;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-width: 2;
}

.form-modal__embed {
    width: min(100%, 60rem);
    min-height: 40rem;
    margin: clamp(5.5rem, 10vw, 8rem) auto clamp(2rem, 6vw, 5rem);
}

.form-modal__embed iframe,
.form-modal__embed form,
.form-modal__embed > div {
    max-width: 100%;
}

.form-modal__embed iframe {
    /* GoHighLevel's generated inline embed starts with display:none. The
       surrounding Form Modal—not GoHighLevel—controls when it is visible. */
    display: block !important;
    width: 100%;
    min-height: 40rem !important;
    border: 0;
}

body.form-modal-is-open {
    overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
    .form-modal__close {
        transition: none;
    }
}

/* Keep the Custom HTML child block usable in Gutenberg rather than showing a
   full-screen dialog over the editing canvas. */
.editor-styles-wrapper .form-modal__overlay[open] {
    position: relative;
    inset: auto;
    display: block;
    width: 100%;
    height: auto;
    min-height: 22rem;
    margin: 1rem 0;
    overflow: visible;
}

.editor-styles-wrapper .form-modal__overlay[open]::backdrop {
    display: none;
}

.editor-styles-wrapper .form-modal__embed {
    min-height: 14rem;
    margin: 4.5rem 1rem 1rem;
}
