/*
 * Laid out on the page grid (.le-grid): title and text on the left half, the form on the right half.
 * Each theme sets these colours; everything below reads them.
 */
.le-form-section {
	--form-background: var(--le-white);
	--form-text: var(--le-black);
	--form-muted: var(--le-600);
	--form-placeholder: var(--le-400);
	--form-hover: var(--le-100);
	--form-status: var(--le-500);

	align-items: start;
	padding-block: 2rem 5.125rem;
	color: var(--form-text);
	background: var(--form-background);
	/* Clear of the sticky navbar when a button jumps here. */
	scroll-margin-top: 4rem;
}

.le-form-section--dark {
	--form-background: var(--le-black);
	--form-text: var(--le-white);
	--form-muted: var(--le-300);
	--form-placeholder: var(--le-white);
	--form-hover: var(--le-800);
	--form-status: var(--le-300);
}

.le-form-section__intro {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 1.5rem;
	grid-column: 1 / span 6;
}

.le-form-section__copy,
.le-form-section__details {
	max-width: 21.125rem;
	margin: 0;
	color: var(--form-muted);
	text-box: trim-both cap alphabetic;
}

/* Contact details: one per line, a little apart. */
.le-form-section__details > * {
	display: block;
	width: fit-content;
}

.le-form-section__details > * + * {
	margin-top: 0.5rem;
}

.le-form-section__details a {
	color: inherit;
	text-decoration: none;
}

.le-form-section__details a:hover,
.le-form-section__details a:focus-visible {
	color: var(--form-text);
	text-decoration: underline;
}

/* The form: two columns, each field half or full width. */
.le-form-section__form {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 1.125rem;
	align-items: start;
	grid-column: 7 / -1;
}

.le-form__field {
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 0;
}

.le-form__field--wide,
.le-form__actions {
	grid-column: 1 / -1;
}

/* Every piece of form text is the small mono capitals of the buttons. */
.le-form__input,
.le-form__label,
.le-form__choice,
.le-form__file-button,
.le-form__file-name {
	font-family: var(--le-font-mono);
	font-size: 0.6969rem;
	font-weight: 500;
	line-height: 1.27;
	letter-spacing: 0.0348rem;
	color: var(--form-text);
}

.le-form__label,
.le-form__choice,
.le-form__file-button,
.le-form__file-name,
.le-form__input::placeholder {
	text-transform: uppercase;
}

/* Text boxes: a line along the top and left. */
.le-form__input {
	display: block;
	width: 100%;
	height: 1.4375rem;
	padding: 0.25rem 0.5rem;
	border: 0;
	border-top: 1px solid var(--form-text);
	border-left: 1px solid var(--form-text);
	border-radius: 0;
	background: transparent;
	transition: border-color 0.2s;
}

textarea.le-form__input {
	height: 5rem;
	resize: vertical;
}

.le-form__input::placeholder {
	color: var(--form-placeholder);
	opacity: 1;
}

.le-form__input:focus {
	outline: none;
	border-color: var(--le-blue);
}

/* Dropdown: the label shows as its empty first choice, greyed like a placeholder, with a chevron at the right. */
.le-form__field--select {
	position: relative;
}

.le-form__select {
	padding-right: 1.75rem;
	appearance: none;
	cursor: pointer;
	text-transform: uppercase;
}

.le-form__select:has(option[value=""]:checked) {
	color: var(--form-placeholder);
}

/* The open list is drawn by the browser; keep it readable whatever the theme. */
.le-form__select option {
	color: var(--le-black);
	background: var(--le-white);
}

.le-form__field--select::after {
	content: "";
	position: absolute;
	top: calc(1px + 0.25rem);
	right: 0.5rem;
	width: 0.6692rem;
	height: 0.9375rem;
	background: var(--form-text);
	mask: url("../../assets/images/select-chevron.svg") center / contain no-repeat;
	pointer-events: none;
}

/* Choices: a heading, then one option per line. */
.le-form__field--radio,
.le-form__field--checkbox {
	padding-block: 0.25rem;
}

.le-form__field legend {
	float: left;
	width: 100%;
	margin-bottom: 1.125rem;
	padding: 0;
}

.le-form__choice {
	display: flex;
	clear: both;
	align-items: center;
	gap: 0.5rem;
	cursor: pointer;
}

.le-form__choice + .le-form__choice {
	margin-top: 0.625rem;
}

.le-form__field--consent {
	align-items: flex-start;
	padding-top: 1.5rem;
}

.le-form__box {
	flex: none;
	width: 1rem;
	height: 1rem;
	margin: 0;
	border: 1px solid var(--form-text);
	border-radius: 0;
	background: transparent center / 100% no-repeat;
	appearance: none;
	cursor: pointer;
	transition: background-color 0.15s;
}

.le-form__box[type="radio"] {
	border-radius: 50%;
}

.le-form__box[type="checkbox"]:checked {
	background-color: var(--le-blue);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2.74 8.43l3.2 3.05 7.32-6.95' fill='none' stroke='black' stroke-width='.82' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.le-form__box[type="radio"]:checked {
	background-color: var(--le-blue);
	box-shadow: inset 0 0 0 0.1875rem var(--form-background);
}

.le-form__box:focus-visible,
.le-form__file-input:focus-visible + .le-form__file-button {
	outline: 2px solid var(--le-blue);
	outline-offset: 2px;
}

