/* =============================================================================
   CONSULT MODAL (.consult-modal) — "Schedule a Consultation" popup
   =============================================================================
   Restored consultation form, rebuilt on the editorial ("ax") system. Opens from
   any .js-consult-trigger (e.g. "Book a discovery session" on the contact page).
   Reuses the contact form's field skin where possible; tokens only, no Font
   Awesome, no flatpickr (native date/time inputs). Requires ax-system.css.
   ============================================================================= */

.consult-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;                 /* above the fixed header (z 1000) */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(12, 12, 13, 0.55);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s var(--ax-ease), visibility 0.3s var(--ax-ease);
}
.consult-modal.is-open { opacity: 1; visibility: visible; }

.consult-modal__box {
    position: relative;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    overscroll-behavior: contain;   /* keep scroll inside; don't chain to page */
    -webkit-overflow-scrolling: touch;
    background: var(--ax-bg);
    border: 1px solid var(--ax-border);
    border-radius: 20px;
    padding: clamp(24px, 3.5vw, 40px);
    box-shadow: 0 40px 90px -40px rgba(12, 12, 13, 0.35);
    transform: translateY(20px);
    transition: transform 0.4s var(--ax-ease);
}
.consult-modal.is-open .consult-modal__box { transform: translateY(0); }

.consult-modal__close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: var(--ax-surface);
    color: var(--ax-text-2);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background 0.2s var(--ax-ease), color 0.2s var(--ax-ease);
}
.consult-modal__close:hover { background: var(--ax-border); color: var(--ax-text); }

.consult-modal__head { margin-bottom: 26px; padding-right: 40px; }
.consult-modal__title {
    font-family: var(--ax-font-head);
    font-weight: 600;
    font-size: clamp(23px, 2.4vw, 29px);
    letter-spacing: -0.025em;
    color: var(--ax-text);
    margin: 0 0 8px;
}
.consult-modal__sub {
    font-family: var(--ax-font-body);
    font-size: 14.5px;
    line-height: 1.55;
    color: var(--ax-text-2);
    margin: 0;
}

/* Layout — two-up rows that stack on narrow screens. */
.cm-row { display: grid; gap: 16px; margin-bottom: 16px; }
@media (min-width: 560px) { .cm-row--2 { grid-template-columns: 1fr 1fr; } }

.cm-field { display: flex; flex-direction: column; margin-bottom: 16px; }
.cm-row .cm-field { margin-bottom: 0; }

.cm-field label {
    font-family: var(--ax-font-body);
    font-weight: 500;
    font-size: 13.5px;
    color: var(--ax-text);
    margin-bottom: 7px;
}
.cm-field .req { color: var(--ax-red); }

.cm-input {
    font-family: var(--ax-font-body);
    font-size: 15px;
    line-height: 1.5;
    color: var(--ax-text);
    background: var(--ax-surface);
    border: 1px solid var(--ax-border);
    border-radius: 10px;
    padding: 12px 14px;
    width: 100%;
    transition: border-color 0.2s var(--ax-ease), box-shadow 0.2s var(--ax-ease);
    -webkit-appearance: none;
    appearance: none;
}
/* Native date/time pickers keep their control glyphs (don't strip appearance). */
.cm-input[type="date"], .cm-input[type="time"] { -webkit-appearance: none; appearance: none; }
textarea.cm-input { resize: vertical; min-height: 112px; -webkit-appearance: none; }
.cm-input::placeholder { color: var(--ax-text-3); }
.cm-input:focus {
    outline: none;
    border-color: var(--ax-accent);
    background: var(--ax-bg);
    box-shadow: 0 0 0 3px rgba(33, 49, 100, 0.1);
}

/* Select — custom chevron, no native arrow. */
.cselect { position: relative; }
.cselect__chev {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ax-text-3);
    font-size: 12px;
    pointer-events: none;
}
.cselect select.cm-input { padding-right: 38px; cursor: pointer; }

/* Per-field error message. */
.cm-field-err {
    font-family: var(--ax-font-body);
    font-size: 12.5px;
    line-height: 1.4;
    color: var(--ax-red);
    margin-top: 6px;
}
.cm-field-err:empty { margin-top: 0; }

.cm-field.is-invalid .cm-input { border-color: var(--ax-red); background: var(--ax-bg); }
.cm-field.is-invalid label { color: var(--ax-red); }

/* Terms checkbox — native control restored (mirrors the contact-form fix). */
.cm-field--checkbox {
    flex-direction: row;
    align-items: flex-start;
    gap: 10px;
    margin-top: 4px;
}
.cm-field--checkbox input[type="checkbox"] {
    -webkit-appearance: auto;
    appearance: auto;
    width: 18px;
    height: 18px;
    margin-top: 2px;
    flex: 0 0 auto;
    cursor: pointer;
    accent-color: var(--ax-accent);
}
.cm-check__body { display: flex; flex-direction: column; }
.cm-field--checkbox label {
    margin-bottom: 0;
    font-weight: 500;
    font-size: 14px;
    color: var(--ax-text-2);
    line-height: 1.5;
    cursor: pointer;
}
.cm-field--checkbox a {
    color: var(--ax-accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Submit — navy primary, matching the site accent and every other CTA. */
.cm-btn {
    width: 100%;
    margin-top: 22px;
    padding: 15px 22px;
    font-family: var(--ax-font-body);
    font-weight: 600;
    font-size: 15.5px;
    color: #fff;
    background: var(--ax-accent);
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    transition: filter 0.2s var(--ax-ease), opacity 0.2s var(--ax-ease);
}
.cm-btn:hover { filter: brightness(1.12); }
.cm-btn:disabled { opacity: 0.6; cursor: default; }

/* Form-level status banner (success / error). */
.cm-status {
    font-family: var(--ax-font-body);
    font-size: 14px;
    line-height: 1.5;
    border-radius: 10px;
    margin-bottom: 18px;
    display: none;
}
.cm-status.is-active { display: block; padding: 12px 14px; }
.cm-status.is-error   { background: rgba(236, 57, 37, 0.08);  color: var(--ax-red); }
.cm-status.is-success { background: rgba(55, 179, 74, 0.10);  color: #14532d; }
