/* CMT Orange Tools — Formidable Forms theme integration.
 * Base tokens are also stored as the reusable Formidable style
 * "CMT Orange Tools"; these rules provide the project-specific layouts. */

:where(.cmt-form, .cb-form-section, .cmt-fn__nl-box) .frm_forms {
	--cmt-form-gap: 20px;
	font-family: Poppins, sans-serif;
	color: inherit;
}

/*
 * Formidable genera quasi tutto il proprio tema tramite custom properties.
 * Le rimappiamo sui token CMT nel punto di integrazione, così il tema salvato
 * nel database resta modificabile ma non reintroduce colori, raggi e font
 * estranei al design system del sito.
 */
:where(.cmt-form, .cb-form-section, .cmt-fn__nl-box) .frm_forms.with_frm_style.frm_style_cmt-orange-tools {
	--font: Poppins, sans-serif;
	--font-size: var(--wp--preset--font-size--body-m, 16px);
	--field-font-size: var(--wp--preset--font-size--body-m, 16px);
	--field-height: 35px;
	--field-pad: 7px 18px 8px;
	--field-weight: 400;
	--field-border-width: 1px;
	--border-color: transparent;
	--border-color-active: var(--wp--preset--color--nero, #000);
	--border-radius: 2px;
	--bg-color: var(--wp--preset--color--bianco, #fff);
	--bg-color-active: var(--wp--preset--color--bianco, #fff);
	--text-color: var(--wp--preset--color--nero, #000);
	--label-color: currentColor;
	--label-padding: 0 0 11px;
	--box-shadow: none;
	--submit-font-size: var(--wp--preset--font-size--body-l, 18px);
	--submit-weight: 400;
	--submit-padding: 13px 22px;
	--submit-border-radius: 2px;
	--submit-border-width: 1px;
	--submit-bg-color: var(--wp--preset--color--nero, #000);
	--submit-border-color: var(--wp--preset--color--nero, #000);
	--submit-text-color: var(--wp--preset--color--bianco, #fff);
	--submit-hover-bg-color: var(--wp--preset--color--bianco, #fff);
	--submit-hover-border-color: var(--wp--preset--color--nero, #000);
	--submit-hover-color: var(--wp--preset--color--nero, #000);
}

:where(.cmt-form, .cb-form-section, .cmt-fn__nl-box) .frm_forms .frm_form_title,
:where(.cmt-form, .cb-form-section, .cmt-fn__nl-box) .frm_forms .frm_description {
	display: none;
}

:where(.cmt-form, .cb-form-section, .cmt-fn__nl-box) .frm_forms fieldset {
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
}

:where(.cmt-form, .cb-form-section) .frm_forms .frm_fields_container {
	display: grid;
	grid-template-columns: repeat(6, minmax(0, 1fr));
	gap: var(--cmt-form-gap);
}

:where(.cmt-form, .cb-form-section) .frm_forms .frm_form_field,
:where(.cmt-form, .cb-form-section) .frm_forms .frm_submit {
	grid-column: 1 / -1;
	min-width: 0;
	margin: 0;
}

:where(.cmt-form, .cb-form-section) .frm_forms .cmt-frm-half {
	grid-column: span 3;
}

:where(.cmt-form, .cb-form-section) .frm_forms .cmt-frm-third {
	grid-column: span 2;
}

:where(.cmt-form, .cb-form-section) .frm_forms .frm_primary_label {
	display: block;
	margin: 0 0 8px;
	font: 600 16px/1.25 Poppins, sans-serif;
	color: inherit;
}

.cmt-form .frm_forms .frm_primary_label {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

:where(.cmt-form, .cb-form-section) .frm_forms :where(input[type='text'], input[type='email'], input[type='tel'], input[type='url'], input[type='number'], select, textarea) {
	width: 100%;
	min-height: 35px;
	box-sizing: border-box;
	padding: 7px 18px 8px;
	border: 1px solid transparent;
	border-radius: 2px;
	outline: 0;
	background: var(--wp--preset--color--bianco, #fff);
	box-shadow: none;
	font: 300 16px/1.35 Poppins, sans-serif;
	color: var(--wp--preset--color--nero, #111);
}

/* Formidable calcola gli input come content-box: l'altezza del token verrebbe
 * sommata al padding. Qui la rendiamo davvero l'altezza finale del mockup. */
:where(.cmt-form, .cb-form-section) .frm_forms.with_frm_style.frm_style_cmt-orange-tools .frm_form_field :where(input[type='text'], input[type='email'], input[type='tel'], input[type='url'], input[type='number'], select) {
	height: var(--field-height, 35px);
	min-height: var(--field-height, 35px);
	box-sizing: border-box;
	line-height: 18px;
}

:where(.cmt-form, .cb-form-section) .frm_forms textarea {
	min-height: 129px;
	resize: vertical;
}

:where(.cmt-form, .cb-form-section) .frm_forms :where(input, select, textarea):focus-visible {
	border-color: var(--wp--preset--color--nero, #111);
	outline: 2px solid currentColor;
	outline-offset: 2px;
	box-shadow: none;
}

:where(.cmt-form, .cb-form-section) .frm_forms .frm_error {
	margin-top: 6px;
	font-size: 13px;
	line-height: 1.35;
	color: #8b1f18;
}

:where(.cmt-form, .cb-form-section) .frm_forms .frm_error_style,
:where(.cmt-form, .cb-form-section) .frm_forms .frm_message {
	grid-column: 1 / -1;
	padding: 16px 18px;
	border: 1px solid currentColor;
	border-radius: 2px;
	background: color-mix(in srgb, var(--wp--preset--color--bianco, #fff) 88%, transparent);
	color: var(--wp--preset--color--nero, #111);
}

:where(.cmt-form, .cb-form-section) .frm_forms .frm_checkbox label {
	display: block;
	position: relative;
	padding-left: 28px;
	font: 300 14px/1.45 Poppins, sans-serif;
	color: inherit;
}

:where(.cmt-form, .cb-form-section, .cmt-fn__nl-box) .frm_forms .frm_checkbox a {
	color: inherit;
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
}

:where(.cmt-form, .cb-form-section, .cmt-fn__nl-box) .frm_forms .frm_checkbox a:hover {
	text-decoration-thickness: 2px;
}

:where(.cmt-form, .cb-form-section) .frm_forms input[type='checkbox'] {
	width: 18px;
	height: 18px;
	margin: 0;
	accent-color: var(--wp--preset--color--nero, #111);
}

:where(.cmt-form, .cb-form-section) .frm_forms .frm_checkbox label > input[type='checkbox'] {
	position: absolute;
	top: 1px;
	left: 0;
}

:where(.cmt-form, .cb-form-section) .frm_forms .frm_button_submit {
	display: inline-flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	width: 207px;
	min-width: 207px;
	min-height: 50px;
	box-sizing: border-box;
	padding: 13px 23px;
	border: var(--submit-border-width, 1px) solid var(--submit-border-color, var(--wp--preset--color--nero, #111));
	border-radius: 2px;
	background: var(--submit-bg-color, var(--wp--preset--color--nero, #111));
	box-shadow: none;
	font: var(--submit-weight, 400) var(--submit-font-size, 18px)/19px Poppins, sans-serif;
	color: var(--submit-text-color, var(--wp--preset--color--bianco, #fff));
	cursor: pointer;
	transition: background-color .2s ease, color .2s ease;
}

:where(.cmt-form, .cb-form-section, .cmt-fn__nl-box) .frm_forms .frm_button_submit::after {
	content: '';
	display: block;
	flex: 0 0 auto;
	width: 0;
	height: 0;
	border-top: 6px solid transparent;
	border-bottom: 6px solid transparent;
	border-left: 16px solid currentColor;
}

.cmt-form .frm_forms .frm_submit,
.cb-form-section .frm_forms .frm_submit {
	display: flex;
	width: 100%;
}

.cmt-form--arancione .frm_forms .frm_submit {
	justify-content: flex-start;
}

.cmt-form--scuro .frm_forms .frm_submit,
.cb-form-section .frm_forms .frm_submit {
	justify-content: flex-end;
}

.cmt-form--scuro .frm_forms.with_frm_style.frm_style_cmt-orange-tools,
.cb-form-section .frm_forms.with_frm_style.frm_style_cmt-orange-tools {
	--submit-bg-color: var(--wp--preset--color--arancione, #dc7431);
	--submit-border-color: var(--wp--preset--color--arancione, #dc7431);
	--submit-text-color: var(--wp--preset--color--bianco, #fff);
	--submit-hover-bg-color: var(--wp--preset--color--nero, #000);
	--submit-hover-border-color: var(--wp--preset--color--arancione, #dc7431);
	--submit-hover-color: var(--wp--preset--color--bianco, #fff);
}

:where(.cmt-form, .cb-form-section) .frm_forms .frm_button_submit:hover,
:where(.cmt-form, .cb-form-section) .frm_forms .frm_button_submit:focus-visible {
	border-color: var(--submit-hover-border-color, var(--wp--preset--color--nero, #111));
	background: var(--submit-hover-bg-color, var(--wp--preset--color--bianco, #fff));
	color: var(--submit-hover-color, var(--wp--preset--color--nero, #111));
}

:where(.cmt-form, .cb-form-section, .cmt-fn__nl-box) .frm_forms .frm_button_submit:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 3px;
}

/* Careers: labels visible, three columns and upload controls matching the board. */
.cb-form-section .frm_forms .frm_fields_container {
	gap: 24px 38px;
}

.cb-form-section .frm_forms textarea {
	min-height: 198px;
}

.cb-form-section .frm_forms .frm_form_field[type='hidden'],
.cb-form-section .frm_forms input[type='hidden'] {
	display: none;
}

.cb-form-section .frm_forms .frm_dropzone {
	min-height: 74px;
	border: 1px dashed currentColor;
	border-radius: 2px;
	background: color-mix(in srgb, var(--wp--preset--color--bianco, #fff) 28%, transparent);
}

/* Newsletter: Formidable replaces the former inert inline form. */
.cmt-fn__nl-box .cmt-newsletter__formidable-wrap,
.cmt-fn__nl-box .frm_forms,
.cmt-fn__nl-box .frm_form_field {
	width: 100%;
}

.cmt-fn__nl-box .frm_forms .frm_fields_container {
	display: flex;
	flex-direction: column;
	gap: 13px;
	align-items: stretch;
}

.cmt-fn__nl-box .frm_forms .frm_form_field {
	margin: 0;
}

.cmt-fn__nl-box .frm_forms .cmt-frm-newsletter-email {
	width: 100%;
}

.cmt-fn__nl-box .frm_forms .cmt-frm-consent {
	grid-column: 1 / -1;
}

.cmt-fn__nl-box .frm_forms .frm_submit {
	width: 100%;
	margin: 0;
}

.cmt-fn__nl-box .frm_forms .frm_primary_label {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.cmt-fn__nl-box .frm_forms input[type='email'],
.cmt-fn__nl-box .frm_forms input[type='text'] {
	width: 100%;
	height: 35px;
	min-height: 35px;
	box-sizing: border-box;
	padding: 7px 6px 8px;
	border: 1px solid transparent;
	border-radius: 2px;
	background: var(--wp--preset--color--bianco, #fff);
	font: 300 18px/20px Poppins, sans-serif;
	color: var(--wp--preset--color--nero, #111);
	text-align: center;
}

.cmt-fn__nl-box .frm_forms.with_frm_style.frm_style_cmt-orange-tools .frm_form_field input[type='email'],
.cmt-fn__nl-box .frm_forms.with_frm_style.frm_style_cmt-orange-tools .frm_form_field input[type='text'] {
	height: 35px;
	min-height: 35px;
	box-sizing: border-box;
}

.cmt-fn__nl-box .frm_forms .frm_checkbox label {
	display: block;
	position: relative;
	padding-left: 26px;
	font: 300 12px/1.4 Poppins, sans-serif;
	color: inherit;
}

.cmt-fn__nl-box .frm_forms .frm_checkbox label > input[type='checkbox'] {
	position: absolute;
	top: 0;
	left: 0;
	width: 18px;
	height: 18px;
	margin: 0;
}

.cmt-fn__nl-box .frm_forms .frm_button_submit {
	display: inline-flex;
	align-items: center;
	justify-content: space-between;
	gap: 18px;
	width: 100%;
	min-height: 50px;
	margin: 0;
	padding: 13px 30px;
	border: 1px solid var(--wp--preset--color--nero, #111);
	border-radius: 2px;
	background: var(--wp--preset--color--nero, #111);
	font: 400 18px/19px Poppins, sans-serif;
	color: var(--wp--preset--color--bianco, #fff);
}

.cmt-formidable-warning {
	margin: 16px 0 0;
	padding: 12px 14px;
	border: 1px dashed currentColor;
	font: 500 13px/1.4 Poppins, sans-serif;
}

@media (max-width: 767px) {
	:where(.cmt-form, .cb-form-section) .frm_forms .frm_fields_container,
	.cmt-fn__nl-box .frm_forms .frm_fields_container {
		display: flex;
		flex-direction: column;
		gap: 16px;
	}

	:where(.cmt-form, .cb-form-section) .frm_forms .cmt-frm-half,
	:where(.cmt-form, .cb-form-section) .frm_forms .cmt-frm-third,
	.cmt-fn__nl-box .frm_forms .frm_submit {
		width: 100%;
	}

	.cmt-fn__nl-box .frm_forms .frm_button_submit {
		width: 100%;
	}
}

@media (prefers-reduced-motion: reduce) {
	:where(.cmt-form, .cb-form-section, .cmt-fn__nl-box) .frm_forms * {
		transition: none !important;
	}
}
