/*
 * Fluent Forms (scoped to .fluentform), same look as the old Contact Form 7
 * forms: 52px fields with a 1px primary border, floating labels, uppercase
 * outline / fill / white submit buttons. Enqueued from Fluent's
 * `fluentform/before_form_render` action after Fluent's base layout CSS; its
 * default skin (fluentform-public-default.css) is switched off.
 *
 * Floating labels, CSS only: the label sits inside the field while the field
 * is empty and unfocused (":placeholder-shown"; the placeholder repeats the
 * label and is transparent), and moves up onto the top-left border, small and
 * in the brand colour, once focused or filled.
 */

.fluentform {
	--fluentform-danger: var(--wp--preset--color--orange);
}

.fluentform .ff-el-group {
	position: relative;
	margin-bottom: 1.5rem;
}

/* Two-column rows (Fluent containers) stack below 768px. */
.fluentform .ff-t-container {
	gap: 20px;
}

@media (max-width: 767.98px) {

	.fluentform .ff-t-container {
		display: block;
	}
}

.fluentform .ff-t-container .ff-t-cell {
	padding: 0;
}

/* Controls. */
.fluentform :is(input:not([type="checkbox"], [type="radio"], [type="hidden"]), select, textarea).ff-el-form-control {
	box-sizing: border-box;
	height: 52px;
	padding: 0.5rem 0.875rem;
	border: 1px solid var(--wp--preset--color--primary);
	border-radius: 0;
	background-color: var(--wp--preset--color--white);
	color: var(--wp--preset--color--body-color);
	font: inherit;
	line-height: 1.5;
	box-shadow: none;
	transition: border-color 0.15s ease-in-out;
}

.fluentform textarea.ff-el-form-control {
	height: auto;
	min-height: 8rem;
	resize: vertical;
}

.fluentform .ff-el-form-control:focus {
	border-color: #a1906c;
	outline: 2px solid var(--wp--preset--color--primary-text);
	outline-offset: 0;
}

.fluentform :is(input, textarea).ff-el-form-control::placeholder {
	color: transparent;
	opacity: 0;
}

/* Label: on the top border, left (focused, filled, or a select); its text
   stays in line with the typed text. */
.fluentform .ff-el-group > .ff-el-input--label {
	position: absolute;
	top: 0;
	left: 0.5rem;
	z-index: 1;
	width: max-content;
	max-width: calc(100% - 1rem);
	margin: 0;
	padding: 2px 0.375rem;
	background-color: var(--wp--preset--color--white);
	color: var(--wp--preset--color--primary-text);
	font-size: 80%;
	line-height: 1;
	transform: translate(0, -50%);
	transition: all 0.25s;
	pointer-events: none;
}

.fluentform .ff-el-input--label label {
	margin: 0;
	font-weight: inherit;
}

/* "Nome*": asterisk right after the label, in the label colour. */
.fluentform .ff-el-input--label.ff-el-is-required.asterisk-right label::after {
	margin-left: 0;
	color: inherit;
	content: "*";
}

/* Label inside the empty field, like a placeholder. */
.fluentform .ff-el-group:not(:focus-within):has(input.ff-el-form-control:placeholder-shown) > .ff-el-input--label {
	top: 26px;
	left: 1px;
	padding: 2px 0.875rem;
	background-color: transparent;
	color: var(--wp--preset--color--body-color);
	font-size: 1em;
	transform: translate(0, -50%);
}

.fluentform .ff-el-group:not(:focus-within):has(textarea.ff-el-form-control:placeholder-shown) > .ff-el-input--label {
	top: 1.5rem;
	left: 1px;
	padding: 2px 0.875rem;
	background-color: transparent;
	color: var(--wp--preset--color--body-color);
	font-size: 1em;
	transform: translate(0, -50%);
}

/* Privacy acceptance. */
.fluentform .ff-el-tc .ff-el-form-check-label {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 20px;
	line-height: 1.5;
}

