/* ABC Canada 2027 — les formulaires.
   Le moteur d'écran de `form.js` et tout ce qui l'habille : la mise en page à
   deux colonnes, les champs, les cartes de choix, l'alerte de synthèse, la
   navigation et l'écran de succès (§52). Extrait de stay.css le jour où une
   troisième page en a eu besoin, comme page.css l'avait été pour le chrome de
   page : les formulaires Community Stay et la page de contact tournent
   dessus. Charge après site.css, motion.css et page.css, avant la feuille de
   module s'il y en a une. */

/* ── Pages de formulaire (§52) ────────────────────────────────────────── */
.form-page { padding: clamp(28px, 4vw, 44px) var(--pad-x) var(--section-y); }
.form-layout {
  max-width: var(--wrap); margin: 0 auto;
  display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 56px;
  align-items: start;
}
.form-head { margin-bottom: 36px; }
/* Le titre du bloc est un h1 quand le formulaire est toute la page, un h2
   quand il n'en est qu'une section — la page de contact a déjà son h1. */
.form-head h1,
.form-head h2 { margin: 0 0 12px; font-weight: 400; font-size: clamp(32px, 4.2vw, 52px); line-height: 1; letter-spacing: -.03em; }
.form-head h1 strong,
.form-head h2 strong { font-weight: var(--font-heading-weight); }
.form-head p { margin: 0; max-width: 52ch; font-size: 16px; color: var(--ink-muted); }

/* Progression : le libellé porte l'information, la barre l'illustre. */
/* Sans JavaScript toutes les étapes sont visibles : le compteur n'aurait
   alors aucun sens, il n'apparaît qu'une fois le script en route. */
.form-progress { display: none; margin-bottom: 32px; }
.js .form-progress { display: block; }
.form-progress-label {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px;
  margin: 0 0 10px; font-size: 11px; letter-spacing: .14em; font-weight: 600;
}
.form-progress-step { color: var(--color-text); }
.form-progress-name { color: var(--ink-muted); letter-spacing: .08em; }
.progress-bar { display: flex; gap: 6px; }
.progress-seg { flex: 1; height: 6px; background: rgba(32, 30, 29, .15); }
.progress-seg[data-state="done"] { background: var(--color-text); }
.progress-seg[data-state="current"] { background: var(--color-accent); }

.step { border-top: var(--rule); padding-top: 28px; margin: 0 0 8px; }
.step + .step { margin-top: 44px; }
.step-legend { padding: 0; }
.step-legend h2 { margin: 0 0 8px; font-size: clamp(24px, 2.6vw, 32px); letter-spacing: -.02em; }
.step-legend p { margin: 0 0 28px; max-width: 54ch; font-size: 14px; color: var(--ink-60); }
.step > fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }

.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.field-grid > .field--wide { grid-column: 1 / -1; }
.field > label,
.field > .field-label {
  display: block; margin-bottom: 8px;
  font-size: 12px; letter-spacing: .1em; font-weight: 600; text-transform: uppercase;
  color: var(--color-text);
}
.field-hint { display: block; margin: -2px 0 8px; font-size: 12px; letter-spacing: 0; text-transform: none; font-weight: 400; color: var(--ink-60); }
.field .input {
  min-height: 52px; padding: 12px 14px; font-size: 15px;
  background: var(--color-bg); border: 2px solid rgba(32, 30, 29, .3); border-radius: 0;
}
.field select.input { appearance: none; background-image: none; }
.field .input:hover { border-color: rgba(32, 30, 29, .55); }
.field .input:focus-visible { border-color: var(--color-accent); outline: 2px solid var(--color-accent); outline-offset: 2px; }
.field[data-invalid] .input { border-color: var(--color-accent-700); }
.field-error { display: none; margin: 8px 0 0; font-size: 13px; font-weight: 600; color: var(--accent-text); }
.field[data-invalid] .field-error { display: block; }
.field[data-invalid] .field-error::before { content: "✕ "; }

/* Cartes de choix : l'input reste dans le flux d'accessibilité, seule sa
   présentation est remplacée. L'état coché est porté par le remplissage ET
   par la coche — jamais par la couleur seule (§57). */
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(215px, 100%), 1fr)); gap: 12px; }
.choices--tight { grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)); }
.choice { position: relative; display: block; cursor: pointer; }
.choice input { position: absolute; opacity: 0; width: 0; height: 0; }
.choice-box {
  display: flex; flex-direction: column; gap: 6px; height: 100%;
  min-height: 64px; padding: 16px 18px;
  background: var(--color-bg); border: 2px solid rgba(32, 30, 29, .3);
  transition: background .2s var(--ease-out, ease), border-color .2s var(--ease-out, ease);
}
.choice-box::after {
  content: "✓"; position: absolute; top: 14px; right: 16px;
  font-size: 14px; font-weight: var(--font-heading-weight); opacity: 0;
}
.choice:hover .choice-box { border-color: rgba(32, 30, 29, .6); }
.choice input:focus-visible + .choice-box { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.choice input:checked + .choice-box {
  background: var(--color-text); border-color: var(--color-text); color: var(--color-bg);
}
.choice input:checked + .choice-box::after { opacity: 1; }
.choice-title { font-family: var(--font-heading); font-weight: var(--font-heading-weight); font-size: 16px; letter-spacing: -.01em; padding-right: 22px; }
.choice-note { font-size: 12px; color: var(--ink-60); }
.choice input:checked + .choice-box .choice-note { color: var(--ground-70); }

/* Consentements : la case reste native, agrandie. */
.consent { display: grid; grid-template-columns: 22px 1fr; gap: 14px; align-items: start; padding: 18px 0; border-top: var(--hair); }
.consent input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--color-accent); }
.consent span { font-size: 14px; color: var(--ink-60); }
.consent strong { color: var(--color-text); font-weight: 600; }
.field[data-invalid] .consent span { color: var(--accent-text); }

