/*
 * Contact page - intro, details, form, map.
 * Markup: template-parts/contact-part.php, contact-map-part.php,
 * template-parts/forms/contact-form.cf7 (Contact Form 7)
 */

.contact,
.contact-map {
	--contact-title-size: clamp(1.75rem, 0.777vw + 1.568rem, 2.5rem);
	--contact-title-xl-size: clamp(2rem, 1.036vw + 1.756rem, 3rem);
	--contact-pad-top: clamp(2rem, 1.036vw + 1.756rem, 3rem);
	--contact-pad-bottom: clamp(3rem, 3.077vw + 2.3077rem, 6rem);

	margin: 0;
	font-family: var(--theme-font);
	color: var(--sl-grey-900);
}

/* ---- intro and details ---- */

/* The form sits on a grey panel that runs to the right edge of the window. */
.contact-grid {
	display: grid;
	grid-template-columns: minmax(0, 453px) minmax(0, 931px);
	justify-content: space-between;
}

.contact-info {
	display: flex;
	flex-direction: column;
	gap: 2.5rem;
	padding: var(--contact-pad-top) 0 var(--contact-pad-bottom);
}

.contact-intro {
	display: flex;
	flex-direction: column;
	gap: 1.5rem;
}

.contact-title {
	margin: 0;
	font-size: var(--contact-title-size);
	font-weight: 400;
	line-height: 1.1;
	color: var(--sl-grey-900);
}

.contact-title b,
.contact-title strong {
	display: block;
	font-size: var(--contact-title-xl-size);
	font-weight: 600;
}

.contact-lead {
	font-size: 1rem;
	/* The design sets this text on a 22px line (16px x 1.375), see content-page.css. */
	line-height: 1.375;
}

.contact-lead p {
	margin: 0;
}

.contact-lead p + p {
	margin-top: 1.375em;
}

.contact-details {
	display: flex;
	flex-direction: column;
	gap: 2rem;
	font-size: 1rem;
	line-height: 1.375;
}

.contact-lines {
	display: flex;
	flex-direction: column;
	gap: 1.5rem;
}

.contact-address {
	margin: 0;
	padding-left: 1rem;
	border-left: 1px solid var(--sl-primary-600);
	font-style: normal;
}

.contact-line {
	display: flex;
	align-items: flex-start;
	gap: 0.75rem;
}

.contact-line--center {
	align-items: center;
}

.contact-line-icon {
	flex: none;
	width: 1.5rem;
	height: 1.5rem;
}

.contact-phones {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.contact-details a {
	color: inherit;
	text-decoration: none;
}

.contact-details a:hover,
.contact-details a:focus-visible {
	color: var(--sl-primary-600);
	text-decoration: underline;
}

/* ---- form ---- */

.contact {
	/* Darker than the design's #ef4444 for the messages and borders of the error
	   state - those are text on the grey panel and need 4.5:1 (WCAG 1.4.3). */
	--contact-error: #b91c1c;
}

.contact-panel {
	padding: var(--contact-pad-top) 0 var(--contact-pad-bottom) 7.5rem;
	background: var(--sl-grey-50);
	box-shadow: 0 0 0 100vmax var(--sl-grey-50);
	clip-path: inset(0 -100vmax 0 0);
}

.contact-panel .wpcf7 form {
	margin: 0;
}

.contact-form-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	align-items: end;
	gap: 1.5rem 1rem;
}

.contact-note {
	grid-column: 1 / -1;
	margin: 0;
	font-family: var(--sl-font-ui);
	font-size: 0.75rem;
	line-height: 1.5;
	color: var(--sl-grey-600);
}

.contact-field {
	display: flex;
	flex-direction: column;
	gap: 0.375rem;
	min-width: 0;
}

.contact-field label {
	display: flex;
	gap: 0.25rem;
	margin: 0;
	font-family: var(--sl-font-ui);
	font-size: 0.875rem;
	font-weight: 500;
	line-height: normal;
	color: var(--sl-grey-700);
}

