/*
 * Contact block (template-parts/blocks/section_contact.php, js/blocks_js/block_contact.js).
 * Loaded by abefactors_acf_block_enqueue_assets() only on pages that contain the block (and in the editor).
 *
 * Design (Figma "Contact"), at 1728px:
 *   section   about 84px under the banner photo, about 144px above the footer
 *   line      1px Charcoal across the block (1378px)
 *   left      504px: title Bold 32px 31px under the line; email (underlined) and phone Regular 18/30 about 60px
 *             under the title; social icons 21px about 25px lower
 *   right     855px (19px gap): the form. Labels Bold 18/30 with "(required)" Regular; a 1px line under each
 *             field 82px under its label; 34px to the next label; first and last name side by side (416px, 21px
 *             gap); message about 130px high; Submit (yellow) 42px under the last line
 *
 * Contact Form 7 form (Contact > Contact Forms > Contact page > Form):
 *
 *   <div class="cf7_row">
 *   <p class="cf7_field cf7_half"><label for="cf7-first-name"><strong>First name</strong> (required)</label>
 *   [text* first-name id:cf7-first-name autocomplete:given-name]</p>
 *   <p class="cf7_field cf7_half"><label for="cf7-last-name"><strong>Last name</strong> (required)</label>
 *   [text* last-name id:cf7-last-name autocomplete:family-name]</p>
 *   </div>
 *   <p class="cf7_field"><label for="cf7-email"><strong>E-mail</strong> (required)</label>
 *   [email* your-email id:cf7-email autocomplete:email]</p>
 *   <p class="cf7_field"><label for="cf7-subject"><strong>Subject</strong> (required)</label>
 *   [text* your-subject id:cf7-subject]</p>
 *   <p class="cf7_field"><label for="cf7-message"><strong>Message</strong> (required)</label>
 *   [textarea* your-message id:cf7-message x5]</p>
 *   <p class="cf7_submit"><button type="submit" class="button button-primary hover-button-default btn_submit">Submit</button></p>
 *
 * Colour note: the design's Gold field line (#C29D62) is 2.5:1 on white. A field's edge needs 3:1 (WCAG 1.4.11),
 * so the lines use a darker gold, #A07C45 (3.7:1). Focus: a 2px Charcoal line and an outline.
 */

/* ------------------------------------------------------------------
 * Section and columns
 * ------------------------------------------------------------------ */
.section_contact {
	position: relative;
	--contact-line: var(--wp--preset--color--secondary);
	--contact-field-line: #a07c45;
}

.section_contact.global-block-ptb {
	padding-top: clamp(48px, 4.9vw, 84px);
	padding-bottom: clamp(60px, 8.3vw, 144px);
}

.section_contact.has_bg_color {
	--contact-line: currentColor;
}

/* Background Image (Settings): a 70% Charcoal overlay; set the text colour to White. */
.section_contact.has_bg::before {
	content: "";
	position: absolute;
	inset: 0;
	background: var(--wp--preset--color--secondary);
	opacity: 0.7;
	pointer-events: none; /* decorative */
}

.section_contact.has_bg > .container {
	position: relative;
}

.contact_grid {
	display: grid;
	grid-template-columns: minmax(0, 504fr) minmax(0, 855fr);
	column-gap: 19px;
	align-items: start;
}

.top-line-one .contact_grid {
	padding-top: 31px;
	border-top: 1px solid var(--contact-line);
}

.top-line-two .contact_head,
.top-line-two .contact_body {
	padding-top: 31px;
	border-top: 1px solid var(--contact-line);
}

/* ------------------------------------------------------------------
 * Left: title, contact details, social icons
 * ------------------------------------------------------------------ */
.contact_head .section_title_above {
	margin: 0 0 12px;
}

.contact_title {
	max-width: 12.5em; /* "Every project starts / somewhere. Let's talk." */
	margin: 0;
	font-weight: 700;
	letter-spacing: 0;
}

