/*!
 * EC Forms — front (assets/css/ec-forms.css)
 * Mobile-first, sans dépendance, jetons --ecf-* surchargeables (ARCHITECTURE §9.6,
 * préréglages : includes/front/class-theme.php). Sobre : fonds unis et radius, aucun
 * flou, dégradé, ombre ni liseré d'accent ; la hiérarchie passe par la typographie et
 * l'espace. Polices héritées du site (jamais de nom de police ici). Tout état visuel
 * posé par le JS est une classe présente dans ce fichier (UCSS de LiteSpeed).
 */

.ecf {
	--ecf-accent: #1e3a8a;
	--ecf-accent-contrast: #ffffff;
	--ecf-cta: var(--ecf-accent);
	--ecf-cta-contrast: #ffffff;
	--ecf-ink: #0f172a;
	--ecf-text: #334155;
	--ecf-muted: #475569;
	--ecf-surface: #f4f5f9;
	--ecf-bg: #ffffff;
	--ecf-border: #d4d8e2;
	--ecf-error: #b42318;
	--ecf-success: #067647;
	--ecf-focus: var(--ecf-accent);
	--ecf-radius: 14px;
	--ecf-radius-btn: 999px;
	--ecf-font-heading: inherit;
	--ecf-font-body: inherit;
	--ecf-weight-heading: 800;
	--ecf-gap: 16px;

	display: block;
	max-width: 640px;
	margin: 0 auto;
	color: var(--ecf-text);
	font-family: var(--ecf-font-body);
	font-size: 16px;
	line-height: 1.5;
	text-align: left;
	box-sizing: border-box;
}
/* `.ecf` exclu : sinon cette règle écrase son border-box par le content-box du thème. */
.ecf *,
.ecf *::before,
.ecf *::after { box-sizing: inherit; }

.ecf-sr,
.ecf__live {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}
.ecf__hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.ecf [hidden] { display: none !important; }

.ecf__notice,
.ecf__alert {
	background: var(--ecf-surface);
	border-radius: var(--ecf-radius);
	padding: 14px var(--ecf-gap);
	margin: 0 0 var(--ecf-gap);
	color: var(--ecf-ink);
}
.ecf__alert { color: var(--ecf-error); font-weight: 600; }

/* Progression (F7) : une barre fine, sans total textuel */
.ecf__progress {
	height: 4px;
	margin: 0 0 28px;
	background: var(--ecf-surface);
	border-radius: 4px;
	overflow: hidden;
}
.ecf__progress-bar {
	height: 100%;
	width: var(--ecf-progress, 0%);
	background: var(--ecf-accent);
	border-radius: inherit;
	transition: width 150ms ease-out;
}

