/*
 * Contact form (cluedit-core block cluedit/contact-form, BOARD #12): the glass
 * panel of the final CTA — reference: prototypes/h-dusk-coral.html (.form).
 * Used on dark sections: the home final CTA, the Contact page paths and the
 * service-page form band. Loaded only when the block renders (inc/blocks.php).
 */

.cluedit-form {
	position: relative;
	box-sizing: border-box;
	max-width: 760px;
	margin: 48px auto 0;
	border:
		1px solid
		color-mix(in srgb, var(--wp--preset--color--surface) 20%, transparent);
	border-radius: var(--wp--custom--radius--l);
	background: color-mix(in srgb, var(--wp--preset--color--surface) 8%, transparent);
	color: var(--wp--preset--color--surface);
	text-align: left;
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
}

/* The panel does not clip (the drop-down list may overflow it), so the bar
   carries the top corners itself. */
.cluedit-form__top {
	height: 10px;
	border-radius:
		calc(var(--wp--custom--radius--l) - 1px)
		calc(var(--wp--custom--radius--l) - 1px) 0 0;
	background: var(--wp--preset--color--accent);
}

.cluedit-form__body {
	padding: 30px;
}

.cluedit-form :is(p, legend) {
	margin-block: 0;
}

.cluedit-form__grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px 14px;
	margin-bottom: 16px;
}

.cluedit-form__field label {
	display: block;
	margin-bottom: 6px;
	color: var(--cluedit-final-label, var(--wp--preset--color--on-dark));
	font-size: 14px;
	line-height: 1.55;
}

.cluedit-form :is(.cluedit-form__req, .cluedit-form__opt) {
	color: var(--cluedit-final-note, var(--wp--preset--color--on-dark));
	font-weight: 400;
}

.cluedit-form__field :is(input, select, textarea, .cluedit-select__button) {
	box-sizing: border-box;
	width: 100%;
	min-height: 47px;
	margin: 0;
	padding: 12px 14px;
	border:
		1px solid
		color-mix(in srgb, var(--wp--preset--color--surface) 22%, transparent);
	border-radius: var(--wp--custom--radius--s);
	background: var(--cluedit-final-field, var(--wp--preset--color--navy));
	color: var(--wp--preset--color--surface);
	font: inherit;
	font-size: 16px;
	line-height: 1.3;
}

/* Drop-down: the input look plus a chevron (the select itself has no arrow). */
.cluedit-form__field--select {
	position: relative;
}

.cluedit-form__field select {
	padding-right: 40px;
	-webkit-appearance: none;
	appearance: none;
	cursor: pointer;
}

.cluedit-form__field--select::after {
	content: "";
	z-index: 1;
	position: absolute;
	right: 14px;
	bottom: 15px;
	width: 16px;
	height: 16px;
	background-color: var(--wp--preset--color--on-dark);
	-webkit-mask: url(../icons/arrow-down.svg) center / contain no-repeat;
	mask: url(../icons/arrow-down.svg) center / contain no-repeat;
	pointer-events: none;
	transition: transform var(--cluedit-duration) var(--cluedit-ease);
}

/* Styled drop-down (view.js): a button that opens a list of choices. */
.cluedit-form .cluedit-select__button {
	display: block;
	padding-right: 40px;
	overflow: hidden;
	text-align: left;
	text-overflow: ellipsis;
	white-space: nowrap;
	cursor: pointer;
}

.cluedit-form .cluedit-select__button.is-placeholder {
	color: var(--wp--preset--color--on-dark-mute);
}

.cluedit-form__field--select.is-open::after {
	transform: rotate(180deg);
}

.cluedit-form .cluedit-select__list {
	position: absolute;
	z-index: 20;
	top: calc(100% + 6px);
	right: 0;
	left: 0;
	box-sizing: border-box;
	max-height: 288px;
	margin: 0;
	padding: 6px;
	overflow-y: auto;
	border:
		1px solid
		color-mix(in srgb, var(--wp--preset--color--surface) 22%, transparent);
	border-radius: var(--wp--custom--radius--s);
	background: var(--wp--preset--color--navy);
	box-shadow: 0 18px 40px -16px color-mix(in srgb, var(--wp--preset--color--ink) 80%, transparent);
	list-style: none;
}

.cluedit-form .cluedit-select__list[hidden] {
	display: none;
}

.cluedit-form .cluedit-select__option {
	position: relative;
	padding: 10px 36px 10px 12px;
	border-radius: var(--wp--custom--radius--xs);
	color: var(--wp--preset--color--surface);
	font-size: 15px;
	line-height: 1.4;
	cursor: pointer;
}

.cluedit-form .cluedit-select__option.is-placeholder {
	color: var(--wp--preset--color--on-dark-mute);
}

.cluedit-form .cluedit-select__option:hover,
.cluedit-form .cluedit-select__option.is-active {
	background: color-mix(in srgb, var(--wp--preset--color--surface) 10%, transparent);
}

.cluedit-form .cluedit-select__option[aria-selected="true"] {
	color: var(--wp--preset--color--peach);
}

