/**
 * Hero section.
 */

.hero {
	--hero-card-padding-block: 60px;
	--hero-card-padding-inline: 65px;
	--hero-column-gap: 40px;
	--hero-contact-tile: 48px;
	--hero-contact-columns: 2;
	--hero-form-padding: 33px;

	/* Boxed content on a full-bleed card. The 1440px design artboard less its
	 * two 20px gutters is the widest the copy and form are allowed to get; the
	 * background photo keeps spanning the whole card. */
	--hero-boxed-width: calc(1440px - (var(--page-gutter) * 2));
	--hero-boxed-inline: min(100%, var(--hero-boxed-width));

	/* Card padding grows past its authored value to centre that box once the
	 * card is wider than the box. */
	--hero-edge-inline: calc(((100% - var(--hero-boxed-inline)) / 2) + var(--hero-card-padding-inline));

	/* Column split from the design: a 705px copy column and a 525px form across
	 * the card's 1230px content width. */
	--hero-copy-track: 705;
	--hero-form-track: 525;

	/* Percentage rather than an fr pair, since fr is not valid inside calc(). */
	--hero-copy-width: calc((100% - var(--hero-column-gap)) * var(--hero-copy-track) / (var(--hero-copy-track) + var(--hero-form-track)));

	/* Matches the empty column reserved by .hero__inner so the overlaid form
	 * lines up with the grid it visually sits in. */
	--hero-form-width: calc((var(--hero-boxed-inline) - (var(--hero-card-padding-inline) * 2) - var(--hero-column-gap)) * var(--hero-form-track) / (var(--hero-copy-track) + var(--hero-form-track)));

	/* Height the admin bar steals from the viewport, so the card can stay a
	 * full screen tall for logged-in users too. */
	--hero-viewport-offset: 0px;

	/* The design artboard is 1440x977 with a 20px gutter, so the card is
	 * 1400x937. */
	--hero-card-height: 937px;

	/* The design pairs the copy column with the form panel at 680px, but that
	 * left the space-between gaps feeling open — trimmed so the three blocks
	 * sit closer without collapsing to the mobile floor gap. */
	--hero-content-height: 600px;

	display: grid;
	grid-template-columns: minmax(0, 1fr);
	padding: var(--page-gutter);
	background-color: var(--color-neutral-100);
}

/* Set on .hero rather than .hero__card so the responsive rules below, which
 * drop the card's min-height entirely, are not outranked by .admin-bar. */
.admin-bar .hero {
	--hero-viewport-offset: 32px;
}

@media screen and (max-width: 782px) {
	.admin-bar .hero {
		--hero-viewport-offset: 46px;
	}
}

.hero__card {
	position: relative;
	display: flex;
	align-items: stretch;
	overflow: hidden;
	grid-area: 1 / 1;
	min-height: calc(100vh - (var(--page-gutter) * 2) - var(--hero-viewport-offset));
	min-height: max(var(--hero-card-height), calc(100svh - (var(--page-gutter) * 2) - var(--hero-viewport-offset)));
	padding-block: var(--hero-card-padding-block);
	padding-inline: var(--hero-edge-inline);
	border-radius: var(--radius-card);
	background-color: var(--color-neutral-200);
	isolation: isolate;
}

/* Background image + overlay */

.hero__media {
	position: absolute;
	inset: 0;
	z-index: -1;
}