/* Résumé d'erreurs (F2) : seulement à partir de 3 champs, toujours avec une liste */
.ecf__summary {
	background: var(--ecf-surface);
	border-radius: var(--ecf-radius);
	padding: 14px var(--ecf-gap);
	margin: 0 0 20px;
	color: var(--ecf-ink);
	outline: none;
}
.ecf__summary-title { margin: 0; font-weight: 700; color: var(--ecf-error); }
.ecf__summary ul { display: flex; flex-wrap: wrap; gap: 0 20px; margin: 0; padding: 0; list-style: none; }
.ecf__summary li { margin: 0; }
/* Liens du résumé et « Envoyer sans JavaScript » : cibles de 48 px (liste, pas du texte courant) */
.ecf__summary a,
.ecf__retry a { display: inline-flex; align-items: center; min-height: 48px; }
.ecf__summary a { color: var(--ecf-error); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

/* Puces récapitulatives (F10) : une ligne, « Objet : Autre · Modifier » */
.ecf__chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 20px; }
.ecf__chip {
	display: inline-flex;
	align-items: center;
	max-width: 100%;
	min-height: 48px;
	padding: 0 6px 0 16px;
	background: var(--ecf-surface);
	border-radius: var(--ecf-radius-btn);
	color: var(--ecf-ink);
	font-size: 15px;
	white-space: nowrap;
}
.ecf__chip-text { overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.ecf__chip-sep { margin: 0 2px 0 8px; color: var(--ecf-muted); }
.ecf__chip-edit {
	flex: 0 0 auto;
	min-height: 48px;
	padding: 0 10px;
	border: 0;
	background: none;
	color: var(--ecf-accent);
	font: inherit;
	font-weight: 700;
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
}

/* Étapes : fondu de 150 ms à l'apparition (display none → block relance l'animation) */
.ecf--js.ecf--steps .ecf__step:not(.is-active),
.ecf--js.ecf--steps .ecf__step.is-skipped:not(.is-active) { display: none; }
.ecf__step.is-hidden,
.ecf__field.is-hidden { display: none !important; }
.ecf__step { border: 0; padding: 0; margin: 0 0 32px; min-width: 0; }
.ecf--js.ecf--steps .ecf__step.is-active { margin: 0; animation: ecf-in 150ms ease-out; }
@keyframes ecf-in { from { opacity: 0; } to { opacity: 1; } }
.ecf__legend { display: block; width: 100%; float: left; padding: 0; margin: 0 0 20px; }
.ecf__legend + * { clear: both; }
.ecf__step-title {
	margin: 0;
	font-family: var(--ecf-font-heading);
	font-weight: var(--ecf-weight-heading);
	font-size: clamp(22px, 20px + .5vw, 24px);
	line-height: 1.3;
	letter-spacing: -.01em;
	color: var(--ecf-ink);
}
/* F6 : focus programmatique après changement d'étape, jamais de contour */
.ecf__step-title:focus,
.ecf__step-title:focus-visible { outline: none !important; }
.ecf__step-desc { margin: -8px 0 20px; font-size: 16px; color: var(--ecf-muted); clear: both; }
.ecf__cond-label { margin: -8px 0 20px; font-size: 15px; color: var(--ecf-muted); clear: both; }
.ecf--js .ecf__cond-label { display: none; }

/* Champs : 52 px, 16 px minimum (pas de zoom iOS) */
.ecf__field { margin: 0 0 20px; }
.ecf__label { display: block; margin: 0 0 8px; font-weight: 600; color: var(--ecf-ink); }
.ecf__req { font-weight: 400; font-size: 14px; color: var(--ecf-muted); }
.ecf__hint { margin: -4px 0 8px; font-size: 15px; color: var(--ecf-muted); }
.ecf__field input:not([type="radio"]):not([type="checkbox"]),
.ecf__field select,
.ecf__field textarea {
	display: block;
	width: 100%;
	min-height: 52px;
	margin: 0;
	padding: 12px 16px;
	font: inherit;
	font-size: 16px;
	color: var(--ecf-ink);
	background: var(--ecf-bg);
	border: 1px solid var(--ecf-border);
	border-radius: var(--ecf-radius);
	box-shadow: none;
}
.ecf__field textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.ecf__field input:not([type="radio"]):not([type="checkbox"]):focus,
.ecf__field select:focus,
.ecf__field textarea:focus {
	border-color: var(--ecf-focus);
	outline: 2px solid var(--ecf-focus);
	outline-offset: -1px;
}
.ecf__field.is-error input:not([type="radio"]):not([type="checkbox"]),
.ecf__field.is-error select,
.ecf__field.is-error textarea { border-color: var(--ecf-error); }
.ecf__counter { margin: 6px 0 0; text-align: right; font-size: 13px; color: var(--ecf-muted); }
.ecf__error { margin: 8px 0 0; font-size: 15px; font-weight: 600; color: var(--ecf-error); }
.ecf__suggest {
	display: inline-block;
	min-height: 48px;
	margin: 8px 0 0;
	padding: 0 16px;
	border: 0;
	border-radius: var(--ecf-radius-btn);
	background: var(--ecf-surface);
	color: var(--ecf-ink);
	font: inherit;
	font-size: 15px;
	cursor: pointer;
}

/* Cases à cocher (champ checkbox, marketing) : cible de 48 px */
.ecf__checkbox,
.ecf__marketing {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	min-height: 48px;
	padding: 12px 0;
	cursor: pointer;
	color: var(--ecf-ink);
}
.ecf__checkbox input,
.ecf__marketing input {
	flex: 0 0 auto;
	width: 22px; height: 22px;
	margin: 1px 0 0;
	accent-color: var(--ecf-accent);
}

/* Cartes (F1, F3, F4) : emoji à gauche, titre au-dessus de la description */
.ecf__cards { display: grid; grid-template-columns: 1fr; gap: 10px; margin: 0; padding: 0; }
.ecf__card {
	position: relative;
	display: flex;
	align-items: center;
	gap: 14px;
	min-height: 60px;
	padding: 13px 17px;
	background: var(--ecf-bg);
	border: 1px solid var(--ecf-border);
	border-radius: var(--ecf-radius);
	color: var(--ecf-ink);
	cursor: pointer;
	transition: border-color 150ms ease, background-color 150ms ease;
}
.ecf__card:hover { border-color: var(--ecf-accent); }
.ecf__card-input {
	position: absolute;
	inset: 0;
	width: 100%; height: 100%;
	margin: 0;
	opacity: 0;
	cursor: pointer;
}
.ecf__card-emoji { flex: 0 0 auto; width: 32px; font-size: 28px; line-height: 1; text-align: center; }
.ecf__card-body { display: block; min-width: 0; }
.ecf__card-title { display: block; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.ecf__card-hint { display: block; margin-top: 2px; font-size: 15px; line-height: 1.4; color: var(--ecf-muted); }
.ecf__card.is-selected {
	padding: 12px 16px;
	border: 2px solid var(--ecf-accent);
	background: var(--ecf-surface);
}
/* Un seul contour, celui de la carte (F1) ; `.is-focus` = repli posé par le JS */
.ecf__card:has(.ecf__card-input:focus-visible),
.ecf__card.is-focus { outline: 2px solid var(--ecf-focus); outline-offset: 2px; }
.ecf__card-input:focus { outline: none; }

/* Navigation (F5) : Précédent à gauche en lien texte, action à droite */
.ecf__nav { display: flex; align-items: center; gap: 12px; margin-top: 28px; }
.ecf__consent + .ecf__nav { margin-top: 20px; }
.ecf:not(.ecf--js) .ecf__nav { display: none; }
.ecf__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 48px;
	padding: 0 24px;
	border: 0;
	border-radius: var(--ecf-radius-btn);
	background: var(--ecf-surface);
	color: var(--ecf-ink);
	font: inherit;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	transition: opacity 150ms ease;
}
.ecf__btn--next,
.ecf__btn--submit {
	min-height: 52px;
	min-width: 144px;
	margin-left: auto;
	padding: 0 28px;
	background: var(--ecf-cta);
	color: var(--ecf-cta-contrast);
}
.ecf__btn--next:hover,
.ecf__btn--submit:hover { opacity: .9; }
.ecf__btn--prev {
	padding: 0 2px;
	background: none;
	color: var(--ecf-muted);
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 3px;
}
.ecf__btn--prev:hover { color: var(--ecf-ink); }
.ecf__btn:focus-visible,
.ecf__chip-edit:focus-visible,
.ecf__suggest:focus-visible,
.ecf__summary a:focus-visible { outline: 2px solid var(--ecf-focus); outline-offset: 2px; }
.ecf__btn:disabled,
.ecf__btn.is-loading { opacity: .6; cursor: default; }

/* Mention RGPD (F5) : au-dessus de la barre, jamais entre deux boutons */
.ecf__consent { margin: 24px 0 0; font-size: 14px; line-height: 1.5; color: var(--ecf-muted); }
.ecf__notice-text { margin: 0; }
.ecf__consent a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.ecf__consent .ecf__marketing { font-size: 15px; }

/* Repli sans JS et affichage « single » : un seul bouton d'envoi, sous la mention */
.ecf__final { display: flex; flex-direction: column; align-items: stretch; gap: 20px; }
.ecf__final .ecf__consent { margin: 0; }
.ecf--js.ecf--steps .ecf__final { display: none; }

.ecf__retry,
.ecf__resume {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 16px;
	margin: 20px 0 0;
	padding: 14px var(--ecf-gap);
	background: var(--ecf-surface);
	border-radius: var(--ecf-radius);
	color: var(--ecf-ink);
}
.ecf__retry p,
.ecf__resume p { flex: 1 1 100%; margin: 0; font-weight: 600; }
.ecf__retry p { color: var(--ecf-error); }
.ecf__retry a { color: var(--ecf-accent); }
.ecf__resume { margin: 0 0 20px; }
.ecf__resume .ecf__btn,
.ecf__retry .ecf__btn { background: var(--ecf-bg); }
.is-resuming .ecf__step,
.is-resuming .ecf__progress { display: none !important; }

/* Confirmation (F9, inchangée) */
.ecf__success {
	padding: 40px var(--ecf-gap);
	background: var(--ecf-surface);
	border-radius: var(--ecf-radius);
	text-align: center;
	color: var(--ecf-ink);
	outline: none;
}
.ecf__success::before {
	content: "";
	display: block;
	width: 48px;
	height: 48px;
	margin: 0 auto 14px;
	border-radius: 50%;
	background: var(--ecf-accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 22px no-repeat;
}
.ecf__success-title {
	margin: 0 0 8px;
	font-family: var(--ecf-font-heading);
	font-size: 22px;
	font-weight: var(--ecf-weight-heading);
	color: var(--ecf-ink);
}
.ecf__success p:not(.ecf__success-title) { margin: 0; color: var(--ecf-muted); }
.ecf.is-sent .ecf__form { display: none; }

/* Page de prévisualisation isolée */
.ecf-preview-body { margin: 0; background: #ffffff; }
.ecf-preview { padding: 40px 16px; }

/* Au-delà de 560 px : deux colonnes de cartes si ≥ 4 options courtes (F3) */
@media (min-width: 560px) {
	.ecf__cards--2 { grid-template-columns: 1fr 1fr; }
	.ecf__final { align-items: flex-end; }
	.ecf__final .ecf__consent { align-self: stretch; }
}

@media (prefers-reduced-motion: reduce) {
	.ecf--js.ecf--steps .ecf__step.is-active,
	.ecf__progress-bar,
	.ecf__card,
	.ecf__btn { animation: none !important; transition: none !important; }
}
