/* =========================================================================
   LE FORMULAIRE DE SOUMISSION — habillage partagé
   -------------------------------------------------------------------------
   Sorti d'accueil.css le 2026-10-11, à l'identique, pour servir aussi le
   formulaire de l'étape 5 du constructeur sur /sites-web/ (décision C3).
   Chargé APRÈS la feuille de la page : c'est l'ordre qu'avaient ces règles
   au milieu d'accueil.css, donc l'accueil se rend exactement comme avant.

   Les boutons .t-btn sont ici aussi : le formulaire s'en sert pour
   « Suivant », « Retour » et « Envoyer ma demande ».
   ========================================================================= */
  :root {
    --t-erreur: #A3281B;
    --t-ease: cubic-bezier(0.16, 1, 0.3, 1);
  }

  .t-btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 52px; padding: 15px 30px;
    border: 1.5px solid transparent; border-radius: 999px;
    font-size: 0.9375rem; font-weight: 600; letter-spacing: 0.02em; line-height: 1;
    text-decoration: none; cursor: pointer;
    transition: background-color 200ms var(--t-ease), border-color 200ms var(--t-ease),
                color 200ms var(--t-ease), transform 200ms var(--t-ease);
  }
  .t-btn--p { background: var(--sc-accent); color: var(--sc-accent-ink); }
  .t-btn--p:hover { background: #D69A02; transform: translateY(-2px); }
  .t-btn--s { border-color: var(--sc-ink); color: var(--sc-ink); background: transparent; }
  .t-btn--s:hover { background: var(--sc-ink); color: var(--sc-surface); transform: translateY(-2px); }

  .t-form {
    padding: clamp(18px, 2.1vw, 26px);
    background: var(--sc-surface);
    border: 1px solid var(--t-line);
    border-radius: 16px;
    box-shadow: 0 20px 48px rgba(38, 38, 38, 0.07);
  }

  /* =====================================================================
     HABILLAGE DE WPFORMS
     ---------------------------------------------------------------------
     Le moteur est WPForms ; l'apparence reste celle de Tréma. On habille
     son balisage réel plutôt que de le remplacer : la validation, l'envoi
     AJAX et l'anti-pourriel continuent de fonctionner.
     ===================================================================== */
  .t-form .wpforms-container { margin: 0; }
  .t-form .wpforms-form { display: grid; gap: 0; }
  .t-form .wpforms-field-container { display: grid; gap: clamp(10px, 1.2vw, 13px); }
  .t-form .wpforms-field { padding: 0; display: grid; gap: 4px; }
  .t-form .wpforms-head-container { display: none; }

  .t-form .wpforms-field-label {
    font-size: 0.875rem; font-weight: 500; color: var(--sc-ink);
    margin: 0; display: block;
  }
  /* L'astérisque de WPForms est remplacée par une mention lisible. */
  .t-form .wpforms-required-label { color: var(--t-erreur); font-weight: 500; }
  .t-form .wpforms-field-sublabel { font-size: 0.8125rem; color: var(--sc-ink-soft); }

  .t-form input[type="text"],
  .t-form input[type="email"],
  .t-form input[type="tel"],
  .t-form input[type="url"],
  .t-form select,
  .t-form textarea {
    width: 100%;
    max-width: none;
    padding: 11px 14px;
    font-family: inherit;
    font-size: 16px;   /* 16 px minimum : sans quoi iOS zoome au focus */
    line-height: 1.5;
    color: var(--sc-ink);
    background: var(--sc-surface);
    border: 1.5px solid var(--t-line);
    border-radius: 10px;
    box-shadow: none;
    transition: border-color 180ms var(--t-ease), box-shadow 180ms var(--t-ease);
  }
  .t-form textarea { resize: vertical; min-height: 84px; }
  .t-form select {
    appearance: none; padding-right: 40px; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%235E5E5E' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 14px center; background-size: 16px;
  }
  .t-form input:hover, .t-form select:hover, .t-form textarea:hover { border-color: rgba(38,38,38,0.3); }
  .t-form input:focus, .t-form select:focus, .t-form textarea:focus {
    outline: none;
    border-color: var(--sc-accent);
    box-shadow: 0 0 0 4px rgba(236, 171, 2, 0.16);
  }
  .t-form input:focus-visible, .t-form select:focus-visible, .t-form textarea:focus-visible {
    outline: 3px solid var(--sc-ink); outline-offset: 3px;
  }

  /* Erreurs : WPForms pose .wpforms-error sur le contrôle et un <label>
     d'erreur après lui. On les habille aux couleurs de la charte. */
  .t-form .wpforms-error,
  .t-form input.wpforms-error, .t-form select.wpforms-error, .t-form textarea.wpforms-error {
    border-color: var(--t-erreur);
  }
  .t-form label.wpforms-error {
    display: block; margin-top: 2px;
    font-size: 0.875rem; line-height: 1.4; color: var(--t-erreur);
  }

  /* Le consentement : case de 22 px et libellé à côté, pas en dessous. */
  .t-form .wpforms-field-checkbox ul { list-style: none; margin: 0; padding: 0; }
  .t-form .wpforms-field-checkbox li {
    display: grid; grid-template-columns: auto 1fr; gap: 11px; align-items: start;
  }
  .t-form .wpforms-field-checkbox input[type="checkbox"] {
    width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--sc-accent); flex: none;
  }
  .t-form .wpforms-field-checkbox label {
    font-size: 0.9375rem; line-height: 1.5; font-weight: 400; color: var(--sc-ink);
  }

  /* Le champ « Estimation » (n° 9) : rempli par la calculatrice de
     /sites-web/, envoyé avec la demande, jamais affiché. Un champ texte sous
     WPForms Lite, que trema-pages.php marque aussi `hidden`. */
  .t-form .wpforms-field.trema-estimation { display: none !important; }

  /* Le champ appât et le jeton anti-pourriel restent dans le DOM, invisibles. */
  .t-form .wpforms-field-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

  .t-form .wpforms-submit-container { margin-top: clamp(16px, 2vw, 22px); padding: 0; }
  .t-form button.wpforms-submit { width: 100%; }
  .t-form .wpforms-confirmation-container-full,
  .t-form .wpforms-confirmation-container {
    margin: 0; padding: 0; background: none; border: 0;
    font-size: 1rem; line-height: 1.6; color: var(--sc-ink);
  }

  /* =====================================================================
     LES TROIS ÉTAPES
     ---------------------------------------------------------------------
     Posées par soumission-etapes.js. Sans JavaScript, aucune de ces règles
     ne s'applique : les neuf champs s'affichent à la suite et le formulaire
     reste envoyable. L'étapisation est une amélioration, jamais une
     condition de fonctionnement.
     ===================================================================== */
  .t-etapes-tete { display: grid; gap: 7px; margin-bottom: clamp(12px, 1.5vw, 16px); }
  .t-etapes-num {
    font-size: 0.75rem; font-weight: 600; letter-spacing: 0.14em;
    text-transform: uppercase; color: var(--sc-ink-soft);
  }
  .t-etapes-num b { color: var(--sc-ink); font-weight: 600; }
  .t-etapes-jauge { height: 2px; background: var(--t-line); border-radius: 999px; overflow: hidden; }
  .t-etapes-jauge i {
    display: block; height: 100%; width: 33.333%;
    background: var(--sc-accent);
    transition: width 320ms var(--t-ease);
  }
  @media (prefers-reduced-motion: reduce) { .t-etapes-jauge i { transition: none; } }

  .t-pas[hidden] { display: none; }
  .t-pas-titre {
    margin: 0 0 clamp(9px, 1.1vw, 12px);
    font-size: 1.125rem; font-weight: 600; letter-spacing: -0.015em; color: var(--sc-ink);
  }

  .t-nav-etapes { display: flex; gap: 10px; margin-top: clamp(13px, 1.6vw, 18px); align-items: stretch; }
  /* Le conteneur d'envoi de WPForms vit maintenant dans la barre. */
  .t-nav-etapes .wpforms-submit-container { flex: 1 1 auto; margin: 0; padding: 0; }
  .t-nav-etapes .wpforms-submit-container button { width: 100%; min-height: 48px; }
  .t-nav-etapes .t-btn { flex: 1 1 auto; min-height: 48px; }
  .t-nav-etapes .t-btn--s { flex: 0 1 auto; padding-inline: 22px; }

  /* ⚠️ `.t-btn` déclare `display: inline-flex`. Une déclaration d'auteur
     l'emporte sur la règle `[hidden] { display: none }` du navigateur, quelle
     que soit la spécificité. Résultat : le script posait bien `hidden` sur
     « Suivant » à la dernière étape, et le bouton restait à l'écran à côté de
     « Envoyer ma demande ». Il faut le dire explicitement. */
  .t-nav-etapes [hidden] { display: none !important; }

  /* La carte ne doit jamais sauter de hauteur entre deux étapes : la plus
     haute est mesurée au chargement et réservée. */
  .t-pas-zone { position: relative; }
