/* =====================================================================
   40 — FORMULAIRES
   Éléments communs : .form-card (carte), .form-field (champ), .choice (pastille à cocher), .form-success.
   Deux formulaires s'appuient dessus :
     .contact-form   formulaire à profils (pages des pôles et page Contact)  → components/contact-form.js
     .step-form      formulaire à étapes (page d'accueil)                    → components/multi-step-form.js
   État d'erreur d'un champ : classe .has-error sur .form-field.
===================================================================== */

/* ---- Carte claire, lisible sur n'importe quel fond ---- */
.form-card { background: var(--color-paper); color: var(--color-ink); border-radius: 36px; padding: 44px; box-shadow: 0 30px 70px rgba(28,20,15,.18); }
.form-card__title { font-size: clamp(24px, 3vw, 32px); margin-bottom: 10px; }
.form-card__intro { font-size: 15px; line-height: 1.6; color: var(--text-muted-on-light); margin-bottom: 28px; max-width: 56ch; }
@media (max-width: 640px) { .form-card { padding: 30px 20px; border-radius: 28px; } }

/* ---- Champs ---- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 14px; }
.form-field { grid-column: 1 / -1; margin: 0 0 18px; padding: 0; border: 0; min-width: 0; }
.form-field--half { grid-column: auto; }
@media (max-width: 560px) { .form-field--half { grid-column: 1 / -1; } }
.form-field__label { display: block; font-size: 12.5px; color: var(--text-muted-on-light); margin-bottom: 7px; padding: 0; }
.form-field__required { color: var(--color-orange-text); }
.form-field__control {
  width: 100%; padding: 13px 20px; border: 1.5px solid var(--line-on-light); border-radius: var(--radius-pill);
  background: var(--color-white); color: var(--color-ink); font: 400 15px var(--font-body); transition: border-color .25s;
}
textarea.form-field__control { border-radius: 24px; min-height: 120px; resize: vertical; }
.form-field__control:focus { outline: none; border-color: var(--color-ink); }
.form-field__hint { display: none; margin-top: 6px; font-size: 12px; font-weight: 500; color: #9b2d1a; }
.form-field__counter { margin-top: 4px; font-size: 12px; text-align: right; color: var(--text-muted-on-light); }
.form-field.has-error .form-field__control { border-color: #9b2d1a; }
.form-field.has-error .form-field__hint { display: block; }

/* ---- Pastilles à cocher (cases et boutons radio natifs) ---- */
.choice-group { display: flex; flex-wrap: wrap; gap: 10px; }
.choice { position: relative; display: inline-block; margin: 0; }
.choice__input { position: absolute; opacity: 0; pointer-events: none; }
.choice__label { display: inline-block; padding: 10px 18px; border: 1.5px solid var(--line-on-light); border-radius: var(--radius-pill); font-size: 13.5px; background: var(--color-white); cursor: pointer; transition: .25s; }
.choice__input:checked + .choice__label { background: var(--color-ink); border-color: var(--color-ink); color: var(--color-paper); }
.choice__input:focus-visible + .choice__label { outline: 2px solid var(--color-ink); outline-offset: 2px; }

/* ---- Consentements ---- */
.consent { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 12px; font-size: 13.5px; line-height: 1.5; color: var(--text-muted-on-light); cursor: pointer; }
.consent input { margin-top: 3px; accent-color: var(--color-ink); }
.consent-group.has-error .form-field__hint { display: block; }

/* ---- Message de succès ---- */
.form-success { text-align: center; padding: 24px 0 8px; }
.form-success__icon { width: 60px; height: 60px; border-radius: 50%; background: var(--color-ink); display: flex; align-items: center; justify-content: center; margin: 0 auto 22px; }
.form-success__icon svg { width: 26px; height: 26px; }
.form-success__message { max-width: 44ch; margin: 0 auto; font-size: 16px; line-height: 1.6; color: var(--text-muted-on-light); }

/* ---- Indicateur d'envoi sur le bouton ---- */
.is-sending { opacity: .85; pointer-events: none; }
.is-sending::after { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255,246,234,.35); border-top-color: var(--color-paper); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Formulaire à profils (.contact-form) ---- */
.contact-form { display: block; }
.contact-form__profile-label { font-size: 12.5px; color: var(--text-muted-on-light); margin-bottom: 10px; }
.contact-form__profiles { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 26px; }
.profile-chip { padding: 10px 16px; border: 1.5px solid var(--color-ink); border-radius: var(--radius-pill); background: none; color: var(--color-ink); font: 500 13.5px var(--font-body); cursor: pointer; transition: .25s; }
.profile-chip[aria-pressed="true"] { background: var(--color-ink); color: var(--color-paper); }
.contact-form__submit { width: 100%; margin-top: 4px; }

/* ---- Formulaire à étapes (.step-form) ---- */
.step-form__progress { display: flex; align-items: center; gap: 10px; list-style: none; padding: 0; margin: 28px 0 34px; }
.step-form__progress-item { display: flex; align-items: center; gap: 10px; flex: 1; font-size: 12.5px; color: var(--text-muted-on-light); }
.step-form__progress-item:last-child { flex: none; }
.step-form__progress-item:not(:last-child)::after { content: ""; flex: 1; height: 1.5px; margin-left: 6px; background: var(--line-on-light); transition: background .4s; }
.step-form__progress-item.is-complete:not(:last-child)::after { background: var(--color-orange); }
.step-form__progress-number { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border: 1.5px solid var(--line-on-light); border-radius: 50%; font: 500 13px var(--font-heading); transition: .35s; }
.step-form__progress-item.is-active .step-form__progress-number { background: var(--color-ink); border-color: var(--color-ink); color: var(--color-paper); }
.step-form__progress-item.is-complete .step-form__progress-number { background: var(--color-orange); border-color: var(--color-orange); color: var(--color-ink); }
.step-form__progress-item.is-active .step-form__progress-label, .step-form__progress-item.is-complete .step-form__progress-label { color: var(--color-ink); }
@media (max-width: 560px) { .step-form__progress-label { display: none; } }
.step-form__panel { animation: panel-in .4s ease; }
@keyframes panel-in { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .step-form__panel { animation: none; } }
.step-form__actions { display: flex; justify-content: space-between; align-items: center; margin-top: 30px; }
.step-form__button--back { background: none; border: 0; padding: 12px 6px; font: 500 13.5px var(--font-body); color: var(--text-muted-on-light); cursor: pointer; }
.step-form__button--primary { margin-left: auto; }
.file-drop { position: relative; display: block; margin: 0; padding: 22px; border: 1.5px dashed var(--line-on-light); border-radius: 24px; text-align: center; font-size: 13.5px; color: var(--text-muted-on-light); cursor: pointer; transition: .25s; }
.file-drop strong { display: block; margin-bottom: 4px; color: var(--color-ink); font-weight: 500; }
.file-drop.is-dragging-over { border-color: var(--color-ink); background: rgba(224,138,46,.14); }
.file-drop input { position: absolute; opacity: 0; pointer-events: none; }
.file-chip { display: inline-flex; align-items: center; gap: 8px; margin-top: 10px; padding: 6px 14px; font-size: 12.5px; background: var(--color-white); border: 1.5px solid var(--line-on-light); border-radius: var(--radius-pill); }
.file-chip button { border: 0; background: none; color: #9b2d1a; cursor: pointer; }
