/*
 * Passe 41 (19/11/2026, demande du client) : « Sur Se connecter, dans la validation du panier et partout où le client
 * doit remplir une information (adresse e-mail, adresse de livraison, autre), mets le même motion design que dans la
 * partie Contact, Nous écrire : quand on clique par exemple sur Nom, Prénom, je veux le même effet sur tout le site. »
 *
 * L'effet de référence est celui des champs de Contact (passe 21 de style.css, retours du 15/11), repris ici à
 * l'identique, sans toucher à Contact :
 *  - champ d'une ligne souligné d'un filet gris chaud (#8E867B, 5,3 pour 1 sur le fond : WCAG 1.4.11), voile blanc à
 *    2,5 %, texte blanc ; au focus, un trait or de 3 px se trace du centre vers les bords (dégradé or clair vers or,
 *    0,6 s), le champ se teinte d'or à 7 %, un halo doré passe sous le trait, le filet devient or ;
 *  - étiquette en Lato 12 px, capitales espacées (0,22 em), ivoire ; au focus du champ, elle passe à l'or clair avec
 *    un halo et monte de 0,2 rem (transformation seule : rien ne bouge autour) ;
 *  - zone de texte dans un cadre gris chaud doublé d'un second filet à 4 px ; au focus, cadre or plein, lueur, teinte ;
 *  - coche or quand un champ obligatoire est bien rempli (:user-valid, seulement après la saisie du visiteur), qui
 *    apparaît en grandissant ; ici dessinée dans le fond du champ, ce qui la place au bon endroit dans tous les
 *    formulaires (WooCommerce en blocs ou classiques, formulaires de l'extension) sans élément ajouté ;
 *  - le contour carré de focus du thème (3 px or) est remplacé, pour ces champs seulement, par cet ensemble ; un contour
 *    transparent est gardé pour le mode couleurs forcées (où il est redessiné).
 *
 * Où : Mon compte (connexion, inscription si elle est ouverte un jour, mot de passe perdu et nouveau mot de passe,
 * détails du compte, adresses), panier (calcul des frais de livraison, code promo quand les codes seront activés),
 * page Commande (e-mail, adresses de livraison et de facturation, pays, note de commande, code promo), formulaires de
 * l'extension autres que Contact (Devenir revendeur), avis des produits et commentaires (fermés aujourd'hui), champs de
 * recherche (pied de page, page de résultats, Systèmes clients, Actualités : trait, halo et étiquette seulement, leur
 * cadre est gardé). Le site n'a pas de lettre d'information.
 * Pas repris : l'entrée en cascade des lignes du formulaire de Contact (elle joue au chargement, ce que la passe 32
 * réserve aux éléments qui arrivent du bas de l'écran, et les blocs Panier et Commande se redessinent à chaque saisie).
 * WooCommerce en blocs : l'étiquette est posée dans le champ et monte d'elle-même quand il est actif ; elle prend la
 * couleur et le halo, sans montée de plus.
 * Mouvement réduit : rien ne se trace ni ne monte, la couleur seule signale le focus. Couleurs forcées : contour du
 * système au focus.
 * Retour arrière : supprimer cette feuille.
 */

:root {
	--champ-or: var(--wp--preset--color--or);
	--champ-or-clair: var(--wp--preset--color--or-clair);
	--champ-blanc: var(--wp--preset--color--blanc);
	--champ-ivoire: #ECE5D8;
	--champ-gris-chaud: #8E867B;
	--champ-gris-chaud-doux: #4A453F;
	--champ-voile: rgb(255 255 255 / 0.025);
	--champ-teinte: color-mix(in srgb, var(--wp--preset--color--or) 7%, transparent);
	--champ-halo: 0 0.75rem 1.1rem -0.9rem color-mix(in srgb, var(--wp--preset--color--or) 85%, transparent);
	--champ-courbe: cubic-bezier(0.2, 0.7, 0.2, 1);
	--champ-trait: linear-gradient(var(--wp--preset--color--or-clair), var(--wp--preset--color--or));
	--champ-coche: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8.5l3.2 3L13 4.5' fill='none' stroke='%23E6B10C' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	--champ-erreur: #FF8A80;
}

