/**
 * EvenShot Core — styles publics des formulaires.
 *
 * Le plugin est volontairement autonome : il embarque les quelques utilitaires
 * dont ses gabarits ont besoin (`.sr-only`, `.hp-field`, `.glass-panel`) afin de
 * rester présentable même sur un thème qui ne les fournit pas. Les valeurs
 * s'appuient sur les variables CSS du thème EvenShot lorsqu'elles existent, avec
 * un repli explicite dans le cas contraire.
 */

/* ---------------------------------------------------------------------------
 * Utilitaires
 * ------------------------------------------------------------------------ */

.waitlist-form .sr-only,
.contact-form .sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Champ piège à robots : invisible et hors du parcours clavier. */
.hp-field {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	opacity: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	clip-path: inset(50%);
	pointer-events: none;
}

.waitlist-form.glass-panel {
	background: var(--es-surface);
	border: 1px solid color-mix(in srgb, var(--es-line) 60%, transparent);
	box-shadow: var(--es-shadow-card);
	backdrop-filter: blur(18px);
}

/* ---------------------------------------------------------------------------
 * Formulaire de liste d'attente
 * ------------------------------------------------------------------------ */

.waitlist-form {
	display: grid;
	gap: clamp(6px, 1.2vh, 10px);
	max-width: 680px;
	padding: clamp(6px, 1.2vh, 10px);
	border-radius: var(--es-radius);
}

.waitlist-form input:not(.hp-field) {
	width: 100%;
	min-height: clamp(40px, 5.5vh, 54px);
	padding: 0 16px;
	color: var(--es-ink);
	background: color-mix(in srgb, var(--es-soft) 88%, transparent);
	border: 1px solid var(--es-line);
	border-radius: var(--es-radius);
	outline: none;
	font-family: inherit;
	font-size: inherit;
}

.waitlist-form input:focus,
.custom-select:focus,
.custom-select.is-open {
	border-color: color-mix(in srgb, var(--es-brand) 62%, transparent);
	box-shadow: var(--es-ring-focus);
}

.waitlist-form button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	min-height: clamp(40px, 5.5vh, 54px);
	padding: 0 18px;
	color: var(--es-on-accent);
	background: var(--es-gradient-brand);
	border: 0;
	border-radius: var(--es-radius);
	box-shadow: var(--es-glow-brand), var(--es-ring-inset);
	font-family: inherit;
	font-size: inherit;
	font-weight: var(--es-fw-semi, 600);
	white-space: nowrap;
	cursor: pointer;
	opacity: 1;
	transition: transform 180ms ease, box-shadow 180ms ease, opacity 300ms ease, background 300ms ease;
}

.waitlist-form button.fade-out {
	opacity: 0;
}

.waitlist-form button.fade-in {
	opacity: 1;
}

.waitlist-form button:hover {
	transform: translateY(-2px);
	box-shadow: var(--es-glow-brand-strong), var(--es-ring-inset);
}

.waitlist-form button:disabled {
	cursor: wait;
	opacity: 0.76;
}

.waitlist-form button.is-success {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: var(--es-gradient-success);
	box-shadow: var(--es-glow-success), var(--es-ring-inset);
}

.waitlist-form button.is-success svg {
	flex-shrink: 0;
	width: 24px;
	height: 24px;
}

/*
 * Zone de statut accessible (aria-live), masquée tant qu'elle est vide.
 * Sélecteurs volontairement peu spécifiques : le thème actif, dont la feuille
 * est chargée après celle-ci, doit pouvoir les redéfinir sans lutte de poids.
 */
.form-status {
	margin: 0;
	font-size: var(--es-text-15);
	font-weight: var(--es-fw-semi, 600);
}

.form-status:empty {
	display: none;
}

.form-status.is-success {
	color: var(--es-success-deep);
}

.form-status.is-error {
	color: var(--es-brand-deep);
}

/* ---------------------------------------------------------------------------
 * Liste déroulante personnalisée
 * ------------------------------------------------------------------------ */

