/*
 * WP Monthly Events — contact form ([wpme_contact]).
 *
 * Loaded only on the page that shows the form. Every property a theme is
 * likely to set on inputs and buttons is set here, so the form looks the
 * same in Kadence and in any other theme.
 *
 * Contrast on white (WCAG 2.1 AA): text 12:1, hints 6.9:1, error text 7.5:1,
 * field borders 4.4:1, button text 6.5:1.
 */

.wpme-contact {
	--wpme-contact-border: #7b7396;
	--wpme-contact-error: #a51d16;
	box-sizing: border-box;
	margin: 1.5rem 0 0;
	padding: clamp(1.25rem, 4vw, 2rem);
	border: 1px solid #e6defa;
	border-radius: 18px;
	background: #fff;
	color: #2e2a45;
	/* The page header is not sticky, but leave room when a theme's is. */
	scroll-margin-top: 6rem;
}

.wpme-contact *,
.wpme-contact *::before,
.wpme-contact *::after {
	box-sizing: inherit;
}

.wpme-contact [hidden] {
	display: none !important;
}

/* ---------- Fields ---------- */

.wpme-contact .wpme-contact__form {
	display: grid;
	gap: 1.25rem;
	margin: 0;
}

.wpme-contact__row {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
	gap: 1.25rem;
}

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

.wpme-contact .wpme-contact__field label {
	display: block;
	margin: 0;
	color: #120b2e;
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.4;
	letter-spacing: normal;
	text-transform: none;
}

.wpme-contact__required {
	color: #5b5675;
	font-size: 0.875em;
	font-weight: 400;
}