/* ------------------------------------------------------------------------------------------------------------------
 * 1. Champs d'une ligne : formulaires classiques de WooCommerce (Mon compte), blocs Panier et Commande, formulaires
 *    de l'extension hors Contact, avis et commentaires.
 * ------------------------------------------------------------------------------------------------------------------ */
body .woocommerce form .form-row input.input-text:not([type="checkbox"]):not([type="radio"]),
body .has-dark-controls .wc-block-components-text-input input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
body .lf:not(.lf-contact) .lf-champ input:is([type="text"], [type="email"], [type="tel"], [type="url"]),
body .comment-form input:is([type="text"], [type="email"], [type="url"]) {
	min-height: 3.5rem;
	padding-right: 2.25rem;
	border: 0;
	border-bottom: 1px solid var(--champ-gris-chaud);
	border-radius: var(--legato-rayon, 2px) var(--legato-rayon, 2px) 0 0;
	background-color: var(--champ-voile);
	background-image: var(--champ-trait), var(--champ-coche);
	background-position: 50% 100%, right 0.75rem center;
	background-size: 0 3px, 0 0;
	background-repeat: no-repeat;
	box-shadow: none;
	color: var(--champ-blanc);
	transition: background-size 0.6s var(--champ-courbe), background-color 0.35s ease, border-color 0.35s ease, box-shadow 0.6s ease;
}

/* Formulaires classiques et de l'extension : étiquette au-dessus, champ plus généreux (texte de 20 px comme Contact,
 * 18 px sur téléphone). Les blocs de WooCommerce gardent leur hauteur et leur étiquette posée dans le champ. */
body .woocommerce form .form-row input.input-text:not([type="checkbox"]):not([type="radio"]),
body .lf:not(.lf-contact) .lf-champ input:is([type="text"], [type="email"], [type="tel"], [type="url"]),
body .comment-form input:is([type="text"], [type="email"], [type="url"]) {
	padding-top: 0.55em;
	padding-bottom: 0.45em;
	padding-left: 0.6rem;
	font-size: 1.25rem;
}

@media (max-width: 599.98px) {
	body .woocommerce form .form-row input.input-text:not([type="checkbox"]):not([type="radio"]),
	body .lf:not(.lf-contact) .lf-champ input:is([type="text"], [type="email"], [type="tel"], [type="url"]),
	body .comment-form input:is([type="text"], [type="email"], [type="url"]) {
		font-size: 1.125rem;
	}
}

/* Blocs Panier et Commande : même hauteur que Contact, l'étiquette posée dans le champ garde sa place en haut. */
body .has-dark-controls .wc-block-components-text-input input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]) {
	height: 3.5rem;
	padding-left: 0.6rem;
}

/* Au focus : trait or tracé du centre vers les bords, teinte et halo. */
body .woocommerce form .form-row input.input-text:not([type="checkbox"]):not([type="radio"]):focus,
body .has-dark-controls .wc-block-components-text-input input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):focus,
body .lf:not(.lf-contact) .lf-champ input:is([type="text"], [type="email"], [type="tel"], [type="url"]):focus,
body .comment-form input:is([type="text"], [type="email"], [type="url"]):focus {
	border-bottom-color: var(--champ-or);
	background-color: var(--champ-teinte);
	background-size: 100% 3px, 0 0;
	box-shadow: var(--champ-halo);
	color: var(--champ-blanc);
}

/* Coche or : champ obligatoire bien rempli par le visiteur (jamais sur un champ prérempli qu'il n'a pas touché, ni sur
 * un champ signalé en erreur, ni sur un mot de passe, où se trouve le bouton « Afficher »). Décorative ; aucun texte. */
