/*
 * Contact form.
 *
 * Deliberately minimal, in the mailing list form's manner. Colour and type
 * come from the active theme's theme.json presets where available, with
 * fallbacks so the form stays legible under any theme. Themes style it
 * further in their own CSS.
 *
 * Fields stack; a field declared `width => half` pairs with its neighbour
 * once there is room. Everything else spans the form.
 */

.groundrules-contact__form {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 1rem;
	max-width: 40rem;
}

/* view.js hides the form once sent; `display: grid` above would outrank [hidden]. */
.groundrules-contact__form[hidden] {
	display: none;
}

@media (min-width: 34rem) {
	.groundrules-contact__form {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.groundrules-contact__form > * {
		grid-column: 1 / -1;
	}

	.groundrules-contact__form > .groundrules-contact__field--half {
		grid-column: auto;
	}
}

.groundrules-contact__field label {
	display: block;
	margin-bottom: 0.35em;
}

.groundrules-contact__field input,
.groundrules-contact__field textarea {
	box-sizing: border-box;
	width: 100%;
	padding: 0.5em 0.6em;
	border: 1px solid var(--wp--preset--color--rule, #767676);
	background: var(--wp--preset--color--background, #fff);
	color: inherit;
	font: inherit;
}

.groundrules-contact__field textarea {
	resize: vertical;
}

.groundrules-contact__privacy {
	margin: 0;
	font-size: 0.9em;
}

.groundrules-contact__submit {
	justify-self: start;
	padding: 0.5em 1.2em;
	border: 1px solid currentColor;
	background: var(--wp--preset--color--foreground, #1a1a1a);
	color: var(--wp--preset--color--background, #fff);
	cursor: pointer;
}

.groundrules-contact__submit[disabled] {
	opacity: 0.6;
	cursor: progress;
}

/* The status region only occupies space once it has something to say. */
.groundrules-contact__status:empty {
	display: none;
}

.groundrules-contact__status {
	margin-block: 1rem;
	padding: 0.75em 1em;
	border-inline-start: 3px solid var(--wp--preset--color--accent, #8a5a2b);
}

/* Honeypot: away from sighted users, and out of the tab order. */
.groundrules-contact__trap {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

.groundrules-contact :focus-visible {
	outline: 2px solid var(--wp--preset--color--accent, #8a5a2b);
	outline-offset: 2px;
}
