/*
 * Thrive Formulaires — rendu côté visiteur.
 * Volontairement sobre : le formulaire hérite de la police et des couleurs du thème. Chaque site ajuste
 * les variables ci-dessous (dans son thème) sans toucher à l'extension. Contrastes WCAG 2.2 AA par défaut.
 */
.tf-wrap {
  --tf-gap: 1.25rem;
  --tf-text: inherit;
  --tf-muted: #4a4f57;          /* 8,1:1 sur blanc */
  --tf-border: #6b7079;         /* 4,9:1 sur blanc : bordure de champ visible (WCAG 1.4.11) */
  --tf-bg: #fff;
  --tf-radius: 6px;
  --tf-focus: #1d4ed8;
  --tf-error: #b42318;          /* 6,3:1 sur blanc */
  --tf-error-bg: #fef3f2;
  --tf-success: #05603a;        /* 7,4:1 sur blanc */
  --tf-success-bg: #ecfdf3;
  --tf-button-bg: #1f2937;
  --tf-button-text: #fff;
  color: var(--tf-text);
  margin-block: 1.5rem;
  container-type: inline-size;
}

.tf-wrap *, .tf-wrap *::before, .tf-wrap *::after { box-sizing: border-box; }

.tf-form { display: flex; flex-direction: column; gap: var(--tf-gap); }

.tf-required-note { margin: 0; font-size: .9em; color: var(--tf-muted); }

/* Colonnes : empilées quand le formulaire est étroit (mobile, barre latérale), la disposition choisie à partir de 560 px de large. */
.tf-row { display: grid; grid-template-columns: 1fr; gap: var(--tf-gap); }
.tf-col { display: flex; flex-direction: column; gap: var(--tf-gap); min-width: 0; }
@container (min-width: 560px) {
  .tf-row--50-50 { grid-template-columns: 1fr 1fr; }
  .tf-row--33-66 { grid-template-columns: 1fr 2fr; }
  .tf-row--66-33 { grid-template-columns: 2fr 1fr; }
  .tf-row--33-33-33 { grid-template-columns: repeat(3, 1fr); }
}

.tf-field { display: flex; flex-direction: column; gap: .375rem; margin: 0; min-width: 0; }
.tf-field > label, .tf-field legend { font-weight: 600; }
fieldset.tf-field { border: 0; padding: 0; }
fieldset.tf-field legend { padding: 0; margin-bottom: .375rem; }
.tf-req { color: var(--tf-error); margin-inline-start: .15em; }
.tf-help { margin: 0; font-size: .9em; color: var(--tf-muted); }

.tf-field input[type="text"],
.tf-field input[type="email"],
.tf-field input[type="tel"],
.tf-field input[type="date"],
.tf-field input[type="datetime-local"],
.tf-field input[type="number"],
.tf-field input[type="file"],
.tf-field select,
.tf-field textarea {
  width: 100%;
  max-width: 100%;
  min-height: 2.75rem;            /* cible tactile confortable (WCAG 2.5.8) */
  padding: .55rem .75rem;
  font: inherit;
  color: inherit;
  background: var(--tf-bg);
  border: 1px solid var(--tf-border);
  border-radius: var(--tf-radius);
}
.tf-field textarea { resize: vertical; }
.tf-field input[type="file"] { padding: .45rem; }

.tf-choices { display: flex; flex-direction: column; gap: .5rem; }
.tf-choice, .tf-field--checkbox:not(fieldset), .tf-field--consent, .tf-field--rgpd { display: flex; flex-direction: row; flex-wrap: wrap; align-items: flex-start; gap: .5rem; }
.tf-field--checkbox:not(fieldset) > label, .tf-field--consent > label, .tf-rgpd__text { font-weight: 400; flex: 1; }
.tf-rgpd__text > label { display: inline; font-weight: 400; }
.tf-rgpd__link { color: inherit; text-decoration: underline; }
.tf-field--rgpd > .tf-help,
.tf-field--checkbox:not(fieldset) > .tf-help,
.tf-field--checkbox:not(fieldset) > .tf-error,
.tf-field--consent > .tf-error,
.tf-field--rgpd > .tf-error { flex-basis: 100%; }
.tf-choice input, .tf-field--checkbox input, .tf-field--consent input, .tf-field--rgpd input { width: 1.25rem; height: 1.25rem; margin: .15rem 0 0; flex: none; accent-color: var(--tf-button-bg); }