body .woocommerce form .form-row:not(.woocommerce-invalid) input.input-text:not([type="checkbox"]):not([type="radio"]):not([type="password"]):required:user-valid,
body .has-dark-controls .wc-block-components-text-input:not(.has-error) input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="password"]):required:user-valid,
body .lf:not(.lf-contact) .lf-champ input:is([type="text"], [type="email"], [type="tel"], [type="url"]):not([aria-invalid="true"]):required:user-valid,
body .comment-form input:is([type="text"], [type="email"], [type="url"]):required:user-valid {
	background-size: 0 3px, 1rem 1rem;
}

body .woocommerce form .form-row:not(.woocommerce-invalid) input.input-text:not([type="checkbox"]):not([type="radio"]):not([type="password"]):required:user-valid:focus,
body .has-dark-controls .wc-block-components-text-input:not(.has-error) input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="password"]):required:user-valid:focus,
body .lf:not(.lf-contact) .lf-champ input:is([type="text"], [type="email"], [type="tel"], [type="url"]):not([aria-invalid="true"]):required:user-valid:focus,
body .comment-form input:is([type="text"], [type="email"], [type="url"]):required:user-valid:focus {
	background-size: 100% 3px, 1rem 1rem;
}

/* ------------------------------------------------------------------------------------------------------------------
 * 2. Listes de choix (pays) : même filet, même trait. Bloc Commande : le cadre est porté par le conteneur, la liste y
 *    est transparente ; ailleurs, par la liste elle-même (flèche du navigateur gardée).
 * ------------------------------------------------------------------------------------------------------------------ */
body .has-dark-controls .wc-blocks-components-select .wc-blocks-components-select__container,
body .woocommerce form .form-row select,
body .lf:not(.lf-contact) .lf-champ select {
	min-height: 3.5rem;
	border: 0;
	border-bottom: 1px solid var(--champ-gris-chaud);
	border-radius: var(--legato-rayon, 2px) var(--legato-rayon, 2px) 0 0;
	background-color: var(--champ-voile);
	background-image: var(--champ-trait);
	background-position: 50% 100%;
	background-size: 0 3px;
	background-repeat: no-repeat;
	box-shadow: none;
	color: var(--champ-blanc);
	transition: background-size 0.6s var(--champ-courbe), background-color 0.35s ease, border-color 0.35s ease, box-shadow 0.6s ease;
}

body .woocommerce form .form-row select,
body .lf:not(.lf-contact) .lf-champ select {
	padding: 0.55em 0.6rem 0.45em;
	font-size: 1.125rem;
}

body .has-dark-controls .wc-blocks-components-select .wc-blocks-components-select__select,
body .has-dark-controls .wc-blocks-components-select .wc-blocks-components-select__select:focus {
	height: 3.5rem;
	padding-left: 0.6rem;
	border: 0;
	background: transparent;
	box-shadow: none;
	color: var(--champ-blanc);
}

body .has-dark-controls .wc-blocks-components-select .wc-blocks-components-select__container:focus-within,
body .woocommerce form .form-row select:focus,
body .lf:not(.lf-contact) .lf-champ select:focus {
	border-bottom-color: var(--champ-or);
	background-color: var(--champ-teinte);
	background-size: 100% 3px;
	box-shadow: var(--champ-halo);
}

/* Liste ouverte : options sur le fond des champs du thème (et non le blanc du système). */
body :is(.wc-blocks-components-select__select, .woocommerce form .form-row select, .lf:not(.lf-contact) .lf-champ select) option {
	background-color: var(--wp--preset--color--anthracite);
	color: var(--champ-blanc);
}

/* ------------------------------------------------------------------------------------------------------------------
 * 3. Zones de texte : note de commande, message (Devenir revendeur), avis.
 * ------------------------------------------------------------------------------------------------------------------ */
body .has-dark-controls textarea.wc-block-components-textarea,
body .woocommerce form .form-row textarea,
body .lf:not(.lf-contact) .lf-champ textarea,
body .comment-form textarea {
	padding: 1rem 1.1rem;
	border: 1px solid var(--champ-gris-chaud);
	border-radius: var(--legato-rayon, 2px);
	outline: 1px solid var(--champ-gris-chaud-doux);
	outline-offset: 4px;
	background-color: var(--champ-voile);
	box-shadow: none;
	font-size: 1.125rem;
	line-height: 1.6;
	color: var(--champ-blanc);
	transition: border-color 0.35s ease, box-shadow 0.35s ease, background-color 0.35s ease;
}

