/* Ruga Hero Slider — front-end */

.rhs {
	--rhs-h: 620px;
	--rhs-hm: 540px;
	--rhs-accent: #f5c518;
	--rhs-btn: #002c5f;
	--rhs-dur: 6s;
	--rhs-nav-h: 64px;
	--rhs-ease: cubic-bezier(.22, .61, .36, 1);

	position: relative;
	width: 100%;
	height: var(--rhs-h);
	overflow: hidden;
	background: #0b0f14;
	color: #fff;
	isolation: isolate;
	-webkit-font-smoothing: antialiased;
}

.rhs *,
.rhs *::before,
.rhs *::after {
	box-sizing: border-box;
}

.rhs-empty {
	padding: 16px;
	background: #fff8e1;
	border: 1px dashed #e0b200;
	font-size: 14px;
}

/* ---------- Trascinamento (mouse e touch) ---------- */

.rhs {
	touch-action: pan-y; /* lo scroll verticale della pagina resta libero, il swipe orizzontale è nostro */
}

.rhs--draggable .rhs__slides {
	cursor: grab;
}

.rhs--draggable .rhs__cta,
.rhs--draggable .rhs__tab,
.rhs--draggable .rhs__pause {
	cursor: pointer;
}

.rhs.is-dragging,
.rhs.is-dragging * {
	cursor: grabbing !important;
	-webkit-user-select: none;
	user-select: none;
}

/* ---------- Slide ---------- */

.rhs__slides {
	position: absolute;
	inset: 0;
}

.rhs__slide {
	position: absolute;
	inset: 0;
	opacity: 0;
	visibility: hidden;
	transition: opacity .8s var(--rhs-ease), visibility 0s linear .8s;
}

.rhs__slide.is-active {
	opacity: 1;
	visibility: visible;
	transition: opacity .8s var(--rhs-ease), visibility 0s;
	z-index: 1;
}

.rhs__media,
.rhs__media img,
.rhs__video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	display: block;
}

.rhs__media img,
.rhs__video {
	object-fit: cover;
	object-position: var(--rhs-fx, 50%) var(--rhs-fy, 50%);
	max-width: none;
}

.rhs__video {
	opacity: 0;
	transition: opacity .6s ease;
}

.rhs__video.is-ready {
	opacity: 1;
}

/* leggero zoom sull'immagine attiva */
.rhs__media img {
	transform: scale(1.05);
	transition: transform 9s linear;
}

.rhs__slide.is-active .rhs__media img {
	transform: scale(1);
}

/* ---------- Sfumatura ---------- */

.rhs__overlay {
	--ov: 0, 0, 0;
	position: absolute;
	inset: 0;
	pointer-events: none;
	background:
		linear-gradient(0deg, rgba(var(--ov), calc(var(--rhs-o, .45) * .95)) 0%, rgba(var(--ov), 0) 55%),
		linear-gradient(90deg, rgba(var(--ov), var(--rhs-o, .45)) 0%, rgba(var(--ov), calc(var(--rhs-o, .45) * .35)) 50%, rgba(var(--ov), 0) 85%);
}

.rhs__slide--right .rhs__overlay {
	background:
		linear-gradient(0deg, rgba(var(--ov), calc(var(--rhs-o, .45) * .95)) 0%, rgba(var(--ov), 0) 55%),
		linear-gradient(270deg, rgba(var(--ov), var(--rhs-o, .45)) 0%, rgba(var(--ov), calc(var(--rhs-o, .45) * .35)) 50%, rgba(var(--ov), 0) 85%);
}

.rhs__slide--center .rhs__overlay {
	background:
		linear-gradient(0deg, rgba(var(--ov), calc(var(--rhs-o, .45) * .95)) 0%, rgba(var(--ov), 0) 60%),
		radial-gradient(ellipse at center, rgba(var(--ov), calc(var(--rhs-o, .45) * .6)) 0%, rgba(var(--ov), 0) 75%);
}

.rhs__slide--dark .rhs__overlay {
	--ov: 255, 255, 255;
}

