/**
 * CHGA Contact block.
 *
 * The form is a Forminator form, so most of this file re-dresses Forminator's
 * own markup to match the design: white boxes on a grey panel, the label carried
 * by the placeholder, and the gold submit button pinned bottom right.
 */

.chga-contact {
	--chga-ct-panel: var(--chga-grey);
	--chga-ct-field: var(--chga-white);
	--chga-ct-corner-opacity: 1;
	--chga-ct-corner-ratio: 963 / 520;
	--chga-ct-radius: 2px;
	--chga-ct-field-pad-y: clamp(0.85rem, 0.7rem + 0.5vw, 1.15rem);
	--chga-ct-field-pad-x: clamp(0.9rem, 0.7rem + 0.6vw, 1.375rem);

	position: relative;
	isolation: isolate;
	overflow: hidden;
	padding-block: clamp(2.75rem, 1.2rem + 4vw, 5.5rem);
	color: var(--chga-navy);
	background-color: var(--chga-white);
}

/* Corner graphic --------------------------------------------------------- */

.chga-contact__corner-wrap {
	position: absolute;
	width: 40%;
	min-width: 16rem;
	max-width: 52rem;
	/* Reserves the right box before the lazy-loaded artwork arrives. */
	aspect-ratio: var(--chga-ct-corner-ratio);
	opacity: var(--chga-ct-corner-opacity);
	pointer-events: none;
	z-index: 1;
	line-height: 0;
}

.chga-contact__corner-wrap--top-left {
	left: -6%;
	top: -4%;
}

.chga-contact__corner-wrap--top-right {
	right: -6%;
	top: -4%;
}

.chga-contact__corner-wrap--bottom-left {
	left: -6%;
	bottom: -4%;
}

.chga-contact__corner-wrap--bottom-right {
	right: -6%;
	bottom: -4%;
}