/* La note de commande n'occupe pas la hauteur d'un message : l'air autour du cadre doublé lui suffit. */
body .has-dark-controls textarea.wc-block-components-textarea {
	margin-top: 1rem;
	font-size: 1rem;
}

/* Texte d'exemple : le gris des champs du thème (6,6 pour 1), et non la couleur du texte que WooCommerce lui donne. */
body .has-dark-controls textarea.wc-block-components-textarea::placeholder {
	color: #9A9A9A;
	opacity: 1;
}

body .has-dark-controls textarea.wc-block-components-textarea:focus,
body .woocommerce form .form-row textarea:focus,
body .lf:not(.lf-contact) .lf-champ textarea:focus,
body .comment-form textarea:focus {
	border-color: var(--champ-or);
	box-shadow: inset 0 0 0 1px var(--champ-or), 0 0 1.4rem -0.6rem color-mix(in srgb, var(--champ-or) 60%, transparent);
	background-color: color-mix(in srgb, var(--champ-or) 4%, transparent);
	color: var(--champ-blanc);
}

/* ------------------------------------------------------------------------------------------------------------------
 * 4. Focus : l'ensemble trait, teinte et étiquette remplace le contour carré de 3 px du thème (WCAG 2.4.7) ; le cadre
 *    or plein le remplace sur les zones de texte. Contour transparent gardé pour le mode couleurs forcées.
 * ------------------------------------------------------------------------------------------------------------------ */
body .woocommerce form .form-row :is(input.input-text, select):focus-visible,
body .has-dark-controls .wc-block-components-text-input input:focus-visible,
body .has-dark-controls .wc-blocks-components-select__select:focus-visible,
body .lf:not(.lf-contact) .lf-champ :is(input, select):focus-visible,
body .comment-form :is(input[type="text"], input[type="email"], input[type="url"]):focus-visible {
	outline: 1px solid transparent !important;
	outline-offset: 0 !important;
}

body .has-dark-controls textarea.wc-block-components-textarea:focus-visible,
body .woocommerce form .form-row textarea:focus-visible,
body .lf:not(.lf-contact) .lf-champ textarea:focus-visible,
body .comment-form textarea:focus-visible {
	outline: 1px solid transparent !important;
	outline-offset: 4px !important;
}

/* ------------------------------------------------------------------------------------------------------------------
 * 5. Étiquettes.
 * ------------------------------------------------------------------------------------------------------------------ */

/* Au-dessus du champ (formulaires classiques, extension, avis) : l'écriture des étiquettes de Contact. */
body .woocommerce form .form-row > label:not(.woocommerce-form__label-for-checkbox, .checkbox),
body .lf:not(.lf-contact) .lf-champ > label,
body .comment-form > p:not(.comment-form-cookies-consent) > label {
	display: block;
	width: fit-content;
	margin-bottom: 0.45rem;
	font-family: var(--wp--preset--font-family--lato);
	font-size: 0.75rem;
	font-weight: 400;
	line-height: 1.4;
	letter-spacing: 0.22em;
	text-transform: uppercase;
	color: var(--champ-ivoire);
	transition: color 0.35s ease, transform 0.45s var(--champ-courbe), text-shadow 0.45s ease;
}

body .woocommerce form .form-row:focus-within > label:not(.woocommerce-form__label-for-checkbox, .checkbox),
body .lf:not(.lf-contact) .lf-champ:focus-within > label,
body .comment-form > p:not(.comment-form-cookies-consent):focus-within > label {
	color: var(--champ-or-clair);
	text-shadow: 0 0 0.9rem color-mix(in srgb, var(--champ-or) 55%, transparent);
	transform: translateY(-0.2rem);
}

