/*
 * Contact page popup message form (vv/contact-form) — a native <dialog>.
 * Tokens only — every colour, spacing, radius and shadow value here
 * traces to theme.json (docs/03-design-tokens.md).
 */

/*
 * The trigger button and the (closed, `display:none` by default) <dialog>
 * render as direct siblings inside patterns/contact.php's existing
 * wp:buttons flex row — no wrapper div, so flexbox `gap` spaces the
 * trigger correctly without depending on core's `.wp-block-buttons >
 * .wp-block-button` selectors, which don't match through an extra
 * wrapper layer (this previously left the button unstyled and wrapping
 * onto its own line). Fully self-styled rather than reusing
 * `is-style-outline` for the same reason — no ambiguity about which
 * cascade layer wins. Forest (not terracotta) deliberately distinguishes
 * this from the other two buttons — DESIGN LAW keeps terracotta as the
 * one *filled* action colour, so forest appears only in outline form here.
 */
.vv-contact-trigger {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: var(--wp--preset--spacing--xs) var(--wp--preset--spacing--lg);
	border: 2px solid var(--wp--preset--color--forest-700);
	border-radius: var(--wp--custom--radius--pill);
	background: transparent;
	color: var(--wp--preset--color--forest-700);
	font-family: inherit;
	font-size: var(--wp--preset--font-size--body);
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
	transition:
		background-color 180ms var(--wp--custom--motion--entrance-ease),
		color 180ms var(--wp--custom--motion--entrance-ease);
}

.vv-contact-trigger:hover {
	background: var(--wp--preset--color--forest-700);
	color: var(--wp--preset--color--cream-50);
}

.vv-contact-trigger:focus-visible {
	outline: 2px solid var(--wp--preset--color--forest-700);
	outline-offset: 3px;
}

.vv-contact-modal {
	width: 100%;
	max-width: min(560px, calc(100vw - 2 * var(--wp--preset--spacing--sm)));
	margin: auto;
	border: none;
	border-radius: var(--wp--custom--radius--lg);
	padding: 0;
	background: var(--wp--preset--color--card-background);
	box-shadow: var(--wp--preset--shadow--soft-lg);
	color: var(--wp--preset--color--body-text);
}

.vv-contact-modal::backdrop {
	background-color: rgba(34, 44, 27, 0.45);
}

@media (prefers-reduced-motion: no-preference) {
	.vv-contact-modal {
		opacity: 0;
		transform: translateY(8px) scale(0.98);
		transition:
			opacity 240ms var(--wp--custom--motion--entrance-ease),
			transform 240ms var(--wp--custom--motion--entrance-ease),
			display 240ms allow-discrete,
			overlay 240ms allow-discrete;
	}

	.vv-contact-modal[open] {
		opacity: 1;
		transform: translateY(0) scale(1);
	}

	@starting-style {
		.vv-contact-modal[open] {
			opacity: 0;
			transform: translateY(8px) scale(0.98);
		}
	}

	.vv-contact-modal::backdrop {
		background-color: rgba(34, 44, 27, 0);
		transition:
			background-color 240ms var(--wp--custom--motion--entrance-ease),
			display 240ms allow-discrete,
			overlay 240ms allow-discrete;
	}

	.vv-contact-modal[open]::backdrop {
		background-color: rgba(34, 44, 27, 0.45);
	}

	@starting-style {
		.vv-contact-modal[open]::backdrop {
			background-color: rgba(34, 44, 27, 0);
		}
	}
}

.vv-contact-modal__panel {
	position: relative;
	padding: var(--wp--preset--spacing--lg);
}

.vv-contact-modal__close {
	position: absolute;
	top: var(--wp--preset--spacing--sm);
	right: var(--wp--preset--spacing--sm);
	width: 36px;
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: var(--wp--custom--radius--pill);
	border: 1px solid var(--wp--preset--color--card-border);
	background: var(--wp--preset--color--cream-50);
	color: var(--wp--preset--color--heading-text);
	cursor: pointer;
}

.vv-contact-modal__close:hover,
.vv-contact-modal__close:focus-visible {
	background: var(--wp--preset--color--cream-200);
	outline: 2px solid var(--wp--preset--color--terracotta-600);
	outline-offset: 2px;
}

.vv-contact-modal__title {
	font-family: var(--wp--preset--font-family--fraunces);
	font-size: var(--wp--preset--font-size--h-4);
	color: var(--wp--preset--color--heading-text);
	margin: 0 var(--wp--preset--spacing--xl) var(--wp--preset--spacing--3-xs) 0;
}

.vv-contact-modal__intro {
	color: var(--wp--preset--color--muted-text);
	margin: 0 0 var(--wp--preset--spacing--md);
}

.vv-contact-form__row {
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--3-xs);
	margin-bottom: var(--wp--preset--spacing--sm);
}

.vv-contact-form__row label {
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	color: var(--wp--preset--color--heading-text);
}

.vv-contact-form__row input,
.vv-contact-form__row textarea {
	border: 1px solid var(--wp--preset--color--card-border);
	border-radius: var(--wp--custom--radius--sm);
	padding: var(--wp--preset--spacing--xs) var(--wp--preset--spacing--sm);
	font-size: var(--wp--preset--font-size--body);
	font-family: inherit;
	min-height: 44px;
	background: var(--wp--preset--color--white);
	color: var(--wp--preset--color--body-text);
}

.vv-contact-form__row textarea {
	min-height: 110px;
	resize: vertical;
}

.vv-contact-form__row input:focus-visible,
.vv-contact-form__row textarea:focus-visible {
	outline: 2px solid var(--wp--preset--color--terracotta-600);
	outline-offset: 2px;
}

.vv-contact-form__hp {
	position: absolute;
	left: -9999px;
}

.vv-contact-form__captcha-note {
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--muted-text);
	margin: 0 0 var(--wp--preset--spacing--sm);
}

.vv-contact-form__status {
	min-height: 1.2em;
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--forest-700);
	margin: 0 0 var(--wp--preset--spacing--sm);
}

.vv-contact-form__actions {
	display: flex;
	justify-content: flex-end;
	gap: var(--wp--preset--spacing--sm);
}

.vv-contact-form__cancel {
	background: transparent;
	border: 1px solid var(--wp--preset--color--card-border);
	border-radius: var(--wp--custom--radius--pill);
	padding: var(--wp--preset--spacing--xs) var(--wp--preset--spacing--lg);
	min-height: 44px;
	cursor: pointer;
	color: var(--wp--preset--color--body-text);
}

.vv-contact-form__submit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: var(--wp--preset--spacing--xs) var(--wp--preset--spacing--lg);
	border: none;
	border-radius: var(--wp--custom--radius--pill);
	background: var(--wp--preset--color--button-primary);
	color: var(--wp--preset--color--button-primary-text);
	font-family: inherit;
	font-size: var(--wp--preset--font-size--body);
	font-weight: 600;
	cursor: pointer;
}

.vv-contact-form__submit:hover {
	background: var(--wp--preset--color--terracotta-700);
}

.vv-contact-form__submit:focus-visible {
	outline: 2px solid var(--wp--preset--color--terracotta-600);
	outline-offset: 2px;
}

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

@media (max-width: 480px) {
	.vv-contact-modal__panel {
		padding: var(--wp--preset--spacing--md);
	}

	.vv-contact-form__actions {
		flex-direction: column-reverse;
	}

	.vv-contact-form__cancel,
	.vv-contact-form__submit {
		width: 100%;
	}
}
