/* Euralpha Product Cubes — front-end */

.epc {
	--epc-ink: #14161a;
	--epc-muted: #6b7077;
	--epc-accent: #14161a;
	--epc-hover-ink: #ffffff;
	--epc-border: rgba(20, 22, 26, 0.12);
	--epc-scene-h: 560px;
	--epc-radius: 18px;
	--epc-scale: 1;

	/* Sfondo della scena: sovrascrivibile da admin o da shortcode */
	--epc-bg: linear-gradient(180deg, #fbfbfa 0%, #f0efec 100%);
	--epc-glow: rgba(0, 0, 0, 0.22);
	--epc-face-bg: #d9d6d1;

	position: relative;
	width: 100%;
	color: var(--epc-ink);
	box-sizing: border-box;
}
.epc *,
.epc *::before,
.epc *::after { box-sizing: border-box; }

.epc--dark {
	--epc-ink: #f4f5f6;
	--epc-muted: rgba(244, 245, 246, 0.62);
	--epc-accent: #ffffff;
	--epc-border: rgba(255, 255, 255, 0.16);
	--epc-bg: radial-gradient(120% 90% at 50% 20%, #24272c 0%, #121417 70%);
	--epc-glow: rgba(0, 0, 0, 0.55);
	--epc-face-bg: #2a2d32;
}

.epc--transparent { --epc-bg: transparent; }

/* ---------- Header ---------- */

.epc-head { text-align: center; max-width: 760px; margin: 0 auto 26px; }
.epc-eyebrow {
	display: inline-block;
	font-size: 0.72rem;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--epc-muted);
	margin-bottom: 10px;
}
.epc-title { margin: 0 0 10px; font-size: clamp(1.6rem, 3.2vw, 2.6rem); line-height: 1.15; }
.epc-sub { margin: 0; color: var(--epc-muted); font-size: 0.98rem; line-height: 1.55; }

/* ---------- Scena ---------- */

.epc-scene {
	position: relative;
	width: 100%;
	height: var(--epc-scene-h);
	perspective: 1600px;
	perspective-origin: 50% 45%;
	overflow: hidden;
	border-radius: var(--epc-radius);
	touch-action: pan-y;
}

.epc-scene { background: var(--epc-bg); }

.epc-stage {
	position: absolute;
	inset: 0;
	transform-style: preserve-3d;
	transform: scale(var(--epc-scale));
}

/* ---------- Cubo ---------- */

.epc-item {
	position: absolute;
	top: 50%;
	left: 50%;
	transition: transform 0.52s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.4s ease;
	transform-style: preserve-3d;
}

.epc-cube-scene {
	position: relative;
	width: 200px;
	height: 200px;
	perspective: 1000px;
	cursor: grab;
	/* pan-y: lo scroll verticale della pagina resta possibile anche partendo da un cubo */
	touch-action: pan-y;
	user-select: none;
	-webkit-user-select: none;
	-webkit-touch-callout: none;
}
.epc-cube-scene.is-dragging { cursor: grabbing; }
.epc-item.is-active .epc-face.is-linked { cursor: pointer; }
.epc-cube-scene img { pointer-events: none; }

.epc-cube {
	position: relative;
	width: 100%;
	height: 100%;
	transform-style: preserve-3d;
	will-change: transform;
}

.epc-face {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: flex-end;
	border-radius: 16px;
	overflow: hidden;
	background-size: cover;
	background-position: center;
	background-color: var(--epc-face-bg);
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35), inset 0 0 26px rgba(0, 0, 0, 0.28);
	text-decoration: none;
	color: #fff;
	/* impedisce il drag&drop nativo del link, che interrompeva la rotazione */
	-webkit-user-drag: none;
	user-select: none;
	-webkit-user-select: none;
}

/* Ombreggiatura calcolata dal JS: la luce resta ferma mentre il cubo gira,
   cosi' le sei facce si leggono come un solido e non come sei quadrati. */
.epc-face::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
	background: rgba(6, 7, 9, var(--epc-shade, 0));
	pointer-events: none;
}
.epc-face::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0) 52%);
	pointer-events: none;
}

.epc-caption {
	color: var(--epc-hover-ink);
	position: relative;
	z-index: 2;
	width: 100%;
	padding: 10px 12px;
	pointer-events: none;
	opacity: 0;
	transform: translateY(6px);
	transition: opacity 0.35s ease, transform 0.35s ease;
}
.epc-item.is-active .epc-face.is-front .epc-caption { opacity: 1; transform: none; }

.epc-caption .epc-name {
	display: block;
	font-size: 0.78rem;
	font-weight: 600;
	line-height: 1.25;
	text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}
.epc-caption .epc-cta {
	display: inline-block;
	margin-top: 3px;
	font-size: 0.64rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	opacity: 0.85;
}

.epc-shadow {
	position: absolute;
	left: 50%;
	top: 50%;
	width: 220px;
	height: 220px;
	margin: -110px 0 0 -110px;
	transform: translateY(126px) rotateX(78deg) scale(1, 0.5);
	background: radial-gradient(closest-side, var(--epc-glow), transparent 74%);
	filter: blur(9px);
	opacity: 0.5;
	pointer-events: none;
	transition: opacity 0.5s ease;
}
.epc-item.is-active .epc-shadow { opacity: 0.85; }

.epc-item.is-active .epc-face.is-linked:hover { box-shadow: inset 0 0 0 2px #fff, inset 0 0 26px rgba(0, 0, 0, 0.28); }
.epc-face:focus-visible { outline: 3px solid #fff; outline-offset: -3px; }

/* ---------- Hint + dots ---------- */

.epc-dots {
	display: flex;
	justify-content: center;
	gap: 8px;
	margin-top: 18px;
	flex-wrap: wrap;
}
.epc-dot {
	appearance: none;
	border: 1px solid var(--epc-border);
	background: transparent;
	color: var(--epc-muted);
	font: inherit;
	font-size: 0.76rem;
	line-height: 1;
	padding: 8px 14px;
	border-radius: 999px;
	cursor: pointer;
	transition: all 0.25s ease;
}
.epc-dot:hover { border-color: var(--epc-hover-ink); color: var(--epc-hover-ink); }
.epc-dot.is-active {
	background: var(--epc-accent);
	border-color: var(--epc-accent);
	color: #fff;
}
.epc--dark .epc-dot.is-active { color: #14161a; }

/* ---------- Accessibilita' / SEO ---------- */

.epc-seo {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}
.epc-fallback { list-style: none; padding: 0; text-align: center; }

/* ---------- Responsive ---------- */

@media (max-width: 1024px) {
	.epc { --epc-scene-h: 480px; }
}
@media (max-width: 767px) {
	.epc { --epc-scene-h: 420px; }
	.epc-scene { perspective: 1100px; }
}

@media (prefers-reduced-motion: reduce) {
	.epc-item { transition: none; }
}

/* Elementor 4.x: neutralizza i wrapper interni che romperebbero il layout */
.epc > .e-con-inner,
.epc .elementor-widget-container { display: contents; }
