/*
 * Contact form ([threedh_contact_form]). Scoped to .threedh-contact and built only on the theme's
 * tokens (theme.json presets and custom properties), with fallbacks for other themes. Same look as
 * the registration form.
 */
.threedh-contact {
	--tc-surface: var(--wp--preset--color--accent-3, #1a1a1a);
	--tc-field: var(--wp--preset--color--base, #0d0d0d);
	--tc-text: var(--wp--preset--color--contrast, #f4f1ea);
	--tc-muted: var(--wp--preset--color--accent-4, #a8a29a);
	--tc-line: var(--wp--preset--color--accent-6, #3a3a3a);
	--tc-accent: var(--wp--preset--color--accent-1, #d72638);
	--tc-focus: var(--wp--custom--focus-ring, #e6ddcf);
	--tc-radius: var(--wp--preset--border-radius--sm, 6px);
	--tc-error: #ff7a88;
	--tc-ok: #8fd9ab;
}

.threedh-contact__form {
	display: grid;
	gap: 1.25rem;
	margin: 0;
	padding: clamp(1.25rem, 4vw, 2.25rem);
	background: var(--tc-surface);
	border: 1px solid var(--wp--custom--card-border, #262626);
	border-radius: var(--wp--preset--border-radius--md, 12px);
	color: var(--tc-text);
}

.threedh-contact__form p { margin: 0; }

.threedh-contact__row {
	display: grid;
	grid-template-columns: 1fr;
	gap: 1.25rem;
}

@media (min-width: 640px) {
	.threedh-contact__row { grid-template-columns: 1fr 1fr; }
}

.threedh-contact__field {
	display: flex;
	flex-direction: column;
	gap: 0.375rem;
	min-width: 0;
}

.threedh-contact__field > label {
	color: var(--tc-text);
	font-size: var(--wp--preset--font-size--small, 0.875rem);
	font-weight: 700;
	line-height: 1.3;
}

.threedh-contact__req { color: var(--tc-accent); font-weight: 800; }
.threedh-contact__opt { color: var(--tc-muted); font-weight: 500; }

.threedh-contact input[type="text"],
.threedh-contact input[type="email"],
.threedh-contact input[type="tel"],
.threedh-contact textarea {
	display: block;
	box-sizing: border-box;
	width: 100%;
	min-height: 44px;
	padding: 0.75rem 0.875rem;
	background: var(--tc-field);
	color: var(--tc-text);
	border: 1px solid var(--tc-line);
	border-radius: var(--tc-radius);
	font: inherit;
	font-size: 1rem; /* 16px stops iOS zoom on focus */
	line-height: 1.4;
}

.threedh-contact textarea { min-height: 9rem; resize: vertical; }

.threedh-contact input:hover,
.threedh-contact textarea:hover { border-color: var(--tc-muted); }

.threedh-contact input:focus-visible,
.threedh-contact textarea:focus-visible,
.threedh-contact__submit:focus-visible,
.threedh-contact__notice:focus-visible {
	outline: 2px solid var(--tc-focus);
	outline-offset: 2px;
}

/* Optional "text me" box under the phone row; same look as the consent boxes of the other forms. */
.threedh-contact__consent label {
	display: flex;
	align-items: flex-start;
	gap: 0.625rem;
	color: var(--wp--preset--color--accent-2, #e6ddcf);
	font-size: 1rem;
	font-weight: 500;
	line-height: 1.45;
	cursor: pointer;
}

.threedh-contact__consent a { color: inherit; text-decoration: underline; }

/* Drawn here, so it belongs to the dark form instead of showing as a white system box. */
.threedh-contact input[type="checkbox"] {
	-webkit-appearance: none;
	appearance: none;
	flex: none;
	box-sizing: border-box;
	width: 1.25rem;
	height: 1.25rem;
	margin: 0.125rem 0 0;
	padding: 0;
	background: var(--tc-field) center / 0.75rem no-repeat;
	border: 2px solid var(--tc-muted);
	border-radius: 4px;
	cursor: pointer;
}

.threedh-contact input[type="checkbox"]:hover { border-color: var(--tc-text); }

.threedh-contact input[type="checkbox"]:checked {
	background-color: #d92638;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.2 6.3l2.5 2.5 5.1-5.4' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	border-color: #d92638;
}

@media (forced-colors: active) {
	.threedh-contact input[type="checkbox"] { -webkit-appearance: auto; appearance: auto; }
}

.threedh-contact .has-error input,
.threedh-contact .has-error textarea { border-color: var(--tc-error); }

.threedh-contact__error {
	color: var(--tc-error);
	font-size: var(--wp--preset--font-size--small, 0.875rem);
	font-weight: 600;
}

.threedh-contact__error::before { content: "\26A0\FE0E\00a0"; }

.threedh-contact__notice {
	margin: 0;
	padding: 0.875rem 1rem;
	background: var(--tc-field);
	color: var(--tc-text);
	border: 1px solid var(--tc-line);
	border-left-width: 4px;
	border-radius: var(--tc-radius);
	font-weight: 600;
	line-height: 1.45;
}

.threedh-contact__notice--error { border-color: var(--tc-error); }
.threedh-contact__notice--ok { border-color: var(--tc-ok); }
.threedh-contact__notice ul { margin: 0.5rem 0 0; padding-left: 1.25rem; font-weight: 500; }
.threedh-contact__notice a { color: inherit; }

.threedh-contact__actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.threedh-contact__submit { min-height: 48px; cursor: pointer; }

@media (max-width: 599px) {
	.threedh-contact__submit { width: 100%; }
}

/* Honeypot: off screen, out of the tab order. */
.threedh-contact__hp {
	position: absolute;
	left: -10000px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}
