/**
 * ==========================================================================
 * SCT PROD — CONTACT FORM
 * ==========================================================================
 *
 * Contact Form 7 integration
 * Reproduction du composant issu de la maquette SCT Prod.
 *
 * Scope volontairement limité à .sct-form afin de ne jamais impacter
 * un autre formulaire CF7 du site.
 */


/* ==========================================================================
   01. COMPONENT TOKENS
   ========================================================================== */

.sct-form {
	--sct-brand-50: #edeff5;
	--sct-brand-600: #203d85;
	--sct-brand-700: #1c3675;
	--sct-brand-800: #182e64;

	--sct-neutral-0: #ffffff;
	--sct-neutral-50: #f8fafc;
	--sct-neutral-200: #e2e8f0;
	--sct-neutral-300: #cbd5e1;
	--sct-neutral-400: #94a3b8;
	--sct-neutral-500: #64748b;
	--sct-neutral-600: #475569;
	--sct-neutral-900: #0f172a;

	--sct-success: #1e7a57;
	--sct-success-surface: #e7f4ee;

	--sct-error: #b42318;
	--sct-error-surface: #fcecea;

	--sct-radius-sm: 4px;
	--sct-radius-pill: 999px;

	--sct-transition:
		color 140ms cubic-bezier(.2, 0, 0, 1),
		background-color 140ms cubic-bezier(.2, 0, 0, 1),
		border-color 140ms cubic-bezier(.2, 0, 0, 1),
		box-shadow 140ms cubic-bezier(.2, 0, 0, 1);

	display: grid;

	/*
   * Valeur de la maquette :
   * espace entre les grands groupes fonctionnels du formulaire.
   */
	gap: 32px;

	width: 100%;
	min-width: 0;

	margin: 0;
	padding: 0;

	color: var(--sct-neutral-900);

	font-family:
		"Barlow",
		"Helvetica Neue",
		Arial,
		system-ui,
		sans-serif;

	font-size: 16px;
}


/* Normalisation locale uniquement. */

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


/**
 * IMPORTANT — Contact Form 7 peut injecter des <br>
 * depuis les retours à la ligne du template.
 *
 * Aucun <br> n'est fonctionnellement nécessaire dans ce composant :
 * on les neutralise.
 */

.sct-form br {
	display: none !important;
}


/*
 * Neutralise également les marges WordPress / Divi / CF7
 * susceptibles d'être injectées sur les paragraphes.
 */

.sct-form p {
	margin: 0;
}


/* ==========================================================================
   02. CF7 WRAPPERS
   ========================================================================== */

.sct-form .wpcf7-form-control-wrap {
	display: block;

	width: 100%;
	min-width: 0;

	margin: 0;
	padding: 0;
}


/*
 * On gère notre propre état de chargement.
 */

.sct-form .wpcf7-spinner {
	display: none !important;
}


/* ==========================================================================
   03. FIELDSET — TYPE DE BESOIN
   ========================================================================== */

.sct-form__fieldset {
	min-width: 0;

	margin: 0;
	padding: 0;

	border: 0;
}


.sct-form__legend {
	margin: 0;
	padding: 0;

	color: var(--sct-neutral-900);

	font-size: 18px;
	font-weight: 600;
	line-height: 1.3;
}


/* ==========================================================================
   04. RADIO PILLS
   ========================================================================== */

.sct-form__needs {
	margin-top: 16px;
}


.sct-form__needs-list.wpcf7-form-control {
	display: flex;
	flex-wrap: wrap;

	gap: 12px;

	margin: 0;
	padding: 0;
}


.sct-form__needs-list .wpcf7-list-item {
	margin: 0;
	padding: 0;
}


.sct-form__needs-list label {
	position: relative;

	display: block;

	margin: 0;
	padding: 0;

	cursor: pointer;
}


/**
 * Visually hidden.
 *
 * Le vrai input radio reste :
 * - focusable ;
 * - accessible au clavier ;
 * - disponible pour les lecteurs d'écran.
 */