/* Dans le champ (blocs Panier et Commande) : ivoire au repos, or clair et halo au focus ; la montée reste celle de
 * WooCommerce (l'étiquette passe en haut du champ dès qu'il est actif). */
body .has-dark-controls .wc-block-components-text-input.wc-block-components-text-input label,
body .has-dark-controls .wc-blocks-components-select .wc-blocks-components-select__label {
	left: 0.6rem;
	color: var(--champ-ivoire);
	transition: transform 0.2s ease, color 0.35s ease, text-shadow 0.45s ease;
}

body .has-dark-controls .wc-block-components-text-input.wc-block-components-text-input:focus-within label,
body .has-dark-controls .wc-blocks-components-select:focus-within .wc-blocks-components-select__label {
	color: var(--champ-or-clair);
	text-shadow: 0 0 0.9rem color-mix(in srgb, var(--champ-or) 55%, transparent);
}

/* ------------------------------------------------------------------------------------------------------------------
 * 6. Erreurs : le rouge de l'extension (#FF8A80, 8 pour 1 sur le fond), filet de 2 px, toujours avec le message de
 *    WooCommerce ou de l'extension ; il passe devant le trait or, même au focus.
 * ------------------------------------------------------------------------------------------------------------------ */
body .woocommerce form .form-row.woocommerce-invalid input.input-text:not([type="checkbox"]):not([type="radio"]),
body .woocommerce form .form-row.woocommerce-invalid input.input-text:not([type="checkbox"]):not([type="radio"]):focus,
body .woocommerce form .form-row.woocommerce-invalid select,
body .has-dark-controls .wc-block-components-text-input.has-error input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
body .has-dark-controls .wc-block-components-text-input.has-error input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):focus,
body .has-dark-controls .has-error .wc-blocks-components-select .wc-blocks-components-select__container,
body .has-dark-controls .wc-blocks-components-select.has-error .wc-blocks-components-select__container,
body .lf:not(.lf-contact) .lf-champ input:is([type="text"], [type="email"], [type="tel"], [type="url"])[aria-invalid="true"],
body .lf:not(.lf-contact) .lf-champ input:is([type="text"], [type="email"], [type="tel"], [type="url"])[aria-invalid="true"]:focus,
body .lf:not(.lf-contact) .lf-champ select[aria-invalid="true"] {
	border-bottom: 2px solid var(--champ-erreur);
}

body .has-dark-controls .wc-block-components-text-input.has-error label,
body .has-dark-controls .has-error .wc-blocks-components-select .wc-blocks-components-select__label,
body .has-dark-controls .wc-block-components-validation-error,
body .woocommerce form .form-row.woocommerce-invalid > label:not(.woocommerce-form__label-for-checkbox, .checkbox) {
	color: var(--champ-erreur);
}

body .lf:not(.lf-contact) .lf-champ textarea[aria-invalid="true"] {
	border-color: var(--champ-erreur);
	border-width: 2px;
	outline-color: rgb(255 138 128 / 0.3);
}

/* ------------------------------------------------------------------------------------------------------------------
 * 7. Recherche (pied de page, page de résultats, Systèmes clients, Actualités) : leur cadre est gardé ; au focus, le
 *    même trait or se trace sous le texte, avec le halo, et l'étiquette visible passe à l'or clair.
 * ------------------------------------------------------------------------------------------------------------------ */
body .wp-block-search .wp-block-search__input {
	background-image: var(--champ-trait);
	background-position: 50% 100%;
	background-size: 0 3px;
	background-repeat: no-repeat;
	transition: background-size 0.6s var(--champ-courbe), background-color 0.35s ease, border-color 0.35s ease, box-shadow 0.6s ease;
}

body .wp-block-search .wp-block-search__input:focus {
	background-size: 100% 3px;
	box-shadow: var(--champ-halo);
}

body .wp-block-search:not(.pied-de-page *) .wp-block-search__input:focus {
	border-color: var(--champ-or);
	background-color: var(--champ-teinte);
}

