/*
 * ADH Core — contact form styles.
 * Colour and radius tokens come from theme.json presets, with hex fallbacks so the form
 * stays readable under any theme.
 */

.adh-form {
	--adh-white: var(--wp--preset--color--white, #ffffff);
	--adh-cream: var(--wp--preset--color--cream, #f7f3ea);
	--adh-sand: var(--wp--preset--color--sand, #e9e2d2);
	--adh-navy: var(--wp--preset--color--navy, #1d3553);
	--adh-navy-dark: var(--wp--preset--color--navy-dark, #15283f);
	--adh-gold: var(--wp--preset--color--gold, #b88b2b);
	--adh-gold-deep: var(--wp--preset--color--gold-deep, #8a6519);
	--adh-ink: var(--wp--preset--color--ink, #22314a);
	--adh-gray: var(--wp--preset--color--gray, #475569);
	--adh-gray-light: var(--wp--preset--color--gray-light, #e2e8f0);
	--adh-error: var(--wp--preset--color--error, #b42318);
	--adh-radius: var(--wp--custom--radius--s, 8px);
	--adh-radius-m: var(--wp--custom--radius--m, 14px);
	--adh-fast: var(--wp--custom--motion--fast, 180ms);
	--adh-ease: var(--wp--custom--motion--ease, cubic-bezier(0.2, 0.7, 0.2, 1));
	--adh-font-heading: var(--wp--preset--font-family--manrope, "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
	--adh-focus-ring: 0 0 0 3px var(--wp--preset--color--gold-deep, #8a6519);

	max-width: 100%;
	margin: 0;
	color: var(--adh-ink);
	scroll-margin-top: 6rem;
}

/* ---------- Layout ---------- */

.adh-form__grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 1.25rem 1.5rem;
	margin-bottom: 1.5rem;
}

@media (min-width: 640px) {
	.adh-form__grid {
		grid-template-columns: 1fr 1fr;
	}

	.adh-form__field--full {
		grid-column: 1 / -1;
	}
}

.adh-form__field {
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
	min-width: 0;
}

/* ---------- Labels ---------- */

.adh-form__field label {
	font-family: var(--adh-font-heading);
	font-weight: 600;
	font-size: 0.9375rem;
	line-height: 1.4;
	color: var(--adh-navy);
}

.adh-form__required,
.adh-form__optional {
	font-weight: 400;
	font-size: 0.8125rem;
	color: var(--adh-gray);
}

.adh-form__required {
	color: var(--adh-gold-deep);
}

/* ---------- Controls ---------- */

.adh-form input[type="text"],
.adh-form input[type="tel"],
.adh-form input[type="email"],
.adh-form select,
.adh-form textarea {
	-webkit-appearance: none;
	appearance: none;
	box-sizing: border-box;
	width: 100%;
	min-height: 48px;
	padding: 0.65rem 0.9rem;
	font: inherit;
	font-size: 1rem;
	line-height: 1.4;
	color: var(--adh-ink);
	background-color: var(--adh-white);
	border: 1px solid var(--adh-gray); /* >= 3:1 on white and on cream (WCAG 1.4.11); gray-light is too faint for a field boundary */
	border-radius: var(--adh-radius);
	box-shadow: none;
	transition: border-color var(--adh-fast) var(--adh-ease), box-shadow var(--adh-fast) var(--adh-ease);
}

.adh-form input::placeholder,
.adh-form textarea::placeholder {
	color: var(--adh-gray);
	opacity: 0.8;
}

.adh-form textarea {
	min-height: 160px;
	resize: vertical;
}

.adh-form select {
	padding-right: 2.75rem;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23B88B2B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 0.9rem center;
	background-size: 20px 20px;
	cursor: pointer;
}

.adh-form input:hover,
.adh-form select:hover,
.adh-form textarea:hover {
	border-color: var(--adh-gold);
}

.adh-form input:focus,
.adh-form select:focus,
.adh-form textarea:focus {
	outline: 3px solid transparent; /* invisible normally; forced-colors mode (box-shadow dropped) paints it with the system colour */
	outline-offset: 2px;
	border-color: var(--adh-gold);
	box-shadow: var(--adh-focus-ring);
}

.adh-form input:focus-visible,
.adh-form select:focus-visible,
.adh-form textarea:focus-visible {
	border-color: var(--adh-gold);
	box-shadow: var(--adh-focus-ring);
}

/* Invalid state */

.adh-form .is-invalid,
.adh-form [aria-invalid="true"] {
	border-color: var(--adh-error);
	border-width: 2px;
	padding-block: calc(0.65rem - 1px);
}

.adh-form .is-invalid:focus,
.adh-form [aria-invalid="true"]:focus {
	border-color: var(--adh-error);
	box-shadow: 0 0 0 3px rgb(180 35 24 / 0.22);
}

/* ---------- Field messages ---------- */

.adh-form__error {
	margin: 0;
	font-size: 0.9rem;
	line-height: 1.45;
	font-weight: 500;
	color: var(--adh-error);
}

.adh-form__error::before {
	content: "\26A0\FE0E";
	margin-right: 0.35em;
	font-weight: 600;
}

.adh-form__hint,
.adh-form__warning {
	margin: 0;
	font-size: 0.875rem;
	line-height: 1.45;
	color: var(--adh-gray);
}

.adh-form__warning {
	color: var(--adh-gold-deep);
	font-weight: 500;
}

/* ---------- Notices (live region) ---------- */

.adh-form__messages:empty {
	display: none;
}

.adh-form__notice {
	margin: 0 0 1.5rem;
	padding: 1rem 1.25rem;
	border-radius: var(--adh-radius);
	border-left: 4px solid var(--adh-gold);
	background-color: var(--adh-cream);
	color: var(--adh-ink);
	font-size: 1rem;
	line-height: 1.55;
}

.adh-form__notice p {
	margin: 0;
}

.adh-form__notice p + ul {
	margin-top: 0.6rem;
}

.adh-form__notice--success {
	background-color: var(--adh-cream);
	border-left-color: var(--adh-gold);
}

.adh-form__notice--error {
	background-color: #fef3f2;
	border-left-color: var(--adh-error);
}

.adh-form__notice--warning {
	background-color: var(--adh-cream);
	border-left-color: var(--adh-gold-deep);
	color: var(--adh-gold-deep);
}

.adh-form__notice a {
	color: inherit;
	font-weight: 600;
	text-decoration: underline;
	text-decoration-color: var(--adh-gold);
	text-underline-offset: 0.15em;
}

.adh-form__notice--error a {
	color: var(--adh-error);
	text-decoration-color: currentColor;
}

.adh-form__notice a:hover,
.adh-form__notice a:focus-visible {
	text-decoration-thickness: 2px;
}

.adh-form__summary {
	margin: 0;
	padding-left: 1.25rem;
	list-style: disc;
}

.adh-form__summary li {
	margin: 0.25rem 0;
}

/* ---------- Honeypot (never visible, never reachable) ---------- */

.adh-form__hp {
	position: absolute;
	left: -9999px;
	top: auto;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* ---------- Submit ---------- */

.adh-form__actions {
	margin: 0 0 1rem;
}

.adh-form__submit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 48px;
	width: 100%;
	cursor: pointer;
	font-family: var(--adh-font-heading);
	font-weight: 600;
	transition: background-color var(--adh-fast) var(--adh-ease), transform var(--adh-fast) var(--adh-ease), box-shadow var(--adh-fast) var(--adh-ease);
}

@media (min-width: 640px) {
	.adh-form__submit {
		width: auto;
		min-width: 16rem;
	}
}

.adh-form__submit:focus-visible {
	outline: 3px solid transparent; /* invisible normally; forced-colors mode (box-shadow dropped) paints it with the system colour */
	outline-offset: 2px;
	box-shadow: var(--adh-focus-ring);
}

.adh-form__submit:disabled,
.adh-form__submit[aria-disabled="true"] {
	cursor: progress;
	opacity: 0.7;
	transform: none;
	box-shadow: none;
}

/* ---------- Information paragraphs ---------- */

.adh-form__info,
.adh-form__urgence,
.adh-form__preview-note {
	margin: 0 0 0.75rem;
	font-size: 0.875rem;
	line-height: 1.55;
	color: var(--adh-gray);
}

.adh-form__info a {
	color: var(--adh-navy);
	font-weight: 600;
	text-decoration: underline;
	text-decoration-color: var(--adh-gold);
	text-underline-offset: 0.15em;
}

.adh-form__urgence {
	padding: 0.85rem 1rem;
	background-color: var(--adh-cream);
	border-left: 3px solid var(--adh-gold);
	border-radius: var(--adh-radius);
	color: var(--adh-ink);
}

.adh-form__urgence a {
	font-family: var(--adh-font-heading);
	font-weight: 700;
	color: var(--adh-navy);
	text-decoration: none;
	white-space: nowrap;
}

.adh-form__urgence a:hover,
.adh-form__urgence a:focus-visible {
	text-decoration: underline;
	text-decoration-color: var(--adh-gold);
	text-decoration-thickness: 2px;
	text-underline-offset: 0.15em;
}

.adh-form__preview-note {
	font-style: italic;
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
	.adh-form input,
	.adh-form select,
	.adh-form textarea,
	.adh-form__submit {
		transition: none;
	}
}