.sct-form__needs-list input[type="radio"] {
	position: absolute;

	width: 1px;
	height: 1px;

	margin: 0;
	padding: 0;

	overflow: hidden;

	clip: rect(0 0 0 0);
	clip-path: inset(50%);

	white-space: nowrap;
}


.sct-form__needs-list .wpcf7-list-item-label {
	display: inline-flex;
	align-items: center;
	justify-content: center;

	gap: 8px;

	min-height: 44px;

	padding: 10px 18px;

	border: 1.5px solid var(--sct-neutral-300);
	border-radius: var(--sct-radius-pill);

	background: var(--sct-neutral-0);

	color: var(--sct-neutral-600);

	font-size: 15px;
	font-weight: 600;
	line-height: 1.2;

	white-space: nowrap;

	transition: var(--sct-transition);

	user-select: none;
}


.sct-form__needs-list label:hover .wpcf7-list-item-label {
	border-color: var(--sct-neutral-400);

	background: var(--sct-neutral-50);

	color: var(--sct-neutral-900);
}


.sct-form__needs-list input[type="radio"]:focus-visible+.wpcf7-list-item-label {
	border-color: var(--sct-brand-600);

	box-shadow:
		0 0 0 2px var(--sct-neutral-0),
		0 0 0 5px rgba(32, 61, 133, 0.35);
}


.sct-form__needs-list input[type="radio"]:checked+.wpcf7-list-item-label {
	border-color: var(--sct-brand-600);

	background: var(--sct-brand-50);

	color: var(--sct-brand-700);
}


.sct-form__needs-list input[type="radio"]:checked+.wpcf7-list-item-label::before {
	content: "";

	flex: 0 0 auto;

	width: 7px;
	height: 7px;

	border-radius: 50%;

	background: var(--sct-brand-600);
}


/* ==========================================================================
   05. TWO-COLUMN GRID
   ========================================================================== */

.sct-form__grid {
	display: grid;

	grid-template-columns: repeat(2, minmax(0, 1fr));

	/*
   * Valeur exacte du design :
   * --space-5 = 24px.
   */
	gap: 24px;

	width: 100%;
	min-width: 0;

	margin: 0;
	padding: 0;
}


/* ==========================================================================
   06. FIELDS
   ========================================================================== */

.sct-form__field {
	display: grid;

	/*
   * Valeur de la maquette originale.
   */
	gap: 6px;

	min-width: 0;

	margin: 0;
	padding: 0;
}


.sct-form__label {
	display: block;

	margin: 0;
	padding: 0;

	color: var(--sct-neutral-900);

	font-size: 15px;
	font-weight: 600;
	line-height: 1.35;
}


/* ==========================================================================
   07. INPUTS / TEXTAREA
   ========================================================================== */

.sct-form .wpcf7-form-control.sct-form__control {
	display: block;

	width: 100%;
	min-width: 0;

	/*
   * Hauteur exacte du standalone.
   */
	min-height: 48px;

	margin: 0;

	/*
   * Valeur exacte de la maquette.
   */
	padding: 12px 14px;

	appearance: none;

	border: 1.5px solid var(--sct-neutral-300);
	border-radius: var(--sct-radius-sm);

	outline: none;

	background: var(--sct-neutral-0);

	color: var(--sct-neutral-900);

	font-family:
		"Barlow",
		"Helvetica Neue",
		Arial,
		system-ui,
		sans-serif;

	font-size: 16px;
	font-weight: 400;
	line-height: 1.4;

	box-shadow: none;

	transition: var(--sct-transition);
}


.sct-form .wpcf7-form-control.sct-form__control:hover {
	border-color: var(--sct-neutral-400);
}


.sct-form .wpcf7-form-control.sct-form__control:focus,
.sct-form .wpcf7-form-control.sct-form__control:focus-visible {
	border-color: var(--sct-brand-600);

	outline: none;

	box-shadow:
		0 0 0 3px rgba(32, 61, 133, 0.16);
}