/* ---------- Contenuto ---------- */

.rhs__content {
	position: absolute;
	z-index: 2;
	left: 0;
	right: 0;
	bottom: 0;
	padding: 0 clamp(20px, 5vw, 72px) 40px;
	max-width: min(100%, 980px);
	text-align: left;
}

.rhs--has-nav .rhs__content {
	bottom: var(--rhs-nav-h);
	padding-bottom: 36px;
}

.rhs__slide--center .rhs__content {
	left: 50%;
	right: auto;
	width: min(100%, 880px);
	transform: translateX(-50%);
	text-align: center;
}

.rhs__slide--right .rhs__content {
	left: auto;
	right: 0;
	text-align: right;
}

.rhs__slide--light .rhs__content {
	color: #fff;
	text-shadow: 0 1px 14px rgba(0, 0, 0, .25);
}

.rhs__slide--dark .rhs__content {
	color: #0b1a2b;
	text-shadow: none;
}

.rhs .rhs__eyebrow {
	margin: 0 0 8px;
	font-size: clamp(.8rem, 1.3vw, 1rem);
	font-weight: 700;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--rhs-accent);
}

.rhs .rhs__title {
	margin: 0 0 14px;
	padding: 0;
	font-size: clamp(2rem, 5.2vw, 4.25rem);
	font-weight: 700;
	line-height: 1.05;
	letter-spacing: -.01em;
	color: inherit;
	text-transform: none;
}

.rhs .rhs__sub {
	margin: 0 0 12px;
	max-width: 62ch;
	font-size: clamp(1rem, 1.6vw, 1.3rem);
	line-height: 1.4;
	color: inherit;
}

.rhs__slide--center .rhs__sub {
	margin-left: auto;
	margin-right: auto;
}

.rhs__slide--right .rhs__sub {
	margin-left: auto;
}

.rhs .rhs__legal {
	margin: 0 0 20px;
	font-size: clamp(.78rem, 1.05vw, .92rem);
	line-height: 1.5;
	opacity: .92;
	color: inherit;
}

.rhs .rhs__cta {
	display: inline-block;
	min-width: 180px;
	padding: 14px 32px;
	background: var(--rhs-btn);
	color: #fff;
	border: 0;
	border-radius: 2px;
	font-size: .95rem;
	font-weight: 600;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	text-shadow: none;
	transition: background-color .2s ease, transform .2s ease;
}

.rhs .rhs__cta:hover,
.rhs .rhs__cta:focus-visible {
	background: color-mix(in srgb, var(--rhs-btn) 80%, #fff);
	color: #fff;
}

.rhs .rhs__cta:focus-visible,
.rhs .rhs__tab:focus-visible,
.rhs .rhs__pause:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 3px;
}

/* ingresso del testo */
.rhs__content > * {
	opacity: 0;
	transform: translateY(18px);
}

.rhs__slide.is-active .rhs__content > * {
	opacity: 1;
	transform: none;
	transition: opacity .7s var(--rhs-ease), transform .7s var(--rhs-ease);
}

.rhs__slide.is-active .rhs__content > :nth-child(1) { transition-delay: .15s; }
.rhs__slide.is-active .rhs__content > :nth-child(2) { transition-delay: .25s; }
.rhs__slide.is-active .rhs__content > :nth-child(3) { transition-delay: .35s; }
.rhs__slide.is-active .rhs__content > :nth-child(4) { transition-delay: .45s; }
.rhs__slide.is-active .rhs__content > :nth-child(5) { transition-delay: .55s; }

/* ---------- Barra di navigazione ---------- */

.rhs__nav {
	position: absolute;
	z-index: 3;
	left: 0;
	right: 0;
	bottom: 0;
	height: var(--rhs-nav-h);
	display: flex;
	align-items: stretch;
	background: rgba(0, 0, 0, .78);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	overflow-x: auto;
	scrollbar-width: none;
	scroll-snap-type: x proximity;
}

.rhs__nav::-webkit-scrollbar {
	display: none;
}

