/* CF - Product Gallery 1.0.2: stili front-end. Nessuna dipendenza esterna. */
.cf-pg {
	position: relative;
	width: 100%;
	max-width: 100%;
	--cf-pg-accent: currentColor;
	/* Miniature: 4 per riga come nella galleria precedente, al massimo 110px. */
	--cf-pg-thumb-gap: 8px;
	--cf-pg-thumb: min(110px, calc((100% - 3 * var(--cf-pg-thumb-gap)) / 4));
	/* Altezza massima dell'immagine principale: lascia spazio alle miniature senza scroll
	   (viewport meno intestazione, margini e striscia delle miniature). */
	--cf-pg-stage-max: calc(100vh - 260px);
}

.cf-pg__preview-badge {
	position: absolute;
	top: 8px;
	left: 8px;
	z-index: 4;
	padding: 2px 8px;
	font: 600 11px/1.6 system-ui, sans-serif;
	letter-spacing: .02em;
	color: #fff;
	background: #aa2988;
	border-radius: 3px;
	pointer-events: none;
}

.cf-pg__stage {
	position: relative;
	width: 100%;
	aspect-ratio: var(--cf-pg-ratio, 1 / 1);
	max-height: max(320px, var(--cf-pg-stage-max));
	overflow: hidden;
	background: #fff;
	outline: none;
}

.cf-pg__stage:focus-visible {
	box-shadow: 0 0 0 2px var(--cf-pg-accent);
}

.cf-pg__track {
	display: flex;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	overflow-x: auto;
	overflow-y: hidden;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior-x: contain;
}

.cf-pg__track::-webkit-scrollbar {
	display: none;
}

.cf-pg__slide {
	position: relative;
	flex: 0 0 100%;
	width: 100%;
	height: 100%;
	scroll-snap-align: start;
	scroll-snap-stop: always;
	display: flex;
	align-items: center;
	justify-content: center;
}

.cf-pg__image-link,
.cf-pg__image,
.cf-pg__video,
.cf-pg__play,
.cf-pg__iframe {
	display: block;
	width: 100%;
	height: 100%;
	margin: 0;
	border: 0;
}

.cf-pg__image,
.cf-pg__play img {
	object-fit: contain;
	width: 100%;
	height: 100%;
}

.cf-pg__image-link {
	cursor: zoom-in;
}

.cf-pg__video {
	object-fit: contain;
	background: #000;
}

.cf-pg__play {
	position: relative;
	padding: 0;
	background: #000;
	cursor: pointer;
}

.cf-pg__play-icon,
.cf-pg__thumb-badge {
	position: absolute;
	top: 50%;
	left: 50%;
	display: block;
	border-radius: 50%;
	background: rgba(0, 0, 0, .6);
	transform: translate(-50%, -50%);
	pointer-events: none;
}

.cf-pg__play-icon {
	width: 64px;
	height: 64px;
	border: 2px solid #fff;
}

.cf-pg__play-icon::after,
.cf-pg__thumb-badge::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 55%;
	border-style: solid;
	border-color: transparent transparent transparent #fff;
	transform: translate(-50%, -50%);
}

.cf-pg__play-icon::after {
	border-width: 12px 0 12px 20px;
}

.cf-pg__play:hover .cf-pg__play-icon,
.cf-pg__play:focus-visible .cf-pg__play-icon {
	background: rgba(0, 0, 0, .85);
}

.cf-pg__arrow {
	position: absolute;
	top: 50%;
	z-index: 3;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .85);
	box-shadow: 0 1px 4px rgba(0, 0, 0, .2);
	color: #000;
	cursor: pointer;
	transform: translateY(-50%);
	transition: opacity .2s;
}

.cf-pg__arrow--prev {
	left: 8px;
}

.cf-pg__arrow--next {
	right: 8px;
}

.cf-pg__arrow::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 10px;
	height: 10px;
	border-top: 2px solid currentColor;
	border-right: 2px solid currentColor;
	transform: translate(-30%, -50%) rotate(-135deg);
}

.cf-pg__arrow--next::before {
	transform: translate(-70%, -50%) rotate(45deg);
}

