/**
 * Mertex 2026 Contact Form 7 residual styles.
 *
 * The form markup (cf7-forms/) carries Bootstrap 5 classes — .row/.col-md-6,
 * .mb-3, .form-control, .form-select, .btn — so layout, spacing, and control
 * chrome come from the bundled bootstrap.min.css. This file only holds what
 * class names cannot express: Mertex design tokens and CF7-generated classes.
 *
 * @package Mertex_2026
 */

/* CF7 markup helpers */

/* Hide stray <br> tags. */
.wpcf7 .mertex-cf7 br {
	display: none;
}

.wpcf7 .mertex-cf7 .wpcf7-form-control-wrap {
	display: block;
	width: 100%;
}

/* Fields: brand tokens on top of .form-control / .form-select. */

.wpcf7 .mertex-cf7 .form-control,
.wpcf7 .mertex-cf7 .form-select {
	background-color: var(--white-color);
	border-color: transparent;
}

.wpcf7 .mertex-cf7 input.form-control,
.wpcf7 .mertex-cf7 .form-select {
	height: 48px;
}

.wpcf7 .mertex-cf7 .form-control:hover,
.wpcf7 .mertex-cf7 .form-select:hover,
.wpcf7 .mertex-cf7 .form-control:focus,
.wpcf7 .mertex-cf7 .form-select:focus {
	background-color: var(--white-color);
	border-color: var(--primary-color);
}

/* Brand-blue focus ring replacing the Bootstrap default ring. */
.wpcf7 .mertex-cf7 .form-control:focus,
.wpcf7 .mertex-cf7 .form-select:focus {
	box-shadow: 0 0 0 0.25rem rgba(131, 192, 240, 0.25);
}

.wpcf7 .mertex-cf7 .form-control::placeholder {
	color: var(--mertex-muted);
}

/* Mute the select text while the empty first_as_label option is selected. */
.wpcf7 .mertex-cf7 .form-select:invalid {
	color: var(--mertex-muted);
}

/* Options render in the normal text color inside the open dropdown. */
.wpcf7 .mertex-cf7 .form-select option {
	color: var(--secondary-color);
}

.wpcf7 .mertex-cf7 textarea.form-control {
	min-height: 140px;
	resize: vertical;
}

/* Submit button: Bootstrap .btn base + Mertex brand colors. */

.wpcf7 .mertex-cf7 .btn-mertex {
	background-color: var(--dark-color);
	border-color: var(--dark-color);
	color: var(--white-color);
	font-weight: 600;
	letter-spacing: 0.06em;
	padding: 0.75rem 2.5rem;
	text-transform: uppercase;
}

.wpcf7 .mertex-cf7 .btn-mertex:hover,
.wpcf7 .mertex-cf7 .btn-mertex:focus {
	background-color: var(--primary-color);
	background-color: color-mix(in srgb, var(--primary-color) 85%, #000000);
	border-color: transparent;
	color: var(--white-color);
}

.wpcf7 .mertex-cf7 .btn-mertex:focus {
	box-shadow: 0 0 0 0.25rem rgba(131, 192, 240, 0.25);
}

.wpcf7 .mertex-cf7 .wpcf7-spinner {
	margin-left: 0.75rem;
	vertical-align: middle;
}

/* CF7 validation mapped to Bootstrap feedback values. */

.wpcf7 .mertex-cf7 .form-control.wpcf7-not-valid,
.wpcf7 .mertex-cf7 .form-select.wpcf7-not-valid {
	border-color: var(--bs-danger);
}

/* Same values as Bootstrap .invalid-feedback (which stays display:none). */
.wpcf7 .mertex-cf7 .wpcf7-not-valid-tip {
	color: var(--bs-danger);
	display: block;
	font-size: 0.875em;
	margin-top: 0.25rem;
}

.wpcf7 .mertex-cf7 ~ .wpcf7-response-output {
	margin: 1rem 0 0;
}

/* Fill-height layout: grow the textarea so the form fills its Elementor
 * column's background area (e.g. the grey contact column).
 *
 * The CF7 shortcode sits in an .elementor-widget-wrap that is display:flex
 * with row direction + flex-wrap:wrap, so flex-grow there can only widen a
 * widget, never stretch it vertically. The chain below flips the wrap to a
 * single flex column, then passes a definite height down through
 * .elementor-shortcode → .wpcf7 → <form> → .mertex-cf7 → the message <p> →
 * .wpcf7-form-control-wrap, so the textarea absorbs the leftover space.
 * Every rule is scoped by :has(.mertex-cf7): without a definite-height
 * ancestor the percentages resolve to auto and flex:1 finds no free space,
 * so forms outside this layout render exactly as before.
 */

/* Wrap becomes a vertical stack; Vertical Position (align-content) is inert
 * with nowrap, so top/center columns behave identically. */
.elementor-widget-wrap:has(> .elementor-element .mertex-cf7) {
	flex-direction: column;
	flex-wrap: nowrap;
}

/* The widget holding the form claims the wrap's leftover height. */
.elementor-widget-wrap > .elementor-element:has(.mertex-cf7) {
	flex: 1 1 auto;
	min-height: 0;
}

/* Definite height down to the <form>. */
.elementor-shortcode:has(.mertex-cf7),
.elementor-widget-container:has(.mertex-cf7),
.wpcf7:has(.mertex-cf7),
.wpcf7-form:has(.mertex-cf7) {
	height: 100%;
}

/* Inside the form: .mertex-cf7 grows; .wpcf7-response-output keeps its
 * natural height at the bottom. */
.wpcf7-form:has(.mertex-cf7) {
	display: flex;
	flex-direction: column;
}

.wpcf7 .mertex-cf7 {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	min-height: 0;
}

/* The message field's <p>, its control wrap, and the textarea absorb the
 * remaining space; the existing min-height: 140px stays the floor. */
.wpcf7 .mertex-cf7 > p:has(textarea) {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	min-height: 0;
}

.wpcf7 .mertex-cf7 > p:has(textarea) .wpcf7-form-control-wrap {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	min-height: 0;
}

.wpcf7 .mertex-cf7 textarea.form-control {
	flex: 1 1 auto;
}
