/* =====================================================
   IMAT Quest — Lead form  (css/lead-form.css)
   Added 2026-06-26.

   On-brand "Get matched with a mentor" lead-capture form.
   Single-column (best form-conversion + mobile-first).
   Sits between the colophon CTA and the footer.
   Reuses: .container, .btn .btn-primary, .reveal (from style.css).
   References design tokens from css/tokens.css — no hardcoded values.
   ===================================================== */

.lead-form {
  background: var(--color-cream);
  padding: var(--space-l) 0;
}

.lead-form__inner {
  max-inline-size: 620px;
}

/* ─── Heading ─────────────────────────────────────── */
.lead-form__head {
  text-align: center;
  margin-block-end: var(--space-s);
}

.lead-form__eyebrow {
  font-family: var(--font-body);
  font-weight: var(--weight-semibold);
  font-size: var(--text-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-amber-ink);
  margin-block-end: var(--space-2xs);
}

.lead-form__title {
  font-family: var(--font-heading);
  font-weight: var(--weight-bold);
  font-size: var(--text-lg);
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--color-navy);
  margin: 0 0 var(--space-2xs);
  text-wrap: pretty;
}

.lead-form__sub {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--color-text-muted);
  margin: 0 auto;
  max-inline-size: 46ch;
  text-wrap: pretty;
}

/* ─── The form card ───────────────────────────────── */
.lead-form__form {
  display: grid;
  gap: var(--space-m);
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-l);
}

.lead-form__field {
  display: grid;
  gap: var(--space-2xs);
}

.lead-form__field label {
  font-family: var(--font-body);
  font-weight: var(--weight-semibold);
  font-size: var(--text-sm);
  color: var(--color-navy);
}

.lead-form__req {
  color: var(--color-burgundy);
}

/* Inputs, selects, textarea share one look */
.lead-form__field input,
.lead-form__field select,
.lead-form__field textarea {
  inline-size: 100%;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-navy);
  background: var(--color-white);
  border: 1.5px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  padding: 0.58em 0.8em;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
  appearance: none;
}

.lead-form__field textarea {
  resize: vertical;
  min-block-size: 3.2em;
  line-height: 1.5;
}

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

/* Focus ring — amber, matches brand accent */
.lead-form__field input:focus-visible,
.lead-form__field select:focus-visible,
.lead-form__field textarea:focus-visible {
  outline: none;
  border-color: var(--color-amber);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--color-amber), transparent 75%);
}

/* Custom dropdown chevron for selects */
.lead-form__field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23001f3d' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.8em center;
  background-size: 1.1em;
  padding-inline-end: 2.6em;
  cursor: pointer;
}

/* ─── WhatsApp: country-code select + number ──────── */
.lead-form__phone {
  display: grid;
  grid-template-columns: minmax(5.5rem, auto) 1fr;
  gap: var(--space-xs);
}

.lead-form__phone .lead-form__cc {
  inline-size: auto;
}

/* ─── Validation errors ───────────────────────────── */
.lead-form__error {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  color: var(--color-burgundy);
  margin: 0;
  min-block-size: 1em;
}
.lead-form__error:empty {
  display: none;
}

.lead-form__field input[aria-invalid="true"],
.lead-form__field select[aria-invalid="true"] {
  border-color: var(--color-burgundy);
}

/* ─── Actions ─────────────────────────────────────── */
.lead-form__actions {
  display: grid;
  gap: var(--space-xs);
  justify-items: center;
  margin-block-start: var(--space-2xs);
}

.lead-form__submit {
  inline-size: 100%;
}

.lead-form__submit[aria-busy="true"] {
  opacity: 0.7;
  pointer-events: none;
}

.lead-form__privacy {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-align: center;
  margin: 0;
}

/* ─── Status line (aria-live) ─────────────────────── */
.lead-form__status {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  text-align: center;
  margin: 0;
  color: var(--color-burgundy);
}
.lead-form__status:empty {
  display: none;
}

/* ─── Success panel (replaces form after submit) ──── */
.lead-form__success {
  text-align: center;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-xl) var(--space-l);
}

.lead-form__success-mark {
  inline-size: 3rem;
  block-size: 3rem;
  margin: 0 auto var(--space-s);
  display: grid;
  place-items: center;
  border-radius: var(--radius-full);
  background: color-mix(in oklch, var(--color-success), transparent 82%);
  color: var(--color-success);
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
}

.lead-form__success-title {
  font-family: var(--font-heading);
  font-weight: var(--weight-bold);
  font-size: var(--text-xl);
  color: var(--color-navy);
  margin: 0 0 var(--space-2xs);
  text-wrap: balance;
}

.lead-form__success-sub {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text-muted);
  margin: 0;
}
.lead-form__success-sub a {
  color: var(--color-teal);
  font-weight: var(--weight-semibold);
  text-decoration: none;
  white-space: nowrap;
}
.lead-form__success-sub a:hover {
  text-decoration: underline;
}

/* ─── Honeypot: hidden from humans, bait for bots ─── */
.lead-form__hp {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ─── Desktop / tablet: two columns so the form fits one screen ──
   instead of one long single-column scroll. Mobile stays single-column. */
@media (min-width: 768px) {
  .lead-form__inner {
    max-inline-size: 860px;
  }
  .lead-form__form {
    grid-template-columns: 1fr 1fr;
    column-gap: var(--space-l);
    row-gap: var(--space-xs);
    padding: var(--space-s) var(--space-l);
  }
  /* Message box, action row and status line span the full width */
  .lead-form__field:has(textarea),
  .lead-form__actions,
  .lead-form__status {
    grid-column: 1 / -1;
  }
  /* Keep the optional message compact (still drag-resizable) */
  .lead-form__field textarea {
    min-block-size: 2.4em;
    block-size: 3.4em;
  }
  /* Comfortable centered button instead of a too-wide full bleed */
  .lead-form__submit {
    inline-size: auto;
    padding-inline: var(--space-2xl);
  }
}