.cluedit-form .cluedit-select__option[aria-selected="true"]::after {
	content: "";
	position: absolute;
	top: 50%;
	right: 12px;
	width: 16px;
	height: 16px;
	margin-top: -8px;
	background-color: var(--wp--preset--color--peach);
	-webkit-mask: url(../icons/check.svg) center / contain no-repeat;
	mask: url(../icons/check.svg) center / contain no-repeat;
}

.cluedit-form__field select option {
	background: var(--wp--preset--color--navy);
	color: var(--wp--preset--color--surface);
}

.cluedit-form__field textarea {
	display: block;
	min-height: 96px;
	line-height: 1.55;
	resize: vertical;
}

.cluedit-form__field ::placeholder {
	color: var(--wp--preset--color--on-dark-mute);
	opacity: 1;
}

.cluedit-form__field--message {
	margin-bottom: 22px;
}

.cluedit-form .cluedit-form__hint {
	margin-top: 6px;
	color: var(--cluedit-final-note, var(--wp--preset--color--on-dark));
	font-size: var(--wp--preset--font-size--2-xs);
	line-height: 1.55;
}

/* Errors: peach text and border on the dark panel, plus the message text. */
.cluedit-form .cluedit-form__error {
	margin-top: 6px;
	color: var(--wp--preset--color--peach);
	font-size: 14px;
	line-height: 1.55;
}

.cluedit-form [aria-invalid="true"] {
	border-color: var(--wp--preset--color--peach);
	box-shadow: 0 0 0 1px var(--wp--preset--color--peach);
}

.cluedit-form .cluedit-form__status {
	margin-bottom: 20px;
	padding: 12px 14px;
	border: 1px solid var(--wp--preset--color--peach);
	border-radius: var(--wp--custom--radius--s);
	background: color-mix(in srgb, var(--wp--preset--color--peach) 12%, transparent);
	font-size: var(--wp--preset--font-size--s);
	line-height: 1.55;
}

.cluedit-form .cluedit-form__status[hidden],
.cluedit-form .cluedit-form__error[hidden] {
	display: none;
}

/* Honeypot: hidden and out of the tab order; bots fill it, people don't. */
.cluedit-form .cluedit-form__hp {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

.cluedit-form__button {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 48px;
	margin: 0 auto;
	padding: 0 24px;
	border: 0;
	border-radius: var(--wp--custom--radius--pill);
	background: var(--wp--preset--color--accent);
	box-shadow:
		0 10px 30px -12px
		color-mix(in srgb, var(--wp--preset--color--accent) 70%, transparent);
	color: var(--wp--preset--color--accent-ink);
	font: inherit;
	font-size: 16px;
	font-weight: 600;
	cursor: pointer;
	transition: transform var(--cluedit-duration) var(--cluedit-ease);
}

.cluedit-form__button:disabled {
	cursor: progress;
	opacity: 0.8;
}

.cluedit-form__button:hover:not(:disabled) {
	transform: translateY(-3px);
}

.cluedit-form .cluedit-form__note {
	margin-top: 18px;
	color: var(--cluedit-final-note, var(--wp--preset--color--on-dark));
	font-size: var(--wp--preset--font-size--2-xs);
	line-height: 1.55;
	text-align: center;
}

.cluedit-form .cluedit-form__note a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* Success state in place of the fields (ADR-0013 revision 3). */
.cluedit-form__done {
	display: grid;
	gap: 16px;
	justify-items: start;
	padding: 30px;
}

.cluedit-form__done[hidden],
.cluedit-form__body[hidden] {
	display: none;
}

.cluedit-form__done:focus {
	outline: none;
}

.cluedit-form .cluedit-form__done-title {
	margin: 0;
	color: var(--wp--preset--color--surface);
	font-size: var(--wp--preset--font-size--2-xl);
	line-height: 1.2;
}

.cluedit-form .cluedit-form__done-lead {
	color: var(--wp--preset--color--surface);
	font-size: var(--wp--preset--font-size--m);
	line-height: 1.55;
}

.cluedit-form .cluedit-form__done-text {
	color: var(--cluedit-final-note, var(--wp--preset--color--on-dark));
	font-size: var(--wp--preset--font-size--s);
	line-height: 1.55;
}

.cluedit-form__done .wp-block-buttons {
	margin: 0;
}

/* The reCAPTCHA badge is replaced by the notice under the button
   (Google allows this). */
.grecaptcha-badge {
	visibility: hidden;
}

/* Focus on the dark glass panel: lilac ring (as .cluedit-on-dark). */
.cluedit-form :focus-visible {
	outline: 2px solid var(--wp--preset--color--lilac);
	outline-offset: 3px;
}

@media (max-width: 800px) {

	.cluedit-form__body {
		padding: 22px;
	}

	/* First and last name stay side by side; the rest take the full row. */
	.cluedit-form__grid > .cluedit-form__field:nth-child(n + 3) {
		grid-column: 1 / -1;
	}
}
