.nffat-contact-form {
	--field-fill: color-mix(in srgb, var(--wp--preset--color--line) 50%, var(--wp--preset--color--white));
	--field-fill-hover: var(--wp--preset--color--line);
	--field-edge-hover: color-mix(in srgb, var(--wp--preset--color--ink-muted) 35%, var(--wp--preset--color--white));
	--field-off: color-mix(in srgb, var(--wp--preset--color--ink-muted) 45%, var(--wp--preset--color--white));
	--field-radius: 14px;
	--field-height: 52px;
	--tap: 40px;
}

@media (pointer: coarse) {
	.nffat-contact-form {
		--tap: 44px;
	}
}

/* Three groups in one column: you, courses, when and where. */
.nffat-form__groups {
	display: grid;
	gap: 40px;
}

.nffat-form__group {
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 0;
}

.nffat-form__group > legend:not(.screen-reader-text) {
	margin-bottom: 8px;
	padding: 0;
	font-size: 14px;
	font-weight: 600;
}

.nffat-contact-form .nffat-form__fields {
	gap: 18px 14px;
}

.nffat-form__lines,
.nffat-form__field--dates {
	grid-column: 1 / -1;
}

.nffat-contact-form .nffat-form__field label {
	font-size: 14px;
}

.nffat-form__control {
	position: relative;
}

/* Quiet grey fields; white with a teal edge while you type. */
.nffat-contact-form .nffat-form__control :is(input, textarea, select) {
	min-height: var(--field-height);
	padding: 14px 16px;
	border: 1.5px solid transparent;
	border-radius: var(--field-radius);
	background-color: var(--field-fill);
	transition: background-color 180ms var(--nffat-ease-out), border-color 180ms var(--nffat-ease-out), box-shadow 180ms var(--nffat-ease-out);
}

.nffat-contact-form .nffat-form__control textarea {
	min-height: 132px;
	field-sizing: content;
	max-height: 360px;
	resize: none;
}

@media (hover: hover) and (pointer: fine) {
	.nffat-contact-form .nffat-form__control :is(input, textarea, select):hover:not(:focus) {
		border-color: var(--field-edge-hover);
		background-color: var(--field-fill-hover);
	}
}

.nffat-contact-form .nffat-form__control :is(input, textarea, select):focus {
	outline: none;
	border-color: var(--wp--preset--color--teal);
	background-color: var(--wp--preset--color--white);
	box-shadow: 0 0 0 4px var(--wp--preset--color--teal-50);
}

.nffat-contact-form .nffat-form__control [aria-invalid="true"]:not(:focus) {
	border-color: var(--wp--preset--color--magenta-700);
	background-color: var(--wp--preset--color--magenta-50);
}

/* Without the script: one course and headcount side by side, and a plain date box per date. */
.nffat-form__line {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 200px);
	gap: 14px;
	align-items: start;
}

.nffat-form__control--dates:has(> input) {
	display: grid;
	gap: 8px;
}

.nffat-form__link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: var(--tap);
	padding: 0;
	border: 0;
	background: none;
	color: var(--wp--preset--color--teal);
	font: inherit;
	font-size: 15px;
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
}

.nffat-form__link .nffat-icon {
	width: 14px;
	height: 14px;
}

.nffat-form__link:focus-visible,
.nffat-contact-form button:focus-visible {
	outline: 2px solid var(--wp--preset--color--teal);
	outline-offset: 2px;
}

.nffat-form__kept {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 24px;
	padding: 4px 16px;
	border-radius: 12px;
	background: var(--wp--preset--color--teal-50);
	font-size: 14px;
}

.nffat-form__kept .nffat-form__link {
	flex: none;
	color: var(--wp--preset--color--teal-700);
	font-size: 14px;
}

/* Gentle shake when a field is left wrong. */
.nffat-form__control.is-shaking {
	animation: nffat-form-shake 420ms var(--nffat-ease-out);
}

@keyframes nffat-form-shake {
	20% { translate: -6px 0; }
	40% { translate: 5px 0; }
	60% { translate: -3px 0; }
	80% { translate: 2px 0; }
}

.nffat-form__count {
	align-self: flex-end;
	margin: 0;
	font-size: 13px;
	font-variant-numeric: tabular-nums;
	color: var(--wp--preset--color--ink-muted);
	opacity: 0;
	transition: opacity 300ms;
}

.nffat-form__field--message:focus-within .nffat-form__count,
.nffat-form__count.is-near {
	opacity: 1;
}

.nffat-form__count.is-near {
	color: var(--wp--preset--color--magenta-700);
}

