/**
 * Contact Form 7 — flat, minimal, full-width form styling.
 *
 * Reference: Material Design 3 "filled" text fields (tinted surface,
 * bottom indicator line that thickens on focus), simplified to flat:
 * no shadows, no elevation, no floating labels (static labels above
 * each field are more accessible and need no markup changes).
 *
 * All colors/fonts come from theme.json presets, so a future rebrand
 * (Phase 02) only needs to change the palette, not this file.
 * Everything is scoped under .wpcf7 so nothing else on the site is affected.
 */

.wpcf7 {
	--cf-surface: color-mix(in srgb, var(--wp--preset--color--contrast) 4%, var(--wp--preset--color--base));
	--cf-surface-hover: color-mix(in srgb, var(--wp--preset--color--contrast) 8%, var(--wp--preset--color--base));
	--cf-line: var(--wp--preset--color--accent-4);
	--cf-focus: var(--wp--preset--color--contrast);
	--cf-error: #b3261e; /* Material 3 error tone; 6.5:1 on white */
	--cf-success: #1b6e3a;
	--cf-radius: 4px;
	--cf-gap: 1.5rem;

	width: 100%;
	margin-block-start: var(--wp--preset--spacing--40, 1.5rem);
}

.wpcf7 .wpcf7-form {
	display: flex;
	flex-direction: column;
	gap: var(--cf-gap);
}

/* CF7 wraps each row in <p>; let the flex gap handle spacing. */
.wpcf7 .wpcf7-form > p {
	margin: 0;
}

/* Labels: small, medium-weight, sitting above the field. */
.wpcf7 label {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	font-size: var(--wp--preset--font-size--small);
	font-weight: 500;
	letter-spacing: 0.01em;
	color: var(--wp--preset--color--contrast);
}

/* CF7 inserts a <br> between label text and field; flex gap replaces it. */
.wpcf7 label > br {
	display: none;
}

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

/* Text inputs + textarea: Material "filled" field, flattened. */
.wpcf7 input[type="text"],
.wpcf7 input[type="email"],
.wpcf7 input[type="tel"],
.wpcf7 input[type="url"],
.wpcf7 input[type="number"],
.wpcf7 textarea {
	box-sizing: border-box;
	width: 100%;
	min-height: 3.5rem; /* 56px — Material field height, comfortable touch target */
	padding: 1rem;
	border: 0;
	border-bottom: 1px solid var(--cf-line);
	border-radius: var(--cf-radius) var(--cf-radius) 0 0;
	background: var(--cf-surface);
	color: var(--wp--preset--color--contrast);
	font-family: inherit;
	font-size: 1rem; /* ≥16px prevents iOS zoom-on-focus */
	line-height: 1.5;
	appearance: none;
	transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.wpcf7 textarea {
	min-height: 10rem;
	resize: vertical;
}

.wpcf7 input:hover,
.wpcf7 textarea:hover {
	background: var(--cf-surface-hover);
}

/* Focus: the bottom line thickens to 2px and the surface darkens slightly
   (Material's active-indicator pattern). Inset shadow avoids layout shift.
   Text fields match :focus-visible on mouse click too, so a full outline
   ring here would show on every click — the indicator alone is enough. */
.wpcf7 input:not([type="submit"]):focus,
.wpcf7 textarea:focus {
	outline: none;
	background: var(--cf-surface-hover);
	box-shadow: inset 0 -2px 0 var(--cf-focus);
}

/* Invalid field (CF7 adds aria-invalid after a failed submit). */
.wpcf7 [aria-invalid="true"] {
	border-bottom-color: var(--cf-error);
	box-shadow: inset 0 -2px 0 var(--cf-error);
}

.wpcf7 .wpcf7-not-valid-tip {
	display: block;
	margin-top: 0.375rem;
	font-size: var(--wp--preset--font-size--small);
	font-weight: 400;
	color: var(--cf-error);
}

/* Submit: full-width pill, matching the header's yellow "Contact" button. */
.wpcf7 input[type="submit"] {
	box-sizing: border-box;
	width: 100%;
	min-height: 3.5rem;
	padding: 1rem 2rem;
	border: 0;
	border-radius: 9999px;
	background-color: var(--wp--preset--color--accent-1);
	color: var(--wp--preset--color--contrast);
	font-family: inherit;
	font-size: 1rem;
	font-weight: 600;
	letter-spacing: 0.02em;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.wpcf7 input[type="submit"]:hover {
	background-color: color-mix(in srgb, var(--wp--preset--color--accent-1) 85%, black);
}

.wpcf7 input[type="submit"]:focus-visible {
	outline: 2px solid var(--cf-focus);
	outline-offset: 3px;
}

.wpcf7 input[type="submit"]:disabled {
	opacity: 0.6;
	cursor: progress;
}

/* CF7's spinner: overlay it inside the right end of the button so it
   doesn't add height below the button while hidden. */
.wpcf7 .wpcf7-form > p:has(input[type="submit"]) {
	position: relative;
}

.wpcf7 .wpcf7-spinner {
	position: absolute;
	top: 50%;
	right: 1.25rem;
	margin: 0;
	transform: translateY(-50%);
	background-color: var(--wp--preset--color--contrast);
}

/* Response message: flat banner with a colored left rule. */
.wpcf7 form .wpcf7-response-output {
	margin: 0;
	padding: 0.875rem 1rem;
	border: 0;
	border-left: 4px solid var(--cf-line);
	border-radius: var(--cf-radius);
	background: var(--cf-surface);
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.5;
}

.wpcf7 form.sent .wpcf7-response-output {
	border-left-color: var(--cf-success);
	background: color-mix(in srgb, var(--cf-success) 8%, var(--wp--preset--color--base));
}

.wpcf7 form.invalid .wpcf7-response-output,
.wpcf7 form.unaccepted .wpcf7-response-output,
.wpcf7 form.failed .wpcf7-response-output,
.wpcf7 form.aborted .wpcf7-response-output,
.wpcf7 form.spam .wpcf7-response-output {
	border-left-color: var(--cf-error);
	background: color-mix(in srgb, var(--cf-error) 6%, var(--wp--preset--color--base));
}

@media (prefers-reduced-motion: reduce) {
	.wpcf7 input,
	.wpcf7 textarea {
		transition: none;
	}
}