.chga-contact__corner {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

/*
 * The artwork is drawn for the bottom right, so the other corners flip it. This
 * has to live on the image: the wrapper's transform belongs to the scroll
 * parallax, which would otherwise wipe the flip out on its first tick.
 */
.chga-contact__corner-wrap--top-left .chga-contact__corner {
	transform: scale(-1);
}

.chga-contact__corner-wrap--top-right .chga-contact__corner {
	transform: scaleY(-1);
}

.chga-contact__corner-wrap--bottom-left .chga-contact__corner {
	transform: scaleX(-1);
}

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

.chga-contact__inner {
	position: relative;
	z-index: 2;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: clamp(1.25rem, 0.8rem + 1.5vw, 2.5rem);
	width: 100%;
	max-width: var(--chga-container);
	margin-inline: auto;
	padding-inline: var(--chga-gutter);
}

.chga-contact__head {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: clamp(0.75rem, 0.55rem + 0.7vw, 1.375rem);
	text-align: center;
}

.chga-contact__heading {
	margin: 0;
	font-size: clamp(1.625rem, 2.6vw, 3.125rem);
	font-weight: 700;
	line-height: 1.15;
	letter-spacing: -0.015em;
	/* #D28C10 */
	color: var(--chga-gold-mid);
	text-align: center;
}

.chga-contact__rule {
	display: block;
	width: clamp(3.25rem, 4.5vw, 5.375rem);
	height: 2px;
	background-color: var(--chga-navy);
	transform-origin: center;
}

.chga-contact__intro {
	max-width: 52rem;
	margin: 0;
	font-size: clamp(0.9375rem, 0.85rem + 0.55vw, 1.375rem);
	line-height: 1.45;
	color: var(--chga-navy);
	text-wrap: pretty;
}

.chga-contact__panel {
	display: flex;
	flex-direction: column;
	width: min(100%, 68rem);
	padding: clamp(1.25rem, 0.7rem + 1.9vw, 2.75rem);
	background-color: var(--chga-ct-panel);
}

/* Telephone -------------------------------------------------------------- */

/*
 * Sits on the same side as the form's own Submit button, so the panel has one
 * column of actions rather than two competing ones.
 */
.chga-contact__call {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: flex-end;
	gap: clamp(0.5rem, 0.35rem + 0.55vw, 1rem);
}

.chga-contact__call--top {
	margin-bottom: clamp(1rem, 0.7rem + 1.1vw, 1.75rem);
}

.chga-contact__call--bottom {
	margin-top: clamp(1rem, 0.7rem + 1.1vw, 1.75rem);
}

.chga-contact__call-label {
	font-size: clamp(0.9375rem, 0.88rem + 0.22vw, 1.0625rem);
	font-weight: 600;
	color: var(--chga-navy);
}

/*
 * Navy against the form's gold Submit: the form is still the primary route, and
 * two gold buttons in one panel would not say which. The hover swaps in the
 * gold gradient, the same way the shared ghost button does.
 */
.chga-contact__call-button {
	background: var(--chga-navy);
	transition:
		background-color 0.45s var(--chga-ease),
		box-shadow 0.45s var(--chga-ease),
		transform 0.45s var(--chga-ease);
}

.chga-contact__call-button:hover,
.chga-contact__call-button:focus-visible {
	background: var(--chga-gold-gradient);
}

.chga-contact__call-icon {
	width: 1.15em;
	height: 1.15em;
	flex: 0 0 auto;
}

/* The design sets the panel and its heading right of centre. */
.chga-contact--right .chga-contact__inner {
	align-items: flex-end;
}

.chga-contact--right .chga-contact__head {
	/* Keeps the heading over the panel rather than over the artwork. */
	margin-right: clamp(0, 6vw, 12rem);
}

.chga-contact__missing {
	margin: 0;
	padding: 2rem;
	text-align: center;
	color: var(--chga-navy);
}

.chga-contact__note {
	margin: clamp(0.75rem, 1.4vw, 1.25rem) 0 0;
	font-size: 0.875rem;
	line-height: 1.5;
	color: var(--chga-navy);
	opacity: 0.75;
}

/* -------------------------------------------------------------------------
 * Forminator
 *
 * Selectors are deliberately scoped inside .chga-contact so nothing here can
 * reach a Forminator form used anywhere else on the site.
 * ---------------------------------------------------------------------- */

.chga-contact .forminator-ui.forminator-custom-form {
	font-family: var(--chga-font);
}

/*
 * Forminator puts every full-width field in a single row, so the spacing between
 * the boxes has to come from the row rather than from a margin on each one.
 */
.chga-contact .forminator-row {
	display: flex;
	flex-direction: column;
	gap: clamp(0.625rem, 0.45rem + 0.6vw, 1.0625rem);
	margin-bottom: 0;
}

.chga-contact .forminator-col {
	width: 100%;
	padding: 0;
}

/* Forminator prints this wrapper whether or not there is anything to say. */
.chga-contact .forminator-response-message:empty {
	display: none;
}

/*
 * The design puts the field name inside the box. The label still has to exist
 * and stay associated with the input, so it is hidden from sight only.
 */
.chga-contact .forminator-label {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.chga-contact .forminator-input,
.chga-contact .forminator-textarea,
.chga-contact .forminator-select--field,
.chga-contact .select2-container .select2-selection--single {
	display: block;
	width: 100%;
	min-height: 0;
	height: auto;
	padding: var(--chga-ct-field-pad-y) var(--chga-ct-field-pad-x);
	font-family: var(--chga-font);
	font-size: clamp(0.9375rem, 0.88rem + 0.22vw, 1.0625rem);
	line-height: 1.4;
	color: var(--chga-navy);
	background-color: var(--chga-ct-field);
	border: 1px solid transparent;
	border-radius: var(--chga-ct-radius);
	box-shadow: none;
	transition:
		border-color 0.35s var(--chga-ease),
		box-shadow 0.35s var(--chga-ease);
}

.chga-contact .forminator-textarea {
	min-height: clamp(11rem, 8rem + 9vw, 17rem);
	resize: vertical;
}

.chga-contact .forminator-input::placeholder,
.chga-contact .forminator-textarea::placeholder {
	color: #6b6b6b;
	opacity: 1;
}

.chga-contact .forminator-input:focus,
.chga-contact .forminator-textarea:focus,
.chga-contact .select2-container--open .select2-selection--single {
	outline: none;
	border-color: var(--chga-gold-mid);
	box-shadow: 0 0 0 3px rgba(210, 140, 16, 0.22);
}

/* Select ----------------------------------------------------------------- */

/*
 * Unstyled Forminator leaves a plain <select>, so the design's gold triangle is
 * drawn as the control's own background. The Select2 rules below cover the case
 * where Forminator does swap in its enhanced dropdown.
 */
.chga-contact .forminator-select--field {
	appearance: none;
	-webkit-appearance: none;
	padding-right: calc(var(--chga-ct-field-pad-x) * 2 + 0.9rem);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='%23d28c10' d='M0 0h12L6 8z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right var(--chga-ct-field-pad-x) center;
	background-size: 0.9rem 0.6rem;
	cursor: pointer;
}

.chga-contact .forminator-select--field:invalid,
.chga-contact .forminator-select--field option[value=""] {
	color: #6b6b6b;
}

.chga-contact .select2-container {
	width: 100% !important;
}

.chga-contact .select2-container .select2-selection--single {
	display: flex;
	align-items: center;
}

.chga-contact .select2-container .select2-selection__rendered {
	padding: 0;
	line-height: 1.4;
	color: var(--chga-navy);
}

.chga-contact .select2-container .select2-selection__placeholder {
	color: #6b6b6b;
}

/* The gold triangle from the design, in place of Select2's own caret. */
.chga-contact .select2-container .select2-selection__arrow {
	position: absolute;
	top: 50%;
	right: var(--chga-ct-field-pad-x);
	width: 0;
	height: 0;
	transform: translateY(-50%);
	border-left: 0.45rem solid transparent;
	border-right: 0.45rem solid transparent;
	border-top: 0.55rem solid var(--chga-gold-mid);
	transition: transform 0.35s var(--chga-ease);
}

.chga-contact .select2-container .select2-selection__arrow b {
	display: none;
}

.chga-contact .select2-container--open .select2-selection__arrow {
	transform: translateY(-50%) rotate(180deg);
}

.chga-contact .select2-container .select2-selection__clear {
	margin-right: 1.5rem;
	color: var(--chga-navy);
}

/* Button ----------------------------------------------------------------- */

/* Overrides the column direction the other rows use, so flex-end means right. */
.chga-contact .forminator-row-last {
	display: flex;
	flex-direction: row;
	justify-content: flex-end;
	margin-top: clamp(1rem, 0.6rem + 1.4vw, 2.25rem);
}

.chga-contact .forminator-row-last .forminator-col {
	flex: 0 0 auto;
	width: auto;
	padding: 0;
}

.chga-contact .forminator-button-submit {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5em;
	min-height: 3rem;
	min-width: clamp(9rem, 12vw, 12.5rem);
	padding: clamp(0.75rem, 0.6rem + 0.5vw, 1rem) clamp(1.5rem, 1rem + 1.6vw, 2.75rem);
	font-family: var(--chga-font);
	font-size: clamp(0.9375rem, 0.86rem + 0.28vw, 1.125rem);
	font-weight: 700;
	line-height: 1.2;
	color: var(--chga-white);
	text-align: center;
	text-decoration: none;
	background: var(--chga-gold-gradient);
	background-size: 160% 100%;
	background-position: 0% 50%;
	border: 0;
	border-radius: 0;
	cursor: pointer;
	transition:
		background-position 0.7s var(--chga-ease),
		box-shadow 0.45s var(--chga-ease),
		transform 0.45s var(--chga-ease);
}

.chga-contact .forminator-button-submit:hover,
.chga-contact .forminator-button-submit:focus-visible {
	color: var(--chga-white);
	background-position: 100% 50%;
	transform: translateY(-2px);
	box-shadow: 0 14px 30px -14px rgba(203, 131, 2, 0.85);
}

.chga-contact .forminator-button-submit:focus-visible {
	outline: 2px solid var(--chga-gold-light);
	outline-offset: 3px;
}

/* Messages --------------------------------------------------------------- */

.chga-contact .forminator-response-message {
	margin: 0 0 clamp(0.75rem, 1.4vw, 1.25rem);
	padding: clamp(0.75rem, 1.4vw, 1.125rem) var(--chga-ct-field-pad-x);
	font-size: 1rem;
	line-height: 1.5;
	border-radius: var(--chga-ct-radius);
}

.chga-contact .forminator-response-message.forminator-error {
	color: #7a1616;
	background-color: #fdeaea;
	border-left: 3px solid #b52020;
}

.chga-contact .forminator-response-message.forminator-success {
	color: #0d4d2b;
	background-color: #e8f6ee;
	border-left: 3px solid #1c8a4e;
}

.chga-contact .forminator-error-message {
	margin-top: 0.4rem;
	font-size: 0.875rem;
	line-height: 1.4;
	color: #b52020;
}

.chga-contact .forminator-input.forminator-has_error,
.chga-contact .forminator-textarea.forminator-has_error {
	border-color: #b52020;
}

/* Small screens ---------------------------------------------------------- */

@media (max-width: 48rem) {
	.chga-contact--right .chga-contact__inner {
		align-items: center;
	}

	.chga-contact--right .chga-contact__head {
		margin-right: 0;
	}

	.chga-contact .forminator-row-last {
		justify-content: stretch;
	}

	.chga-contact .forminator-row-last .forminator-col,
	.chga-contact .forminator-button-submit {
		width: 100%;
	}

	/* Full width, like the Submit button below it. */
	.chga-contact__call {
		justify-content: center;
	}

	.chga-contact__call-button {
		width: 100%;
	}
}

/* Editor preview --------------------------------------------------------- */

.chga-contact--preview {
	padding-block: 2.5rem;
}
