/* The menu CTA opens the same assessment flow as the main website. */
:root[data-dialog-open] {
    overflow: hidden;
}

.lead-dialog {
    width: min(calc(100% - 32px), 704px);
    max-height: min(90dvh, 768px);
    margin: auto;
    padding: 0;
    border: 0;
    border-radius: 20px;
    background: transparent;
    color: var(--color-on-surface);
    overflow: hidden;
    box-shadow: 0 24px 64px rgb(0 28 23 / 28%);
}

.lead-dialog[open] {
    animation: lead-dialog-enter 180ms cubic-bezier(.2, 0, 0, 1);
}

.lead-dialog::backdrop {
    background: rgb(0 28 23 / 62%);
    backdrop-filter: blur(4px);
}

.lead-dialog__surface {
    position: relative;
    max-height: min(90dvh, 768px);
    padding: clamp(24px, 4vw, 40px);
    border: 1px solid rgb(0 91 69 / 12%);
    border-radius: inherit;
    background: radial-gradient(circle at 100% 0%, rgb(171 229 223 / 54%), transparent 34%), #f9fafc;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.lead-dialog__close {
    position: absolute;
    inset-block-start: 16px;
    inset-inline-end: 16px;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid #c4ccc9;
    border-radius: 50%;
    background: rgb(255 255 255 / 72%);
    color: var(--color-interactive);
    cursor: pointer;
}

.lead-dialog__close svg,
.lead-dialog__success-icon svg {
    width: 20px;
    height: 20px;
}

.lead-dialog__close:hover,
.lead-dialog__close:focus-visible {
    background: var(--color-primary);
    color: #fff;
}

.lead-dialog__header {
    display: grid;
    gap: 12px;
    padding-inline-end: 48px;
    margin-block-end: 24px;
}

.lead-dialog__eyebrow {
    width: fit-content;
    margin: 0;
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--color-primary-container);
    color: var(--color-interactive);
    font-size: .8125rem;
    font-weight: 650;
    line-height: 1.4;
}

.lead-dialog__header h2 {
    max-width: 17ch;
    margin: 0;
    font-size: clamp(1.75rem, 1.4rem + 1.7vw, 2.5rem);
    line-height: 1.15;
}

.lead-dialog__header > p:last-child {
    max-width: 56ch;
    margin: 0;
    color: var(--color-on-surface-variant);
    line-height: 1.6;
}

.lead-form {
    display: grid;
    gap: 20px;
}

.lead-form__honeypot {
    position: absolute;
    inset-inline-start: -10000px;
    inline-size: 1px;
    block-size: 1px;
    opacity: 0;
    pointer-events: none;
}

.lead-dialog[data-lead-state="success"] .lead-dialog__header,
.lead-dialog[data-lead-state="success"] .lead-form {
    display: none !important;
}

.lead-form__phone {
    display: grid;
    grid-template-columns: minmax(7.5rem, .34fr) minmax(0, 1fr);
    gap: 24px;
}

.lead-form__phone-code {
    position: relative;
    min-width: 0;
}

.lead-form__phone-code-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 52px;
    gap: 8px;
    padding: 12px 16px;
    border: 1px solid #c4ccc9;
    border-radius: 8px;
    background: #fff;
    color: var(--color-on-surface);
    text-align: start;
    cursor: pointer;
}

.lead-form__phone-code-trigger:hover,
.lead-form__phone-code-trigger[aria-expanded="true"],
.lead-form__phone-code-trigger:focus-visible {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgb(0 196 179 / 16%);
    outline: none;
}

.lead-form__phone-code-current {
    display: inline-flex;
    min-width: 0;
    gap: 8px;
    overflow: hidden;
    white-space: nowrap;
}

.lead-form__phone-code-current span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
}

.lead-form__phone-code-trigger svg {
    flex: none;
    width: 16px;
    height: 16px;
}

.lead-form__phone-code-panel {
    position: absolute;
    z-index: 2;
    inset-block-start: calc(100% + 8px);
    inset-inline: 0;
    max-height: min(20rem, 45dvh);
    padding: 8px;
    border: 1px solid #c4ccc9;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 12px 28px rgb(0 28 23 / 18%);
    overflow-y: auto;
}

