/* RI.VE Musei – slider della home.
   Usa le variabili del tema (--rive-*) con valori di riserva.

   Telefono e tablet: foto intera a tutta larghezza, testo sotto.
   Computer (da 48em): lo slider riempie l'altezza dello schermo sotto
   l'header (la calcola slider.js in --rs-h), foto ritagliata, testo in basso
   a sinistra su una sfumatura, frecce ai lati, puntini al centro in basso. */

.rive-slider {
	--rs-scuro: var(--rive-verde-scurissimo, #0a4a29);
	--rs-ink: var(--rive-ink, #1a1f1c);
	--rs-chiaro: var(--rive-superficie, #f4f8f2);
	--rs-velo: rgba(8, 28, 17, 0.55);
	position: relative;
	margin: 0 0 2rem;
	color: #fff;
	background: var(--rs-scuro);
}

/* ---- Senza JavaScript: le slide sono impilate, una sotto l'altra ---- */

.rive-slide + .rive-slide {
	margin-top: 4px;
}

.rive-slide {
	position: relative;
}

.rive-slide__media {
	position: relative;
	overflow: hidden;
}

/* L'immagine occupa sempre tutta la larghezza; l'altezza segue le proporzioni. */
.rive-slide__img {
	display: block;
	width: 100%;
	height: auto;
}

/* Video: sopra la foto, che resta come copertina finché non parte */
.rive-slide__video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: var(--rs-pos, center);
	background: var(--rs-scuro);
	opacity: 0;
	transition: opacity 0.6s ease;
}

.rive-slide__video[hidden] {
	display: none;
}

.rive-slide__video.is-playing {
	opacity: 1;
}

/* ---- Testo ---- */

.rive-slide__caption {
	padding: 1rem 1.25rem 1.25rem;
	background: var(--rs-scuro);
}

.rive-slide__kicker {
	margin: 0 0 0.35rem;
	font-size: 0.8125rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.rive-slide__title {
	margin: 0 0 0.5rem;
	color: #fff;
	font-size: clamp(1.375rem, 1.1rem + 1.2vw, 1.875rem);
	line-height: 1.15;
}

.rive-slide__text {
	max-width: 38rem;
	margin: 0 0 1rem;
	font-size: 1.0625rem;
	line-height: 1.5;
}

.rive-slide__caption > :last-child {
	margin-bottom: 0;
}

/* Pulsante: bianco su fondo scuro (contrasto > 10:1) */
.rive-slider .rive-slide__cta {
	display: inline-block;
	padding: 0.7rem 1.25rem;
	border-radius: 0;
	color: var(--rs-scuro);
	background: #fff;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	text-shadow: none;
}

.rive-slider .rive-slide__cta:hover {
	background: var(--rs-chiaro);
	text-decoration: underline;
	text-underline-offset: 0.2em;
}

/* Fuoco visibile su qualsiasi sfondo: anello bianco con filo scuro dentro */
.rive-slider :focus-visible {
	outline: 3px solid #fff;
	outline-offset: 2px;
	box-shadow: 0 0 0 2px var(--rs-ink);
}

/* ---- Con JavaScript: carosello ---- */

.rive-slider.is-enhanced .rive-slider__viewport {
	position: relative;
	overflow: hidden;
	transition: height 0.6s ease; /* su telefono l'altezza segue la slide visibile (vedi slider.js) */
}

.rive-slider.is-enhanced .rive-slider__track {
	display: flex;
	align-items: flex-start; /* ogni slide ha la sua altezza */
	transition: transform 0.9s ease;
}

.rive-slider.is-enhanced .rive-slide {
	flex: 0 0 100%;
	min-width: 0;
	margin-top: 0;
}

/* ---- Comandi: coprono la sola area della foto; frecce ai lati, puntini in basso ---- */

.rive-slider__controls {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	z-index: 3;
	height: var(--rs-media-h, 100%);
	pointer-events: none;
}

.rive-slider__controls > * {
	pointer-events: auto;
}

.rive-slider__btn {
	position: absolute;
	top: 50%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.5rem;
	height: 2.5rem;
	margin-top: -1.25rem;
	padding: 0;
	border: 0;
	border-radius: 50%;
	color: #fff;
	background: rgba(8, 28, 17, 0.55);
	cursor: pointer;
	transition: background-color 0.35s ease;
}

.rive-slider__btn:hover {
	background: rgba(8, 28, 17, 0.85);
}

.rive-slider__prev {
	left: 0.5rem;
}

.rive-slider__next {
	right: 0.5rem;
}

/* Pausa: non si vede finché non ci si arriva con Tab, poi compare in alto a sinistra */
.rive-slider__pause {
	top: 0.75rem;
	left: 0.75rem;
	margin-top: 0;
}

.rive-slider__pause:not(:focus) {
	width: 1px;
	height: 1px;
	margin: -1px;
	overflow: hidden;
	clip-path: inset(50%);
	opacity: 0;
}

.rive-slider__dots {
	position: absolute;
	left: 50%;
	bottom: 0.75rem;
	display: flex;
	gap: 0.125rem;
	margin: 0;
	padding: 0.125rem 0.5rem;
	list-style: none;
	border-radius: 999px;
	background: rgba(8, 28, 17, 0.45);
	transform: translateX(-50%);
}

.rive-slider__dot {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.75rem;
	height: 1.75rem;
	padding: 0;
	border: 0;
	background: transparent;
	cursor: pointer;
}

.rive-slider__dot::before {
	content: "";
	width: 0.75rem;
	height: 0.75rem;
	border: 2px solid #fff;
	border-radius: 50%;
	background: transparent;
}

.rive-slider__dot[aria-current="true"]::before {
	background: #fff;
}

/* ---- Computer: altezza dello schermo, foto ritagliata, testo su sfumatura ---- */

@media (min-width: 48em) {
	.rive-slider.is-enhanced.is-fill .rive-slider__viewport,
	.rive-slider.is-fill .rive-slide {
		height: var(--rs-h, 40rem);
	}

	.rive-slider.is-fill .rive-slide__media {
		height: 100%;
	}

	.rive-slider.is-fill .rive-slide__img {
		height: 100%;
		object-fit: cover;
		object-position: var(--rs-pos, center);
	}

	/* Sfumatura scura leggera in basso, solo dove c'è del testo */
	.rive-slide.has-caption .rive-slide__media::after {
		content: "";
		position: absolute;
		inset: 0;
		background: linear-gradient(to top, rgba(8, 28, 17, 0.85) 0%, rgba(8, 28, 17, 0.6) 30%, rgba(8, 28, 17, 0) 65%);
		pointer-events: none;
	}

	.rive-slide__caption {
		position: absolute;
		left: clamp(3.5rem, 7vw, 7rem);
		bottom: clamp(3.5rem, 8vw, 5.5rem); /* sopra i puntini */
		max-width: min(42rem, 70%);
		padding: 0;
		background: transparent;
		text-shadow: 0 1px 14px rgba(0, 0, 0, 0.35);
	}

	.rive-slide__title {
		font-size: clamp(1.75rem, 1rem + 2.2vw, 3.25rem);
	}

	.rive-slide__kicker {
		font-size: 0.875rem;
	}

	.rive-slider__btn {
		width: 3rem;
		height: 3rem;
		margin-top: -1.5rem;
	}

	.rive-slider__pause {
		margin-top: 0;
	}

	.rive-slider__prev {
		left: clamp(0.75rem, 2vw, 1.5rem);
	}

	.rive-slider__next {
		right: clamp(0.75rem, 2vw, 1.5rem);
	}

	.rive-slider__dots {
		bottom: clamp(1rem, 2.5vw, 1.75rem);
	}
}

@media (prefers-reduced-motion: reduce) {
	.rive-slider.is-enhanced .rive-slider__track,
	.rive-slider.is-enhanced .rive-slider__viewport,
	.rive-slide__video,
	.rive-slider__btn {
		transition: none;
	}
}