.cf-pg__arrow:disabled {
	opacity: .3;
	cursor: default;
}

.cf-pg--single .cf-pg__arrow,
.cf-pg--single .cf-pg__thumbs {
	display: none;
}

.cf-pg__thumbs {
	position: relative;
	display: flex;
	gap: var(--cf-pg-thumb-gap);
	margin: 8px 0 0;
	padding: 2px 2px 4px;
	overflow-x: auto;
	overflow-y: hidden;
	scroll-snap-type: x proximity;
	scrollbar-width: thin;
	-webkit-overflow-scrolling: touch;
}

.cf-pg__thumb {
	position: relative;
	flex: 0 0 auto;
	width: var(--cf-pg-thumb);
	aspect-ratio: 1 / 1;
	padding: 0;
	border: 2px solid transparent;
	border-radius: 2px;
	background: none;
	cursor: pointer;
	opacity: .6;
	scroll-snap-align: start;
	transition: opacity .2s, border-color .2s;
}

.cf-pg__thumb:hover,
.cf-pg__thumb:focus-visible {
	opacity: 1;
}

.cf-pg__thumb.is-active {
	border-color: var(--cf-pg-accent);
	opacity: 1;
}

.cf-pg__thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.cf-pg__thumb-badge {
	width: 26px;
	height: 26px;
	background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23fff' d='M6 3.5v17l14-8.5z'/></svg>") center / contain no-repeat;
	filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .7));
}

.cf-pg__thumb-badge::after {
	content: none;
}

/* Lightbox */
.cf-pg-lightbox {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, .92);
}

.cf-pg-lightbox[hidden] {
	display: none;
}

.cf-pg-lightbox__figure {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 48px 56px;
	box-sizing: border-box;
}

.cf-pg-lightbox__img {
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	box-shadow: 0 2px 24px rgba(0, 0, 0, .5);
}

.cf-pg-lightbox__close,
.cf-pg-lightbox__arrow {
	position: absolute;
	z-index: 2;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .12);
	color: #fff;
	cursor: pointer;
}

.cf-pg-lightbox__close:hover,
.cf-pg-lightbox__arrow:hover,
.cf-pg-lightbox__close:focus-visible,
.cf-pg-lightbox__arrow:focus-visible {
	background: rgba(255, 255, 255, .3);
}

.cf-pg-lightbox__close {
	top: 12px;
	right: 12px;
}

.cf-pg-lightbox__close::before,
.cf-pg-lightbox__close::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 20px;
	height: 2px;
	background: currentColor;
	transform: translate(-50%, -50%) rotate(45deg);
}

.cf-pg-lightbox__close::after {
	transform: translate(-50%, -50%) rotate(-45deg);
}

.cf-pg-lightbox__arrow {
	top: 50%;
	transform: translateY(-50%);
}

.cf-pg-lightbox__arrow--prev {
	left: 12px;
}

.cf-pg-lightbox__arrow--next {
	right: 12px;
}

.cf-pg-lightbox__arrow::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 12px;
	height: 12px;
	border-top: 2px solid currentColor;
	border-right: 2px solid currentColor;
	transform: translate(-30%, -50%) rotate(-135deg);
}

.cf-pg-lightbox__arrow--next::before {
	transform: translate(-70%, -50%) rotate(45deg);
}

.cf-pg-lightbox--single .cf-pg-lightbox__arrow,
.cf-pg-lightbox--single .cf-pg-lightbox__counter {
	display: none;
}

.cf-pg-lightbox__counter {
	position: absolute;
	bottom: 14px;
	left: 50%;
	font: 13px/1 system-ui, sans-serif;
	color: #fff;
	transform: translateX(-50%);
}

body.cf-pg-lightbox-open {
	overflow: hidden;
}

@media (max-width: 600px) {
	.cf-pg {
		--cf-pg-stage-max: 70vh;
	}

	.cf-pg__arrow {
		width: 34px;
		height: 34px;
	}

	.cf-pg-lightbox__figure {
		padding: 56px 8px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.cf-pg__track,
	.cf-pg__thumbs {
		scroll-behavior: auto;
	}
}