.lead-form__phone-code-panel[hidden] {
    display: none !important;
}

.lead-form__phone-code-search {
    position: sticky;
    inset-block-start: 0;
    z-index: 1;
    min-height: 44px !important;
    margin-block-end: 8px;
    background: #fff !important;
}

.lead-form__phone-code-list {
    display: grid;
    gap: 1px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.lead-form__phone-code-option {
    display: flex;
    justify-content: space-between;
    width: 100%;
    gap: 16px;
    padding: 8px 12px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--color-on-surface);
    text-align: start;
    cursor: pointer;
}

.lead-form__phone-code-option:hover,
.lead-form__phone-code-option:focus-visible,
.lead-form__phone-code-option[aria-selected="true"] {
    background: var(--color-primary-container);
    color: var(--color-interactive);
    outline: none;
}

.lead-form__phone-code-option[hidden],
.lead-form__phone-code-list > li[hidden] {
    display: none;
}

.lead-form__fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px 24px;
}

.lead-form__field {
    display: grid;
    align-content: start;
    gap: 8px;
    min-width: 0;
}

.lead-form__field--full {
    grid-column: 1 / -1;
}

.lead-form__field label {
    color: var(--color-on-surface);
    font-size: .9375rem;
    font-weight: 650;
}

.lead-form input {
    width: 100%;
    min-height: 52px;
    padding: 12px 16px;
    border: 1px solid #c4ccc9;
    border-radius: 8px;
    background: #fff;
    color: var(--color-on-surface);
    outline: none;
    transition: border-color 150ms cubic-bezier(.2, 0, 0, 1), box-shadow 150ms cubic-bezier(.2, 0, 0, 1);
}

.lead-form input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgb(0 196 179 / 16%);
}

.lead-form input[aria-invalid="true"] {
    border-color: #b3261e;
    box-shadow: 0 0 0 3px rgb(179 38 30 / 10%);
}

.lead-form input::placeholder {
    color: #989898;
}

.lead-form__field-error {
    display: block;
    color: #b3261e;
    font-size: .8125rem;
    line-height: 1.4;
}

.lead-form__field-error:empty {
    display: none;
}

.lead-form__privacy,
.lead-form__status {
    margin: 0;
    color: #989898;
    font-size: .8125rem;
    line-height: 1.6;
}

.lead-form__status {
    min-height: 1.4em;
    margin-top: -12px;
    text-align: center;
}

.lead-form__status[data-state="error"] {
    color: #b3261e;
}

.lead-form__submit {
    width: 100%;
    justify-self: stretch;
    min-height: 48px;
}

.lead-form__submit:disabled {
    cursor: wait;
    opacity: .64;
}

.lead-form__alternative {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    color: var(--color-on-surface-variant);
    font-size: .9375rem;
    text-align: center;
}

.lead-form__alternative a {
    color: var(--color-interactive);
    font-weight: 650;
    text-decoration: underline;
    text-underline-offset: .15em;
}

.lead-dialog__success {
    min-height: 360px;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 12px;
    text-align: center;
}

.lead-dialog__success:not([hidden]) {
    display: grid;
}

.lead-dialog__success[hidden] {
    display: none !important;
}

.lead-dialog__success-icon {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--color-primary-container);
    color: var(--color-interactive);
}

.lead-dialog__success h3,
.lead-dialog__success p {
    margin: 0;
}

.lead-dialog__success h3 {
    font-size: 1.5rem;
}

.lead-dialog__success p {
    max-width: 42ch;
    color: #989898;
}

@keyframes lead-dialog-enter {
    from {
        opacity: 0;
        transform: translateY(16px) scale(.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (max-width: 767px) {
    .lead-dialog {
        width: calc(100% - 16px);
        max-height: calc(100dvh - 16px);
    }

    .lead-dialog__surface {
        max-height: calc(100dvh - 16px);
        padding: 32px 24px;
    }

    .lead-form__fields {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .lead-form__field--full {
        grid-column: auto;
    }

    .lead-form__phone {
        grid-template-columns: 7.25rem minmax(0, 1fr);
        gap: 16px;
    }

    .lead-form__submit {
        width: 100%;
    }
}

@media (max-width: 359px) {
    .lead-form__phone {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .lead-dialog[open] {
        animation: none;
    }
}
