/* ============================================================
   Widget Elementor "Timeline Organazoto"
   Sezione "sticky": resta ferma a schermo mentre l'utente scrolla
   la pagina, e lo scroll fa avanzare/tornare indietro fra le tappe
   (mostrandone sempre fino a 5 alla volta). Si sblocca da sola
   quando si raggiunge l'ultima tappa (vedi timeline-organazoto.js).
   Le icone esagono sono immagini caricate dall'utente nel repeater
   Elementor: nessuna forma/SVG generata qui, solo layout e stati.
   Prefisso classi: oz-timeline / oz-hex / oz-connector
   ============================================================ */

.oz-timeline-pin-wrapper {
	position: relative;
	width: var(--oz-vw, 100vw);
	left: 50%;
	margin-left: calc(var(--oz-vw, 100vw) / -2);
}

.oz-timeline {
	--oz-green: #1d472f;
	--oz-green-dark: #1e472f;
	--oz-line: rgba(255, 255, 255, 0.45);
	--oz-line-strong: #ffffff;
	--oz-text: #ffffff;

	position: sticky;
	top: 0;
	height: 100vh;
	overflow: hidden;
	background: var(--oz-green);
	color: var(--oz-text);
	font-family: 'Outfit', sans-serif;
	isolation: isolate;
	display: flex;
	align-items: center;
	justify-content: center;
}

/* Immagine foglia, singola, in basso a sinistra (non ripetuta a sfondo) */
.oz-timeline__leaf {
	position: absolute;
	left: 0;
	bottom: 0;
	width: clamp(320px, 42vw, 640px);
	height: auto;
	aspect-ratio: 1 / 1;
	background-repeat: no-repeat;
	background-position: left bottom;
	background-size: contain;
	opacity: 0.9;
	pointer-events: none;
	z-index: 0;
}

.oz-timeline__inner {
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: 1680px;
	padding: clamp(64px, 9vw, 96px) clamp(20px, 5vw, 64px) clamp(40px, 6vw, 72px);
}

/* Anno grande + linea verticale che "esce" dalla tappa selezionata,
   posizionati via JS sopra/sotto l'esagono attivo */
.oz-timeline__active-marker {
	position: absolute;
	top: 0;
	z-index: 2;
	display: flex;
	flex-direction: column;
	align-items: center;
	transform: translateX(-50%);
	transition: left 0.35s cubic-bezier(.65, 0, .35, 1), top 0.35s cubic-bezier(.65, 0, .35, 1);
	pointer-events: none;
	opacity: 0;
}

.oz-timeline__active-marker.is-visible { opacity: 1; }

.oz-timeline__active-year {
	position: absolute;
	bottom: calc(100% + 16px);
	display: inline-block;
	font-size: clamp(26px, 3vw, 36px);
	font-weight: 600;
	color: var(--oz-text);
	white-space: nowrap;
	font-family: 'Outfit', sans-serif;
}

.oz-timeline__active-year.is-cycling {
	animation: oz-year-cycle 0.4s ease;
}

@keyframes oz-year-cycle {
	0%   { transform: translateY(calc(var(--oz-dir, 1) * 14px)); opacity: 0; }
	100% { transform: translateY(0); opacity: 1; }
}

.oz-timeline__active-line {
	position: absolute;
	top: 100%;
	width: 1px;
	height: clamp(90px, 11vw, 140px);
	background: var(--oz-line-strong);
}

/* ---------- Riga di tappe: finestra fissa di 5, il resto scorre sotto ---------- */

.oz-timeline__scroller {
	display: flex;
	align-items: center;
	justify-content: center;
}

.oz-timeline__viewport {
	position: relative;
	overflow: clip;
	max-width: 100%;
}

.oz-timeline__track {
	display: flex;
	align-items: center;
	width: max-content;
	padding: 6px 4px;
	transition: transform 0.55s cubic-bezier(.65, 0, .35, 1);
	will-change: transform;
}

/* ---------- Connettore fra due tappe consecutive ---------- */

.oz-connector {
	position: relative;
	flex: 0 0 auto;
	width: clamp(48px, 7vw, 140px);
	height: 2px;
	align-self: center;
	background-image: repeating-linear-gradient(to right, var(--oz-line) 0 2px, transparent 2px 7px);
}

.oz-connector::after {
	content: '';
	position: absolute;
	inset: 0;
	background: var(--oz-line-strong);
	transform: scaleX(0);
	transform-origin: left;
	transition: transform 0.5s cubic-bezier(.65, 0, .35, 1);
}

