/**
 * Barra flottante "Biscotto" (container Elementor con _title = Biscotto).
 *
 * Layout:
 * - larghezza totale = somma contenuti (logo + nav + CTA), senza overflow
 * - centrata orizzontalmente (position fixed)
 * - altezza/offset verticale restano quelli impostati in Elementor
 *
 * Scroll-spy (aiop-biscotto-bar.js):
 * - voce attiva: classe `.is-active` su link e widget Heading
 * - linea rilevamento: `--aiop-biscotto-spy-viewport-ratio` (default 0.375 ≈ poco sopra il centro)
 * - colore attivo: Orange Elementor (`--e-global-color-fifth`), override `--aiop-biscotto-nav-active-color`
 */

.aiop-biscotto-bar.e-con {
	box-sizing: border-box;
	width: max-content !important;
	max-width: calc(100vw - 32px);
	--aiop-biscotto-spy-viewport-ratio: 0.375;
	--aiop-biscotto-nav-active-color: var(--e-global-color-fifth, #eb6037);
	--aiop-biscotto-glass-blur: 4px;
	--width: auto !important;
	left: 50% !important;
	right: auto !important;
	transform: translateX(-50%);
	overflow: hidden;
}

@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
	.aiop-biscotto-bar.e-con,
	.aiop-biscotto-bar > .e-con:nth-child(2),
	.aiop-biscotto-bar > .e-con.aiop-biscotto-bar__nav-scroll,
	.aiop-biscotto-bar__glass-surface.e-con {
		-webkit-backdrop-filter: blur(var(--aiop-biscotto-glass-blur, 4px));
		backdrop-filter: blur(var(--aiop-biscotto-glass-blur, 4px));
	}
}

body.rtl .aiop-biscotto-bar.e-con {
	left: auto !important;
	right: 50% !important;
	transform: translateX(50%);
}

.aiop-biscotto-bar > .e-con {
	box-sizing: border-box;
	flex: 0 0 auto;
	width: auto !important;
	max-width: none;
	--width: auto !important;
	min-width: 0;
}

.aiop-biscotto-bar > .e-con.e-con-full {
	flex: 0 0 auto;
	width: auto !important;
	--width: auto !important;
}

/* Logo: dimensione immagine fissa (allineata al widget Image custom 100px) */
.aiop-biscotto-bar > .e-con:first-child {
	flex: 0 0 auto;
}

.aiop-biscotto-bar > .e-con:first-child .elementor-widget-image img {
	display: block;
	width: 100px;
	max-width: 100px;
	height: auto;
}

/* Sezione anchor: larghezza dalle voci, senza uscire dal Biscotto */
.aiop-biscotto-bar > .e-con:nth-child(2) {
	flex: 0 0 auto;
	margin-left: 0 !important;
	margin-right: 0 !important;
}

.aiop-biscotto-bar > .e-con:nth-child(2) .elementor-widget-heading {
	flex: 0 0 auto;
	width: auto;
	max-width: none;
}

.aiop-biscotto-bar > .e-con:nth-child(2) .elementor-heading-title {
	white-space: nowrap;
}

/* Voce nav attiva (scroll-spy) */
.aiop-biscotto-bar a.is-active,
.aiop-biscotto-bar .elementor-widget-heading.is-active .elementor-heading-title,
.aiop-biscotto-bar .elementor-widget-heading.is-active .elementor-heading-title a {
	color: var(--aiop-biscotto-nav-active-color, var(--e-global-color-fifth, #eb6037));
	font-weight: 700;
}

/* Blocco CTA: larghezza = max(titolo 2 righe, pulsante) */
.aiop-biscotto-bar > .e-con:last-child {
	flex: 0 0 auto;
	width: auto !important;
	max-width: none;
	--content-width: auto !important;
}

.aiop-biscotto-bar > .e-con:last-child .e-con-inner {
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	align-items: stretch;
	width: max-content;
	max-width: 100%;
}

.aiop-biscotto-bar > .e-con:last-child .elementor-widget-heading {
	width: auto;
	max-width: 100%;
	align-self: center;
}

.aiop-biscotto-bar > .e-con:last-child .elementor-widget-button {
	width: 100%;
	min-width: 0;
}

.aiop-biscotto-bar > .e-con:last-child .elementor-heading-title,
.aiop-biscotto-bar__cta-title .elementor-heading-title {
	display: block;
	width: max-content;
	max-width: 100%;
	box-sizing: border-box;
	white-space: normal;
	text-align: center;
	line-height: 1.05;
	overflow-wrap: normal;
	word-break: normal;
	text-transform: uppercase;
}

.aiop-biscotto-bar > .e-con:last-child .elementor-widget-button .elementor-button {
	box-sizing: border-box;
	display: inline-flex;
	width: 100%;
	justify-content: center;
	white-space: nowrap;
}

@media (max-width: 767px) {
	.aiop-biscotto-bar.e-con {
		max-width: calc(100vw - 16px);
	}

	.aiop-biscotto-bar > .e-con:nth-child(2) .elementor-heading-title {
		white-space: normal;
	}
}

/* Variante nav-only (Chi siamo): nav compatta, no spazio morto a destra */
.aiop-biscotto-bar--nav-only > .e-con:nth-child(2) > .e-con-inner {
	display: flex;
	flex-flow: row nowrap;
	justify-content: flex-start;
	align-items: center;
	gap: 0 1rem;
	width: max-content;
	max-width: 100%;
}

.aiop-biscotto-bar--nav-only > .e-con:nth-child(2) .elementor-widget-heading {
	flex: 0 0 auto;
}

/* Variante nav-only (Chi siamo): scroll orizzontale su mobile */
.aiop-biscotto-bar--nav-only > .e-con.aiop-biscotto-bar__nav-scroll {
	overflow-x: auto;
	overflow-y: hidden;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
	max-width: min(72vw, 640px);
}

.aiop-biscotto-bar--nav-only > .e-con.aiop-biscotto-bar__nav-scroll::-webkit-scrollbar {
	display: none;
}

@media (max-width: 767px) {
	.aiop-biscotto-bar--nav-only > .e-con.aiop-biscotto-bar__nav-scroll .elementor-heading-title {
		font-size: 15px;
	}
}
