/*! Bubento. Copyright 2026 LEARNLOGICS SRL. Licensed under the Bubento End-User Licence Agreement: https://www.bubento.com/licence */
.bubento-form {
	display: grid;
	gap: 1rem;
	max-width: 720px;
	font-family: var(--bubento-font-sans, inherit);
}

.bubento-form__header,
.bubento-form__fields,
.bubento-form__actions,
.bubento-form__completion {
	display: grid;
	gap: 0.875rem;
}

/* A little more air between questions than inside one. */
.bubento-form__fields {
	gap: 1.375rem;
}

/*
 * Whatever the script hides stays hidden, however a part is laid out: a field a condition
 * switches off, the other steps of a wizard, and the answered form once the thank-you shows.
 */
.bubento-form [hidden] {
	display: none;
}

.bubento-form__status:empty {
	display: none;
}

.bubento-form__title {
	margin: 0;
	font-family: var(--bubento-heading-font, inherit);
	font-size: 1.5rem;
	font-weight: var(--bubento-heading-weight, 700);
	line-height: 1.2;
}

/* A title the page's own heading already gives stays the form's name for screen readers only. */
.bubento-form__title--hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.bubento-form__intro,
.bubento-form__field-help,
.bubento-form__status {
	margin: 0;
	color: var(--bubento-muted-foreground, #6a6a6a);
}

.bubento-form__field {
	display: grid;
	gap: 0.55rem;
	margin: 0;
	padding: 0;
	border: 0;
	min-width: 0;
}

.bubento-form__field-title,
.bubento-form__section-title {
	color: inherit;
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.35;
	padding: 0;
}

/* A question is a legend, which the field's gap does not reach, so it carries its own space; a little more above a list of options. */
.bubento-form__field-title {
	margin: 0 0 0.5rem;
}

.bubento-form__field:has(> .bubento-form__choices) > .bubento-form__field-title {
	margin-bottom: 0.75rem;
}

.bubento-form__section-title {
	padding-top: 0.75rem;
	border-top: 1px solid var(--bubento-border, #e5e5e5);
}

.bubento-form__input {
	box-sizing: border-box;
	margin: 0;
	width: 100%;
	min-height: 48px;
	border: 1px solid var(--bubento-input, #878787);
	border-radius: var(--bubento-radius-md, 6px);
	padding: 0.7rem 0.875rem;
	background: var(--bubento-input-background, #ffffff);
	color: inherit;
	font: inherit;
	transition: border-color var(--bubento-motion-duration, 150ms) var(--bubento-motion-ease, cubic-bezier(0.4, 0, 0.2, 1)), box-shadow var(--bubento-motion-duration, 150ms) var(--bubento-motion-ease, cubic-bezier(0.4, 0, 0.2, 1));
}

/* Hints inside a field ("Such as Galaxy S22") read at the quiet text's 4.5:1, not the browser's faint grey. */
.bubento-form__input::placeholder {
	color: var(--bubento-muted-foreground, #6a6a6a);
	opacity: 1;
}

/*
 * A file field is a place to drop photos: a dashed box with room around the form's outlined button,
 * not a text field holding the browser's grey "Choose Files" (files dropped on it are taken, as on
 * any file field).
 */
.bubento-form__input[type="file"] {
	padding: 1.125rem 1rem;
	border-style: dashed;
	background: color-mix(in srgb, var(--bubento-muted, #f5f5f5) 55%, var(--bubento-input-background, #ffffff));
	color: var(--bubento-muted-foreground, #6a6a6a);
	cursor: pointer;
}

.bubento-form__input[type="file"]:hover {
	border-color: var(--bubento-primary, #171717);
}

.bubento-form__input[type="file"]::file-selector-button {
	margin-right: 0.75rem;
	padding: 0.5rem 0.875rem;
	border: 0;
	border-radius: var(--bubento-radius-button, 6px);
	background: transparent;
	box-shadow: inset 0 0 0 1px var(--bubento-input, #878787);
	color: var(--bubento-foreground, #0a0a0a);
	font: inherit;
	font-weight: var(--bubento-button-weight, 500);
	cursor: pointer;
}

.bubento-form__input[type="file"]:hover::file-selector-button {
	background: var(--bubento-secondary, #f5f5f5);
}

/* One focus style: the border takes the ring colour and a soft halo hugs the field, so nothing reaches the label above. */
.bubento-form__input:focus,
.bubento-form__input:focus-visible {
	border-color: var(--bubento-ring, #171717);
	outline: 2px solid transparent;
	outline-offset: 0;
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--bubento-ring, #171717) 22%, transparent);
}

.bubento-form__field.has-error .bubento-form__input:focus {
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--bubento-destructive, #cd2424) 22%, transparent);
}

/* Windows high contrast: the transparent outline becomes a visible one. */
@media (forced-colors: active) {
	.bubento-form__input:focus,
	.bubento-form__input:focus-visible {
		outline-color: Highlight;
	}
}

textarea.bubento-form__input {
	min-height: 120px;
	resize: vertical;
}

/*
 * Dropdowns draw their own arrow, in the hint colour, with room between it and the edge.
 * The box is restated one level more specific, because themes often style `.site select`,
 * which would otherwise put the text under the arrow or fade the outline.
 */
.bubento-form__select {
	position: relative;
	min-width: 0;
}

.bubento-form select.bubento-form__input {
	padding: 0.7rem 2.75rem 0.7rem 0.875rem;
	border: 1px solid var(--bubento-input, #878787);
	background: var(--bubento-input-background, #ffffff);
	-webkit-appearance: none;
	appearance: none;
	cursor: pointer;
}

.bubento-form select.bubento-form__input:focus {
	border-color: var(--bubento-ring, #171717);
}

.bubento-form .has-error select.bubento-form__input {
	border-color: var(--bubento-destructive, #cd2424);
}

.bubento-form__select-icon {
	position: absolute;
	top: 50%;
	right: 0.875rem;
	width: 1rem;
	height: 1rem;
	color: var(--bubento-muted-foreground, #6a6a6a);
	transform: translateY(-50%);
	pointer-events: none;
}

/* Windows high contrast: the browser's own arrow, which follows the system colours. */
@media (forced-colors: active) {
	.bubento-form select.bubento-form__input {
		padding-right: 0.875rem;
		-webkit-appearance: auto;
		appearance: auto;
	}

	.bubento-form__select-icon {
		display: none;
	}
}

/* "(optional)" after a question reads as a quiet note; the asterisk (.bubento-form__required) keeps the question's look. */
.bubento-form__optional {
	color: var(--bubento-muted-foreground, #6a6a6a);
	font-weight: 400;
}

/*
 * Checkboxes and radio buttons: the box lines up with the question's left edge
 * and sits centred on the first line of its answer, also when the answer wraps.
 */
.bubento-form__choices {
	display: grid;
	gap: 0.625rem;
}

.bubento-form__choice {
	display: grid;
	grid-template-columns: 1.125rem minmax(0, 1fr);
	align-items: start;
	column-gap: 0.625rem;
	font-size: 0.9375rem;
	line-height: 1.5;
	cursor: pointer;
}

.bubento-form__choice-input {
	box-sizing: border-box;
	width: 1.125rem;
	height: 1.125rem;
	margin: calc((0.9375rem * 1.5 - 1.125rem) / 2) 0 0;
	accent-color: var(--bubento-primary, #171717);
	cursor: pointer;
}

.bubento-form__choice-input:focus-visible {
	outline: 2px solid var(--bubento-ring, #171717);
	outline-offset: 2px;
}

/*
 * The form draws its own tick boxes and round options: a box with the field's edge that fills with
 * the button colour when chosen, in every browser the same, instead of each system's own control.
 */
@supports (appearance: none) {
	.bubento-form__choice-input {
		-webkit-appearance: none;
		appearance: none;
		display: inline-grid;
		place-content: center;
		border: 1px solid var(--bubento-input, #878787);
		border-radius: var(--bubento-radius-sm, 4px);
		background: var(--bubento-input-background, #ffffff);
		transition: background-color var(--bubento-motion-duration, 150ms) var(--bubento-motion-ease, cubic-bezier(0.4, 0, 0.2, 1)), border-color var(--bubento-motion-duration, 150ms) var(--bubento-motion-ease, cubic-bezier(0.4, 0, 0.2, 1));
	}

	.bubento-form__choice-input[type="radio"] {
		border-radius: 50%;
	}

	.bubento-form__choice-input::before {
		content: "";
		width: 0.6875rem;
		height: 0.6875rem;
		background: var(--bubento-primary-foreground, #ffffff);
		clip-path: polygon(14% 44%, 0 65%, 46% 100%, 100% 18%, 82% 4%, 42% 66%);
		transform: scale(0);
	}

	.bubento-form__choice-input[type="radio"]::before {
		clip-path: circle(32%);
	}

	.bubento-form__choice-input:checked {
		border-color: var(--bubento-primary, #171717);
		background: var(--bubento-primary, #171717);
	}

	.bubento-form__choice-input:checked::before {
		transform: scale(1);
	}

	.bubento-form .has-error .bubento-form__choice-input {
		border-color: var(--bubento-destructive, #cd2424);
	}
}

/* With a system's high-contrast colours the browser's own controls come back, as it draws them best. */
@media (forced-colors: active) {
	.bubento-form__choice-input {
		-webkit-appearance: auto;
		appearance: auto;
	}

	.bubento-form__choice-input::before {
		content: none;
	}
}

.bubento-form__choice--consent {
	margin-top: 0.25rem;
}

.bubento-form__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	align-items: center;
}

.bubento-form__button {
	border: 0;
	border-radius: var(--bubento-radius-button, 6px);
	background: var(--bubento-primary, #171717);
	color: var(--bubento-primary-foreground, #ffffff);
	min-height: 50px;
	padding: 0.875rem 1.5rem;
	font: inherit;
	font-weight: var(--bubento-button-weight, 500);
	cursor: pointer;
	transition: background-color var(--bubento-motion-duration, 150ms) var(--bubento-motion-ease, cubic-bezier(0.4, 0, 0.2, 1));
}

.bubento-form__button:hover {
	background: color-mix(in srgb, var(--bubento-primary, #171717) 90%, var(--bubento-background, #ffffff));
}

.bubento-form__button:focus-visible {
	outline: 2px solid var(--bubento-ring, #171717);
	outline-offset: 2px;
}

.bubento-form__button:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.bubento-form__button--secondary {
	background: transparent;
	color: var(--bubento-foreground, #0a0a0a);
	box-shadow: inset 0 0 0 1px var(--bubento-border, #e5e5e5);
}

.bubento-form__button--secondary:hover {
	background: var(--bubento-secondary, #f5f5f5);
}

.bubento-form__error-summary,
.bubento-form__field-error {
	color: var(--bubento-destructive, #cd2424);
	font-size: 0.875rem;
	font-weight: 500;
}

.bubento-form__field.has-error .bubento-form__input {
	border-color: var(--bubento-destructive, #cd2424);
}

.bubento-form__progress {
	display: grid;
	gap: 0.35rem;
}

.bubento-form__progress-track {
	height: 6px;
	overflow: hidden;
	border-radius: var(--bubento-radius-pill, 9999px);
	background: var(--bubento-muted, #f5f5f5);
}

.bubento-form__progress-bar {
	display: block;
	height: 100%;
	width: 0;
	background: var(--bubento-primary, #171717);
	transition: width var(--bubento-motion-duration, 150ms) var(--bubento-motion-ease, cubic-bezier(0.4, 0, 0.2, 1));
}

.bubento-form__completion {
	padding: 1rem;
	border: 1px solid var(--bubento-border, #e5e5e5);
	border-radius: var(--bubento-radius-lg, 8px);
	background: var(--bubento-card, #ffffff);
	box-shadow: var(--bubento-shadow-sm, 0 1px 2px 0 rgb(0 0 0 / 0.05));
}

.bubento-form__completion h3 {
	margin: 0;
	font-size: 1.1rem;
}

/*
 * Cloudflare Turnstile: takes room only while it asks the visitor to tick its box (or shows a
 * problem). Until then it stays out of the form's grid, so it adds no gap.
 */
.bubento-form__turnstile:empty {
	display: none;
}

.bubento-form__turnstile:not(.is-asking) {
	position: absolute;
	inset-inline: 0;
	height: 0;
	overflow: hidden;
}

.bubento-form__honeypot {
	position: absolute;
	left: -10000px;
	width: 1px;
	height: 1px;
	opacity: 0;
}

.bubento-form.is-submitting {
	opacity: 0.72;
	pointer-events: none;
}

@media (max-width: 640px) {
	.bubento-form {
		max-width: none;
	}

	.bubento-form__actions {
		align-items: stretch;
		flex-direction: column;
	}

	.bubento-form__button {
		width: 100%;
	}
}

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