/* ===== Slider Progetti 3D ===== */
.sp3d {
	/* Personalizza qui i colori (o sovrascrivili nel CSS personalizzato di Divi) */
	--sp3d-primary: #0b7a62;
	--sp3d-primary-dark: #075c4a;
	--sp3d-accent: #f7c632;
	--sp3d-pill-bg: #40a88b;
	--sp3d-pill-text: #231f1f;
	--sp3d-btn-bg: #ffd507;
	--sp3d-btn-text: #231f1f;
	--sp3d-btn-hover-bg: #0E4E3D;
	--sp3d-btn-hover-text: #ffffff;
	--sp3d-focus: #0E4E3D;
	--sp3d-text: #3b3f3e;
	--sp3d-dot: #c7e3da;
	--sp3d-radius: 18px;
	--sp3d-w: 720px;              /* larghezza card centrale, ricalcolata dal JS */
	--sp3d-h: calc(var(--sp3d-w) * 0.58); /* altezza immagini: aumenta 0.58 per card più alte */

	position: relative;
	width: 100%;
	overflow: hidden;
	padding: 24px 0 40px;
	font-family: inherit;
	color: var(--sp3d-text);
	-webkit-tap-highlight-color: transparent;
}

/* --- Palco 3D --- */
.sp3d .sp3d-stage {
	position: relative;
	height: calc(var(--sp3d-h) * 1.32);
	perspective: 1500px;
	perspective-origin: 50% 50%;
	touch-action: pan-y;
	user-select: none;
}
.sp3d .sp3d-track {
	position: absolute;
	inset: 0;
	transform-style: preserve-3d;
}
.sp3d .sp3d-card {
	position: absolute;
	top: 50%;
	left: 50%;
	width: var(--sp3d-w);
	height: var(--sp3d-h);
	margin: calc(var(--sp3d-h) / -2) 0 0 calc(var(--sp3d-w) / -2);
	border-radius: var(--sp3d-radius);
	overflow: hidden;
	background: #e9efed;
	box-shadow: 0 18px 40px -18px rgba(20, 50, 40, .35);
	transition: transform .7s cubic-bezier(.22, .8, .24, 1), opacity .7s ease, filter .7s ease;
	will-change: transform;
	backface-visibility: hidden;
	cursor: pointer;
	display: block;
}
.sp3d .sp3d-card.is-active { cursor: pointer; }
.sp3d .sp3d-card img,
.sp3d .sp3d-card .sp3d-img {
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	display: block;
	pointer-events: none;
	-webkit-user-drag: none;
}
.sp3d.is-dragging .sp3d-card { transition-duration: .25s; }

/* --- Frecce --- */
.sp3d .sp3d-arrow {
	position: absolute;
	top: 50%;
	z-index: 50;
	width: 64px;
	height: 64px;
	margin-top: -32px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #fff;
	color: var(--sp3d-primary);
	box-shadow: 0 6px 20px rgba(0, 0, 0, .14);
	display: grid;
	place-items: center;
	cursor: pointer;
	transition: transform .2s ease, box-shadow .2s ease;
}
.sp3d .sp3d-arrow svg { width: 28px; height: 28px; }
.sp3d .sp3d-prev { left: 16px; }
.sp3d .sp3d-next { right: 16px; }
.sp3d .sp3d-next svg { transform: scaleX(-1); }
.sp3d .sp3d-arrow:hover { transform: scale(1.06); box-shadow: 0 8px 26px rgba(0, 0, 0, .2); }

