/**
 * Contact Form 7 — layout for the forms from the old site.
 *
 * The forms carried over from the previous theme (Baubuch, Kontakt,
 * Online-Beratung, Besichtigungen, Services, Partner, Kunden empfehlen Kunden,
 * Newsletter …) are written in that theme's markup: .musterhaus-contact with a
 * left and a right column, Bootstrap rows, a .musterhaus-datenschutzhinweis
 * box. Their layout used to live in bb-theme-child/style.css and left with it.
 *
 * cf7.css already styles every control in them. What it cannot give them is
 * layout — that comes from the .fmt-form-* helpers, which these forms do not
 * use. This file maps the old classes onto the same rhythm instead, so the old
 * forms sit next to the new ones without being rewritten.
 *
 * Temporary by design: as a form is rebuilt with the .fmt-form-* helpers it
 * drops out of here, and when no form uses these classes any more the file
 * goes, together with its enqueue in functions.php. Nothing else depends on it.
 */

/* =========================================================
   Two columns — .musterhaus-contact
   ========================================================= */

.musterhaus-contact:not(.row) {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 14px;
	align-items: start;
}

/* Each column is a stack of fields with the same gap as the rows of a new
   form. The wrappers the old theme drew its underline on (.fm-form-select,
   .grundstueck-select) are plain blocks now and need nothing. */
.musterhaus-contact-left,
.musterhaus-contact-right {
	display: flex;
	flex-direction: column;
	gap: 14px;
	min-width: 0;
}

/* Left over from wpautop days; in a flex column a <br> would cost a gap, and
   in front of the privacy notice it doubles the space above it. */
.musterhaus-contact br,
.wpcf7 br:has(+ .musterhaus-datenschutzhinweis) {
	display: none;
}

/* =========================================================
   Bootstrap rows — Kunden empfehlen Kunden, Multistep
   ========================================================= */

/* Only the classes these forms use, on a 12 column grid. Breakpoints are
   Bootstrap's: sm 576px, md 768px. */
.wpcf7 .container {
	padding: 0;
}
.wpcf7 .row {
	display: grid;
	grid-template-columns: repeat(12, minmax(0, 1fr));
	gap: 14px;
}
.wpcf7 .row + .row {
	margin-top: 14px;
}
.wpcf7 .row > * {
	grid-column: span 12;
	min-width: 0;
}
@media (min-width: 576px) {
	.wpcf7 .row > .col-sm-3 {
		grid-column: span 3;
	}
	.wpcf7 .row > .col-sm-9 {
		grid-column: span 9;
	}
}
@media (min-width: 768px) {
	.wpcf7 .row > .col-md-4 {
		grid-column: span 4;
	}
	.wpcf7 .row > .col-md-6 {
		grid-column: span 6;
	}
	.wpcf7 .row > .col-md-8 {
		grid-column: span 8;
	}
}

/* Section headings inside a form ("Ihre Angaben als Vermittler"). */
.wpcf7 .row h3 {
	margin: 0;
	font-size: 18px;
	font-weight: 500;
	letter-spacing: -0.01em;
	color: var(--ink);
}

/* =========================================================
   Multistep — Baubuch bestellen
   ========================================================= */

.wpcf7 .fh-step-title {
	margin: 0 0 18px;
	font-size: 22px;
	font-weight: 500;
	line-height: 1.25;
	letter-spacing: -0.015em;
	color: var(--ink);
}

/* The label comes after its input in the markup (the old theme floated it
   into the field); here it goes back on top, in the style of .fmt-form-label. */
.wpcf7 .fh-multi-contact-field {
	display: flex;
	flex-direction: column-reverse;
}
.wpcf7 .fh-multi-contact-field > label {
	display: block;
	margin-bottom: 8px;
	font-size: 11px;
	font-weight: 500;
	text-transform: uppercase;
	letter-spacing: .12em;
	color: var(--ink-mute);
}

/* =========================================================
   Forms written as running text — Newsletter
   ========================================================= */

/* Fields sit directly in a paragraph, between bits of loose text, with
   nothing to space them. Their margins collapse into one gap between two
   fields. */
.wpcf7 form > p > .wpcf7-form-control-wrap,
.wpcf7 form > .wpcf7-form-control-wrap {
	margin-block: 14px;
}

/* =========================================================
   Consent — the [checkbox* einverstanden] every old form ends with
   ========================================================= */

/* A sentence to agree with, not an option to pick: the same treatment as
   .fmt-form-consent in cf7.css. All old forms name the field the same. */
.wpcf7-form-control-wrap[data-name="einverstanden"] .wpcf7-checkbox .wpcf7-list-item label,
.wpcf7-form-control-wrap[data-name="einverstanden"] .wpcf7-checkbox .wpcf7-list-item label:hover,
.wpcf7-form-control-wrap[data-name="einverstanden"] .wpcf7-checkbox .wpcf7-list-item label:has(input:checked) {
	align-items: flex-start;
	padding: 0;
	font-size: 12px;
	font-weight: 400;
	line-height: 1.5;
	color: var(--ink-soft);
	background: none;
	border-color: transparent;
}
.wpcf7-form-control-wrap[data-name="einverstanden"] .wpcf7-checkbox input[type="checkbox"] {
	margin-top: 3px;
}

/* =========================================================
   Privacy notice and submit
   ========================================================= */

/* The same box as .fmt-form-note. */
.musterhaus-datenschutzhinweis {
	margin: 0 0 18px;
	padding: 14px 16px;
	font-size: 11.5px;
	line-height: 1.55;
	color: var(--ink-mute);
	background: var(--bg-2);
	border: 1px solid var(--line);
	border-radius: 8px;
}
.musterhaus-contact .musterhaus-datenschutzhinweis {
	margin: 0;
}
.musterhaus-datenschutzhinweis b,
.musterhaus-datenschutzhinweis strong {
	font-weight: 500;
	color: var(--ink-soft);
}
.musterhaus-datenschutzhinweis a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* Centred, as on the old site. The button sits in the middle track and the
   spinner in the one beside it, so the spinner's space does not push the
   button off centre. */
.musterhaus-contact-button {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	margin-top: 22px;
}
.musterhaus-contact-button .wpcf7-submit {
	grid-column: 2;
}
.musterhaus-contact-button .wpcf7-spinner {
	justify-self: start;
}

/* =========================================================
   Phone — one column
   ========================================================= */

@media (max-width: 680px) {
	.musterhaus-contact:not(.row) {
		grid-template-columns: 1fr;
	}
	/* rows="10" is there to fill the right column next to the left one; in a
	   single column it is just a tall box. */
	.musterhaus-contact .wpcf7-textarea {
		height: 140px;
	}
	/* The button runs full width here (cf7.css); the spinner goes below it. */
	.musterhaus-contact-button {
		grid-template-columns: 1fr;
	}
	.musterhaus-contact-button .wpcf7-submit {
		grid-column: 1;
	}
	.musterhaus-contact-button .wpcf7-spinner {
		justify-self: center;
		margin: 14px 0 0;
	}
}