/* Résumé d'erreurs en tête d'étape : cible du focus après un envoi refusé. */
.form-alert {
  display: none; margin: 0 0 28px; padding: 18px 20px;
  border: 2px solid var(--color-accent-700); background: var(--color-accent-100);
}
.form-alert[data-open] { display: block; }
.form-alert h2 { margin: 0 0 8px; font-size: 16px; color: var(--color-accent-800); }
.form-alert ul { margin: 0; padding-left: 18px; font-size: 14px; }
.form-alert a { color: var(--color-accent-800); }
.form-alert p { margin: 0; font-size: 14px; }
/* Erreur renvoyee par le serveur : meme boite, mais elle ouvre la page, donc
   elle a besoin de sa marge haute et ne doit pas voler le style du bloc JS. */
.form-alert--server { margin-top: 4px; }
.form-alert--server:focus { outline: 2px solid var(--color-accent-700); outline-offset: 3px; }

.form-nav {
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px;
  margin-top: 40px; padding-top: 28px; border-top: var(--rule);
}
.form-nav .btn { height: 52px; padding: 0 26px; font-size: 15px; letter-spacing: .04em; }
.form-nav .btn-secondary { border-color: rgba(32, 30, 29, .4); }
.form-nav-spacer { flex: 1; }
.form-nav [data-role="submit"][aria-busy="true"] { opacity: .7; pointer-events: none; }
.form-note { margin: 24px 0 0; font-size: 12px; color: var(--ink-muted); max-width: 62ch; }

/* Colonne latérale : rappel du parcours et de la règle de confidentialité. */
.form-aside { position: sticky; top: 104px; display: flex; flex-direction: column; gap: 28px; }
.aside-card { padding: 26px 24px; background: var(--color-surface); border-top: var(--rule); }
.aside-card h2 { margin: 0 0 14px; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; }
.aside-steps { margin: 0; padding: 0; list-style: none; counter-reset: aside; }
.aside-steps li {
  display: grid; grid-template-columns: 26px 1fr; gap: 10px;
  padding: 10px 0; font-size: 14px; color: var(--ink-60); border-top: var(--hair);
}
.aside-steps li:first-child { border-top: 0; }
.aside-steps li::before {
  counter-increment: aside; content: "0" counter(aside);
  font-size: 11px; font-weight: 600; letter-spacing: .08em; color: var(--ink-muted); line-height: 1.7;
}
.aside-steps li[data-state="current"] { color: var(--color-text); font-weight: 600; }
.aside-steps li[data-state="current"]::before { color: var(--accent-text); }
.aside-steps li[data-state="done"]::before { content: "✓"; color: var(--accent-text); }
.aside-card p { margin: 0; font-size: 13px; color: var(--ink-60); }
.aside-card--ink { background: var(--color-text); color: var(--color-bg); border-top: 0; }
.aside-card--ink p { color: var(--ground-70); }
.aside-link { color: var(--accent-text); font-weight: 600; text-decoration: none; border-bottom: 1px solid currentColor; }
.aside-link:hover { color: var(--color-text); }
.aside-card--ink .aside-link { color: var(--color-accent-400); }
.aside-card--ink .aside-link:hover { color: var(--color-bg); }

/* ── Succès (§52 : état success) ──────────────────────────────────────── */
.form-success { max-width: 720px; }
.form-success-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px; margin-bottom: 24px;
  background: var(--color-accent); color: var(--color-bg);
  font-size: 24px; font-weight: var(--font-heading-weight);
}
.form-success h1,
.form-success h2 { margin: 0 0 14px; font-weight: var(--font-heading-weight); font-size: clamp(30px, 4vw, 48px); line-height: 1.02; letter-spacing: -.03em; }
.form-success > p { margin: 0 0 12px; font-size: 17px; color: var(--ink-muted); max-width: 52ch; }
.form-success-ref {
  display: inline-block; margin: 12px 0 32px; padding: 10px 16px;
  background: var(--color-surface); border: 2px solid rgba(32, 30, 29, .3);
  font-size: 14px; font-weight: 600; letter-spacing: .06em;
}
.form-success-next { margin: 0 0 32px; padding: 0; list-style: none; border-top: var(--rule); }
.form-success-next li { padding: 14px 0; border-bottom: var(--hair); font-size: 14px; color: var(--ink-60); }
.form-success-next strong { display: block; font-size: 16px; color: var(--color-text); }
.form-success-actions { display: flex; flex-wrap: wrap; gap: 14px; }
.form-success-actions .btn { height: 52px; padding: 0 26px; letter-spacing: .04em; }

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 1080px) {
  .form-layout { grid-template-columns: 1fr; gap: 44px; }
  .form-aside { position: static; flex-direction: row; flex-wrap: wrap; }
  .form-aside > * { flex: 1 1 280px; }
}