.sct-form .wpcf7-form-control.sct-form__control::placeholder {
	color: #7c8797;

	opacity: 1;
}


/* ==========================================================================
   08. TEXTAREA
   ========================================================================== */

/**
 * Le standalone utilise rows="5".
 *
 * CF7 génère sinon un textarea nettement plus haut.
 *
 * 5 lignes × line-height 25.6px
 * + padding vertical
 * + bordures
 * ≈ 155px.
 */

.sct-form textarea.wpcf7-form-control.sct-form__textarea {
	height: 155px;
	min-height: 155px;
	max-height: 360px;

	padding: 12px 14px;

	line-height: 1.6;

	resize: vertical;
}


/* ==========================================================================
   09. VALIDATION
   ========================================================================== */

.sct-form .wpcf7-form-control[aria-invalid="true"] {
	border-color: var(--sct-error);
}


.sct-form .wpcf7-not-valid-tip {
	display: block;

	margin: 6px 0 0;
	padding: 0;

	color: var(--sct-error);

	font-size: 13px;
	font-weight: 500;
	line-height: 1.4;
}


/* ==========================================================================
   10. ADDITIONAL DETAILS
   ========================================================================== */

.sct-form__more {
	margin: 0;

	/*
   * Valeur exacte du standalone.
   */
	padding-top: 16px;

	border-top: 1px solid var(--sct-neutral-200);
}


.sct-form__more-toggle {
	display: inline-flex;
	align-items: center;

	gap: 10px;

	min-height: 44px;

	margin: 0;
	padding: 0;

	appearance: none;

	border: 0;

	outline: none;

	background: none;

	color: var(--sct-brand-600);

	font-family:
		"Barlow",
		"Helvetica Neue",
		Arial,
		system-ui,
		sans-serif;

	font-size: 15px;
	font-weight: 600;
	line-height: 1.2;

	cursor: pointer;

	transition:
		color 140ms cubic-bezier(.2, 0, 0, 1);
}


.sct-form__more-toggle:hover {
	color: var(--sct-brand-700);
}


.sct-form__more-toggle:focus-visible {
	border-radius: 3px;

	outline: 3px solid rgba(32, 61, 133, 0.3);
	outline-offset: 4px;
}


/* ==========================================================================
   11. PLUS / CROSS ICON
   ========================================================================== */

/**
 * On ne dépend pas du glyphe "+" de Barlow :
 * il est dessiné géométriquement en CSS.
 */

.sct-form__more-icon {
	position: relative;

	display: inline-flex;

	flex: 0 0 22px;

	width: 22px;
	height: 22px;

	border: 1.5px solid currentColor;
	border-radius: 50%;

	font-size: 0;
	line-height: 0;

	transition:
		transform 220ms cubic-bezier(.16, 1, .3, 1);
}


.sct-form__more-icon::before,
.sct-form__more-icon::after {
	content: "";

	position: absolute;

	top: 50%;
	left: 50%;

	width: 9px;
	height: 1.5px;

	border-radius: 999px;

	background: currentColor;

	transform: translate(-50%, -50%);
}


.sct-form__more-icon::after {
	transform:
		translate(-50%, -50%) rotate(90deg);
}


.sct-form__more-toggle[aria-expanded="true"] .sct-form__more-icon {
	transform: rotate(45deg);
}


/* ==========================================================================
   12. DISCLOSURE PANEL
   ========================================================================== */

.sct-form__more-panel {
	margin-top: 24px;

	animation:
		sct-form-reveal 220ms cubic-bezier(.16, 1, .3, 1) both;
}


.sct-form__more-panel[hidden] {
	display: none !important;
}


@keyframes sct-form-reveal {

	from {
		opacity: 0;

		transform: translateY(-6px);
	}

	to {
		opacity: 1;

		transform: translateY(0);
	}

}