.contact_title:not([class*="fontsize-"]) {
	font-size: var(--wp--preset--font-size--medium-32);
	line-height: 1.3;
}

.contact_description {
	max-width: 420px;
	margin-top: 16px;
}

.contact_description p {
	margin: 0 0 16px;
}

.contact_description > :last-child {
	margin-bottom: 0;
}

.contact_details {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	margin-top: clamp(28px, 3.5vw, 60px);
	font-size: var(--wp--preset--font-size--body);
	font-style: normal;
	line-height: 30px;
}

.contact_details a {
	color: inherit;
	overflow-wrap: anywhere; /* long e-mail addresses in narrow columns */
}

.contact_email {
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 4px;
}

.contact_phone {
	text-decoration: none;
}

.contact_phone:hover,
.contact_email:hover {
	text-decoration-thickness: 2px;
}

.contact_phone:hover {
	text-decoration: underline;
	text-underline-offset: 4px;
}

.contact_address {
	margin-top: 8px;
}

/* Social icons ([site_social_links]): 21px icons, 44px targets (WCAG 2.5.8), first icon on the column edge. */
.contact_social {
	margin-top: 12px;
}

.contact_social .site_social_links {
	display: flex;
	flex-wrap: wrap;
	margin: 0 0 0 -11.5px;
	padding: 0;
	list-style: none;
}

.contact_social .site_social_links li {
	margin: 0;
	padding: 0;
}

.contact_social .site_social_links li::before {
	content: none;
}

.contact_social .site_social_links a {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	color: inherit;
	font-size: 21px;
	line-height: 1;
	text-decoration: none;
}

.contact_social .site_social_links a:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: -4px;
}

.contact_button {
	margin-top: 32px;
}

/* ------------------------------------------------------------------
 * Right: the form (Contact Form 7)
 * ------------------------------------------------------------------ */
.section_contact .wpcf7-form {
	display: block; /* the theme's form flex layout is not used here */
}

.section_contact .wpcf7-form .cf7_row {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	column-gap: 21px;
}

.section_contact .wpcf7-form p,
.section_contact .wpcf7-form .cf7_field {
	margin: 0;
	width: auto;
}

.section_contact .wpcf7-form .cf7_field + .cf7_field,
.section_contact .wpcf7-form .cf7_row + .cf7_field {
	margin-top: 34px;
}

/* The two fields side by side start on the same line. */
.section_contact .wpcf7-form .cf7_row > .cf7_field {
	margin-top: 0;
}

.section_contact .wpcf7-form label {
	display: block;
	margin: 0;
	color: inherit;
	font-size: var(--wp--preset--font-size--body);
	font-weight: 400;
	line-height: 30px;
}

.section_contact .wpcf7-form label strong {
	font-weight: 700;
}

.section_contact .wpcf7-form .wpcf7-form-control-wrap {
	display: block;
	margin: 0;
}

/* Fields: no box, only the line under them (as in the design). */
.section_contact .wpcf7-form input[type="text"],
.section_contact .wpcf7-form input[type="email"],
.section_contact .wpcf7-form input[type="tel"],
.section_contact .wpcf7-form input[type="url"],
.section_contact .wpcf7-form textarea {
	display: block;
	width: 100%;
	height: 52px;
	margin: 0;
	padding: 10px 0;
	border: 0;
	border-bottom: 1px solid var(--contact-field-line);
	border-radius: 0;
	background: transparent;
	color: inherit;
	font-family: inherit;
	font-size: var(--wp--preset--font-size--body);
	line-height: 30px;
	box-shadow: none;
}

.section_contact .wpcf7-form textarea {
	height: 140px;
	min-height: 140px;
	resize: vertical;
}

/* Keyboard focus: a thicker Charcoal line and an outline (WCAG 2.4.7, 2.4.13). Not after a mouse or touch
 * press (js/focus-source.js, css/navigation.css): then only the text cursor shows. */