.rhs .rhs__tab {
	position: relative;
	flex: 1 0 auto;
	min-width: 120px;
	margin: 0;
	padding: 0 20px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	color: rgba(255, 255, 255, .55);
	font: inherit;
	font-size: .95rem;
	font-weight: 600;
	line-height: 1.2;
	text-transform: none;
	letter-spacing: 0;
	white-space: nowrap;
	cursor: pointer;
	scroll-snap-align: center;
	transition: color .25s ease;
}

.rhs .rhs__tab:hover,
.rhs .rhs__tab.is-active {
	background: transparent;
	color: #fff;
}

.rhs__bar {
	position: absolute;
	left: 0;
	right: 0;
	top: 0;
	height: 2px;
	background: rgba(255, 255, 255, .22);
	overflow: hidden;
}

.rhs__bar i {
	display: block;
	width: 100%;
	height: 100%;
	background: #fff;
	transform: scaleX(0);
	transform-origin: left center;
}

/* con autoplay: la barra si riempie; senza autoplay: resta piena */
.rhs[data-autoplay="0"] .rhs__tab.is-active .rhs__bar i {
	transform: scaleX(1);
}

.rhs[data-autoplay="1"] .rhs__tab.is-active .rhs__bar i {
	animation: rhs-fill var(--rhs-dur) linear forwards;
}

.rhs.is-halted .rhs__tab.is-active .rhs__bar i {
	animation-play-state: paused;
}

@keyframes rhs-fill {
	from { transform: scaleX(0); }
	to   { transform: scaleX(1); }
}

/* ---------- Pausa ---------- */

.rhs .rhs__pause {
	position: absolute;
	z-index: 4;
	right: clamp(16px, 3vw, 40px);
	bottom: calc(var(--rhs-nav-h) + 20px);
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	display: grid;
	place-items: center;
	border: 0;
	border-radius: 50%;
	background: rgba(60, 60, 60, .65);
	color: #fff;
	cursor: pointer;
	transition: background-color .2s ease;
}

.rhs:not(.rhs--has-nav) .rhs__pause {
	bottom: 20px;
}

.rhs .rhs__pause:hover {
	background: rgba(40, 40, 40, .9);
	color: #fff;
}

.rhs__pause .rhs__ico-play { display: none; }
.rhs__pause[aria-pressed="true"] .rhs__ico-pause { display: none; }
.rhs__pause[aria-pressed="true"] .rhs__ico-play  { display: block; }

/* ---------- Mobile ---------- */

@media (max-width: 767px) {
	.rhs {
		height: var(--rhs-hm);
		--rhs-nav-h: 52px;
	}

	.rhs__content {
		max-width: 100%;
		padding: 0 20px 28px;
	}

	.rhs--has-nav .rhs__content {
		padding-bottom: 24px;
	}

	.rhs__slide--center .rhs__content,
	.rhs__slide--right .rhs__content {
		left: 0;
		right: 0;
		width: 100%;
		transform: none;
	}

	.rhs .rhs__title { margin-bottom: 10px; }

	.rhs .rhs__cta {
		display: block;
		width: 100%;
		min-width: 0;
		padding: 14px 20px;
	}

	.rhs .rhs__tab {
		min-width: 110px;
		padding: 0 14px;
		font-size: .85rem;
	}

	/* il pulsante pausa si sposta in alto per non coprire il testo */
	.rhs .rhs__pause,
	.rhs:not(.rhs--has-nav) .rhs__pause {
		top: 14px;
		bottom: auto;
		right: 14px;
		width: 38px;
		height: 38px;
	}
}

/* ---------- Preferenze di accessibilità ---------- */

@media (prefers-reduced-motion: reduce) {
	.rhs__slide,
	.rhs__slide.is-active {
		transition: opacity .2s linear, visibility 0s;
	}

	.rhs__media img,
	.rhs__slide.is-active .rhs__media img {
		transform: none;
		transition: none;
	}

	.rhs__content > *,
	.rhs__slide.is-active .rhs__content > * {
		transform: none;
		transition: opacity .2s linear;
		transition-delay: 0s !important;
	}
}