.hero__media-image {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.hero__media-overlay {
	position: absolute;
	inset: 0;
	background-color: var(--color-overlay);
	mix-blend-mode: overlay;
}

/* Adds contrast behind the copy without washing out the photo. */
.hero__media::after {
	content: '';
	position: absolute;
	inset: 0;
	background: linear-gradient(90deg, rgba(2, 29, 44, 0.6) 0%, rgba(2, 29, 44, 0.25) 60%, rgba(2, 29, 44, 0.1) 100%);
}

/* Fills the card's content box. Inheriting the card's min-height instead would
 * measure from inside the padding and make the card taller than the design. */
.hero__inner {
	display: grid;
	grid-template-columns: var(--hero-copy-width) minmax(0, 1fr);
	align-items: center;
	gap: var(--hero-column-gap);
	flex: 1;
	min-height: 0;
	width: 100%;
}

/* Left column */

/* space-between is what the design uses: the row gaps are leftover height shared
 * between the three blocks, not an authored gap. Pinning the column to the
 * design's height keeps those gaps identical on viewports taller than the
 * artboard — swap to align-self: stretch to let them grow with the card again.
 * The gap is only a floor for when there is no leftover height, e.g. on mobile. */
.hero__content {
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	gap: var(--space-xl);
	align-self: center;
	min-height: var(--hero-content-height);
	padding-block: 20px;
	color: var(--color-neutral-100);
}

.hero__intro {
	display: flex;
	flex-direction: column;
	gap: var(--space-md);
	align-items: flex-start;
}

.hero__topbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-md);
	width: 100%;
}

.hero__logo-image {
	max-height: 60px;
	width: auto;
}

/* Mobile-only shortcut to the form, which sits below the card on small screens. */
.hero__cta {
	display: none;
}

.hero__headings {
	display: flex;
	flex-direction: column;
}

.hero__subheading {
	margin: 0;
	font-family: var(--font-heading);
	font-size: var(--font-size-h3);
	font-weight: 400;
	line-height: 1.2;
	color: var(--color-neutral-100);
}

.hero__heading {
	margin: 0;
	font-family: var(--font-heading);
	font-size: var(--font-size-display);
	font-weight: 600;
	line-height: 1.05;
	letter-spacing: -0.01em;
	color: var(--color-neutral-100);
}

/* While the form overlays the card, the copy only gets ~49% of the viewport,
 * but the shared type tokens stop growing at their 1440px design sizes well
 * before that. Keeping these tied to the viewport holds the same proportion the
 * design has at 1440, so the headings stay on one line down to the breakpoint.
 * min() caps them at the token, so wide screens are unaffected. */
@media (min-width: 1025px) {
	.hero__subheading {
		font-size: min(var(--font-size-h3), 3.19vw);
	}

	.hero__heading {
		font-size: min(var(--font-size-display), 6.94vw);
	}
}

.hero__rich {
	max-width: 44rem;
	font-size: var(--font-size-body-lg);
	line-height: 1.5;
	color: var(--color-neutral-100);
}

.hero__rich h1,
.hero__rich h2,
.hero__rich h3,
.hero__rich h4,
.hero__rich h5,
.hero__rich h6 {
	margin: 0 0 var(--space-2xs);
	font-family: var(--font-heading);
	font-size: var(--font-size-h5);
	font-weight: 400;
	line-height: 1.2;
	color: var(--color-neutral-100);
}

.hero__rich ol,
.hero__rich ul {
	margin: 0;
	padding-left: 1.7rem;
}

.hero__rich li {
	line-height: 1.5;
}

.hero__rich a {
	color: var(--color-neutral-100);
	text-decoration: underline;
	text-underline-offset: 2px;
	transition: color var(--transition-base);
}

.hero__rich a:hover,
.hero__rich a:focus-visible {
	color: var(--color-accent);
}

/* Contact / social rows */

/* Content-sized columns rather than equal halves, so a second item sits just
 * after the first the way the design has it instead of jumping to the midpoint. */
.hero__contacts {
	display: grid;
	grid-template-columns: repeat(var(--hero-contact-columns), minmax(0, max-content));
	gap: var(--space-md) var(--space-xl);
	margin: 0;
	padding: 0;
	list-style: none;
}

.hero__contact {
	display: flex;
	align-items: center;
	gap: var(--space-sm);
	min-width: 0;
}

.hero__contact-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: var(--hero-contact-tile);
	height: var(--hero-contact-tile);
	border-radius: var(--radius-tile);
	background-color: var(--color-tile-bg);
}

/* Dropped from the row entirely so the value sits beside the previous item, as
 * the design does for the second phone number. */