/* Focus toujours visible, au clavier comme à la souris (WCAG 2.4.7, 2.4.13). */
.tf-wrap :is(input, select, textarea, button, a):focus-visible,
.tf-notice:focus {
  outline: 3px solid var(--tf-focus);
  outline-offset: 2px;
}

.tf-field--invalid input:not([type="checkbox"]):not([type="radio"]),
.tf-field--invalid select,
.tf-field--invalid textarea { border-color: var(--tf-error); border-width: 2px; }
.tf-error { margin: 0; color: var(--tf-error); font-size: .95em; font-weight: 600; display: flex; gap: .4em; align-items: baseline; }
.tf-error__icon {
  display: inline-grid; place-items: center; flex: none;
  width: 1.2em; height: 1.2em; border-radius: 50%;
  background: var(--tf-error); color: #fff; font-size: .8em; line-height: 1;
}

.tf-notice { padding: 1rem 1.25rem; border-radius: var(--tf-radius); border: 2px solid; margin-bottom: var(--tf-gap); }
.tf-notice--error { color: var(--tf-error); background: var(--tf-error-bg); border-color: var(--tf-error); }
.tf-notice--error ul { margin: .5rem 0 0; padding-inline-start: 1.25rem; }
.tf-notice--error a { color: inherit; text-decoration: underline; }
.tf-notice__title { margin: 0; font-size: 1.1em; }
.tf-notice--success { color: var(--tf-success); background: var(--tf-success-bg); border-color: var(--tf-success); }
.tf-notice--success a { color: inherit; }

.tf-separator__title { margin: .5rem 0 0; font-size: 1.15em; }
.tf-field--separator { padding-top: .5rem; }
hr.tf-field--line { width: 100%; border: 0; border-top: 1px solid var(--tf-border); margin: .25rem 0; }

.tf-actions { display: flex; }
.tf-actions--center { justify-content: center; }
.tf-actions--right { justify-content: flex-end; }
.tf-actions--full .tf-submit { width: 100%; }

/* Lu par les lecteurs d'écran seulement. */
.tf-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.tf-submit {
  min-height: 2.75rem;
  padding: .7rem 1.5rem;
  font: inherit; font-weight: 600;
  color: var(--tf-button-text);
  background: var(--tf-button-bg);
  border: 0; border-radius: var(--tf-radius);
  cursor: pointer;
}
.tf-submit:hover { filter: brightness(1.15); }
.tf-submit[aria-disabled="true"], .tf-submit:disabled { opacity: .7; cursor: progress; }

/* Le piège à robots : hors de l'écran, hors du parcours clavier et des lecteurs d'écran. */
.tf-hp { position: absolute !important; left: -10000px !important; width: 1px; height: 1px; overflow: hidden; }

.tf-missing { padding: .75rem 1rem; border: 1px dashed var(--tf-border, #6b7079); }

@media (prefers-reduced-motion: no-preference) {
  .tf-wrap :is(input, select, textarea, button) { transition: border-color .15s, box-shadow .15s; }
}

/* Affichage conditionnel : un bloc masqué ne prend aucune place. */
.tf-cond[hidden] { display: none !important; }

/* Téléphone international (intl-tel-input) */
.tf-wrap .iti { display: block; width: 100%; }
.tf-wrap .iti input[type="tel"] { width: 100%; }
.tf-wrap .iti__country-container { z-index: 2; }
.tf-wrap .iti__search-input { min-height: 2.5rem; }

/* Liste avec recherche (Tom Select) : alignée sur les autres champs. */
.tf-wrap .ts-wrapper { width: 100%; }
.tf-wrap .ts-wrapper .ts-control { min-height: 2.75rem; padding: .55rem .75rem; border: 1px solid var(--tf-border); border-radius: var(--tf-radius); font: inherit; box-shadow: none; }
.tf-wrap .ts-wrapper.focus .ts-control { outline: 2px solid var(--tf-focus, #2f55d4); outline-offset: 2px; }
.tf-wrap .ts-wrapper.multi .ts-control > .item { padding: .15rem .5rem; border-radius: 999px; }
.tf-wrap .ts-dropdown { font: inherit; border-radius: var(--tf-radius); }
.tf-field--invalid .ts-wrapper .ts-control { border-color: var(--tf-error, #b32d2e); }
