/* Slider Bridge — stili minimi, nessuna dipendenza. */

.sb-slider {
	position: relative;
	width: 100%;
	overflow: hidden;
	--sb-scale: 1;
}

.sb-viewport {
	position: relative;
	width: 100%;
	/* Fallback senza JS: rapporto della griglia originale. */
	aspect-ratio: var(--sb-gw) / var(--sb-gh);
	overflow: hidden;
	/* Niente colore di fondo: molte slide non hanno un'immagine di sfondo e la
	   scena è fatta di soli layer, sopra lo sfondo della pagina. */
	background: transparent;
}

/* Browser molto vecchi senza aspect-ratio: altezza minima di sicurezza. */
@supports not (aspect-ratio: 1 / 1) {
	.sb-viewport {
		min-height: 320px;
	}
}

.sb-slide {
	position: absolute;
	inset: 0;
	opacity: 0;
	visibility: hidden;
	transition: opacity .6s ease;
	will-change: opacity;
}

.sb-slide.is-active {
	opacity: 1;
	visibility: visible;
	z-index: 2;
}

/* Senza JS resta visibile solo la prima slide. */
.sb-slider:not(.sb-ready) .sb-slide:not(.is-active) {
	display: none;
}

/* Transizione a scorrimento */
.sb-trans-slide .sb-slide {
	transform: translateX(100%);
	transition: transform .6s ease, opacity 0s linear .6s;
}

.sb-trans-slide .sb-slide.is-active {
	transform: translateX(0);
	transition: transform .6s ease;
}

.sb-trans-slide .sb-slide.sb-out-left {
	transform: translateX(-100%);
	opacity: 1;
	visibility: visible;
	transition: transform .6s ease;
}

.sb-trans-slide .sb-slide.sb-from-left {
	transform: translateX(-100%);
}

.sb-bg {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center center;
	display: block;
	margin: 0;
	max-width: none;
}

/* --- Modalità fedele: palco scalato --- */

.sb-stage {
	position: absolute;
	z-index: 3;
	left: 50%;
	top: 50%;
	width: calc(var(--sb-gw) * 1px);
	height: calc(var(--sb-gh) * 1px);
	transform: translate(-50%, -50%) scale(var(--sb-scale));
	transform-origin: center center;
	pointer-events: none;
}

.sb-layer {
	position: absolute;
	transform: translate(var(--sb-tx, 0), var(--sb-ty, 0));
	pointer-events: auto;
	max-width: calc(var(--sb-gw) * 1px);
	box-sizing: border-box;
	/* Dimensioni e scostamenti passati come variabili: la resa stretta può
	   sovrascriverli, cosa impossibile con gli stili inline. */
	font-size: var(--sb-fs, inherit);
	line-height: var(--sb-lh, normal);
	margin-left: var(--sb-mx, 0);
	margin-top: var(--sb-my, 0);
}

.sb-layer img {
	display: block;
	max-width: 100%;
	height: auto;
}

/* Riquadro con dimensioni dichiarate: l'immagine lo riempie esattamente, come
   faceva l'originale scrivendo width e height sull'<img>. Con object-fit
   diverso da fill l'immagine verrebbe centrata dentro il riquadro e si
   sposterebbe rispetto alla composizione originale. */
.sb-layer-sized img {
	width: 100%;
	height: 100%;
	object-fit: fill;
}

.sb-narrow .sb-layer-sized img {
	height: auto;
}

.sb-nowrap {
	white-space: nowrap;
}

/* L'originale disegnava i layer dentro elementi propri (rs-layer), che non
   ereditano nulla dai fogli di stile del tema. I nostri sono div dentro il
   contenuto: senza questo azzeramento la tipografia del tema si intrufola nei
   testi delle slide. Classi caption e stili inline restano più forti. */
.sb-layer,
.sb-cap-item {
	margin: 0;
	font-weight: normal;
	font-style: normal;
	font-variant: normal;
	text-transform: none;
	text-decoration: none;
	letter-spacing: normal;
	word-spacing: normal;
	text-shadow: none;
	text-indent: 0;
}

/* Schermi troppo stretti perché il palco resti leggibile: i layer tornano in
   flusso, centrati, con tipografia ridotta. Nessun testo tagliato. */

/* La slide attiva torna nel flusso: l'altezza segue il contenuto, così i
   testi non vengono mai tagliati sopra o sotto. */
