/* Manian - Carousel sottocategorie | Autore: Pietro Ibba */

/* Breakpoint allineato al "wpcMobileWidth" di Filter Everything (768px) */
.msc-carousel {
	display: none;
}

@media (max-width: 768px) {
	.msc-carousel {
		display: block;
		width: 100%;
		margin: 0 0 12px;
	}

	.msc-track {
		--msc-gap: 10px;
		display: flex;
		gap: var(--msc-gap);
		margin: 0;
		padding: 4px 2px 8px;
		list-style: none;
		overflow-x: auto;
		overflow-y: hidden;
		scroll-snap-type: x mandatory;
		-webkit-overflow-scrolling: touch;
		overscroll-behavior-x: contain;
		scrollbar-width: none;
		touch-action: pan-x pan-y;
	}

	.msc-track::-webkit-scrollbar {
		display: none;
	}

	/* 4,5 elementi visibili per riga */
	.msc-item {
		flex: 0 0 calc((100% - (var(--msc-gap) * 4)) / 4.5);
		max-width: calc((100% - (var(--msc-gap) * 4)) / 4.5);
		margin: 0;
		padding: 0;
		scroll-snap-align: start;
	}

	.msc-item.msc-is-missing {
		display: none;
	}

	.msc-link {
		display: flex;
		flex-direction: column;
		align-items: center;
		gap: 6px;
		text-decoration: none !important;
		color: inherit;
		-webkit-tap-highlight-color: transparent;
	}

	.msc-thumb {
		display: block;
		width: 100%;
		aspect-ratio: 1 / 1;
		border-radius: 50%;
		overflow: hidden;
		border: 2px solid #e6e1d8;
		background: #f5f3ef;
		box-sizing: border-box;
		transition: border-color .2s ease, box-shadow .2s ease;
	}

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

	.msc-name {
		font-size: 12px;
		line-height: 1.2;
		text-align: center;
		color: #2c2d33;
		word-break: break-word;
	}

	.msc-item.msc-is-active .msc-thumb {
		border-color: #A4916D;
		box-shadow: 0 0 0 2px #fff inset;
	}

	.msc-item.msc-is-active .msc-name {
		color: #A4916D;
		font-weight: 600;
	}

	.msc-carousel.msc-is-loading .msc-link {
		pointer-events: none;
		opacity: .6;
	}

	/* Nasconde il filtro "Categorie" di Filter Everything solo su mobile
	   e solo quando il carousel è presente e collegato al filtro. */
	body.msc-carousel-on .wpc-filters-section.wpc-filter-product_cat {
		display: none !important;
	}
}
