/**
 * Contact Form 7 forms built with the .merineo-form template (prototype Field, Input, Button).
 *
 * The plugin stylesheet stays loaded (spinner, screen reader response); only what differs
 * from the design is overridden here.
 */

.merineo-form {
	display: grid;
	gap: 18px;
	color: var(--wp--preset--color--ink);
}

.merineo-form__field {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.merineo-form__field > label {
	font-size: 12px;
	font-weight: 600;
	line-height: 1.4;
	letter-spacing: 0.1em;
	text-transform: uppercase;
}

.merineo-form__required {
	color: var(--wp--preset--color--blue-deep);
}

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

.merineo-form :is(input[type="text"], input[type="email"], input[type="tel"], textarea) {
	box-sizing: border-box;
	display: block;
	width: 100%;
	height: 44px;
	margin: 0;
	padding: 0 12px;
	font: inherit;
	font-size: 17px;
	line-height: 1.4;
	color: var(--wp--preset--color--ink);
	background: var(--wp--preset--color--white);
	border: 1px solid var(--wp--preset--color--sky);
	border-radius: 4px;
	box-shadow: none;
	transition: color 160ms, background-color 160ms, border-color 160ms;
}

/* Same specificity as the field rule above (its :is() counts the input attribute selectors). */
.merineo-form .merineo-form__field textarea {
	height: auto;
	padding: 12px;
	resize: vertical;
}

.merineo-form :is(input, textarea):focus {
	border-color: var(--wp--preset--color--blue-deep);
	outline: 1px solid var(--wp--preset--color--blue-deep);
	outline-offset: 0;
}

.merineo-form .merineo-form__field .wpcf7-not-valid {
	border-color: #c2453d;
}

.merineo-form .wpcf7-not-valid-tip {
	margin-top: 6px;
	font-size: 13px;
	line-height: 1.5;
	color: #c2453d;
}

.merineo-form__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
}

/* Submit: ink pill with the diagonal arrow (prototype Pill, tone "ink"). */
.merineo-form__submit {
	display: inline-flex;
	gap: 9px;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	min-height: 52px;
	margin: 0;
	padding: 14px 26px;
	font: inherit;
	font-size: 15.5px;
	font-weight: 600;
	line-height: 1.25;
	letter-spacing: 0.005em;
	color: var(--wp--preset--color--white);
	text-align: center;
	cursor: pointer;
	background: var(--wp--preset--color--ink);
	border: 1px solid transparent;
	border-radius: 999px;
	transition: background-color 260ms cubic-bezier(0.2, 0, 0, 1), color 260ms cubic-bezier(0.2, 0, 0, 1);
}

.merineo-form__submit::after {
	flex: 0 0 auto;
	width: 14px;
	height: 14px;
	content: "";
	background-color: currentcolor;
	-webkit-mask: url("../images/arrow-diagonal.svg") center / contain no-repeat;
	mask: url("../images/arrow-diagonal.svg") center / contain no-repeat;
	transition: transform 260ms cubic-bezier(0.2, 0, 0, 1);
}

.merineo-form__submit:hover {
	background: var(--wp--preset--color--blue-deep);
}

.merineo-form__submit:hover::after {
	transform: translate(2px, -2px);
}

.merineo-form__submit:disabled {
	cursor: default;
	opacity: 0.6;
}

/* The plugin spinner keeps its space while hidden and would wrap below the button in narrow
 * columns; the button itself shows the sending state instead. */
.merineo-form .wpcf7-spinner {
	display: none;
}

.wpcf7 form.submitting .merineo-form__submit {
	cursor: progress;
	opacity: 0.6;
}

.merineo-form .merineo-form__note {
	max-width: var(--wp--custom--measure--prose, 64ch);
	margin: 0;
	font-size: 13px;
	line-height: 1.5;
	color: var(--wp--preset--color--slate);
}

/* Message under the form (validation errors, sending failures). */
.wpcf7 form:has(.merineo-form) .wpcf7-response-output {
	margin: 18px 0 0;
	padding: 12px 16px;
	font-size: 14px;
	line-height: 1.5;
	color: var(--wp--preset--color--ink);
	border: 1px solid var(--wp--preset--color--sky);
	border-radius: 4px;
}

.wpcf7 form:has(.merineo-form):is(.invalid, .unaccepted, .payment-required, .failed, .aborted, .spam) .wpcf7-response-output {
	border-color: #c2453d;
}

/* After sending, the thank-you note replaces the fields (prototype ContactForm). */
.merineo-form__thanks {
	display: none;
	padding: 32px;
	background: var(--wp--preset--color--white);
	border: 1px solid rgba(11, 13, 23, 0.14);
	border-radius: 4px;
}

.merineo-form__thanks > * {
	margin: 10px 0 0;
	font-size: 16px;
	line-height: 1.6;
}

.merineo-form__thanks > :first-child {
	margin: 0;
	font-size: 20px;
	font-weight: 700;
}

.wpcf7 form.sent .merineo-form > :not(.merineo-form__thanks),
.wpcf7 form.sent:has(.merineo-form) .wpcf7-response-output {
	display: none;
}

.wpcf7 form.sent .merineo-form__thanks {
	display: block;
}

@media (prefers-reduced-motion: reduce) {

	.merineo-form__submit::after {
		transition: none;
	}
}