.sb-narrow .sb-viewport {
	aspect-ratio: auto;
	height: auto;
}

.sb-narrow .sb-slide.is-active {
	position: relative;
	inset: auto;
	min-height: var(--sb-minh, 300px);
	display: flex;
	align-items: center;
}

.sb-narrow .sb-stage {
	/* relative, non static: deve restare sopra all'immagine di sfondo,
	   che è posizionata in assoluto. */
	position: relative;
	z-index: 3;
	inset: auto;
	width: 100%;
	height: auto;
	transform: none;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: clamp(18px, 6vw, 40px);
	box-sizing: border-box;
	pointer-events: auto;
}

.sb-narrow .sb-caption {
	position: relative;
	inset: auto;
	width: 100%;
	min-height: var(--sb-minh, 300px);
}

.sb-narrow .sb-layer {
	position: static;
	transform: none;
	margin: 0 0 clamp(8px, 2vw, 16px);
	max-width: 100%;
	width: auto !important;
	height: auto !important;
	text-align: center;
	font-size: max(13px, calc(var(--sb-fs, 20px) * .55));
	line-height: 1.25;
}

.sb-narrow .sb-layer:last-child {
	margin-bottom: 0;
}

.sb-narrow .sb-nowrap {
	white-space: normal;
}

/* --- Modalità semplice: didascalia in flusso --- */

.sb-caption {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	padding: clamp(16px, 5vw, 64px);
	box-sizing: border-box;
	z-index: 3;
}

.sb-caption-inner {
	max-width: 720px;
	width: 100%;
}

.sb-align-center {
	justify-content: center;
	text-align: center;
}

.sb-align-center .sb-caption-inner {
	margin: 0 auto;
}

.sb-align-left {
	justify-content: flex-start;
	text-align: left;
}

.sb-align-right {
	justify-content: flex-end;
	text-align: right;
}

.sb-cap-item + .sb-cap-item {
	margin-top: clamp(8px, 1.6vw, 20px);
}

.sb-cap-item.sb-layer-button {
	display: inline-block;
}

.sb-cap-item img {
	max-width: 100%;
	height: auto;
	display: inline-block;
}

.sb-slide-simple .sb-stage {
	display: none;
}

.sb-link {
	color: inherit;
	text-decoration: inherit;
	display: inline-block;
}

/* Slide interamente cliccabile. Davanti ai layer o dietro, come nell'originale;
   dietro i layer conservano i propri link. */
.sb-slide-link {
	position: absolute;
	inset: 0;
	z-index: 5;
	display: block;
	text-indent: -9999px;
	overflow: hidden;
}

.sb-slide-link-back {
	z-index: 2;
}

/* --- Frecce e pallini --- */

.sb-arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 10;
	width: 44px;
	height: 44px;
	border: 0;
	border-radius: 50%;
	background: rgba(0, 0, 0, .45);
	cursor: pointer;
	padding: 0;
	transition: background .2s ease;
}

.sb-arrow:hover,
.sb-arrow:focus-visible {
	background: rgba(0, 0, 0, .75);
}

.sb-arrow span {
	display: block;
	width: 11px;
	height: 11px;
	border-top: 2px solid #fff;
	border-right: 2px solid #fff;
	margin: 0 auto;
}

.sb-arrow-prev {
	left: 14px;
}

.sb-arrow-prev span {
	transform: rotate(-135deg);
	margin-left: 18px;
}

.sb-arrow-next {
	right: 14px;
}

.sb-arrow-next span {
	transform: rotate(45deg);
	margin-left: 14px;
}

.sb-bullets {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 14px;
	z-index: 10;
	display: flex;
	justify-content: center;
	gap: 9px;
}

.sb-bullet {
	width: 11px;
	height: 11px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .5);
	cursor: pointer;
	transition: background .2s ease, transform .2s ease;
}

.sb-bullet.is-active {
	background: #fff;
	transform: scale(1.2);
}

.sb-slider.sb-single .sb-arrow,
.sb-slider.sb-single .sb-bullets {
	display: none;
}

@media (max-width: 600px) {
	.sb-arrow {
		width: 34px;
		height: 34px;
	}

	.sb-arrow-prev span {
		margin-left: 13px;
	}

	.sb-arrow-next span {
		margin-left: 10px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.sb-slide,
	.sb-trans-slide .sb-slide {
		transition-duration: .01ms;
	}
}