.wpme-contact .wpme-contact__field input,
.wpme-contact .wpme-contact__field select,
.wpme-contact .wpme-contact__field textarea {
	display: block;
	width: 100%;
	max-width: 100%;
	height: auto;
	min-height: 3rem;
	margin: 0;
	padding: 0.7rem 0.9rem;
	border: 1px solid var(--wpme-contact-border);
	border-radius: 10px;
	background-color: #fff;
	box-shadow: none;
	color: #120b2e;
	font: inherit;
	font-size: 1rem;
	line-height: 1.5;
	letter-spacing: normal;
	text-transform: none;
	appearance: none;
	-webkit-appearance: none;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.wpme-contact .wpme-contact__field textarea {
	min-height: 10rem;
	resize: vertical;
}

/* The arrow is drawn here because the native one goes with "appearance". */
.wpme-contact .wpme-contact__field select {
	padding-right: 2.75rem;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23120b2e' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 0.9rem center;
	background-size: 1.1rem;
	cursor: pointer;
}

.wpme-contact .wpme-contact__field input:hover,
.wpme-contact .wpme-contact__field select:hover,
.wpme-contact .wpme-contact__field textarea:hover {
	border-color: #120b2e;
}

/* Keyboard and pointer focus are both shown (WCAG 2.4.7). */
.wpme-contact .wpme-contact__field input:focus,
.wpme-contact .wpme-contact__field select:focus,
.wpme-contact .wpme-contact__field textarea:focus {
	border-color: #7120f3;
	outline: 3px solid #7120f3;
	outline-offset: 2px;
	box-shadow: none;
	color: #120b2e;
}

.wpme-contact .wpme-contact__field input[aria-invalid="true"],
.wpme-contact .wpme-contact__field select[aria-invalid="true"],
.wpme-contact .wpme-contact__field textarea[aria-invalid="true"] {
	border-color: var(--wpme-contact-error);
	box-shadow: inset 0 0 0 1px var(--wpme-contact-error);
}

.wpme-contact__hint {
	color: #5b5675;
	font-size: 0.875rem;
	line-height: 1.5;
}

.wpme-contact__error {
	color: var(--wpme-contact-error);
	font-size: 0.9375rem;
	font-weight: 600;
	line-height: 1.4;
}

/* A field for robots: people never see it or reach it. */
.wpme-contact__hp {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

/* ---------- Button and small print ---------- */

.wpme-contact .wpme-contact__privacy {
	margin: 0;
	color: #5b5675;
	font-size: 0.875rem;
	line-height: 1.5;
}

.wpme-contact .wpme-contact__privacy a,
.wpme-contact .wpme-contact__notice a {
	color: #7120f3;
	text-decoration: underline;
	text-underline-offset: 0.2em;
}

.wpme-contact .wpme-contact__notice--error a {
	color: var(--wpme-contact-error);
}

.wpme-contact__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem 1rem;
}

/* Four classes deep, to win over themes that style every button with a
   chain of :not() selectors. The button also carries WordPress's
   has-background and has-text-color classes, which such themes skip. */
.wpme-contact .wpme-contact__form .wpme-contact__actions .wpme-contact__submit {
	display: inline-block;
	width: auto;
	min-height: 3rem;
	margin: 0;
	padding: 0.875rem 1.75rem;
	border: 0;
	border-radius: 999px;
	background: #7120f3;
	box-shadow: none;
	color: #fff;
	font: inherit;
	font-size: 1rem;
	font-weight: 700;
	line-height: 1.25;
	letter-spacing: normal;
	text-transform: none;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.2s ease, transform 0.2s ease;
}

.wpme-contact .wpme-contact__form .wpme-contact__actions .wpme-contact__submit:hover {
	background: #4a13b8;
	box-shadow: none;
	color: #fff;
	transform: translateY(-1px);
}

.wpme-contact .wpme-contact__form .wpme-contact__actions .wpme-contact__submit:focus-visible {
	background: #4a13b8;
	color: #fff;
	outline: 3px solid #7120f3;
	outline-offset: 3px;
}

.wpme-contact .wpme-contact__form .wpme-contact__actions .wpme-contact__submit[disabled] {
	opacity: 0.7;
	cursor: progress;
	transform: none;
}

.wpme-contact__status {
	color: #5b5675;
	font-size: 0.9375rem;
}

/* ---------- Messages ---------- */

.wpme-contact__notice {
	/* The page comes back at this element after a post without the script. */
	scroll-margin-top: 6rem;
	margin: 0 0 1.25rem;
	padding: 1rem 1.25rem;
	border-left: 4px solid #7120f3;
	border-radius: 12px;
	background: #f6f2ff;
	color: #2e2a45;
}

.wpme-contact__notice--success {
	margin-bottom: 0;
}

.wpme-contact__notice--success > p:first-child {
	color: #120b2e;
	font-size: 1.0625rem;
	font-weight: 600;
}

.wpme-contact__notice--error {
	border-left-color: var(--wpme-contact-error);
	background: #fdf2f1;
}

.wpme-contact__notice:focus {
	outline: 3px solid #7120f3;
	outline-offset: 2px;
}

.wpme-contact__notice--error:focus {
	outline-color: var(--wpme-contact-error);
}

.wpme-contact .wpme-contact__notice > :first-child {
	margin-top: 0;
}

.wpme-contact .wpme-contact__notice > :last-child {
	margin-bottom: 0;
}

.wpme-contact .wpme-contact__notice p {
	margin: 0 0 0.5rem;
}

.wpme-contact .wpme-contact__notice ul {
	margin: 0;
	padding-left: 1.25rem;
	list-style: disc;
}

.wpme-contact .wpme-contact__notice li {
	margin: 0.25rem 0;
}

/* Windows high contrast: use the system's own controls and colours. */
@media (forced-colors: active) {
	.wpme-contact .wpme-contact__field select {
		appearance: auto;
		-webkit-appearance: auto;
		background-image: none;
		padding-right: 0.9rem;
	}

	.wpme-contact .wpme-contact__form .wpme-contact__actions .wpme-contact__submit {
		border: 2px solid ButtonText;
	}
}

@media (prefers-reduced-motion: reduce) {
	.wpme-contact .wpme-contact__field input,
	.wpme-contact .wpme-contact__field select,
	.wpme-contact .wpme-contact__field textarea,
	.wpme-contact .wpme-contact__form .wpme-contact__actions .wpme-contact__submit {
		transition: none;
	}

	.wpme-contact .wpme-contact__form .wpme-contact__actions .wpme-contact__submit:hover {
		transform: none;
	}
}