/* Sending: the arrow becomes a heartbeat line while the page posts. */
.nffat-contact-form__send.is-sending {
	pointer-events: none;
}

.nffat-contact-form__send.is-sending .nffat-icon {
	animation: nffat-form-send 700ms var(--nffat-ease-out) both;
}

.nffat-contact-form__send.is-sending .nffat-contact-form__send-label::after {
	content: "";
	display: inline-block;
	width: 1.2em;
	text-align: left;
	animation: nffat-form-dots 1.2s steps(4) infinite;
}

@keyframes nffat-form-send {
	40% { translate: -4px 0; }
	100% { translate: 40px 0; opacity: 0; }
}

@keyframes nffat-form-dots {
	0% { content: ""; }
	25% { content: "."; }
	50% { content: ".."; }
	75% { content: "..."; }
}

/* Sent */
.nffat-contact-form__sent {
	position: relative;
	display: grid;
	justify-items: start;
	gap: 8px;
}

.nffat-contact-form__sent-mark {
	display: grid;
	place-items: center;
	width: 72px;
	height: 72px;
	margin-bottom: 4px;
	border-radius: 50%;
	background: var(--wp--preset--color--teal-50);
	animation: nffat-form-pop 600ms var(--wp--custom--ease--back) both;
}

.nffat-contact-form__sent-mark svg {
	width: 44px;
	height: 44px;
	fill: none;
	stroke: var(--wp--preset--color--teal);
	stroke-width: 3.5;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.nffat-contact-form__sent-mark circle {
	stroke-dasharray: 151;
	stroke-dashoffset: 151;
	animation: nffat-form-draw 700ms var(--nffat-ease-out) 200ms forwards;
}

.nffat-contact-form__sent-mark path {
	stroke-dasharray: 40;
	stroke-dashoffset: 40;
	animation: nffat-form-draw 400ms var(--nffat-ease-out) 750ms forwards;
}

.nffat-contact-form__sent > h2 {
	margin: 0;
	font-size: clamp(28px, 4vw, 36px);
	line-height: 1.1;
}

.nffat-contact-form__sent > p {
	margin: 0;
	font-size: 18px;
	font-weight: 600;
	line-height: 1.55;
}

.nffat-contact-form__sent > :is(h2, p) {
	animation: nffat-form-rise 600ms var(--wp--custom--ease--out) both;
}

.nffat-contact-form__sent > p {
	animation-delay: 120ms;
}

.nffat-contact-form__confetti {
	position: absolute;
	top: 36px;
	left: 36px;
	width: 8px;
	height: 12px;
	border-radius: 2px;
	background: var(--wp--preset--color--magenta);
	pointer-events: none;
	animation: nffat-form-confetti var(--t) var(--d) both;
}

.nffat-contact-form__confetti:nth-child(5n + 1) {
	background: var(--wp--preset--color--teal);
}

.nffat-contact-form__confetti:nth-child(5n + 2) {
	background: var(--wp--preset--color--leaf);
}

.nffat-contact-form__confetti:nth-child(5n + 3) {
	background: var(--wp--preset--color--magenta-100);
}

.nffat-contact-form__confetti:nth-child(5n + 4) {
	background: var(--wp--preset--color--mint);
}

.nffat-contact-form__confetti:nth-child(3n) {
	width: 9px;
	height: 9px;
	border-radius: 50%;
}

@keyframes nffat-form-pop {
	from { scale: 0.3; opacity: 0; }
}

@keyframes nffat-form-draw {
	to { stroke-dashoffset: 0; }
}

@keyframes nffat-form-rise {
	from { opacity: 0; translate: 0 14px; }
}

/* Thrown up and out fast, then left to fall. */
@keyframes nffat-form-confetti {
	0% { opacity: 1; translate: 0 0; scale: 0.4; animation-timing-function: var(--nffat-ease-out); }
	30% { opacity: 1; translate: var(--x) var(--y); scale: 1; rotate: var(--r); animation-timing-function: cubic-bezier(0.55, 0, 1, 0.45); }
	100% { opacity: 0; translate: calc(var(--x) * 1.3) calc(var(--y) + var(--fall)); scale: 1; rotate: calc(var(--r) * 4); }
}

@media (prefers-reduced-motion: reduce) {
	.nffat-contact-form *,
	.nffat-contact-form *::after {
		animation: none !important;
		transition-duration: 0ms !important;
	}

	.nffat-contact-form__sent-mark :is(circle, path) {
		stroke-dashoffset: 0;
	}

	.nffat-contact-form__confetti {
		display: none;
	}
}

@media (max-width: 599px) {
	.nffat-form__line {
		grid-template-columns: minmax(0, 1fr);
	}
}