.hero__contact-icon.is-empty {
	display: none;
}

.hero__contact-icon-image {
	width: auto;
}

.hero__contact-body {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.hero__contact-label {
	font-size: var(--font-size-body-sm);
	line-height: 1.5;
	color: var(--color-neutral-200);
}

/* Keeps its line box so the value below stays on the same baseline as items
 * that do have a label. */
.hero__contact-label.is-empty {
	visibility: hidden;
}

.hero__contact-label.is-empty::before {
	content: '\200b';
}

.hero__contact-value {
	font-size: var(--font-size-body);
	font-weight: 500;
	line-height: 1.5;
	color: var(--color-neutral-100);
	overflow-wrap: anywhere;
}

/* Clears the browser's default anchor underline so the modifier below is what
 * decides, rather than the underline surviving with the toggle off. */
.hero__contact-value--link {
	text-decoration: none;
	transition: color var(--transition-base);
}

.hero__contact-value--underline {
	text-decoration: underline;
	text-underline-offset: 2px;
}

.hero__contact-value--link:hover,
.hero__contact-value--link:focus-visible {
	color: var(--color-accent);
	text-decoration-thickness: 2px;
}

/* Form panel
 *
 * Overlaid on the card in the same grid cell rather than nested inside it, so
 * the same markup can drop below the card on mobile.
 */

.hero__form {
	grid-area: 1 / 1;
	z-index: 1;
	align-self: center;
	justify-self: end;
	width: var(--hero-form-width);
	margin-block: var(--hero-card-padding-block);
	margin-inline: var(--hero-edge-inline);
	padding: var(--hero-form-padding);
	border: 1px solid var(--color-border-subtle);
	border-radius: var(--radius-card);
	background-color: var(--color-neutral-100);
	color: var(--color-ink-900);
	scroll-margin-top: var(--space-md);
}

.hero--form-left .hero__inner {
	grid-template-columns: minmax(0, 1fr) var(--hero-copy-width);
}

.hero--form-left .hero__form {
	justify-self: start;
}

.hero--form-left .hero__content {
	grid-column: 2;
	grid-row: 1;
}

.hero--no-form .hero__inner {
	grid-template-columns: minmax(0, 1fr);
}

.hero--no-form .hero__content {
	max-width: 52rem;
}

/* Gravity Forms
 *
 * The plugin stylesheets load after the theme, so the visual styling is driven
 * through the Gravity Forms CSS API custom properties rather than by fighting
 * selector specificity. Values map onto the shared tokens in global.css.
 */

.hero__form .gform_wrapper {
	margin: 0;
}

/* Gravity Forms prints a per-form inline <style> scoped by element ID
 * (#gform_wrapper_1[data-form-index="0"].gform-theme), which outranks any
 * class-based selector a theme can write. !important is the only way to win
 * that cascade without hard-coding the form ID. */
.hero__form .gform_wrapper.gform-theme {
	/* Fields */
	--gf-ctrl-bg-color: var(--field-bg) !important;
	--gf-ctrl-bg-color-hover: var(--field-bg) !important;
	--gf-ctrl-bg-color-focus: var(--color-neutral-100) !important;
	--gf-ctrl-border-color: var(--field-border) !important;
	--gf-ctrl-border-color-hover: var(--color-neutral-300) !important;
	--gf-ctrl-border-color-focus: var(--field-border-focus) !important;
	--gf-ctrl-border-width: 1px !important;
	--gf-ctrl-color: var(--field-text) !important;
	--gf-ctrl-color-focus: var(--field-text) !important;
	--gf-ctrl-radius: var(--field-radius) !important;
	--gf-ctrl-radius-max-lg: var(--field-radius) !important;
	--gf-ctrl-radius-max-md: var(--field-radius) !important;
	--gf-ctrl-radius-max-sm: var(--field-radius) !important;
	--gf-ctrl-textarea-radius: var(--field-radius) !important;
	--gf-ctrl-textarea-height: 150px !important;
	--gf-ctrl-size: var(--field-height) !important;
	--gf-ctrl-size-md: var(--field-height) !important;
	--gf-ctrl-size-lg: var(--field-height) !important;
	--gf-ctrl-padding-x: var(--field-padding-inline) !important;
	--gf-ctrl-font-family: var(--font-body) !important;
	/* 16px minimum keeps iOS from zooming when a field is focused. */
	--gf-ctrl-font-size: 16px !important;
	--gf-ctrl-line-height: 1.5 !important;

	/* Labels */
	--gf-ctrl-label-color-primary: var(--color-ink-700) !important;
	--gf-ctrl-label-color-secondary: var(--color-ink-500) !important;
	--gf-ctrl-label-color-req: var(--color-ink-500) !important;
	--gf-ctrl-label-font-family-primary: var(--font-body) !important;
	--gf-ctrl-label-font-size-primary: var(--field-label-size) !important;
	--gf-ctrl-label-font-weight-primary: var(--field-label-weight) !important;

	/* Submit button */
	--gf-ctrl-btn-bg-color-primary: var(--btn-primary-bg) !important;
	--gf-ctrl-btn-bg-color-hover-primary: var(--btn-primary-bg-hover) !important;
	--gf-ctrl-btn-bg-color-focus-primary: var(--btn-primary-bg-hover) !important;
	--gf-ctrl-btn-bg-color-disabled-primary: var(--btn-primary-bg-disabled) !important;
	--gf-ctrl-btn-color-primary: var(--btn-primary-text) !important;
	--gf-ctrl-btn-color-hover-primary: var(--btn-primary-text-hover) !important;
	--gf-ctrl-btn-color-focus-primary: var(--btn-primary-text-hover) !important;
	--gf-ctrl-btn-color-disabled-primary: var(--btn-primary-text-disabled) !important;
	--gf-ctrl-btn-border-color-primary: var(--btn-primary-border) !important;
	--gf-ctrl-btn-border-color-hover-primary: var(--btn-primary-border-hover) !important;
	--gf-ctrl-btn-border-color-focus-primary: var(--btn-primary-border-hover) !important;
	--gf-ctrl-btn-radius: var(--btn-radius) !important;
	--gf-ctrl-btn-font-family: var(--btn-font-family) !important;
	--gf-ctrl-btn-font-size: var(--btn-font-size) !important;
	--gf-ctrl-btn-font-size-md: var(--btn-font-size) !important;
	--gf-ctrl-btn-font-size-lg: var(--btn-font-size) !important;
	--gf-ctrl-btn-font-weight: var(--btn-font-weight) !important;
	--gf-ctrl-btn-size: var(--btn-min-height) !important;
	--gf-ctrl-btn-size-md: var(--btn-min-height) !important;
	--gf-ctrl-btn-size-lg: var(--btn-min-height) !important;
	--gf-ctrl-btn-padding-x: var(--btn-padding-inline) !important;
	--gf-ctrl-btn-padding-y: var(--btn-padding-block) !important;

	/* Validation. Overriding the danger palette cascades to the error summary,
	 * field messages and control borders in one move. */
	--gf-color-danger: var(--color-danger) !important;
	--gf-color-danger-rgb: var(--color-danger-rgb) !important;
	--gf-ctrl-border-color-error: var(--color-danger) !important;
	--gf-form-validation-font-family: var(--font-body) !important;
	--gf-form-validation-font-size: var(--font-size-body-sm) !important;
	--gf-form-validation-heading-font-family: var(--font-heading) !important;
	--gf-form-validation-heading-font-size: 1.125rem !important;
	--gf-form-validation-heading-font-weight: 700 !important;
	--gf-form-validation-summary-font-family: var(--font-body) !important;
	--gf-form-validation-summary-font-size: var(--font-size-body-sm) !important;
	--gf-form-validation-radius: var(--radius-input) !important;
	--gf-form-validation-padding-x: var(--space-sm) !important;
	--gf-form-validation-padding-y: var(--space-sm) !important;
	--gf-form-validation-shadow: none !important;

	/* Layout */
	--gf-form-gap-x: 11px !important;
	--gf-form-gap-y: 11px !important;
	--gf-field-gap-x: 11px !important;
	--gf-field-gap-y: 11px !important;
	--gf-form-footer-gap: var(--space-md) !important;
}

.hero__form-title {
	margin: 0 0 var(--space-md);
	font-family: var(--font-heading);
	font-size: var(--font-size-h5);
	font-weight: 700;
	line-height: 1.2;
	color: var(--color-ink-900);
}

.hero__form .gform_heading {
	margin-bottom: var(--space-md);
	padding: 0;
}

.hero__form .gform_description {
	display: block;
	margin-top: var(--space-2xs);
	font-size: var(--font-size-body-sm);
	color: var(--color-ink-500);
}

.hero__form .gform_fields {
	row-gap: 11px;
	column-gap: 11px;
}

.hero__form .gfield_label,
.hero__form .gfield_label.gform-field-label {
	margin-bottom: var(--space-2xs);
	font-family: var(--font-body);
	font-size: var(--field-label-size);
	font-weight: var(--field-label-weight);
	line-height: 1.5;
	color: var(--color-ink-700);
}

.hero__form .gfield_required {
	color: var(--color-ink-700);
}

.hero__form .gform_wrapper.gform-theme textarea {
	min-height: 150px;
	resize: vertical;
}

.hero__form .gform_wrapper input::placeholder,
.hero__form .gform_wrapper textarea::placeholder {
	color: var(--field-placeholder);
	opacity: 1;
}

.hero__form .gform_wrapper .gform_footer {
	margin: 0;
	padding: var(--space-md) 0 0;
}

.hero__form .gform_wrapper .gform_footer .gform_button,
.hero__form .gform_wrapper .gform_footer input[type='submit'],
.hero__form .gform_wrapper .gform_footer button[type='submit'] {
	width: 100% !important;
	max-width: none;
	justify-content: center;
	text-align: center;
}

/* Validation and confirmation
 *
 * The top-of-form error summary is hidden — field-level messages and the
 * branded confirmation are enough, and the summary was crowding the panel.
 */

.hero__form .gform_wrapper .gform_validation_errors,
.hero__form .gform_wrapper .ginput_counter.gfield_description {
	display: none;
}

.hero__form .gform_wrapper .validation_message,
.hero__form .gform_wrapper .gfield_validation_message {
	margin-top: var(--space-2xs);
	padding: 0;
	border: 0;
	background: none;
	font-family: var(--font-body);
	font-size: var(--font-size-body-sm);
	font-weight: 400;
	line-height: 1.4;
	color: var(--color-danger);
}

.hero__form .gform_wrapper .gfield_error .gfield_label {
	color: var(--color-danger);
}

.hero__form .gform_confirmation_message {
	padding: var(--space-md);
	border: 1px solid var(--color-border-subtle);
	border-left: 4px solid var(--color-accent);
	border-radius: var(--radius-input);
	background-color: var(--color-surface-muted);
	font-family: var(--font-body);
	font-size: var(--font-size-body-lg);
	line-height: 1.5;
	color: var(--color-ink-900);
}

.hero__form .gform_confirmation_message > *:first-child {
	margin-top: 0;
}

.hero__form .gform_confirmation_message > *:last-child {
	margin-bottom: 0;
}

.hero__form .gform_confirmation_message a {
	color: var(--color-ink-900);
	text-decoration: underline;
	text-underline-offset: 2px;
	text-decoration-color: var(--color-accent);
	text-decoration-thickness: 2px;
}

/* While submitting, Gravity Forms blanks the button label with
 * `color: transparent` and centres its spinner over the top. Keep the label
 * readable and pin the spinner to the trailing edge instead. */
.hero__form .gform_wrapper.gform-theme .gform_footer .gform_button.gform-has-spinner {
	color: var(--btn-primary-text) !important;
}

.hero__form .gform_wrapper.gform-theme .gform-loader {
	--gf-form-spinner-fg-color: var(--color-ink-900);
	--gf-form-spinner-bg-color: rgba(2, 29, 44, 0.2);

	inset: 0 var(--btn-padding-inline) 0 auto;
	margin-block: auto;
	margin-inline: 0;
}

/* Tablet */

/* The overlaid form only has room for side-by-side fields once the card nears
 * its full width. Below that the panel is narrow enough that a half-width field
 * clips its own placeholder, so each field takes the whole row instead. The
 * lower bound stops this applying once the form drops below the card. */
@media (min-width: 1025px) and (max-width: 1359px) {
	.hero__form .gform_wrapper .gform_fields > .gfield {
		grid-column: 1 / -1;
	}
}

@media (max-width: 1200px) {
	.hero {
		--hero-card-padding-block: 48px;
		--hero-card-padding-inline: 40px;
		--hero-column-gap: 32px;
		--hero-form-padding: 24px;
	}

	/* Above 1024 the form still overlays half the card, leaving the text column
	 * too narrow for two contacts side by side without breaking mid-number;
	 * below it the rows simply stack. */
	.hero__contacts {
		--hero-contact-columns: 1;
	}

	/* Stacked, an icon-less item would otherwise sit flush left while the rest
	 * are indented, so the tile keeps its width. Its height goes, along with the
	 * empty label: with no item beside this one to line up against, they only
	 * add dead space above the value. */
	.hero__contact-icon.is-empty {
		display: flex;
		visibility: hidden;
		height: auto;
	}

	.hero__contact-label.is-empty {
		display: none;
	}
}

/* Tablet and below: the form leaves the card and takes its own full-width row,
 * the same arrangement as mobile. */
@media (max-width: 1024px) {
	.hero {
		--hero-card-padding-block: 40px;
		--hero-card-padding-inline: 32px;
		--hero-form-padding: 24px;

		display: block;
	}

	.hero__card {
		align-items: stretch;
		min-height: 0;
	}

	.hero__inner,
	.hero--form-left .hero__inner {
		grid-template-columns: minmax(0, 1fr);
		gap: var(--space-xl);
	}

	/* Content always leads on small screens, regardless of desktop form position.
	 * The card has no fixed height here, so space-between has nothing to
	 * distribute and this gap is the only thing setting the row rhythm. */
	.hero__content,
	.hero--form-left .hero__content {
		grid-column: 1;
		grid-row: 1;
		gap: var(--space-xl);
		min-height: 0;
		padding-block: 0;
	}

	/* Out of the card entirely, so the background image only has to cover the
	 * copy rather than the full page height. The desktop rules size the panel
	 * against the card and pin it to one edge, so both need clearing here —
	 * width: auto would leave it at its fit-content width rather than filling
	 * the row. */
	.hero__form,
	.hero--form-left .hero__form {
		justify-self: stretch;
		width: 100%;
		margin: var(--space-md) 0 0;
	}

	.hero__cta {
		--btn-font-size: 1rem;
		--btn-padding-block: 0.625rem;
		--btn-padding-inline: 1rem;
		--btn-min-height: 2.75rem;

		display: inline-flex;
		flex: 0 0 auto;
	}

	.hero__media::after {
		background: linear-gradient(180deg, rgba(2, 29, 44, 0.65) 0%, rgba(2, 29, 44, 0.45) 100%);
	}
}

/* Mobile */

@media (max-width: 640px) {
	.hero {
		--hero-card-padding-block: 32px;
		--hero-card-padding-inline: 20px;
		--hero-contact-tile: 40px;
		--hero-form-padding: 20px;
	}

	.hero__logo-image {
		max-height: 44px;
	}

	.hero__contacts {
		--hero-contact-columns: 1;

		gap: var(--space-sm);
	}

	.hero__form .gform_fields {
		row-gap: var(--space-sm);
	}

	.hero__form textarea {
		min-height: 120px;
	}
}