/* ==========================================================================
   13. FOOTER
   ========================================================================== */

.sct-form__footer {
	display: flex;
	flex-wrap: wrap;
	align-items: center;

	/*
   * Valeur originale :
   * --space-5 = 24px.
   */
	gap: 24px;

	width: 100%;

	margin: 0;
	padding: 0;
}


/* ==========================================================================
   14. SUBMIT BUTTON
   ========================================================================== */

.sct-form button.sct-form__submit {
	position: relative;

	display: inline-flex;
	align-items: center;
	justify-content: center;

	gap: 16px;

	width: auto;
	min-width: 0;

	/*
   * Button lg du Design System.
   */
	height: 52px;
	min-height: 52px;

	margin: 0;

	padding: 0 24px;

	appearance: none;

	border: 1px solid var(--sct-brand-600);
	border-radius: var(--sct-radius-sm);

	outline: none;

	background: var(--sct-brand-600);

	color: #ffffff;

	font-family:
		"Barlow",
		"Helvetica Neue",
		Arial,
		system-ui,
		sans-serif;

	font-size: 15px;
	font-weight: 600;
	line-height: 1;

	white-space: nowrap;

	cursor: pointer;

	box-shadow: none;

	transition:
		background-color 140ms cubic-bezier(.2, 0, 0, 1),
		border-color 140ms cubic-bezier(.2, 0, 0, 1),
		transform 140ms cubic-bezier(.2, 0, 0, 1),
		box-shadow 140ms cubic-bezier(.2, 0, 0, 1);
}


.sct-form button.sct-form__submit:hover:not(:disabled) {
	border-color: var(--sct-brand-700);

	background: var(--sct-brand-700);

	transform: translateY(-1px);
}


.sct-form button.sct-form__submit:active:not(:disabled) {
	border-color: var(--sct-brand-800);

	background: var(--sct-brand-800);

	transform: translateY(0);
}


.sct-form button.sct-form__submit:focus-visible {
	box-shadow:
		0 0 0 2px var(--sct-neutral-0),
		0 0 0 5px rgba(32, 61, 133, 0.4);
}


.sct-form button.sct-form__submit:disabled {
	cursor: wait;

	opacity: 0.75;
}


.sct-form__submit-arrow {
	display: block;

	flex: 0 0 auto;

	width: 20px;
	height: 20px;

	transition:
		transform 220ms cubic-bezier(.16, 1, .3, 1);
}


.sct-form button.sct-form__submit:hover:not(:disabled) .sct-form__submit-arrow {
	transform: translateX(3px);
}


/* ==========================================================================
   15. SUBMIT LOADER
   ========================================================================== */

.sct-form__submit-spinner {
	display: none;

	flex: 0 0 auto;

	width: 18px;
	height: 18px;

	border: 2px solid rgba(255, 255, 255, 0.35);
	border-top-color: #ffffff;
	border-radius: 50%;

	animation:
		sct-form-spin 700ms linear infinite;
}


.sct-form.is-submitting .sct-form__submit-arrow {
	display: none;
}


.sct-form.is-submitting .sct-form__submit-spinner {
	display: block;
}


@keyframes sct-form-spin {

	to {
		transform: rotate(360deg);
	}

}


/* ==========================================================================
   16. PRIVACY MESSAGE
   ========================================================================== */

.sct-form__privacy {
	display: block;

	/*
   * Valeur originale du standalone.
   */
	max-width: 40ch;

	margin: 0;
	padding: 0;

	color: var(--sct-neutral-500);

	font-size: 13px;
	font-weight: 400;
	line-height: 1.5;
}


/**
 * Très important :
 *
 * CF7 peut ajouter un <br> entre le texte et le lien à cause
 * du retour à la ligne présent dans l'éditeur du formulaire.
 */

.sct-form__privacy br {
	display: none !important;
}


