/**
 * Avix Forms — front-end styles.
 *
 * Tokens are scoped to .avf-form so they never leak into the host theme.
 * Ported from the Avix Digital design system v1.0.
 */

.avf-form {
	/* Orange ramp */
	--avf-orange-50: #FFF3EC;
	--avf-orange-100: #FFE0CF;
	--avf-orange-200: #FFC1A3;
	--avf-orange-300: #FF9A6B;
	--avf-orange-400: #FB7338;
	--avf-orange-500: #FB5413;
	--avf-orange-600: #E2410B;
	--avf-orange-700: #B83208;
	--avf-orange-800: #8A2606;
	--avf-orange-900: #5C1903;

	/* Ink ramp */
	--avf-ink-50: #EEF3F4;
	--avf-ink-100: #D4E0E2;
	--avf-ink-200: #A6BCC1;
	--avf-ink-300: #6E8A91;
	--avf-ink-400: #3D5C64;
	--avf-ink-500: #1C3C44;
	--avf-ink-600: #0E2E37;
	--avf-ink-700: #052935;
	--avf-ink-800: #04212B;
	--avf-ink-900: #03171E;

	/* Neutrals */
	--avf-paper: #FFFFFF;
	--avf-canvas: #FBFAF8;
	--avf-mist: #F4F2EE;
	--avf-line: #E7E3DC;
	--avf-muted: #C9C3B8;
	--avf-subtle: #9A9488;
	--avf-body: #6B665C;

	/* Semantic */
	--avf-success: #1E9E6A;
	--avf-warning: #E8A317;
	--avf-error: #E0483B;

	/* Type */
	--avf-font-heading: 'Space Grotesk', 'Helvetica Neue', Helvetica, Arial, sans-serif;
	--avf-font-body: 'Hanken Grotesk', 'Helvetica Neue', Helvetica, Arial, sans-serif;
	--avf-font-mono: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;

	/* Spacing */
	--avf-space-2xs: 4px;
	--avf-space-xs: 8px;
	--avf-space-sm: 12px;
	--avf-space-md: 16px;
	--avf-space-lg: 24px;
	--avf-space-xl: 32px;
	--avf-space-2xl: 48px;
	--avf-space-3xl: 64px;

	/* Radius */
	--avf-radius-sm: 8px;
	--avf-radius-md: 12px;
	--avf-radius-lg: 20px;
	--avf-radius-xl: 28px;
	--avf-radius-pill: 999px;

	--avf-transition: 160ms cubic-bezier(0.4, 0, 0.2, 1);

	font-family: var(--avf-font-body);
	color: var(--avf-ink-700);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

.avf-form *,
.avf-form *::before,
.avf-form *::after {
	box-sizing: border-box;
}

/* ---------------------------------------------------------------------------
   Layout
   --------------------------------------------------------------------------- */

.avf-fields {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 20px 18px;
}

.avf-field--full {
	grid-column: 1 / -1;
}

.avf-field--half {
	grid-column: span 1;
}

@media (max-width: 640px) {
	.avf-fields {
		grid-template-columns: 1fr;
	}

	.avf-field--half {
		grid-column: 1 / -1;
	}
}

/* ---------------------------------------------------------------------------
   Labels

   In the stacked layout the label sits inside the control and lifts on focus or
   once a value is present. The label element itself is unchanged — still a real
   <label for> — only its painting moves.
   --------------------------------------------------------------------------- */

.avf-control {
	position: relative;
}

.avf-label {
	display: block;
	margin-bottom: 7px;
	font-family: var(--avf-font-body);
	font-size: 13.5px;
	font-weight: 600;
	letter-spacing: -0.005em;
	line-height: 1.4;
	color: var(--avf-ink-700);
}

/* Headings for radio/checkbox groups keep the classic position. */
.avf-label--static {
	display: block;
	margin-bottom: 10px;
}

/* Visually hidden, still announced. Never use display:none for labels. */
.avf-label--sr {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.avf-required {
	margin-left: 3px;
	color: var(--avf-orange-500);
	font-weight: 500;
}

.avf-help {
	margin: 6px 0 0;
	font-size: 12.5px;
	line-height: 1.5;
	color: var(--avf-subtle);
}

/* ---------------------------------------------------------------------------
   Inputs — stacked
   --------------------------------------------------------------------------- */

.avf-form--stacked .avf-input,
.avf-fields--secondary .avf-input {
	display: block;
	width: 100%;
	height: 60px;
	/* Top padding leaves room for the lifted label. */
	padding: 23px 16px 7px;
	font-family: var(--avf-font-body);
	font-size: 15px; /* Paired with the 16px mobile bump below to stop iOS zoom. */
	font-weight: 500;
	line-height: 1.4;
	color: var(--avf-ink-700);
	background-color: var(--avf-paper);
	border: 1.5px solid var(--avf-line);
	border-radius: var(--avf-radius-md);
	transition: border-color var(--avf-transition), box-shadow var(--avf-transition);
	appearance: none;
	-webkit-appearance: none;
}

.avf-form--stacked textarea.avf-input,
.avf-fields--secondary textarea.avf-input {
	height: auto;
	min-height: 132px;
	padding-top: 28px;
	line-height: 1.6;
	resize: vertical;
}

/* ---- Floating label ---- */

.avf-control .avf-label {
	position: absolute;
	left: 17px;
	top: 19px;
	margin: 0;
	max-width: calc(100% - 34px);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-size: 15px;
	font-weight: 500;
	letter-spacing: 0;
	color: var(--avf-subtle);
	/* Clicks must reach the input underneath, not stop at the label. */
	pointer-events: none;
	transition: top var(--avf-transition), font-size var(--avf-transition), color var(--avf-transition), font-weight var(--avf-transition);
}

.avf-control .avf-input:focus + .avf-label,
.avf-control .avf-input:not(:placeholder-shown) + .avf-label,
.avf-control .avf-input:-webkit-autofill + .avf-label {
	top: 9px;
	font-size: 11.5px;
	font-weight: 600;
	letter-spacing: 0.02em;
	color: var(--avf-orange-600);
}

/*
 * Controls that can never be "empty" in the :placeholder-shown sense — a select
 * always has a selected option, and date/time inputs paint their own format
 * hint — so their labels stay lifted permanently. Without this the label would
 * sit on top of the field's own text.
 */
.avf-field--type-select .avf-control .avf-label,
.avf-field--type-date .avf-control .avf-label,
.avf-field--type-time .avf-control .avf-label {
	top: 9px;
	font-size: 11.5px;
	font-weight: 600;
	letter-spacing: 0.02em;
}

.avf-field--type-select .avf-control .avf-input:focus + .avf-label,
.avf-field--type-date .avf-control .avf-input:focus + .avf-label,
.avf-field--type-time .avf-control .avf-input:focus + .avf-label {
	color: var(--avf-orange-600);
}

/*
 * The placeholder is a hint, not a second label: hidden at rest so it never
 * collides with the resting label, revealed once the field has focus.
 */
.avf-form--stacked .avf-input::placeholder,
.avf-fields--secondary .avf-input::placeholder {
	color: transparent;
	font-weight: 400;
	opacity: 1;
}

.avf-form--stacked .avf-input:focus::placeholder,
.avf-fields--secondary .avf-input:focus::placeholder {
	color: var(--avf-muted);
}

/* Chrome's autofill yellow would otherwise wipe out the field styling. */
.avf-input:-webkit-autofill,
.avf-input:-webkit-autofill:hover,
.avf-input:-webkit-autofill:focus {
	-webkit-text-fill-color: var(--avf-ink-700);
	-webkit-box-shadow: 0 0 0 60px var(--avf-paper) inset;
	box-shadow: 0 0 0 60px var(--avf-paper) inset;
}

.avf-input:hover {
	border-color: var(--avf-muted);
}

.avf-input:focus,
.avf-input:focus-visible {
	outline: none;
	border-color: var(--avf-orange-500);
	box-shadow: 0 0 0 3px rgba(251, 84, 19, 0.13);
}

.avf-input[aria-invalid="true"] {
	border-color: var(--avf-error);
	background-color: rgba(224, 72, 59, 0.02);
}

.avf-input[aria-invalid="true"]:focus {
	box-shadow: 0 0 0 3px rgba(224, 72, 59, 0.13);
}

.avf-input:disabled {
	opacity: 0.55;
	cursor: not-allowed;
	background-color: var(--avf-mist);
}

@media (max-width: 640px) {
	.avf-form--stacked .avf-input,
	.avf-fields--secondary .avf-input {
		font-size: 16px;
	}
}

/* Chevron for the unenhanced (no-JS) select. */
.avf-field--type-select .avf-control::after {
	content: "";
	position: absolute;
	right: 17px;
	top: 50%;
	width: 8px;
	height: 8px;
	border-right: 1.7px solid var(--avf-ink-400);
	border-bottom: 1.7px solid var(--avf-ink-400);
	transform: translateY(-70%) rotate(45deg);
	pointer-events: none;
	transition: border-color var(--avf-transition);
}

/* Once enhanced, the custom trigger draws its own caret. */
.avf-field--type-select .avf-control:has(.avf-select)::after {
	display: none;
}

.avf-field--type-select .avf-control:focus-within::after {
	border-color: var(--avf-orange-500);
}

.avf-field--type-select .avf-input {
	padding-right: 42px;
	cursor: pointer;
}

/* An unselected dropdown should read as a placeholder, not as a real answer. */
.avf-input--select:invalid,
.avf-input--select option[value=""] {
	color: var(--avf-muted);
	font-weight: 400;
}

/* ---------------------------------------------------------------------------
   Custom dropdown

   Layered over the native select, which stays in the DOM holding the value.
   --------------------------------------------------------------------------- */

.avf-select {
	position: relative;
}

/*
 * The native control is taken out of the visual flow but must remain
 * submittable. It keeps zero size rather than display:none so that browser
 * validation UI and autofill still have something to anchor to.
 */
.avf-select .avf-input--select {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	border: 0;
	opacity: 0;
	pointer-events: none;
}

.avf-select__trigger {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	width: 100%;
	height: 60px;
	padding: 23px 16px 7px;
	font-family: var(--avf-font-body);
	font-size: 15px;
	font-weight: 500;
	line-height: 1.4;
	text-align: left;
	color: var(--avf-ink-700);
	background-color: var(--avf-paper);
	border: 1.5px solid var(--avf-line);
	border-radius: var(--avf-radius-md);
	cursor: pointer;
	transition: border-color var(--avf-transition), box-shadow var(--avf-transition);
}

.avf-select__trigger:hover {
	border-color: var(--avf-muted);
}

.avf-select__trigger:focus-visible,
.avf-select.is-open .avf-select__trigger {
	outline: none;
	border-color: var(--avf-orange-500);
	box-shadow: 0 0 0 3px rgba(251, 84, 19, 0.13);
}

.avf-select.is-empty .avf-select__value {
	color: var(--avf-muted);
	font-weight: 400;
}

.avf-select__value {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.avf-select__caret {
	flex-shrink: 0;
	width: 8px;
	height: 8px;
	margin-bottom: 3px;
	border-right: 1.7px solid var(--avf-ink-400);
	border-bottom: 1.7px solid var(--avf-ink-400);
	transform: rotate(45deg);
	transition: transform var(--avf-transition), border-color var(--avf-transition);
}

.avf-select.is-open .avf-select__caret {
	transform: rotate(-135deg);
	margin-bottom: -3px;
	border-color: var(--avf-orange-500);
}

.avf-select__list {
	position: absolute;
	z-index: 40;
	top: calc(100% + 6px);
	left: 0;
	right: 0;
	max-height: 264px;
	overflow-y: auto;
	margin: 0;
	padding: 6px;
	list-style: none;
	background-color: var(--avf-paper);
	border: 1.5px solid var(--avf-line);
	border-radius: var(--avf-radius-md);
	box-shadow: 0 14px 38px rgba(5, 41, 53, 0.13);
	animation: avf-pop 140ms cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes avf-pop {
	from {
		opacity: 0;
		transform: translateY(-5px);
	}
}

.avf-select__option {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 11px 12px;
	font-size: 14.5px;
	font-weight: 500;
	line-height: 1.4;
	color: var(--avf-ink-700);
	border-radius: var(--avf-radius-sm);
	cursor: pointer;
	transition: background-color 110ms ease, color 110ms ease;
}

.avf-select__option:hover,
.avf-select__option.is-active {
	background-color: var(--avf-orange-50);
	color: var(--avf-orange-700);
}

.avf-select__option[aria-selected="true"] {
	color: var(--avf-orange-600);
	font-weight: 600;
}

/* Tick on the chosen option. */
.avf-select__option[aria-selected="true"]::after {
	content: "";
	flex-shrink: 0;
	width: 5px;
	height: 9px;
	border-right: 2px solid var(--avf-orange-500);
	border-bottom: 2px solid var(--avf-orange-500);
	transform: rotate(45deg);
	margin-bottom: 2px;
}

.avf-select__option--placeholder {
	color: var(--avf-subtle);
	font-weight: 400;
}

.avf-select__trigger[aria-invalid="true"],
.avf-field--type-select [aria-invalid="true"] ~ .avf-select__trigger {
	border-color: var(--avf-error);
}

/* ---------------------------------------------------------------------------
   Inputs — conversational
   --------------------------------------------------------------------------- */

.avf-sentence {
	margin: 0 0 34px;
	font-family: var(--avf-font-heading);
	font-size: clamp(21px, 2.5vw, 29px);
	font-weight: 500;
	letter-spacing: -0.018em;
	/* Generous leading so the underlined fields never collide between lines. */
	line-height: 2.25;
	color: var(--avf-ink-700);
}

.avf-sentence__text {
	white-space: pre-wrap;
}

.avf-inline {
	position: relative;
	display: inline-block;
	vertical-align: baseline;
	/* Keeps the control and its trailing punctuation on the same line. */
	white-space: nowrap;
}

.avf-inline__trail {
	margin-left: 1px;
}

.avf-form--conversational .avf-sentence .avf-input {
	display: inline-block;
	/*
	 * The width is a starting point only; avix-forms.js measures the content and
	 * resizes within the min/max below, so the blank hugs whatever is typed.
	 */
	width: clamp(150px, 20vw, 240px);
	min-width: 110px;
	max-width: 340px;
	height: auto;
	padding: 1px 4px 5px;
	font-family: inherit;
	font-size: inherit;
	font-weight: 600;
	line-height: 1.3;
	color: var(--avf-orange-600);
	background-color: transparent;
	border: none;
	/* A dashed rule reads as "fill me in" the way a solid one does not. */
	border-bottom: 2px dashed var(--avf-muted);
	border-radius: 0;
	box-shadow: none;
	transition: border-color var(--avf-transition), background-color var(--avf-transition);
	appearance: none;
	-webkit-appearance: none;
}

.avf-form--conversational .avf-sentence .avf-input:hover {
	border-bottom-color: var(--avf-orange-300);
}

.avf-form--conversational .avf-sentence .avf-input:focus {
	outline: none;
	background-color: var(--avf-orange-50);
	border-bottom-style: solid;
	border-bottom-color: var(--avf-orange-500);
	box-shadow: none;
}

/* Once filled, the rule goes solid — the blank has been answered. */
.avf-form--conversational .avf-sentence .avf-input:not(:placeholder-shown) {
	border-bottom-style: solid;
	border-bottom-color: var(--avf-orange-300);
}

.avf-form--conversational .avf-sentence .avf-input[aria-invalid="true"] {
	border-bottom-color: var(--avf-error);
	border-bottom-style: solid;
	background-color: transparent;
	color: var(--avf-error);
}

/* ---- Inline custom dropdown ---- */

.avf-inline .avf-select {
	display: inline-block;
	vertical-align: baseline;
}

.avf-inline .avf-select__trigger {
	display: inline-flex;
	width: auto;
	min-width: 150px;
	height: auto;
	padding: 1px 4px 5px;
	font-family: inherit;
	font-size: inherit;
	font-weight: 600;
	line-height: 1.3;
	color: var(--avf-orange-600);
	background-color: transparent;
	border: none;
	border-bottom: 2px dashed var(--avf-muted);
	border-radius: 0;
	box-shadow: none;
}

.avf-inline .avf-select__trigger:hover {
	border-bottom-color: var(--avf-orange-300);
}

.avf-inline .avf-select__trigger:focus-visible,
.avf-inline .avf-select.is-open .avf-select__trigger {
	background-color: var(--avf-orange-50);
	border-bottom-style: solid;
	border-bottom-color: var(--avf-orange-500);
	box-shadow: none;
}

.avf-inline .avf-select:not(.is-empty) .avf-select__trigger {
	border-bottom-style: solid;
	border-bottom-color: var(--avf-orange-300);
}

.avf-inline .avf-select__caret {
	width: 7px;
	height: 7px;
	margin-bottom: 5px;
	border-color: var(--avf-orange-500);
}

/* The list must not inherit the sentence's display type size. */
.avf-inline .avf-select__list {
	min-width: 240px;
	font-family: var(--avf-font-body);
	font-size: 15px;
	font-weight: 400;
	line-height: 1.5;
	letter-spacing: 0;
}

.avf-inline--select::after {
	content: "";
	position: absolute;
	right: 8px;
	top: 50%;
	width: 7px;
	height: 7px;
	border-right: 1.6px solid var(--avf-ink-400);
	border-bottom: 1.6px solid var(--avf-ink-400);
	transform: translateY(-80%) rotate(45deg);
	pointer-events: none;
}

.avf-inline--select .avf-input {
	padding-right: 26px;
}

/* The sentence layout keeps visible placeholders — they are the whole point. */
.avf-form--conversational .avf-sentence .avf-input::placeholder {
	color: var(--avf-muted);
	font-weight: 400;
}

.avf-error--inline {
	position: absolute;
	left: 0;
	top: 100%;
	margin-top: 2px;
	font-family: var(--avf-font-body);
	font-size: 12px;
	line-height: 1.3;
	white-space: nowrap;
}

.avf-fields--secondary {
	margin-top: var(--avf-space-xl);
}

/*
 * The sentence stays a sentence at every width. An earlier version turned each
 * field into a full-width block below 768px, which broke the reading line,
 * stranded the trailing punctuation on its own row, and exposed the
 * screen-reader-only labels. Shrinking the type and the blanks keeps the
 * fill-in-the-blank idea intact on a phone.
 */
@media (max-width: 900px) {
	.avf-sentence {
		font-size: 20px;
		line-height: 2.1;
	}
}

@media (max-width: 600px) {
	.avf-sentence {
		font-size: 17px;
		line-height: 2;
		letter-spacing: -0.01em;
	}

	.avf-form--conversational .avf-sentence .avf-input {
		/* 16px keeps iOS from zooming the viewport on focus. */
		font-size: 16px;
		width: clamp(96px, 44vw, 190px);
		min-width: 90px;
		max-width: 100%;
	}

	.avf-inline .avf-select__trigger {
		font-size: 16px;
		min-width: 96px;
	}

	.avf-inline .avf-select__list {
		min-width: 200px;
	}
}

@media (max-width: 767px) {
	.avf-error--inline {
		position: static;
		display: block;
		white-space: normal;
	}
}

/* ---------------------------------------------------------------------------
   Choices and consent

   Native checkboxes cannot be styled consistently across browsers, so the real
   input is hidden and a styled box is drawn in its place. The input stays in
   the DOM and in the tab order, so keyboard and screen-reader behaviour is
   unchanged — only the painting differs.
   --------------------------------------------------------------------------- */

.avf-choices {
	display: flex;
	flex-wrap: wrap;
	gap: 10px 20px;
	padding-top: 2px;
}

.avf-choice,
.avf-consent {
	display: inline-flex;
	align-items: flex-start;
	gap: 10px;
	font-size: 14.5px;
	line-height: 1.5;
	color: var(--avf-body);
	cursor: pointer;
	-webkit-user-select: none;
	user-select: none;
}

.avf-choice input,
.avf-consent input {
	position: absolute;
	opacity: 0;
	width: 20px;
	height: 20px;
	margin: 0;
	cursor: pointer;
}

.avf-choice > span,
.avf-consent > span {
	position: relative;
	padding-top: 1px;
}

.avf-choice > span::before,
.avf-consent > span::before {
	content: "";
	position: absolute;
	left: -30px;
	top: 0;
	width: 20px;
	height: 20px;
	background-color: var(--avf-paper);
	border: 1.5px solid var(--avf-muted);
	border-radius: 6px;
	transition: background-color var(--avf-transition), border-color var(--avf-transition);
}

.avf-choice > span::after,
.avf-consent > span::after {
	content: "";
	position: absolute;
	left: -23.5px;
	top: 5px;
	width: 6px;
	height: 10px;
	border-right: 2px solid var(--avf-paper);
	border-bottom: 2px solid var(--avf-paper);
	transform: rotate(45deg) scale(0.4);
	opacity: 0;
	transition: opacity var(--avf-transition), transform var(--avf-transition);
}

.avf-choice,
.avf-consent {
	padding-left: 30px;
}

.avf-choice:hover > span::before,
.avf-consent:hover > span::before {
	border-color: var(--avf-orange-300);
}

.avf-choice input:checked + span::before,
.avf-consent input:checked + span::before {
	background-color: var(--avf-orange-500);
	border-color: var(--avf-orange-500);
}

.avf-choice input:checked + span::after,
.avf-consent input:checked + span::after {
	opacity: 1;
	transform: rotate(45deg) scale(1);
}

.avf-choice input:focus-visible + span::before,
.avf-consent input:focus-visible + span::before {
	border-color: var(--avf-orange-500);
	box-shadow: 0 0 0 3px rgba(251, 84, 19, 0.18);
}

.avf-choice input[aria-invalid="true"] + span::before,
.avf-consent input[aria-invalid="true"] + span::before {
	border-color: var(--avf-error);
}

/* Radios are round. */
.avf-field--type-radio .avf-choice > span::before {
	border-radius: 50%;
}

.avf-field--type-radio .avf-choice > span::after {
	left: -25px;
	top: 6px;
	width: 8px;
	height: 8px;
	border: none;
	background-color: var(--avf-paper);
	border-radius: 50%;
	transform: scale(0.4);
}

.avf-field--type-radio .avf-choice input:checked + span::after {
	transform: scale(1);
}

.avf-consent a {
	color: var(--avf-orange-600);
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* ---------------------------------------------------------------------------
   Honeypot — hidden from humans, present for bots
   --------------------------------------------------------------------------- */

.avf-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px !important;
	height: 1px !important;
	overflow: hidden !important;
}

/* ---------------------------------------------------------------------------
   Submit button
   --------------------------------------------------------------------------- */

.avf-actions {
	margin-top: 28px;
}

.avf-submit {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-height: 52px;
	padding: 0 30px;
	font-family: var(--avf-font-heading);
	font-size: 15px;
	font-weight: 600;
	letter-spacing: -0.01em;
	color: var(--avf-paper);
	background-color: var(--avf-orange-500);
	border: none;
	border-radius: var(--avf-radius-pill);
	cursor: pointer;
	box-shadow: 0 1px 2px rgba(5, 41, 53, 0.08);
	transition: background-color var(--avf-transition), box-shadow var(--avf-transition), transform var(--avf-transition);
}

.avf-submit:hover {
	background-color: var(--avf-orange-600);
	box-shadow: 0 6px 18px rgba(251, 84, 19, 0.28);
	transform: translateY(-1px);
}

.avf-submit:active {
	transform: translateY(0);
	box-shadow: 0 1px 2px rgba(5, 41, 53, 0.08);
}

.avf-submit:focus-visible {
	outline: 2px solid var(--avf-ink-700);
	outline-offset: 3px;
}

.avf-submit__arrow {
	display: inline-flex;
	transition: transform var(--avf-transition);
}

.avf-submit:hover .avf-submit__arrow {
	transform: translateX(3px);
}

.avf-submit[aria-busy="true"] {
	pointer-events: none;
	background-color: var(--avf-orange-400);
	box-shadow: none;
	transform: none;
}

.avf-submit[aria-busy="true"] .avf-submit__arrow {
	display: none;
}

.avf-spinner {
	display: none;
	width: 15px;
	height: 15px;
	border: 2px solid rgba(255, 255, 255, 0.35);
	border-top-color: var(--avf-paper);
	border-radius: 50%;
	animation: avf-spin 700ms linear infinite;
}

.avf-submit[aria-busy="true"] .avf-spinner {
	display: inline-block;
}

@keyframes avf-spin {
	to {
		transform: rotate(360deg);
	}
}

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

.avf-error {
	display: flex;
	align-items: center;
	gap: 5px;
	margin: 6px 0 0;
	font-size: 12.5px;
	font-weight: 500;
	line-height: 1.4;
	color: var(--avf-error);
}

.avf-error:empty {
	display: none;
}

.avf-error::before {
	content: "";
	flex-shrink: 0;
	width: 13px;
	height: 13px;
	border-radius: 50%;
	background-color: var(--avf-error);
	/* Exclamation mark, drawn with a mask so it inherits the error colour. */
	-webkit-mask: linear-gradient(#fff, #fff) center 3px / 1.5px 5px no-repeat,
		linear-gradient(#fff, #fff) center 10px / 1.5px 1.5px no-repeat;
	mask: linear-gradient(#fff, #fff) center 3px / 1.5px 5px no-repeat,
		linear-gradient(#fff, #fff) center 10px / 1.5px 1.5px no-repeat;
}

.avf-error--inline::before {
	display: none;
}

.avf-message {
	margin-top: 20px;
	font-size: 15px;
	line-height: 1.6;
}

.avf-message:empty {
	display: none;
}

.avf-message--success {
	padding: 16px 20px;
	color: var(--avf-ink-700);
	background-color: var(--avf-orange-50);
	border-left: 3px solid var(--avf-orange-500);
	border-radius: var(--avf-radius-sm);
}

.avf-message--error {
	padding: 16px 20px;
	color: var(--avf-ink-700);
	background-color: rgba(224, 72, 59, 0.07);
	border-left: 3px solid var(--avf-error);
	border-radius: var(--avf-radius-sm);
}

.avf-message:focus {
	outline: none;
}

.avf-notice {
	padding: var(--avf-space-sm) var(--avf-space-md);
	font-family: var(--avf-font-mono);
	font-size: 13px;
	color: var(--avf-orange-700);
	background: var(--avf-orange-50);
	border-radius: var(--avf-radius-sm);
}

/* ---------------------------------------------------------------------------
   Motion preferences
   --------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	.avf-form *,
	.avf-form *::before,
	.avf-form *::after {
		transition-duration: 0.01ms !important;
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
	}

	.avf-submit:hover {
		transform: none;
	}
}

/* ---------------------------------------------------------------------------
   Theme hardening

   This form renders inside somebody else's theme, and page builders in
   particular ship blunt global form rules — `input { width: 100% }`,
   `label { display: block; position: static }` and similar. Any one of those
   turns the conversational sentence back into a broken stack of boxes with the
   screen-reader-only labels exposed.

   These are the handful of declarations the layout cannot survive losing, so
   they are pinned. Deliberately narrow: only structural properties, nothing
   cosmetic, so a theme can still restyle colours, borders and type.
   --------------------------------------------------------------------------- */

/* The visually-hidden label must stay hidden but remain in the a11y tree. */
.avf-form .avf-label--sr {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
}

/* Blanks and their punctuation must stay on the reading line. */
.avf-form--conversational .avf-sentence .avf-inline {
	display: inline-block !important;
	white-space: nowrap !important;
	vertical-align: baseline !important;
}

.avf-form--conversational .avf-sentence .avf-input {
	display: inline-block !important;
	height: auto !important;
	/* Width is set inline by the auto-sizer, which already beats theme CSS. */
	min-height: 0 !important;
	border-top: none !important;
	border-left: none !important;
	border-right: none !important;
	border-radius: 0 !important;
	background-image: none !important;
	box-shadow: none !important;
}

.avf-form--conversational .avf-sentence .avf-select,
.avf-form--conversational .avf-sentence .avf-select__trigger {
	display: inline-flex !important;
	width: auto !important;
	height: auto !important;
	border-top: none !important;
	border-left: none !important;
	border-right: none !important;
	border-radius: 0 !important;
	box-shadow: none !important;
}

/* The native select stays hidden once the custom listbox is in place. */
.avf-form .avf-select .avf-input--select {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	opacity: 0 !important;
	clip: rect(0, 0, 0, 0) !important;
	pointer-events: none !important;
}

/* Themes love to restyle checkboxes; the custom control needs the real one gone. */
.avf-form .avf-choice input,
.avf-form .avf-consent input {
	position: absolute !important;
	opacity: 0 !important;
	width: 20px !important;
	height: 20px !important;
	margin: 0 !important;
}