/* --- Testi sotto la card --- */
.sp3d .sp3d-captions {
	display: grid;
	max-width: 620px;
	margin: 6px auto 0;
	padding: 0 20px;
	text-align: center;
}
.sp3d .sp3d-caption {
	grid-area: 1 / 1;              /* tutte sovrapposte: l'altezza è quella della più alta */
	display: flex;
	flex-direction: column;
	align-items: center;
	opacity: 0;
	visibility: hidden;
	transform: translateY(8px);
	transition: opacity .35s ease, transform .35s ease, visibility 0s linear .35s;
}
.sp3d .sp3d-caption.is-active {
	opacity: 1;
	visibility: visible;
	transform: none;
	transition-delay: .12s, .12s, 0s;
}
.sp3d .sp3d-pill {
	display: inline-block;
	padding: 5px 20px;
	border-radius: 999px;
	background: var(--sp3d-pill-bg);
	color: var(--sp3d-pill-text);
	font-size: 14px;
	font-weight: 600;
	letter-spacing: .02em;
	line-height: 1.4;
	text-transform: uppercase;
}
.sp3d .sp3d-title {
	margin: 12px 0 10px;
	padding: 0;
	color: var(--sp3d-primary);
	font-size: clamp(26px, 2.6vw, 38px);
	font-weight: 800;
	line-height: 1.15;
}
.sp3d .sp3d-excerpt {
	margin: 0 0 22px;
	padding: 0;
	font-size: 18px;
	line-height: 1.5;
	color: var(--sp3d-text);
	text-wrap: balance;
}
.sp3d a.sp3d-btn {
	display: inline-flex;
	align-items: center;
	gap: 22px;
	padding: 16px 30px 16px 48px;
	border-radius: 999px;
	background: var(--sp3d-btn-bg);
	color: var(--sp3d-btn-text);
	font-size: 18px;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	box-shadow: none;
	transition: background-color .2s ease, color .2s ease;
}
.sp3d a.sp3d-btn svg { width: 24px; height: 24px; transition: transform .2s ease; }
.sp3d a.sp3d-btn:hover { background: var(--sp3d-btn-hover-bg); color: var(--sp3d-btn-hover-text); }
.sp3d a.sp3d-btn:hover svg { transform: translateX(4px); }

/* --- Pallini --- */
.sp3d .sp3d-dots {
	display: flex;
	justify-content: center;
	gap: 14px;
	margin-top: 34px;
}
.sp3d .sp3d-dot {
	width: 18px;
	height: 18px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--sp3d-dot);
	cursor: pointer;
	transition: background-color .25s ease, transform .25s ease;
}
.sp3d .sp3d-dot.is-active { background: var(--sp3d-primary); }
.sp3d .sp3d-dot:hover { transform: scale(1.15); }

/* --- Invito finale (pagina progetti) --- */
.sp3d .sp3d-cta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 14px 20px;
	max-width: 760px;
	margin: 40px auto 0;
	padding: 28px 20px 0;
	border-top: 1px solid #e3ece9;
	text-align: center;
}
.sp3d .sp3d-cta-text {
	margin: 0;
	padding: 0;
	font-size: 18px;
	font-weight: 600;
	color: var(--sp3d-text);
}
.sp3d a.sp3d-cta-btn {
	display: inline-block;
	padding: 12px 30px;
	border: 2px solid #0E4E3D;
	border-radius: 999px;
	background: transparent;
	color: #0E4E3D;
	font-size: 17px;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	transition: background-color .2s ease, color .2s ease;
}
.sp3d a.sp3d-cta-btn:hover {
	background: #0E4E3D;
	color: #fff;
}
.sp3d a.sp3d-cta-btn:focus-visible {
	outline: 3px solid var(--sp3d-focus);
	outline-offset: 3px;
}

/* --- Focus da tastiera --- */
.sp3d .sp3d-arrow:focus-visible,
.sp3d .sp3d-dot:focus-visible,
.sp3d a.sp3d-btn:focus-visible,
.sp3d .sp3d-card:focus-visible {
	outline: 3px solid var(--sp3d-focus);
	outline-offset: 3px;
}

/* --- Mobile --- */
@media (max-width: 700px) {
	.sp3d .sp3d-arrow { width: 46px; height: 46px; margin-top: -23px; }
	.sp3d .sp3d-arrow svg { width: 22px; height: 22px; }
	.sp3d .sp3d-prev { left: 8px; }
	.sp3d .sp3d-next { right: 8px; }
	.sp3d .sp3d-pill { font-size: 12px; padding: 4px 14px; }
	.sp3d .sp3d-excerpt { font-size: 16px; }
	.sp3d a.sp3d-btn { font-size: 16px; padding: 14px 24px 14px 32px; gap: 14px; }
	.sp3d .sp3d-dots { margin-top: 24px; }
	.sp3d .sp3d-cta { margin-top: 30px; padding-top: 22px; }
	.sp3d .sp3d-cta-text { font-size: 16px; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
	.sp3d .sp3d-card,
	.sp3d .sp3d-caption { transition-duration: .01ms !important; }
}