body .recherche-systemes input[type="search"],
body .recherche-actualites input[type="search"] {
	background-image:
		var(--champ-trait),
		url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23E6B10C' stroke-width='1.6' stroke-linecap='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5'/%3E%3Cpath d='m15.5 15.5 5 5'/%3E%3C/svg%3E"),
		linear-gradient(180deg, #1C1D21, #141518);
	background-position: 50% 100%, 1rem 50%, 0 0;
	background-size: 0 3px, 1.05rem, auto;
	background-repeat: no-repeat;
	transition: background-size 0.6s var(--champ-courbe), border-color 0.3s ease, box-shadow 0.6s ease;
}

body .recherche-actualites input[type="search"] {
	background-size: 0 3px, 1.15rem, auto;
}

body .recherche-systemes input[type="search"]:focus {
	background-size: 100% 3px, 1.05rem, auto;
}

body .recherche-actualites input[type="search"]:focus {
	background-size: 100% 3px, 1.15rem, auto;
}

body :is(.recherche-systemes, .recherche-actualites) input[type="search"]:focus {
	border-color: var(--champ-or);
	box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.04), var(--champ-halo), 0 0.6rem 1.5rem rgb(0 0 0 / 0.32);
}

body .wp-block-search .wp-block-search__input:focus-visible,
body :is(.recherche-systemes, .recherche-actualites) input[type="search"]:focus-visible {
	outline: 1px solid transparent !important;
	outline-offset: 0 !important;
}

body :is(.recherche-systemes, .recherche-actualites) label {
	transition: color 0.35s ease, text-shadow 0.45s ease;
}

body :is(.recherche-systemes, .recherche-actualites):focus-within label {
	color: var(--champ-or-clair);
	text-shadow: 0 0 0.9rem color-mix(in srgb, var(--champ-or) 55%, transparent);
}


/* ------------------------------------------------------------------------------------------------------------------
 * 8. Mouvement réduit : rien ne se trace, ne grandit ni ne monte ; l'état final est donné d'emblée (trait entier et
 *    étiquette or au focus, coche posée), la couleur seule signale le focus. Les sélecteurs des sections 1 à 7 sont
 *    plus précis : la coupure des transitions passe par !important.
 * ------------------------------------------------------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
	body .woocommerce form .form-row :is(input, select, textarea, label),
	body .has-dark-controls :is(.wc-block-components-text-input input, .wc-block-components-text-input label, .wc-blocks-components-select__container, .wc-blocks-components-select__label, textarea.wc-block-components-textarea),
	body .lf:not(.lf-contact) .lf-champ :is(input, select, textarea, label),
	body .comment-form :is(input, textarea, label),
	body .wp-block-search .wp-block-search__input,
	body :is(.recherche-systemes, .recherche-actualites) :is(input, label) {
		transition: none !important;
	}

	body .woocommerce form .form-row:focus-within > label:not(.woocommerce-form__label-for-checkbox, .checkbox),
	body .lf:not(.lf-contact) .lf-champ:focus-within > label,
	body .comment-form > p:not(.comment-form-cookies-consent):focus-within > label {
		transform: none;
	}
}

/* Couleurs forcées : le contour transparent du focus est redessiné par le navigateur ; on le rend plus épais. Mêmes
 * sélecteurs que la section 4, précédés de html pour passer devant. */
@media (forced-colors: active) {
	html body .woocommerce form .form-row :is(input.input-text, select, textarea):focus-visible,
	html body .has-dark-controls .wc-block-components-text-input input:focus-visible,
	html body .has-dark-controls .wc-blocks-components-select__select:focus-visible,
	html body .has-dark-controls textarea.wc-block-components-textarea:focus-visible,
	html body .lf:not(.lf-contact) .lf-champ :is(input, select, textarea):focus-visible,
	html body .comment-form :is(input[type="text"], input[type="email"], input[type="url"], textarea):focus-visible,
	html body .wp-block-search .wp-block-search__input:focus-visible,
	html body :is(.recherche-systemes, .recherche-actualites) input[type="search"]:focus-visible {
		outline: 2px solid Highlight !important;
		outline-offset: 2px !important;
	}
}
