/* Enquiry form. Uses the theme's tokens where they exist and falls back
   sensibly if the plugin is used with another theme. */

.aae-form-wrap {
	--aae-line: var(--wp--preset--color--line, #e2dac8);
	--aae-ink: var(--wp--preset--color--forest, #22402d);
	--aae-body: var(--wp--preset--color--ink, #292a24);
	--aae-accent: var(--wp--preset--color--terracotta, #BE5A32);
	--aae-error: #b3402e;
	--aae-mist: var(--wp--preset--color--paper-raised, #fbf8f0);
}

.aae-form__heading {
	margin-top: 0;
}

.aae-form__intro {
	max-width: 52ch;
	color: var(--aae-body);
}

.aae-field {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	margin: 0 0 1.1rem;
}

.aae-field label {
	font-size: 0.8rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--aae-body);
}

/* Geometry and colour come from the theme, so these match the booking panel and
   the filters rather than being a third variation. A select still needs telling
   to fill its column, since it otherwise sizes to its widest option. */
.aae-field input,
.aae-field select,
.aae-field textarea {
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
	font: inherit;
}

.aae-field input:focus,
.aae-field select:focus,
.aae-field textarea:focus {
	/*
	 * A single ring only works on the ground it was picked for. This one is
	 * 5.5 on the cream page and 1.85 on the forest bands the form is also
	 * dropped into, where a keyboard user could not see which field they were
	 * in. Paired with a light halo, one of the two always contrasts: the
	 * outline carries it on cream, the halo carries it on forest.
	 */
	outline: 3px solid var(--wp--preset--color--terracotta-deep, #9e4826);
	outline-offset: 1px;
	box-shadow: 0 0 0 5px var(--wp--preset--color--paper, #f7f2e8);
	border-color: transparent;
}

.aae-field.is-invalid input,
.aae-field.is-invalid select,
.aae-field.is-invalid textarea {
	border-color: var(--aae-error);
	box-shadow: inset 0 0 0 1px var(--aae-error);
}

.aae-required {
	margin-left: 0.15rem;
	color: var(--aae-error);
}

.aae-field--consent label {
	flex-direction: row;
	align-items: flex-start;
	gap: 0.6rem;
	font-size: 0.9rem;
	font-weight: 400;
	text-transform: none;
	letter-spacing: 0;
	line-height: 1.45;
	color: var(--aae-body);
	display: flex;
}

.aae-field--consent input {
	width: auto;
	margin-top: 0.2rem;
	flex: 0 0 auto;
}

.aae-field--submit {
	margin-top: 0.5rem;
}

.aae-form__small {
	font-size: 0.85rem;
	color: var(--aae-body);
}

/* A form is read one field at a time, so it wants a measure of its own rather
   than the width of whatever column it was dropped into. At 745px the message
   box and the submit button stopped looking like a form and started looking
   like a banner. */
.aae-form {
	max-width: 34rem;
}

/* Two columns for the short fields on wider screens. */
@media ( min-width: 700px ) {
	.aae-form {
		display: grid;
		grid-template-columns: 1fr 1fr;
		gap: 0 1.25rem;
		/* Two columns need a little more room than one. */
		max-width: 40rem;
	}

	/* Full width is right on a phone, where the button is the whole thumb
	   target. On a desktop it is a button.
	   `align-self`, not `width`: the field is a flex column, so its children
	   stretch to the full column by default and `width: auto` changes nothing. */
	.aae-form .aae-field--submit .aa-btn {
		align-self: flex-start;
		min-width: 14rem;
	}

	.aae-form > .aae-field--message,
	.aae-form > .aae-field--consent,
	.aae-form > .aae-field--submit,
	.aae-form > .aae-form__small,
	.aae-form > .aae-hp {
		grid-column: 1 / -1;
	}

	.aae-form--compact {
		grid-template-columns: 1fr;
	}
}

/* Honeypot: off screen rather than display:none, which some bots skip. */
.aae-hp {
	position: absolute !important;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.aae-notice {
	padding: 1.1rem 1.25rem;
	margin-bottom: 1.5rem;
	border-radius: 12px;
	border-left: 4px solid var(--aae-accent);
	background: var(--aae-mist);
}

.aae-notice h3 {
	margin: 0 0 0.4rem;
}

.aae-notice p:last-child,
.aae-notice ul:last-child {
	margin-bottom: 0;
}

.aae-notice--error {
	border-left-color: var(--aae-error);
}

.aae-notice--error ul {
	margin: 0.5rem 0 0;
	padding-left: 1.25rem;
}

.aae-notice--success {
	border-left-color: var(--wp--preset--color--terracotta-deep, #9e4826);
}
