/* Formulaires — Update 121. Classes globales (.field .label .input .select .textarea .choice .switch .field__hint .field__error)
   ET sélecteurs d'éléments sous .dlm-form (WooCommerce, formulaires des lots : poser class="dlm-form" sur le <form> ou son conteneur).
   Champ 52 px, ≥ 16 px (zoom iOS), porcelaine + filet 1 px --line-strong, radius 2 px. Cases/radios 24 px dans une zone de tap 44 px.
   Erreur : .is-invalid ou [aria-invalid="true"] = filet + liseré --danger ; message .field__error (role="alert" posé par le JS existant) + icône jamais seule. */
.field { display: flex; flex-direction: column; gap: var(--s-2); margin: 0 0 var(--s-4); min-width: 0; }
.label,
.dlm-form label { color: var(--fg); font-size: 0.8125rem; font-weight: 600; line-height: 1.35; }
.label .req, .dlm-form label .required { color: var(--danger-ink); text-decoration: none; }
.field__hint { margin: 0; color: var(--fg-3); font-size: var(--fs-small); }
.field__error,
.dlm-form .woocommerce-error,
.dlm-form [role='alert'] { margin: 0; color: var(--danger-ink); font-size: var(--fs-small); font-weight: 600; }

.input,
.select,
.textarea,
.dlm-form :is(input:not([type='checkbox'], [type='radio'], [type='hidden'], [type='submit'], [type='button'], [type='range'], [type='file'], [type='image']), select, textarea) {
	display: block;
	width: 100%;
	min-width: 0;
	min-height: var(--control-h);
	padding: 0.75rem 0.875rem;
	border: 1px solid var(--line-strong);
	border-radius: var(--r-1);
	background-color: var(--porcelain);
	color: var(--ink);
	font: inherit;
	font-size: 1rem;
	line-height: 1.4;
	transition: border-color var(--dur-2) var(--ease);
}
.textarea,
.dlm-form textarea { min-height: 7.5rem; resize: vertical; }
.input::placeholder,
.textarea::placeholder,
.dlm-form ::placeholder { color: var(--ink-3); opacity: 1; }
.input:hover,
.select:hover,
.textarea:hover,
.dlm-form :is(input, select, textarea):hover { border-color: var(--ink-2); }
.input:focus,
.select:focus,
.textarea:focus,
.dlm-form :is(input, select, textarea):focus { border-color: var(--brand); }

.select,
.dlm-form select {
	padding-right: 2.5rem;
	appearance: none;
	background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
	background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%;
	background-size: 5px 5px;
	background-repeat: no-repeat;
}

.is-invalid,
.dlm-form [aria-invalid='true'],
.input[aria-invalid='true'],
.select[aria-invalid='true'],
.textarea[aria-invalid='true'] { border-color: var(--danger); box-shadow: inset 3px 0 0 var(--danger); }
.dlm-form :is(input, select, textarea):disabled,
.input:disabled,
.select:disabled,
.textarea:disabled { opacity: 0.6; cursor: not-allowed; }

/* Cases, radios : 24 px dessinés, zone 44 px (le label entier). Markup : <label class="choice"><input type="checkbox"> Texte</label> */
.choice,
.dlm-form .woocommerce-form__label-for-checkbox { display: flex; align-items: center; gap: var(--s-3); min-height: var(--tap-min); font-size: var(--fs-body); font-weight: 400; cursor: pointer; }
.choice > input[type='checkbox'],
.choice > input[type='radio'],
.dlm-form input[type='checkbox'],
.dlm-form input[type='radio'] {
	position: relative;
	flex: none;
	width: 24px;
	height: 24px;
	margin: 0;
	border: 1px solid var(--line-strong);
	border-radius: var(--r-1);
	background: var(--porcelain);
	appearance: none;
	cursor: pointer;
	transition: background-color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease);
}
.choice > input[type='radio'],
.dlm-form input[type='radio'] { border-radius: var(--r-round); }
.choice > input:checked,
.dlm-form input[type='checkbox']:checked,
.dlm-form input[type='radio']:checked { border-color: var(--brand); background: var(--brand); }
.choice > input[type='checkbox']:checked::after,
.dlm-form input[type='checkbox']:checked::after {
	content: '';
	position: absolute;
	left: 8px;
	top: 3px;
	width: 6px;
	height: 12px;
	border: solid var(--on-night);
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
}
.choice > input[type='radio']:checked::after,
.dlm-form input[type='radio']:checked::after {
	content: '';
	position: absolute;
	inset: 5px;
	border-radius: var(--r-round);
	background: var(--accent);
}

/* Interrupteur : <label class="choice"><input type="checkbox" role="switch" class="switch"> Texte</label> */
.choice > input.switch[type='checkbox'],
.dlm-form input.switch[type='checkbox'] { width: 44px; height: 26px; border-radius: var(--r-round); border-color: var(--line-strong); background: var(--linen); }
.choice > input.switch::before,
.dlm-form input.switch::before { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: var(--r-round); background: var(--ink-2); transition: transform var(--dur-2) var(--ease), background-color var(--dur-2) var(--ease); }
.choice > input.switch[type='checkbox']:checked,
.dlm-form input.switch[type='checkbox']:checked { background: var(--brand); border-color: var(--brand); }
.choice > input.switch:checked::before,
.dlm-form input.switch:checked::before { transform: translateX(18px); background: var(--accent); }
.choice > input.switch[type='checkbox']:checked::after,
.dlm-form input.switch[type='checkbox']:checked::after { display: none; }

.fieldset { margin: 0 0 var(--s-6); padding: 0; border: 0; }
.fieldset > legend, .dlm-form legend { margin-bottom: var(--s-3); padding: 0; font-family: var(--font-display); font-size: var(--fs-h3); font-weight: 500; }
.form-note { color: var(--fg-3); font-size: var(--fs-small); }
