/* ==========================================================
   TF Formulaires, structure minimale
   ----------------------------------------------------------
   - Préfixe : tf-form-
   - Aucune couleur, aucun rayon, aucun espacement écrit : tout vient des
     jetons --tf-* du site (composants.md § 2). Pas de valeur de repli.
   - L'habillage fin est posé par site.css (demande DC-05), chargé après
     cette feuille ; ici seulement ce qui fait fonctionner le formulaire.
   - Sans JavaScript : toutes les étapes visibles, navigation et barre de
     progression masquées (attribut hidden), envoi natif.
   ========================================================== */

.tf-form {
	position: relative;
	width: min(100%, 760px);
	margin-inline: auto;
	color: var(--tf-marine);
}

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

/* L'attribut hidden l'emporte sur tout style de bouton du site. */
.tf-form [hidden],
.tf-partenaire [hidden] {
	display: none !important;
}

/* Texte réservé aux lecteurs d'écran. */
.tf-form-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

/* Champ piège : hors écran par positionnement, jamais display:none en ligne. */
.tf-form-hp {
	position: absolute;
	left: -10000px;
	top: auto;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* ----------------------------------------------------------
   Étapes : empilées sans JS, une seule visible avec JS.
   ---------------------------------------------------------- */
.tf-form--js .tf-form-step {
	display: none;
}

.tf-form--js .tf-form-step.is-active {
	display: block;
}

.tf-form-step + .tf-form-step {
	margin-top: var(--tf-e-7);
}

.tf-form-step__title {
	margin: 0 0 var(--tf-e-5);
}

.tf-form-step__title:focus {
	outline: none;
}

.tf-form-step__num {
	display: inline-block;
	margin-right: var(--tf-e-3);
	font-size: var(--tf-tt-xs);
	letter-spacing: .08em;
	color: var(--tf-texte-doux);
}

.tf-form-obligatoire,
.tf-form-help,
.tf-form-info {
	font-size: var(--tf-tt-sm);
	color: var(--tf-texte-doux);
	margin: var(--tf-e-2) 0;
}

/* ----------------------------------------------------------
   Champs
   ---------------------------------------------------------- */
.tf-form-field {
	margin: 0 0 var(--tf-e-5);
}

.tf-form-label,
.tf-form-group > legend {
	display: block;
	margin: 0 0 var(--tf-e-2);
	font-weight: 700;
	font-size: var(--tf-tt-lg);
}

.tf-form-group {
	margin: 0;
	padding: 0;
	border: 0;
	min-width: 0;
}

.tf-form-control {
	display: block;
	width: 100%;
	min-height: 52px;
	padding: var(--tf-e-3) var(--tf-e-4);
	font: inherit;
	color: var(--tf-marine);
	background: var(--tf-blanc);
	border: 1px solid var(--tf-bordure);
	border-radius: var(--tf-r-sm);
}

.tf-form-control--textarea {
	min-height: 120px;
	resize: vertical;
}

.tf-form-control-wrap {
	position: relative;
}

.tf-form-control-wrap--amount .tf-form-control {
	padding-right: calc(var(--tf-e-4) + 1.5em);
}

.tf-form-suffix {
	position: absolute;
	right: var(--tf-e-4);
	top: 50%;
	transform: translateY(-50%);
	color: var(--tf-texte-doux);
}

/* Cartes de choix : le bouton radio natif reste au clavier, la carte est le libellé. */
.tf-form-choices {
	display: grid;
	gap: var(--tf-e-3);
	grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.tf-form-choices--radio {
	grid-template-columns: repeat(auto-fit, minmax(120px, max-content));
}

.tf-form-choice {
	position: relative;
	display: block;
	min-width: 0;
}

.tf-form-choice input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
}

.tf-form-choice__card {
	display: flex;
	align-items: center;
	min-height: 52px;
	padding: var(--tf-e-3) var(--tf-e-4);
	border: 1px solid var(--tf-bordure);
	border-radius: var(--tf-r-sm);
	background: var(--tf-blanc);
	cursor: pointer;
	overflow-wrap: anywhere;
}

.tf-form-choice input:checked + .tf-form-choice__card {
	border-color: var(--tf-action);
	box-shadow: inset 0 0 0 1px var(--tf-action);
}

.tf-form-choice input:focus-visible + .tf-form-choice__card,
.tf-form-control:focus-visible,
.tf-form-consent input:focus-visible,
.tf-form-notice:focus-visible,
.tf-form-success:focus-visible {
	outline: 3px solid var(--tf-action);
	outline-offset: 2px;
}

.tf-form-consent__label {
	display: grid;
	grid-template-columns: 24px 1fr;
	gap: var(--tf-e-3);
	align-items: start;
	font-size: var(--tf-tt-md);
	cursor: pointer;
}

.tf-form-consent input {
	width: 24px;
	height: 24px;
	margin: 0;
}

/* Erreur : texte + pictogramme, jamais la seule couleur. */
.tf-form-error {
	margin: var(--tf-e-2) 0 0;
	font-size: var(--tf-tt-sm);
	font-weight: 700;
	color: var(--tf-action-fonce);
}

.tf-form-error__picto {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.4em;
	height: 1.4em;
	border-radius: var(--tf-r-rond);
	border: 2px solid currentColor;
	font-size: .85em;
}

.tf-form-field.is-invalid .tf-form-control,
.tf-form-field.is-invalid .tf-form-choice__card {
	border-color: var(--tf-action-fonce);
}

/* ----------------------------------------------------------
   Navigation, progression, avis, succès
   ---------------------------------------------------------- */
.tf-form-nav {
	display: flex;
	flex-wrap: wrap;
	gap: var(--tf-e-3);
	justify-content: space-between;
	margin-top: var(--tf-e-6);
}

.tf-form-nav .tf-btn {
	min-height: 52px;
}

@media (max-width: 767px) {
	.tf-form-nav .tf-btn {
		width: 100%;
	}
}

.tf-form-progress {
	margin: 0 0 var(--tf-e-6);
}

.tf-form-progress__label {
	margin: 0 0 var(--tf-e-2);
	font-size: var(--tf-tt-sm);
	color: var(--tf-texte-doux);
}

.tf-form-progress__bar {
	height: 6px;
	border-radius: var(--tf-r-rond);
	background: var(--tf-fond);
	overflow: hidden;
}

.tf-form-progress__fill {
	display: block;
	height: 100%;
	width: 0;
	background: var(--tf-action);
	transition: width var(--tf-t-l) var(--tf-ease);
}

.tf-form-progress__list {
	display: none;
	list-style: none;
	margin: var(--tf-e-3) 0 0;
	padding: 0;
	gap: var(--tf-e-3);
}

@media (min-width: 768px) {
	.tf-form-progress__list {
		display: flex;
	}
}

.tf-form-progress__item {
	flex: 1;
	min-width: 0;
	font-size: var(--tf-tt-xs);
	color: var(--tf-texte-doux);
}

.tf-form-progress__item.is-current {
	color: var(--tf-marine);
	font-weight: 700;
}

.tf-form-progress__num {
	margin-right: var(--tf-e-1);
}

.tf-form-notice {
	margin: 0 0 var(--tf-e-5);
	padding: var(--tf-e-4) var(--tf-e-5);
	border-left: 4px solid var(--tf-action);
	background: var(--tf-fond);
	border-radius: var(--tf-r-sm);
}

.tf-form-notice p,
.tf-form-notice ul {
	margin: 0;
}

.tf-form-notice__titre {
	font-weight: 700;
}

.tf-form-success {
	padding: var(--tf-e-6);
	border: 1px solid var(--tf-bordure);
	border-radius: var(--tf-r-md);
	background: var(--tf-blanc);
}

.tf-form-success__links {
	display: flex;
	flex-wrap: wrap;
	gap: var(--tf-e-4);
}

.tf-form-mention {
	font-size: var(--tf-tt-xs);
	color: var(--tf-texte-doux);
}

.tf-form-admin-note {
	padding: var(--tf-e-3);
	border: 1px dashed var(--tf-bordure);
	font-size: var(--tf-tt-sm);
}

@media (prefers-reduced-motion: reduce) {
	.tf-form-progress__fill {
		transition: none;
	}
}

/* ----------------------------------------------------------
   Parcours partenaires
   ---------------------------------------------------------- */
.tf-partenaire__iframe {
	display: block;
	width: 100%;
	border: 0;
	border-radius: var(--tf-r-md);
}

.tf-partenaire__attente {
	padding: var(--tf-e-5);
	border: 1px dashed var(--tf-bordure);
	border-radius: var(--tf-r-md);
	background: var(--tf-fond);
}

.tf-partenaire__lien {
	margin-top: var(--tf-e-3);
	font-size: var(--tf-tt-sm);
}
