/**
 * Carosello territorio — solo .bb-territory-carousel
 */

.bb-territory-section.bb-premium-section--sage-tint,
.bb-territory-section.wp-block-spectra-container {
	background-color: #f7f3ec !important;
}

.bb-territory-section h2.wp-block-spectra-content {
	font-family: var(--wp--preset--font-family--heading-serif, "Source Serif 4", serif);
	font-weight: 600;
}

.bb-territory-carousel {
	--bb-territory-gap: clamp(24px, 2.2vw, 30px);
	--bb-territory-visible: 3;
	position: relative;
	display: flex;
	align-items: center;
	gap: 0.65rem;
	width: 100%;
	margin-top: 0.25rem;
}

.bb-territory-carousel .wp-block-button.bb-territory-prev,
.bb-territory-carousel .wp-block-button.bb-territory-next {
	flex: 0 0 auto;
	margin: 0;
}

.bb-territory-carousel .bb-territory-prev,
.bb-territory-carousel .bb-territory-next,
.bb-territory-carousel .wp-block-button.bb-territory-prev .wp-block-button__link,
.bb-territory-carousel .wp-block-button.bb-territory-next .wp-block-button__link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	min-height: 44px;
	padding: 0 !important;
	border: 1px solid rgba(70, 80, 68, 0.22) !important;
	border-radius: 50% !important;
	background: #fffef9 !important;
	color: #465044 !important;
	box-shadow: none !important;
	cursor: pointer;
	transition:
		background-color 0.28s ease,
		border-color 0.28s ease,
		opacity 0.28s ease;
}

.bb-territory-carousel .bb-territory-prev:hover:not(:disabled),
.bb-territory-carousel .bb-territory-next:hover:not(:disabled),
.bb-territory-carousel .wp-block-button.bb-territory-prev:not(.is-disabled) .wp-block-button__link:hover,
.bb-territory-carousel .wp-block-button.bb-territory-next:not(.is-disabled) .wp-block-button__link:hover {
	background: #d8b77a !important;
	border-color: #d8b77a !important;
	color: #252725 !important;
}

.bb-territory-carousel .bb-territory-prev:disabled,
.bb-territory-carousel .bb-territory-next:disabled,
.bb-territory-carousel .wp-block-button.bb-territory-prev.is-disabled .wp-block-button__link,
.bb-territory-carousel .wp-block-button.bb-territory-next.is-disabled .wp-block-button__link {
	opacity: 0.35;
	cursor: default;
	pointer-events: none;
}

/* Editor: card in fila scrollabile anche in anteprima Gutenberg */
.editor-styles-wrapper .bb-territory-track,
.block-editor-block-list__layout .bb-territory-track {
	display: flex;
	flex-wrap: nowrap;
	overflow-x: auto;
	gap: 1rem;
}

.bb-territory-carousel .bb-territory-arrow {
	display: block;
	width: 9px;
	height: 9px;
	border-top: 2px solid currentColor;
	border-right: 2px solid currentColor;
}

.bb-territory-carousel .bb-territory-prev .bb-territory-arrow {
	transform: rotate(-135deg);
	margin-left: 2px;
}

.bb-territory-carousel .bb-territory-next .bb-territory-arrow {
	transform: rotate(45deg);
	margin-right: 2px;
}

.bb-territory-carousel .bb-territory-track {
	flex: 1 1 auto;
	display: flex;
	flex-wrap: nowrap;
	gap: var(--bb-territory-gap);
	min-width: 0;
	overflow-x: auto;
	overflow-y: hidden;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
	padding-block: 0.15rem;
}

.bb-territory-carousel .bb-territory-track:focus {
	outline: 2px solid #78866b;
	outline-offset: 4px;
}

.bb-territory-carousel .bb-territory-track::-webkit-scrollbar {
	display: none;
	height: 0;
}

.bb-territory-carousel .bb-territory-track > .bb-territory-card {
	flex: 0 0
		calc(
			(100% - (var(--bb-territory-visible) - 1) * var(--bb-territory-gap)) /
				var(--bb-territory-visible)
		);
	scroll-snap-align: start;
	scroll-snap-stop: always;
	min-height: 260px;
	border-radius: 17px !important;
}

.bb-territory-carousel .bb-territory-card.wp-block-spectra-container {
	aspect-ratio: 4 / 3;
	min-height: 0 !important;
}

.bb-territory-carousel .bb-territory-card .wp-block-spectra-container[style*="background-image"],
.bb-territory-carousel .bb-territory-card.wp-block-spectra-container {
	background-size: cover !important;
	background-position: center !important;
}

@media (max-width: 1023px) {
	.bb-territory-carousel {
		--bb-territory-visible: 2;
	}
}

@media (max-width: 767px) {
	.bb-territory-carousel {
		--bb-territory-visible: 1.14;
		gap: 0.35rem;
	}

	.bb-territory-carousel .bb-territory-prev,
	.bb-territory-carousel .bb-territory-next {
		width: 40px;
		height: 40px;
	}
}

@media (max-width: 520px) {
	.bb-territory-carousel .bb-territory-prev {
		margin-inline-end: -0.15rem;
	}

	.bb-territory-carousel .bb-territory-next {
		margin-inline-start: -0.15rem;
	}
}