.custom-select {
	position: relative;
	display: flex;
	align-items: center;
	width: 100%;
	min-height: clamp(40px, 5.5vh, 54px);
	padding: 0 16px;
	color: var(--es-ink);
	background: color-mix(in srgb, var(--es-soft) 88%, transparent);
	border: 1px solid var(--es-line);
	border-radius: var(--es-radius);
	outline: none;
	cursor: pointer;
	user-select: none;
	font-family: inherit;
	font-size: inherit;
}

.custom-select__trigger {
	flex: 1;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.custom-select__chevron {
	flex-shrink: 0;
	margin-left: 8px;
	color: var(--es-muted);
	transition: transform 200ms ease;
	pointer-events: none;
}

.custom-select.is-open .custom-select__chevron {
	transform: rotate(180deg);
}

.custom-select__list {
	position: absolute;
	top: calc(100% + 6px);
	right: 0;
	left: 0;
	z-index: 100;
	margin: 0;
	padding: 4px;
	list-style: none;
	background: var(--es-surface);
	border: 1px solid var(--es-line);
	border-radius: var(--es-radius);
	box-shadow: var(--es-shadow-card);
	opacity: 0;
	visibility: hidden;
	transform: translateY(-4px);
	transition: opacity 160ms ease, transform 160ms ease, visibility 160ms;
}

.custom-select.is-open .custom-select__list {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.custom-select__option {
	display: flex;
	align-items: center;
	min-height: var(--es-touch);
	padding: 0 12px;
	border-radius: var(--es-radius);
	cursor: pointer;
	font-family: inherit;
	font-size: inherit;
	transition: background 120ms ease;
}

.custom-select__option:hover {
	background: color-mix(in srgb, var(--es-soft) 90%, transparent);
}

.custom-select__option.is-selected {
	color: var(--es-brand-deep);
	font-weight: var(--es-fw-semi, 600);
	background: color-mix(in srgb, var(--es-brand) 5%, transparent);
}

/* ---------------------------------------------------------------------------
 * Formulaire de contact
 * ------------------------------------------------------------------------ */

.contact-form {
	display: grid;
	gap: 10px;
}

.contact-form label:not(.hp-field) {
	margin-bottom: -2px;
	color: var(--es-muted);
	font-size: var(--es-text-15);
	font-weight: var(--es-fw-semi, 600);
}

.contact-form input:not(.hp-field),
.contact-form textarea {
	width: 100%;
	padding: 10px 14px;
	color: var(--es-ink);
	background: color-mix(in srgb, var(--es-soft) 88%, transparent);
	border: 1px solid var(--es-line);
	border-radius: var(--es-radius);
	outline: none;
	font: inherit;
	resize: vertical;
}

.contact-form input:focus,
.contact-form textarea:focus {
	border-color: color-mix(in srgb, var(--es-brand) 62%, transparent);
	box-shadow: var(--es-ring-focus);
}

.contact-form button[type="submit"] {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	min-height: 48px;
	margin-top: 4px;
	padding: 0 18px;
	color: var(--es-on-accent);
	background: var(--es-gradient-brand);
	border: 0;
	border-radius: var(--es-radius);
	box-shadow: var(--es-glow-brand);
	font: inherit;
	font-weight: var(--es-fw-semi, 600);
	cursor: pointer;
	transition: transform 180ms ease, box-shadow 180ms ease;
}

.contact-form button[type="submit"]:hover {
	transform: translateY(-2px);
	box-shadow: var(--es-glow-brand-strong);
}

.contact-form button[type="submit"]:disabled {
	cursor: wait;
	opacity: 0.76;
}

.contact-status {
	margin: 0;
	min-height: 1.2em;
	font-size: var(--es-text-15);
	font-weight: var(--es-fw-semi, 600);
}

.contact-status.is-success {
	color: var(--es-success-deep);
}

.contact-status.is-error {
	color: var(--es-brand-deep);
}

/* ---------------------------------------------------------------------------
 * Confort de lecture
 * ------------------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
	.waitlist-form button,
	.contact-form button[type="submit"],
	.custom-select__chevron,
	.custom-select__list,
	.custom-select__option {
		transition: none;
	}
}
