/*
 * Contacts page lead form (sections/contacts-form.php, class ".lead") and the
 * shared partials/lead-form.php body reused inside the dark cards of
 * 28-faq-contact.css / 51-course-offer.css - the selectors here are unscoped
 * on purpose so both contexts get the same control skin.
 *
 * The agreement checkbox is a custom control (`appearance: none`): the native
 * Android/Chrome box renders as a grey system square that reads as foreign
 * next to the white fields and the red button. Its checked mark is drawn with
 * an inset ring instead of an SVG tick because a data-URI cannot read custom
 * properties, and a hardcoded color literal is not allowed here
 * (static-site-css.md §2). The tap target is the whole `.lead-form__agreement`
 * label - that is what toggles the control - which the mobile block keeps at
 * 44px minimum (static-site-a11y.md).
 */

.lead {
    padding: 3vw 0 4.5vw;
}

.lead__title {
    font-size: 1.67vw;
    font-weight: 700;
    color: var(--color-primary);
    margin: 0 0 0.63vw;
}

.lead__text {
    color: var(--color-text-muted);
    margin: 0 0 1.67vw;
    max-width: 40em;
}

.lead-form {
    gap: 1.04vw;
    max-width: 28vw;
}

/*
 * Required-fields legend above the controls and the "phone or e-mail" note
 * between the name and the contact fields: one small-print register, so both
 * share a rule. The hint gets a negative bottom margin because the form is a
 * flex column with one uniform gap - without it the note sits exactly halfway
 * between the field above and the field it actually describes, and reads as
 * belonging to neither.
 */
.lead-form__note,
.lead-form__hint {
    margin: 0;
    font-size: 0.73vw;
    line-height: 1.4;
    color: var(--color-text-muted);
}

.lead-form__hint {
    margin-bottom: -0.52vw;
}

/*
 * The marker is aria-hidden decoration - the requirement itself is carried by
 * the `required` attribute and spelled out in .lead-form__note - so it only
 * has to be findable by eye. The darker CTA token, not the plain one: at this
 * size the plain red falls under 4.5:1 on white.
 */
.lead-form__required {
    font-weight: 700;
    color: var(--color-cta-dark);
}

.lead-form__field {
    gap: 0.31vw;
    font-weight: 700;
    font-size: 0.83vw;
    color: var(--color-text);
}

.lead-form__field input,
.lead-form__field select {
    width: 100%;
    min-width: 0;
    padding: 0.73vw 0.94vw;
    font: inherit;
    font-weight: 400;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

.lead-form__field input::placeholder {
    color: var(--color-text-muted);
}

.lead-form__agreement {
    gap: 0.63vw;
    font-size: 0.83vw;
    font-weight: 400;
    color: var(--color-text);
    cursor: pointer;
}

.lead-form__agreement input[type="checkbox"] {
    flex: 0 0 auto;
    appearance: none;
    -webkit-appearance: none;
    width: 1.25vw;
    height: 1.25vw;
    margin: 0.05vw 0 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    /* Deliberately not var(--radius): the site radius is calibrated for cards
       and would round a 24px box into a circle. */
    border-radius: 0.26vw;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.lead-form__agreement input[type="checkbox"]:checked {
    background: var(--color-cta);
    border-color: var(--color-cta);
    box-shadow: inset 0 0 0 0.21vw var(--color-surface);
}

.lead-form__submit {
    padding: 0.94vw;
    font-weight: 700;
    font-size: 0.94vw;
    color: var(--color-surface);
    background: var(--color-cta);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.lead-form__submit:hover {
    background: var(--color-cta-dark);
}

.lead-form__submit:disabled {
    cursor: progress;
}

.lead-form__status {
    margin: 0;
    padding: 0.63vw 0.83vw;
    font-size: 0.83vw;
    border-radius: var(--radius);
    border: 1px solid transparent;
}

/* Empty on first render (JS fills it) - it must not reserve a row of the
   form's flex gap while there is nothing to announce. */
.lead-form__status:empty {
    display: none;
}

.lead-form__status.is-success {
    color: var(--color-primary);
    background: color-mix(in srgb, var(--color-accent) 10%, transparent);
    border-color: color-mix(in srgb, var(--color-accent) 35%, transparent);
}

.lead-form__status.is-error {
    color: var(--color-cta-dark);
    background: color-mix(in srgb, var(--color-cta) 10%, transparent);
    border-color: color-mix(in srgb, var(--color-cta) 35%, transparent);
}

@media (prefers-reduced-motion: reduce) {
    .lead-form__agreement input[type="checkbox"],
    .lead-form__submit {
        transition: none;
    }
}

@media only screen and (max-width: 767.98px) {
    .lead {
        padding: 6vw 0 9vw;
    }

    .lead__title {
        font-size: 6.4vw;
    }

    .lead__text {
        margin: 0 0 5.33vw;
    }

    .lead-form {
        max-width: none;
        gap: 4vw;
    }

    .lead-form__note,
    .lead-form__hint {
        font-size: 3.47vw;
    }

    .lead-form__hint {
        margin-bottom: -2.13vw;
    }

    .lead-form__field {
        gap: 1.6vw;
        font-size: 3.73vw;
    }

    /* The desktop 0.73vw/0.94vw padding resolves to ~3px on a 375px viewport,
       which collapsed the fields to an untappable strip. Recalculated from the
       375px reference: 12px/14px padding, 16px text, ~50px tall. */
    .lead-form__field input,
    .lead-form__field select {
        padding: 3.2vw 3.73vw;
        font-size: 4.27vw;
    }

    .lead-form__agreement {
        gap: 3.2vw;
        min-height: 11.73vw;
        font-size: 3.73vw;
    }

    .lead-form__agreement input[type="checkbox"] {
        width: 6.4vw;
        height: 6.4vw;
        margin: 0;
        border-radius: 1.33vw;
    }

    .lead-form__agreement input[type="checkbox"]:checked {
        box-shadow: inset 0 0 0 1.07vw var(--color-surface);
    }

    .lead-form__submit {
        padding: 4vw;
        font-size: 4.27vw;
    }

    .lead-form__status {
        padding: 3.2vw 3.73vw;
        font-size: 3.73vw;
    }
}
