.fm-sc {
	/* Accento: --fm-accent se impostato su pagina/sezione o dal parametro "colore", altrimenti il colore link del tema */
	--fm-a: var(--fm-accent, var(--theme-color-text_link, #7eb950));
	--fm-c: var(--fm-cols, 3);
	--fm-gap: 20px;
	margin: 2em 0;
}

@media (max-width: 1024px) {
	.fm-sc { --fm-c: var(--fm-cols-t, 2); }
}

@media (max-width: 767px) {
	.fm-sc { --fm-c: var(--fm-cols-m, 1.2); }
}

.fm-sc .fm-sc-title {
	margin: 0 0 0.8em;
}

.fm-sc .fm-sc-viewport {
	position: relative;
}

/* Carosello orizzontale */
.fm-sc--carousel .fm-sc-track {
	display: flex;
	flex-wrap: nowrap;
	align-items: flex-start;
	gap: var(--fm-gap);
	overflow-x: auto;
	overflow-y: hidden;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	-webkit-overflow-scrolling: touch;
	padding: 4px 2px 8px;
	scrollbar-width: none;
	-ms-overflow-style: none;
}

.fm-sc--carousel .fm-sc-track::-webkit-scrollbar {
	display: none;
}

.fm-sc--carousel .fm-sc-item {
	flex: 0 0 calc((100% - (var(--fm-c) - 1) * var(--fm-gap)) / var(--fm-c));
	min-width: 0;
	scroll-snap-align: start;
}

/* Griglia */
.fm-sc--grid .fm-sc-track {
	display: grid;
	grid-template-columns: repeat(var(--fm-c), minmax(0, 1fr));
	gap: var(--fm-gap);
	align-items: start;
}

/* Card */
.fm-sc .fm-sc-item {
	container-type: inline-size;
	margin: 0;
	border-radius: 12px;
	overflow: hidden;
	background: #fff;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.fm-sc .fm-sc-frame {
	display: block;
	width: 100%;
	max-width: 100%;
	margin: 0;
	border: 0;
}

/* Instagram: altezza stimata in base alla larghezza, poi corretta dal JS con l'altezza reale */
.fm-sc .fm-sc-frame--instagram {
	height: calc(125cqw + 230px);
	min-height: 450px;
	/* Nasconde la riga "Aggiungi un commento…" in fondo all'embed (la card ha overflow: hidden) */
	margin-bottom: calc(-1 * var(--fm-ig-crop, 46px));
}

.fm-sc .fm-sc-frame--tiktok,
.fm-sc .fm-sc-frame--youtube-shorts,
.fm-sc .fm-sc-frame--drive-verticale {
	aspect-ratio: 9 / 16;
	height: auto;
}

.fm-sc .fm-sc-frame--drive-quadrato {
	aspect-ratio: 1 / 1;
	height: auto;
}

.fm-sc .fm-sc-frame--youtube,
.fm-sc .fm-sc-frame--drive-orizzontale {
	aspect-ratio: 16 / 9;
	height: auto;
}

.fm-sc .fm-sc-fallback {
	display: block;
	padding: 2em 1em;
	text-align: center;
}

/* Frecce */
.fm-sc .fm-sc-nav {
	position: absolute;
	top: 50%;
	z-index: 3;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 46px;
	height: 46px;
	margin: -23px 0 0;
	padding: 0 0 4px;
	border: 0;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
	color: var(--fm-a);
	font-size: 30px;
	line-height: 1;
	cursor: pointer;
	transition: transform 0.15s;
}

.fm-sc .fm-sc-nav:hover {
	transform: scale(1.08);
}

.fm-sc .fm-sc-prev { left: -14px; }
.fm-sc .fm-sc-next { right: -14px; }

.fm-sc .fm-sc-nav[hidden] {
	display: none;
}

@media (max-width: 767px) {
	.fm-sc .fm-sc-nav { display: none; }
}

/* Puntini */
.fm-sc .fm-sc-dots {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px;
	margin-top: 14px;
}

.fm-sc .fm-sc-dots:empty,
.fm-sc .fm-sc-dots[hidden] {
	display: none;
}

.fm-sc .fm-sc-dot {
	width: 9px;
	height: 9px;
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 999px;
	background: var(--theme-color-bd_color, #d5d8cf);
	cursor: pointer;
	transition: width 0.25s, background-color 0.25s;
}

.fm-sc .fm-sc-dot.is-active {
	width: 26px;
	background: var(--fm-a);
}

.fm-sc .fm-sc-item[hidden] {
	display: none;
}

/* Google Drive: strato trasparente sul pulsante "Apri in una nuova finestra" */
.fm-sc .fm-sc-drive {
	position: relative;
}

/* Anteprima (immagine in evidenza) sopra il player Drive: lascia passare il click al player,
   che parte; poi carousel.js la nasconde */
.fm-sc-drive .fm-sc-poster {
	position: absolute;
	inset: 0;
	z-index: 1;
	background: #000;
	pointer-events: none;
	transition: opacity 0.25s;
}

.fm-sc-drive .fm-sc-poster img {
	display: block;
	width: 100%;
	height: 100%;
	margin: 0;
	object-fit: contain;
}

.fm-sc-drive .fm-sc-poster::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 64px;
	height: 64px;
	transform: translate(-50%, -50%);
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.55) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23fff' d='M8 5v14l11-7z'/%3E%3C/svg%3E") 55% 50% / 30px no-repeat;
}

.fm-sc-drive.is-playing .fm-sc-poster {
	opacity: 0;
	visibility: hidden;
}

.fm-sc .fm-sc-shield {
	position: absolute;
	top: 0;
	right: 0;
	z-index: 2;
	width: 80px;
	height: 64px;
}

/* Didascalia sotto il video */
.fm-sc .fm-sc-caption {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 12px 16px 14px;
	/* L'embed Instagram è tirato su di --fm-ig-crop: la didascalia deve coprire la riga
	   "Aggiungi un commento…" invece di sovrapporsi in trasparenza */
	position: relative;
	z-index: 1;
	background: #fff;
}

.fm-sc .fm-sc-badge {
	align-self: flex-start;
	padding: 2px 10px;
	border-radius: 999px;
	background: color-mix(in srgb, var(--fm-a) 18%, transparent);
	color: var(--fm-a);
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.fm-sc .fm-sc-name {
	color: var(--theme-color-text_dark, #18240a);
	font-weight: 600;
	line-height: 1.35;
}

/* Schede Tutte / Nutrizione / Movimento / Mindset */
.fm-sc .fm-sc-tabs {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 10px;
	margin: 0 0 24px;
}

.fm-sc .fm-sc-tab {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	padding: 9px 18px;
	border: 1px solid var(--theme-color-bd_color, #e0e3d8);
	border-radius: 999px;
	background: transparent;
	color: var(--theme-color-text_dark, #18240a);
	font-size: 15px;
	line-height: 1.2;
	cursor: pointer;
	transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.fm-sc .fm-sc-tab:hover {
	border-color: var(--fm-a);
}

.fm-sc .fm-sc-tab.is-active {
	border-color: var(--fm-a);
	background: var(--fm-a);
	color: #fff;
}

.fm-sc .fm-sc-tab-count {
	min-width: 22px;
	padding: 1px 6px;
	border-radius: 999px;
	background: var(--theme-color-alter_bg_color, #f7f9f2);
	color: var(--theme-color-text, #797c7f);
	font-size: 12px;
	text-align: center;
}

.fm-sc .fm-sc-tab.is-active .fm-sc-tab-count {
	background: rgba(255, 255, 255, 0.25);
	color: #fff;
}

/* Su mobile le schede scorrono in orizzontale invece di andare a capo */
@media (max-width: 767px) {
	.fm-sc .fm-sc-tabs {
		flex-wrap: nowrap;
		justify-content: flex-start;
		overflow-x: auto;
		margin-right: -16px;
		padding-right: 16px;
		scrollbar-width: none;
	}

	.fm-sc .fm-sc-tabs::-webkit-scrollbar {
		display: none;
	}

	.fm-sc .fm-sc-tab {
		flex: 0 0 auto;
		padding: 8px 14px;
		font-size: 14px;
	}
}

.fm-sc-empty {
	padding: 1em;
	border: 1px dashed #ccc;
	text-align: center;
}