/* File: the browser's own picker is hidden behind a styled Choose file button and the file's name. */
.le-form__field--file .le-form__label {
	margin: 0 0 0.875rem;
}

.le-form__file {
	position: relative;
	display: flex;
	align-items: center;
	gap: 1.125rem;
}

.le-form__file-input {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
}

.le-form__file-button {
	padding: 0.25rem 0.5rem;
	border-top: 1px solid var(--form-text);
	border-left: 1px solid var(--form-text);
	cursor: pointer;
	transition: background-color 0.2s;
}

.le-form__file-button:hover {
	background: var(--form-hover);
}

.le-form__file-name {
	min-width: 0;
	padding: 0.25rem 0.5rem;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.le-form__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 1rem;
	padding-top: 1.5rem;
}

.le-form__status {
	margin: 0;
	color: var(--form-status);
}

.le-form__status:empty {
	display: none;
}

/*
 * Page opening (Contact): eyebrow across the top; the title on the left half with the text in the
 * next three columns; then the form on the left half, its foot level with the image on the right half.
 */
.le-form-section--hero {
	align-items: start;
	padding-block: 6rem 1.5rem;
	row-gap: 0;
}

.le-form-section__eyebrow {
	grid-column: 1 / -1;
	margin: 0;
	color: var(--le-blue);
	text-box: trim-both cap alphabetic;
}

.le-form-section--hero .le-form-section__title {
	grid-row: 2;
	grid-column: 1 / span 6;
	margin-top: 1.125rem;
	color: var(--le-100);
}

.le-form-section--dark:not(.le-form-section--hero) .le-form-section__title {
	color: var(--le-100);
}

.le-form-section__aside {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 1.125rem;
	grid-row: 2;
	grid-column: 7 / span 3;
	margin-top: 1.125rem;
}

.le-form-section--hero .le-form-section__form {
	grid-row: 3;
	grid-column: 1 / span 6;
	align-self: end;
	row-gap: 0.625rem;
	margin-bottom: 1.5rem;
}

.le-form-section__image {
	grid-row: 3;
	grid-column: 7 / -1;
	margin-top: 5rem;
	aspect-ratio: 688 / 504;
	overflow: hidden;
}

.le-form-section__image img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
}

/*
 * CTA panel: like the CTA Panel component, the stack in the left columns and the photo in the right
 * six, on a near-black ground; the form is short and sits under the text.
 */
.le-form-section--panel {
	--form-background: #111212;
	--form-muted: var(--le-200);

	align-items: start;
	padding-block: 1.5rem;
}

.le-form-section__stack {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 1.875rem;
	grid-column: 1 / span 4;
}

.le-form-section--panel .le-form-section__title {
	max-width: 26.25rem;
	color: var(--le-white);
}

.le-form-section__lower {
	display: flex;
	flex-direction: column;
	gap: 2rem;
	width: min(23.4375rem, 100%);
}

.le-form-section--panel .le-form-section__copy {
	max-width: none;
}

.le-form-section--panel .le-form-section__form {
	grid-column: auto;
	width: 100%;
	margin-top: 0;
}

.le-form-section--panel .le-form__actions,
.le-form-section--panel .le-hs .hs-submit .actions {
	padding-top: 0;
}

.le-form-section--panel .le-form-section__image {
	grid-row: auto;
	grid-column: 7 / -1;
	align-self: end;
	margin-top: 0;
	aspect-ratio: 686 / 549;
}

/* Narrower screens: the form goes under the title and text. */
@media (max-width: 1023px) {
	.le-form-section__intro,
	.le-form-section__form {
		grid-column: 1 / -1;
	}

	.le-form-section__form {
		margin-top: 3rem;
	}

	.le-form-section__stack {
		grid-column: 1 / span 6;
	}

	/* The opening layout keeps the form beside the image; only the text widens. */
	.le-form-section__aside {
		grid-column: 7 / -1;
	}
}

/* Phones: one field per line. */
@media (max-width: 880px) {
	.le-form-section {
		padding-block: 1.5rem 3rem;
	}

	.le-form-section__form {
		grid-template-columns: minmax(0, 1fr);
		margin-top: 2.25rem;
	}

	/* The opening layout: eyebrow, title, text, form, then the image, one under another. */
	.le-form-section--hero {
		padding-block: 3rem var(--le-gutter);
	}

	.le-form-section--hero .le-form-section__title,
	.le-form-section__aside,
	.le-form-section--hero .le-form-section__form,
	.le-form-section__image {
		grid-row: auto;
		grid-column: 1 / -1;
	}

	.le-form-section__aside {
		margin-top: 1.5rem;
	}

	.le-form-section--hero .le-form-section__form {
		margin: 2.25rem 0 0;
	}

	.le-form-section__image {
		margin-top: 3rem;
	}

	/* The CTA panel: the stack, then the photo, full width. */
	.le-form-section--panel {
		padding-block: 1.5rem 0.75rem;
	}

	.le-form-section__stack,
	.le-form-section--panel .le-form-section__image {
		grid-column: 1 / -1;
	}

	.le-form-section--panel .le-form-section__form {
		margin-top: 0;
	}

	.le-form-section--panel .le-form-section__image {
		margin-top: 2.25rem;
	}
}