.contact-required {
	font-weight: 600;
	color: var(--sl-danger);
}

.contact-field--select,
.contact-field--area {
	gap: 0.5rem;
}

.contact-field--select label {
	line-height: 1.5;
	color: var(--sl-grey-900);
}

.contact-field--area {
	grid-column: 1 / -1;
}

.contact-field--area label {
	font-family: var(--theme-font);
	font-weight: 400;
	line-height: 1.4;
	color: var(--sl-grey-900);
}

.contact-field .wpcf7-form-control-wrap {
	display: block;
}

.contact .contact-field :is(input, select, textarea) {
	box-sizing: border-box;
	display: block;
	width: 100%;
	max-width: 100%;
	margin: 0;
	background: var(--sl-white);
	border: 1px solid var(--sl-grey-300);
	box-shadow: none;
	color: var(--sl-grey-900);
	font-family: var(--theme-font);
	font-size: 0.875rem;
	line-height: 1.4;
}

.contact .contact-field--text input {
	min-height: 0;
	padding: 0.625rem 0.875rem;
	border-radius: var(--sl-radius-sm);
}

.contact .contact-field--select select {
	min-height: 0;
	padding: 0.75rem 2.5rem 0.75rem 1rem;
	border-radius: var(--sl-radius-md);
	font-family: var(--sl-font-ui);
	line-height: 1.25;
	-webkit-appearance: none;
	appearance: none;
	background-image: url("../template-img/icon_chevron_down_outline.svg");
	background-position: right 1rem center;
	background-repeat: no-repeat;
	background-size: 1rem;
}

/* The first option is the prompt: grey until a topic is chosen. */
.contact .contact-field--select select:has(option[value=""]:checked) {
	color: var(--sl-grey-500);
}

.contact .contact-field--area textarea {
	height: 10.625rem;
	min-height: 0;
	padding: 0.75rem 1rem;
	border-radius: var(--sl-radius-md);
	resize: vertical;
}

.contact-field ::placeholder {
	color: var(--sl-grey-400);
	opacity: 1;
}

.contact-field :is(input, select, textarea):focus-visible,
.contact-consent input:focus-visible {
	outline: 2px solid var(--sl-grey-900);
	outline-offset: 2px;
}

/* ---- spam trap ---- */

/* A field for bots (template-functions/contact.php). Off screen rather than
   display:none, which many bots recognise; the wrapper is aria-hidden and the
   input is out of the tab order, so no visitor meets it. */