.fluentform .ff-el-tc .ff_t_c {
	margin: 0;
	padding: 0;
}

.fluentform input[type="checkbox"] {
	width: 1.1em;
	height: 1.1em;
	margin: 0;
	accent-color: var(--wp--preset--color--primary);
	vertical-align: middle;
}

.fluentform .required-fields {
	margin: 0;
	font-size: 80%;
}

/* Submit (old .btn-outline-primary; .is-primary and .is-white variants). */
.fluentform .ff-btn-submit {
	padding:
		clamp(0.4375rem, 0.390625rem + 0.2344vw, 0.625rem)
		clamp(0.875rem, 0.625rem + 1.25vw, 1.875rem);
	border: 1px solid var(--ragazzo-brand-text, var(--wp--preset--color--primary-text));
	border-radius: 0;
	background-color: transparent;
	color: var(--ragazzo-brand-text, var(--wp--preset--color--primary-text));
	font: inherit;
	font-size: clamp(1.0625rem, 0.890625rem + 0.8594vw, 1.75rem);
	font-weight: 700;
	line-height: 1.55;
	text-transform: uppercase;
	box-shadow: none;
	opacity: 1;
	cursor: pointer;
	transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out;
}

.fluentform .ff-btn-submit:is(:hover, :focus-visible) {
	border-color: var(--wp--preset--color--primary);
	background-color: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--gray-900);
	opacity: 1;
}

.fluentform .ff-btn-submit.is-primary {
	border-color: var(--wp--preset--color--primary);
	background-color: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--gray-900);
}

.fluentform .ff-btn-submit.is-primary:is(:hover, :focus-visible) {
	border-color: #ab9b7c;
	background-color: #b0a184;
}

.fluentform .ff-btn-submit.is-white {
	border-color: var(--wp--preset--color--white);
	color: var(--wp--preset--color--white);
}

.fluentform .ff-btn-submit.is-white:is(:hover, :focus-visible) {
	background-color: var(--wp--preset--color--white);
	color: var(--wp--preset--color--gray-900);
}

/* Messages, in palette colours: light panel, accent border, body text. */
.ff-message-success {
	margin: 0.5rem 0;
	padding: 0.75rem 1.25rem;
	border: 1px solid var(--wp--preset--color--light-gray);
	border-inline-start: 4px solid var(--wp--preset--color--green);
	border-radius: 0;
	background-color: var(--wp--preset--color--light);
	color: var(--wp--preset--color--body-color);
	box-shadow: none;
}

.ff-message-success p {
	margin: 0;
}

.fluentform .ff-el-is-error .text-danger {
	display: block;
	margin-top: 0.25rem;
	padding: 0.25rem 0.75rem;
	border-inline-start: 4px solid var(--wp--preset--color--orange);
	background-color: var(--wp--preset--color--light);
	color: var(--wp--preset--color--body-color);
	font-size: 14px;
}

.ff-errors-in-stack .error {
	padding: 0.25rem 0.75rem;
	border-inline-start: 4px solid var(--wp--preset--color--orange);
	background-color: var(--wp--preset--color--light);
	color: var(--wp--preset--color--body-color);
}

/* File upload (Lavora con noi, Fluent Forms Pro): static label, brand
   button. */
.fluentform .ff-el-group:has(.ff_upload_btn) > .ff-el-input--label {
	position: static;
	width: auto;
	margin-bottom: 0.5rem;
	padding: 0;
	background-color: transparent;
	color: var(--wp--preset--color--body-color);
	font-size: 1em;
	transform: none;
}

.fluentform .ff_upload_btn.ff-btn {
	padding: 0.5rem 1.25rem;
	border-radius: 0;
	background-color: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--gray-900);
	font-weight: 700;
}

.fluentform .ff_upload_btn.ff-btn:is(:hover, :focus-visible) {
	background-color: #b0a184;
	color: var(--wp--preset--color--gray-900);
}