@media (max-width: 760px) {
  .field-grid { grid-template-columns: 1fr; gap: 20px; }
  .form-nav { gap: 10px; }
  .form-nav .btn { width: 100%; justify-content: flex-start; }
  .form-nav-spacer { display: none; }
  /* L'action principale reste au-dessus du bouton de retour sur petit écran. */
  .form-nav [data-role="back"] { order: 2; }
  .form-success-actions .btn { width: 100%; justify-content: flex-start; }
}

/* ── Les places d'une commande ─────────────────────────────────────────────
   La page privee /mes-billets/{token}/. Une ligne par place, en trois zones
   qui repondent chacune a une question : de quelle place s'agit-il, qui
   l'occupe, ou en est-elle. La zone d'etat est a droite parce qu'elle change
   apres l'enregistrement — l'oeil y revient, il ne la cherche pas.

   Une place a nommer porte un filet accent a gauche plutot qu'un fond colore :
   sur dix lignes dont neuf a nommer, un fond aurait repeint la page entiere. */

.places-succes {
  margin: 0 0 28px; padding: 14px 18px;
  background: var(--color-surface); border-left: 3px solid var(--color-text);
  font-size: 14px; font-weight: 600;
}

.places-liste { border-top: var(--rule); }

.place-ligne {
  display: grid;
  grid-template-columns: minmax(110px, 150px) minmax(0, 1fr) minmax(110px, 160px);
  gap: clamp(18px, 3vw, 40px);
  /* Le retrait a gauche est porte par TOUTES les lignes, pas seulement par
     celles qui affichent le filet : sinon les places nommees et les places a
     nommer ne s'alignent plus, et la liste part en escalier. */
  padding: 26px 0 26px 16px;
  border-bottom: var(--hair);
}
.place-ligne--a-nommer { box-shadow: inset 3px 0 0 var(--color-accent); }

.place-rang {
  margin: 0 0 4px;
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: 17px; letter-spacing: -.01em;
}
.place-ref {
  margin: 0; font-size: 12px; letter-spacing: .08em;
  color: var(--ink-60); font-variant-numeric: tabular-nums;
}
.place-produit { margin: 6px 0 0; font-size: 12px; color: var(--ink-60); }

.place-champs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.place-facultatif {
  font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--ink-60);
}

.place-etat { text-align: right; }
.place-tag {
  margin: 0; font-size: 11px; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase; color: var(--ink-60);
}
.place-tag--attente { color: var(--accent-text); }
.place-liens { display: flex; justify-content: flex-end; gap: 14px; margin: 8px 0 0; }
.place-liens a { font-size: 13px; color: var(--color-text); }
.place-envoi { margin: 8px 0 0; font-size: 12px; color: var(--ink-60); }

.places-actions { margin-top: 32px; display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.places-actions .btn { height: 52px; padding: 0 26px; letter-spacing: .04em; }
.places-note { margin: 0; max-width: 62ch; font-size: 13px; color: var(--ink-60); }

/* Le rappel sur la page de confirmation de commande. */
.places-appel {
  margin: 0 0 36px; padding: clamp(24px, 3vw, 36px);
  border: var(--rule); background: var(--color-surface);
}
.places-appel-kicker {
  margin: 0 0 6px; font-size: 11px; font-weight: 600;
  letter-spacing: .16em; color: var(--accent-text);
}
.places-appel-nombre {
  margin: 0 0 12px;
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: clamp(30px, 4vw, 44px); line-height: 1; letter-spacing: -.03em;
}
.places-appel-note { margin: 0 0 22px; max-width: 58ch; font-size: 15px; color: var(--ink-60); }

@media (max-width: 900px) {
  /* En colonne, l'etat remonte contre le repere : les deux tiennent sur une
     ligne, et les champs gardent toute la largeur. */
  .place-ligne { grid-template-columns: minmax(0, 1fr) auto; gap: 16px; }
  .place-champs { grid-column: 1 / -1; }
}

@media (max-width: 620px) {
  .place-champs { grid-template-columns: 1fr; }
}

/* Les deux regles de saisie, dites une fois pour toute la liste. */
.places-intro {
  margin: 0 0 24px; max-width: 68ch;
  font-size: 14px; line-height: 1.6; color: var(--ink-60);
}
.places-intro span { display: block; }

/* La page des places : une liste, pas un formulaire a encadre lateral. */
.places-page { max-width: var(--wrap); margin: 0 auto; }