.contact-hp {
	position: absolute;
	left: -10000px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* ---- consent ---- */

.contact-consent {
	grid-column: 1 / -1;
	font-family: var(--sl-font-ui);
	font-size: 0.75rem;
	font-weight: 400;
	line-height: 1.5;
	color: var(--sl-grey-500);
}

.contact-consent .wpcf7-list-item {
	display: block;
	margin: 0;
}

.contact-consent label {
	display: flex;
	align-items: flex-start;
	gap: 0.5rem;
	margin: 0;
	cursor: pointer;
}

.contact .contact-consent input[type="checkbox"] {
	position: relative;
	flex: none;
	width: 1.125rem;
	height: 1.125rem;
	min-height: 0;
	margin: 0;
	padding: 0;
	background: var(--sl-white);
	border: 1px solid var(--sl-grey-300);
	border-radius: var(--sl-radius-xs);
	-webkit-appearance: none;
	appearance: none;
	cursor: pointer;
}

.contact .contact-consent input[type="checkbox"]:checked {
	background: var(--sl-grey-900);
	border-color: var(--sl-grey-900);
}

.contact .contact-consent input[type="checkbox"]:checked::before {
	content: "";
	position: absolute;
	inset: 0;
	background: var(--sl-white);
	-webkit-mask: url("../template-img/icon_check_xs.svg") no-repeat center / 0.75rem;
	mask: url("../template-img/icon_check_xs.svg") no-repeat center / 0.75rem;
}

.contact-consent a {
	color: inherit;
	text-decoration: underline;
}

/* ---- submit ---- */

.contact-actions {
	grid-column: 1 / -1;
	display: flex;
	align-items: center;
	gap: 1rem;
}

.contact .contact-actions input.contact-submit {
	--sl-btn-pad-y: 0.625rem;
	--sl-btn-pad-x: 1.25rem;
	--sl-btn-font-size: 0.875rem;

	width: auto;
	min-height: 0;
	border: 0;
	border-radius: var(--sl-radius-md);
	font-weight: 700;
	cursor: pointer;
}

.contact-actions .wpcf7-spinner {
	margin: 0;
}

/* ---- validation ---- */

.contact .wpcf7-not-valid:is(input, select, textarea),
.contact .wpcf7-not-valid input {
	border-color: var(--contact-error);
}

.contact .wpcf7-not-valid-tip {
	display: block;
	margin-top: 0.25rem;
	font-family: var(--sl-font-ui);
	font-size: 0.75rem;
	font-weight: 500;
	line-height: 1.4;
	color: var(--contact-error);
}

.contact-consent .wpcf7-not-valid-tip {
	margin-top: 0.5rem;
	padding-left: 1.625rem;
}

.contact .wpcf7 form .wpcf7-response-output {
	grid-column: 1 / -1;
	margin: 1.5rem 0 0;
	padding: 0.75rem 1rem;
	border: 1px solid var(--sl-grey-300);
	border-radius: var(--sl-radius-md);
	font-family: var(--sl-font-ui);
	font-size: 0.875rem;
	line-height: 1.4;
}

.contact .wpcf7 form.invalid .wpcf7-response-output,
.contact .wpcf7 form.unaccepted .wpcf7-response-output,
.contact .wpcf7 form.failed .wpcf7-response-output {
	border-color: var(--contact-error);
	color: var(--contact-error);
}

.contact .wpcf7 form.sent .wpcf7-response-output {
	border-color: #16a34a;
	color: #166534;
}

/* ---- map ---- */

.contact-map {
	margin-block: 7.5rem;
}

.contact-map-title {
	margin: 0 0 1.25rem;
	padding: 0.625rem;
	border-bottom: 1px solid var(--sl-grey-300);
	font-size: clamp(1.5rem, 0.5vw + 1.4rem, 2rem);
	font-weight: 600;
	line-height: 1.3;
	text-align: center;
	color: var(--sl-black);
}

.contact-map-frame {
	height: 37.875rem;
	overflow: hidden;
	background: #bdbdbd;
	border-radius: var(--sl-radius-md);
}

.contact-map-frame iframe {
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
}

/* ---- narrow screens: one column, details first, the form on a full-width panel ---- */

@media (max-width: 1199.98px) {
	.contact-panel {
		padding-left: 4rem;
	}
}

@media (max-width: 991.98px) {
	/* The line breaks of the lead are set for the wide column; on a narrow one the
	   text flows (the editor leaves a space before each break). */
	.contact-lead br {
		display: none;
	}

	.contact-grid {
		grid-template-columns: minmax(0, 1fr);
	}

	.contact-info {
		padding-bottom: 2.5rem;
	}

	.contact-panel {
		margin-inline: calc(-1 * var(--grid-margin));
		padding: 2.5rem var(--grid-margin) var(--contact-pad-bottom);
		box-shadow: none;
		clip-path: none;
	}

	.contact-map {
		margin-block: 3.5rem;
	}

	.contact-map-frame {
		height: 25rem;
	}
}

@media (max-width: 575.98px) {
	.contact-form-grid {
		grid-template-columns: minmax(0, 1fr);
	}

	.contact .contact-actions input.contact-submit {
		width: 100%;
	}
}