.section_contact .wpcf7-form input:focus-visible,
.section_contact .wpcf7-form textarea:focus-visible {
	border-bottom: 2px solid var(--wp--preset--color--secondary);
	outline: 2px solid var(--wp--preset--color--secondary);
	outline-offset: 4px;
}

html[data-input="pointer"] .section_contact .wpcf7-form input:not(.wpcf7-not-valid):focus,
html[data-input="pointer"] .section_contact .wpcf7-form textarea:not(.wpcf7-not-valid):focus {
	border-bottom: 1px solid var(--contact-field-line);
	outline: none;
}


/* Error state: a red line, the message under the field (Contact Form 7 links it with aria-describedby). */
.section_contact .wpcf7-form input.wpcf7-not-valid,
.section_contact .wpcf7-form textarea.wpcf7-not-valid {
	border-bottom: 2px solid #b3261e;
}

.section_contact .wpcf7-form .wpcf7-not-valid-tip {
	display: block;
	margin-top: 6px;
	padding: 0;
	border-radius: 0;
	background: none; /* the theme's red box (theme.css) is not used here: red text on white is 6.5:1 */
	letter-spacing: 0;
	color: #b3261e; /* 6.5:1 on white */
	font-size: var(--wp--preset--font-size--small-16);
	font-weight: 600;
	line-height: 1.4;
}

.section_contact .wpcf7-form .cf7_submit {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-top: 42px;
}

.section_contact .wpcf7-form .wpcf7-spinner {
	margin: 0;
}

/* Result message under the form (sent, errors). */
.section_contact .wpcf7 form .wpcf7-response-output {
	margin: 24px 0 0;
	padding: 12px 16px;
	border: 2px solid var(--contact-field-line);
	border-radius: 0;
	font-size: var(--wp--preset--font-size--body);
	line-height: 1.5;
}

/* Empty until there is a result (Contact Form 7 does this too; kept here in case its stylesheet is off). */
.section_contact .wpcf7 form.init .wpcf7-response-output,
.section_contact .wpcf7 form.resetting .wpcf7-response-output,
.section_contact .wpcf7 form.submitting .wpcf7-response-output {
	display: none;
}

.section_contact .wpcf7 form.invalid .wpcf7-response-output,
.section_contact .wpcf7 form.unaccepted .wpcf7-response-output,
.section_contact .wpcf7 form.failed .wpcf7-response-output {
	border-color: #b3261e;
}

.section_contact .wpcf7 form.sent .wpcf7-response-output {
	border-color: #2e7d32;
}

/* Thank-you text (replaces the form after sending). */
.contact_thankyou_title {
	margin: 0 0 16px;
	font-size: var(--wp--preset--font-size--medium-32);
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: 0;
}

.contact_thankyou_title:focus {
	outline: none; /* it gets focus only by script, to be read out; it is not a control */
}

.contact_thankyou_text {
	max-width: 760px;
	font-size: var(--wp--preset--font-size--body);
	line-height: 30px;
}

.contact_thankyou_text p {
	margin: 0 0 16px;
}

/* ------------------------------------------------------------------
 * Smaller screens: details above the form
 * ------------------------------------------------------------------ */
@media screen and (max-width: 900px) {
	.contact_grid {
		grid-template-columns: minmax(0, 1fr);
		row-gap: 40px;
	}

	.top-line-two .contact_body {
		padding-top: 0;
		border-top: 0;
	}
}

@media screen and (max-width: 600px) {
	.section_contact .wpcf7-form .cf7_row {
		grid-template-columns: minmax(0, 1fr);
	}

	.section_contact .wpcf7-form .cf7_row > .cf7_field + .cf7_field {
		margin-top: 34px;
	}
}

/* Empty block in the editor. */
.contact_block_empty {
	margin: 0;
	padding: 40px 20px;
	border: 1px dashed var(--wp--preset--color--mediumgrey);
	border-radius: 24px;
	text-align: center;
}