.oz-connector.is-filled::after { transform: scaleX(1); }

/* ---------- Singola tappa ---------- */

.oz-timeline__item {
	flex: 0 0 auto;
}

.oz-hex {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: clamp(96px, 8.5vw, 140px);
	background: transparent !important;
	border: 0 !important;
	padding: 10px;
	cursor: pointer;
	font-family: inherit;
	-webkit-tap-highlight-color: transparent;
}

.oz-hex__shape {
	position: relative;
	z-index: 1;
	display: block;
	width: 100%;
	line-height: 0;
}

.oz-hex__shape img {
	width: 100%;
	height: auto;
	display: block;
	transition: transform 0.35s cubic-bezier(.34, 1.56, .64, 1), filter 0.3s ease, opacity 0.3s ease;
}

/* Ripiego testuale se una tappa non ha ancora un'icona caricata */
.oz-hex__fallback {
	position: relative;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	aspect-ratio: 1 / 0.92;
	width: 100%;
	border: 1.5px solid var(--oz-line-strong);
	clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
	font-size: clamp(13px, 1.2vw, 16px);
	font-weight: 500;
	transition: background-color 0.3s ease, opacity 0.3s ease;
}

.oz-hex:hover .oz-hex__shape img { filter: brightness(1.15); }
.oz-hex:hover .oz-hex__fallback { background-color: rgba(255, 255, 255, 0.12); }

.oz-hex:focus-visible { outline: 2px solid #fff; outline-offset: 4px; }

/* La tappa attiva si riduce a un piccolo punto: l'anno e la linea prendono
   il suo posto sopra/sotto (vedi .oz-timeline__active-marker) */
.oz-hex.is-active .oz-hex__shape img {
	transform: scale(0.4);
	filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.3));
}
.oz-hex.is-active .oz-hex__fallback {
	transform: scale(0.55);
	background-color: var(--oz-line-strong);
	border-radius: 50%;
	clip-path: none;
	color: transparent;
}

/* Impulso al click, sul punto attivo */
.oz-hex.is-pulsing .oz-hex__shape img,
.oz-hex.is-pulsing .oz-hex__fallback {
	animation: oz-hex-pulse 0.5s ease-out;
}

@keyframes oz-hex-pulse {
	0%   { filter: drop-shadow(0 0 0 rgba(255, 255, 255, 0.7)); }
	100% { filter: drop-shadow(0 0 14px rgba(255, 255, 255, 0)); }
}

/* ---------- Pannello dettaglio ---------- */

.oz-timeline__detail {
	position: absolute;
	z-index: 1;
	max-width: 480px;
	transition: left 0.35s cubic-bezier(.65, 0, .35, 1), top 0.35s cubic-bezier(.65, 0, .35, 1);
}

.oz-timeline__detail-year {
	display: block;
	font-size: clamp(46px, 7vw, 76px);
	font-weight: 600;
	line-height: 1;
	margin-bottom: 14px;
}

.oz-timeline__detail-title {
	margin: 0 0 10px;
	font-family: 'Outfit', sans-serif !important;
	font-size: clamp(20px, 2.6vw, 26px);
	font-weight: 600;
	color: var(--oz-title-color, var(--oz-text)) !important;
}

.oz-timeline__detail-text {
	margin: 0;
	font-family: 'Roboto', sans-serif;
	font-size: 15px;
	line-height: 1.6;
	color: var(--oz-desc-color, rgba(255, 255, 255, 0.9));
}

.oz-timeline__detail-body {
	transition: opacity 0.28s ease, transform 0.28s ease;
}

.oz-timeline__detail-body.is-switching {
	opacity: 0;
	transform: translateY(6px);
}

/* ---------- Editor Elementor: evita che il widget appaia vuoto senza tappe ---------- */

.oz-timeline__empty {
	position: relative;
	z-index: 1;
	font-family: 'Roboto', sans-serif;
	font-size: 14px;
	opacity: 0.85;
}

/* ---------- Rispetta la preferenza utente per meno animazioni ---------- */

@media (prefers-reduced-motion: reduce) {
	.oz-hex__shape img,
	.oz-connector::after,
	.oz-timeline__detail-body,
	.oz-timeline__track,
	.oz-timeline__active-marker,
	.oz-timeline__active-year {
		transition: none !important;
		animation: none !important;
		scroll-behavior: auto !important;
	}
	.oz-hex.is-pulsing .oz-hex__shape img,
	.oz-hex.is-pulsing .oz-hex__fallback { animation: none !important; }
}