.sct-form__privacy a {
	display: inline;

	margin: 0;
	padding: 0;

	color: var(--sct-neutral-500);

	text-decoration-line: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 2px;

	transition:
		color 140ms cubic-bezier(.2, 0, 0, 1);
}


.sct-form__privacy a:hover {
	color: var(--sct-brand-600);
}


/* ==========================================================================
   17. CF7 RESPONSE OUTPUT
   ========================================================================== */

.wpcf7 form .wpcf7-response-output {
	margin: 24px 0 0 !important;

	padding: 14px 16px !important;

	border: 1px solid var(--sct-neutral-300) !important;
	border-radius: var(--sct-radius-sm);

	font-family:
		"Barlow",
		"Helvetica Neue",
		Arial,
		system-ui,
		sans-serif;

	font-size: 15px;
	font-weight: 500;
	line-height: 1.5;
}


.wpcf7 form.sent .wpcf7-response-output {
	border-color: rgba(30, 122, 87, 0.28) !important;

	background: var(--sct-success-surface);

	color: var(--sct-success);
}


.wpcf7 form.invalid .wpcf7-response-output,
.wpcf7 form.failed .wpcf7-response-output,
.wpcf7 form.spam .wpcf7-response-output,
.wpcf7 form.unaccepted .wpcf7-response-output {
	border-color: rgba(180, 35, 24, 0.28) !important;

	background: var(--sct-error-surface);

	color: var(--sct-error);
}


/* ==========================================================================
   18. RESPONSIVE — TABLET / MOBILE
   ========================================================================== */

@media (max-width: 720px) {

	.sct-form {
		gap: 28px;
	}


	.sct-form__grid {
		grid-template-columns: 1fr;

		gap: 20px;
	}


	.sct-form__needs-list.wpcf7-form-control {
		gap: 10px;
	}


	.sct-form__needs-list .wpcf7-list-item-label {
		min-height: 44px;

		padding: 9px 16px;
	}


	.sct-form__footer {
		align-items: flex-start;

		gap: 18px;
	}

}


/* ==========================================================================
   19. RESPONSIVE — SMALL MOBILE
   ========================================================================== */

@media (max-width: 520px) {

	.sct-form__needs-list.wpcf7-form-control {
		display: grid;

		grid-template-columns: 1fr;
	}


	.sct-form__needs-list .wpcf7-list-item {
		width: 100%;
	}


	.sct-form__needs-list label {
		width: 100%;
	}


	.sct-form__needs-list .wpcf7-list-item-label {
		width: 100%;

		justify-content: flex-start;
	}


	.sct-form__footer {
		display: grid;

		grid-template-columns: 1fr;

		width: 100%;
	}


	.sct-form button.sct-form__submit {
		width: 100%;
	}


	.sct-form__privacy {
		max-width: none;
	}

}


/* ==========================================================================
   20. REDUCED MOTION
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {

	.sct-form *,
	.sct-form *::before,
	.sct-form *::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;

		transition-duration: 0.01ms !important;

		scroll-behavior: auto !important;
	}

}

/* ==========================================================================
   21. CLOUDFLARE TURNSTILE
   ========================================================================== */

/**
 * Le widget est volontairement placé à l'intérieur du bloc
 * "Ajouter des précisions" afin de ne pas créer un nouvel item
 * dans la grille principale .sct-form.
 *
 * En mode interaction-only, Turnstile ne doit avoir aucun impact
 * visuel tant qu'aucune interaction n'est nécessaire.
 */

.sct-form__turnstile {
	width: 100%;
	max-width: 100%;

	margin: 0;
	padding: 0;
}


/**
 * CF7 / Cloudflare injectent le widget dans ce conteneur.
 *
 * Si un challenge devient visible, il ne doit jamais dépasser
 * la largeur disponible, notamment sur mobile.
 */

.sct-form__turnstile .cf-turnstile,
.sct-form__turnstile iframe {
	max-width: 100%;
}