/**
 * Elementor Scroll Shrink Image — frontend layout.
 */

/* Colonne/containers flex di Elementor spesso usano align-items:center sul figlio:
   il widget si restringe al contenuto e left/right sembrano “centro”. */
.elementor-widget-essi_scroll_shrink_split {
	width: 100%;
	max-width: 100%;
	align-self: stretch;
}

.elementor-widget-essi_scroll_shrink_split .elementor-widget-container {
	width: 100%;
	max-width: none;
}

.essi {
	position: relative;
	width: 100%;
	max-width: 100%;
}

.essi-track {
	position: relative;
	width: 100%;
}

.essi-sticky {
	position: sticky;
	top: 0;
	height: 100vh;
	max-height: 100vh;
	overflow: hidden;
	width: 100%;
	box-sizing: border-box;
}

.essi-row {
	display: flex;
	flex-direction: row;
	align-items: stretch;
	width: 100%;
	height: 100%;
	box-sizing: border-box;
}

.essi-row--center {
	justify-content: center;
	align-items: center;
}

/* Primary column resta alta quanto la viewport; il contenuto non “sale” in alto */
.essi-row--center .essi-primary {
	align-self: stretch;
	min-height: 100%;
}

.essi-row--left,
.essi[data-essi-align='left'] .essi-row {
	justify-content: flex-start;
	/* come il centro: asse trasversale centrato; le colonne usano align-self: stretch */
	align-items: center;
}

.essi-row--left .essi-primary,
.essi[data-essi-align='left'] .essi-primary {
	align-self: stretch;
	min-height: 100%;
}

.essi-row--left .essi-secondary-slot,
.essi[data-essi-align='left'] .essi-secondary-slot {
	align-self: stretch;
	min-height: 100%;
}

.essi-row--right,
.essi[data-essi-align='right'] .essi-row {
	justify-content: flex-end;
	/* come sinistra: centratura verticale sulle colonne */
	align-items: center;
}

.essi-row--right .essi-primary,
.essi[data-essi-align='right'] .essi-primary {
	align-self: stretch;
	min-height: 100%;
}

.essi-row--right .essi-secondary-slot,
.essi[data-essi-align='right'] .essi-secondary-slot {
	align-self: stretch;
	min-height: 100%;
}

/* Stesso markup che left (primaria poi slot): invertiamo solo l’ordine visivo */
.essi-row--right.essi-row--with-slot,
.essi[data-essi-align='right'] .essi-row.essi-row--with-slot {
	flex-direction: row-reverse;
	justify-content: flex-start;
}

.essi-primary {
	flex-shrink: 0;
	height: 100%;
	max-width: 100%;
	box-sizing: border-box;
}

.essi-row--with-slot .essi-primary {
	max-width: none;
}

.essi-secondary-slot {
	position: relative;
	flex: 1 1 auto;
	min-width: 0;
	height: 100%;
	overflow: hidden;
	box-sizing: border-box;
}

.essi-frame {
	width: 100%;
	height: 100%;
	overflow: hidden;
	box-sizing: border-box;
}

/* Layout centrato: immagine centrata in larghezza e in altezza nel riquadro */
.essi-row--center .essi-frame {
	display: flex;
	align-items: center;
	justify-content: center;
}

/* Sinistra / destra: crop immagine centrato in altezza e larghezza nel riquadro */
.essi-row--left .essi-primary .essi-frame,
.essi[data-essi-align='left'] .essi-primary .essi-frame,
.essi-row--right .essi-primary .essi-frame,
.essi[data-essi-align='right'] .essi-primary .essi-frame {
	display: flex;
	align-items: center;
	justify-content: center;
}

.essi-frame--secondary {
	position: absolute;
	top: 0;
	bottom: 0;
	width: 30vw;
	will-change: left, transform;
}

.essi-img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: 50% 50%;
}

/* Motion presets — hint compositing for scroll-driven transforms */
.essi--motion-depth .essi-primary .essi-img {
	will-change: transform;
	backface-visibility: hidden;
}

.essi--motion-cinematic .essi-primary .essi-frame {
	will-change: clip-path, filter;
	backface-visibility: hidden;
}

/* Secondaria nello slot: centratura nel riquadro (center / left+split / right+split) */
.essi-row--center .essi-secondary-slot .essi-frame,
.essi-row--left .essi-secondary-slot .essi-frame,
.essi[data-essi-align='left'] .essi-secondary-slot .essi-frame,
.essi-row--right .essi-secondary-slot .essi-frame,
.essi[data-essi-align='right'] .essi-secondary-slot .essi-frame {
	display: flex;
	align-items: center;
	justify-content: center;
}

/* -------------------------------------------------------------------------
   Mobile (stesso breakpoint tipico Elementor ≤767px): tutto centrato,
   niente altezza piena viewport.
   ------------------------------------------------------------------------- */
@media (max-width: 767px) {
	.essi-track {
		min-height: 0 !important;
	}

	.essi-sticky {
		position: relative;
		top: auto;
		height: auto;
		max-height: none;
		min-height: 0;
		overflow: visible;
	}

	.essi-row {
		flex-direction: column !important;
		flex-wrap: nowrap;
		height: auto;
		min-height: 0;
		justify-content: center !important;
		align-items: center !important;
	}

	.essi-row--center,
	.essi-row--left,
	.essi-row--right,
	.essi-row--left.essi-row--with-slot,
	.essi-row--right.essi-row--with-slot,
	.essi[data-essi-align='left'] .essi-row,
	.essi[data-essi-align='right'] .essi-row,
	.essi[data-essi-align='left'] .essi-row.essi-row--with-slot,
	.essi[data-essi-align='right'] .essi-row.essi-row--with-slot {
		flex-direction: column !important;
		justify-content: center !important;
		align-items: center !important;
	}

	/* Ordine DOM naturale: primaria sopra, secondaria sotto (row-reverse desktop non vale su mobile). */
	.essi-row--right.essi-row--with-slot .essi-primary,
	.essi[data-essi-align='right'] .essi-row.essi-row--with-slot .essi-primary {
		order: 1;
	}

	.essi-row--right.essi-row--with-slot .essi-secondary-slot,
	.essi[data-essi-align='right'] .essi-row.essi-row--with-slot .essi-secondary-slot {
		order: 2;
	}

	.essi-row--center .essi-primary,
	.essi-row--left .essi-primary,
	.essi-row--right .essi-primary,
	.essi[data-essi-align='left'] .essi-primary,
	.essi[data-essi-align='right'] .essi-primary {
		align-self: center;
		min-height: 0;
		height: auto;
		width: 100%;
		max-width: 100%;
	}

	.essi-row--with-slot {
		gap: 0.75rem;
	}

	.essi-secondary-slot {
		flex: none;
		width: 100%;
		height: auto;
		min-height: 0;
		align-self: center;
	}

	.essi-frame {
		height: auto;
		min-height: 0;
		max-height: 70vh;
		max-height: min(70vh, 32rem);
	}

	.essi-img {
		width: 100%;
		height: auto;
		max-height: 70vh;
		max-height: min(70vh, 32rem);
		object-fit: cover;
		object-position: 50% 50%;
	}

	.essi-frame--secondary {
		position: relative !important;
		top: auto !important;
		bottom: auto !important;
		left: auto !important;
		transform: none !important;
		width: 100% !important;
		max-width: 100%;
		max-width: min(100%, 28rem);
		margin-left: auto;
		margin-right: auto;
		will-change: auto;
	}

	.essi--motion-depth .essi-primary .essi-img,
	.essi--motion-cinematic .essi-primary .essi-frame {
		will-change: auto;
	}
}
