/* Banner Programmati – frontend
 * Il layout risponde alla larghezza del contenitore (container query),
 * così il banner funziona sia a tutta larghezza sia dentro una colonna.
 */

.bnrp {
	position: relative;
	width: 100%;
	margin: 0 0 1.5em;
	container-type: inline-size;
	container-name: bnrp;
}

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

.bnrp__stage {
	position: relative;
}

/* Le slide sono sovrapposte nella stessa cella: l'altezza è quella della più alta. */
.bnrp__track {
	display: grid;
}

.bnrp .bnrp__slide {
	grid-area: 1 / 1;
	position: relative;
	display: flex;
	min-height: 280px;
	min-height: clamp(280px, 36cqi, 600px);
	overflow: hidden;
	color: var(--bnrp-text, #fff);
	opacity: 0;
	visibility: hidden;
	transition: opacity .6s ease, visibility 0s linear .6s;
}

.bnrp .bnrp__slide.is-active {
	opacity: 1;
	visibility: visible;
	transition: opacity .6s ease, visibility 0s;
}

.bnrp .bnrp__slide--plain {
	background: var(--bnrp-bg, #000);
}

/* Immagine */
.bnrp .bnrp__media,
.bnrp .bnrp__overlay {
	position: absolute;
	inset: 0;
}

.bnrp .bnrp__media picture {
	display: block;
	width: 100%;
	height: 100%;
}

.bnrp .bnrp__img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	object-fit: cover;
	object-position: center;
}

.bnrp .bnrp__overlay {
	background: var(--bnrp-overlay, rgba(0, 0, 0, .4));
	pointer-events: none;
}

/* Testo */
.bnrp .bnrp__content {
	position: relative;
	z-index: 1;
	display: flex;
	flex: 1;
	padding: clamp(1.25rem, 5cqi, 4rem);
}

.bnrp .bnrp__inner {
	max-width: min(40rem, 100%);
}

.bnrp .bnrp__slide--image .bnrp__inner {
	text-shadow: var(--bnrp-shadow, none);
}

.bnrp .bnrp__title {
	margin: 0 0 .35em;
	padding: 0;
	color: inherit;
	font-size: clamp(1.5rem, 1rem + 3cqi, 3.25rem);
	font-weight: 700;
	line-height: 1.12;
	text-wrap: balance;
}

.bnrp .bnrp__subtitle {
	margin: 0;
	padding: 0;
	color: inherit;
	font-size: clamp(1rem, .9rem + .7cqi, 1.3rem);
	line-height: 1.45;
	text-wrap: pretty;
}

.bnrp .bnrp__title:last-child {
	margin-bottom: 0;
}

.bnrp .bnrp__cta {
	display: inline-block;
	margin: 1.25em 0 0;
	text-decoration: none;
	text-shadow: none;
}

.bnrp .bnrp__title + .bnrp__cta {
	margin-top: .75em;
}

/* Posizione verticale */
.bnrp [data-pos^="top"] .bnrp__content { align-items: flex-start; }
.bnrp [data-pos^="center"] .bnrp__content { align-items: center; }
.bnrp [data-pos^="bottom"] .bnrp__content { align-items: flex-end; }

/* Posizione orizzontale */
.bnrp [data-pos$="-left"] .bnrp__content { justify-content: flex-start; text-align: left; }
.bnrp [data-pos$="-center"] .bnrp__content { justify-content: center; text-align: center; }
.bnrp [data-pos$="-right"] .bnrp__content { justify-content: flex-end; text-align: right; }

/* Banner interamente cliccabile */
.bnrp .bnrp__link {
	position: absolute;
	inset: 0;
	z-index: 2;
}

.bnrp .bnrp__link:focus-visible {
	outline: 3px solid currentColor;
	outline-offset: -6px;
}

.bnrp-sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ---------- Slider ---------- */

.bnrp--slider .bnrp__content {
	padding-inline: calc(44px + 2rem);
}

.bnrp .bnrp__arrow,
.bnrp .bnrp__dot,
.bnrp .bnrp__toggle {
	-webkit-appearance: none;
	appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 0;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 999px;
	background: none;
	box-shadow: none;
	color: inherit;
	font: inherit;
	line-height: 1;
	text-transform: none;
	cursor: pointer;
}

.bnrp .bnrp__arrow {
	position: absolute;
	top: 50%;
	z-index: 3;
	width: 44px;
	height: 44px;
	transform: translateY(-50%);
	background: rgba(255, 255, 255, .9);
	color: #1a1a1a;
	transition: background-color .2s ease;
}

.bnrp .bnrp__arrow:hover {
	background: #fff;
}

.bnrp .bnrp__arrow--prev { left: 1rem; }
.bnrp .bnrp__arrow--next { right: 1rem; }

.bnrp .bnrp__arrow svg {
	width: 22px;
	height: 22px;
}

.bnrp .bnrp__nav {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: .25rem;
	margin-top: .5rem;
}

.bnrp .bnrp__dots {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
}

/* Area di tocco 32px, punto visibile 10px. */
.bnrp .bnrp__dot {
	width: 32px;
	height: 32px;
}

.bnrp .bnrp__dot span {
	display: block;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: currentColor;
	opacity: .3;
	transition: opacity .2s ease, transform .2s ease;
}

.bnrp .bnrp__dot[aria-current="true"] span {
	opacity: 1;
	transform: scale(1.2);
}

.bnrp .bnrp__toggle {
	width: 32px;
	height: 32px;
	opacity: .7;
}

.bnrp .bnrp__toggle:hover {
	opacity: 1;
}

.bnrp .bnrp__toggle svg {
	width: 16px;
	height: 16px;
	fill: currentColor;
}

.bnrp .bnrp__icon-play,
.bnrp .bnrp__toggle.is-paused .bnrp__icon-pause {
	display: none;
}

.bnrp .bnrp__toggle.is-paused .bnrp__icon-play {
	display: block;
}

.bnrp .bnrp__arrow:focus-visible,
.bnrp .bnrp__dot:focus-visible,
.bnrp .bnrp__toggle:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.bnrp .bnrp__arrow:focus-visible {
	outline-color: #fff;
	box-shadow: 0 0 0 4px #1a1a1a;
}

/* ---------- Mobile / contenitori stretti ---------- */

@container bnrp (max-width: 600px) {
	.bnrp .bnrp__slide {
		min-height: clamp(300px, 100cqi, 540px);
	}

	.bnrp--slider .bnrp__content {
		padding-inline: clamp(1.25rem, 5cqi, 4rem);
	}

	/* Su schermi piccoli si sfoglia con il dito e con i pallini. */
	.bnrp .bnrp__arrow {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.bnrp .bnrp__slide,
	.bnrp .bnrp__slide.is-active {
		transition: none;
	}
}
