/**
 * ILPA — Il Gruppo Mobile
 *
 * Default presi dal nodo Figma "ILPA/Mobile/Il Gruppo" (301:8479, ILPA-Website).
 * Colonna contenuti 353px su viewport 393 (margini 20), hero a tutta larghezza.
 *
 * Token tipografici mobile del file:
 *   Heading/H1 Mobile Open Sans Regular 30/1.2 · H2 Mobile Regular 26/1.2
 *   Text/Regular 16/1.5 · Text/Small 14/1.4 · Text/Regular/Semibold 16/1.5
 *   Card vetro rgba(255,255,255,.6) + backdrop-blur 10px, raggio 20
 *   Tinta di sezione #276A95 all'8%
 */

.ilpa-gm {
	--ilpa-gm-blue: #276a95; /* Blue/Blueprint Blue */
	--ilpa-gm-ink: #1d2833; /* Blue/700 */
	--ilpa-gm-muted: #52677c; /* Blue/300 */
	--ilpa-gm-page-bg: #f2f7fd;
	--ilpa-gm-glass: rgba(255, 255, 255, 0.6); /* Opacity/White 60% */
	--ilpa-gm-glass-blur: 10px;
	--ilpa-gm-tint: rgba(39, 106, 149, 0.08); /* Opacity/Blueprint Blue 8% */

	--ilpa-gm-radius: 20px;
	--ilpa-gm-pad: 12px;

	--ilpa-gm-h1-size: 30px;
	--ilpa-gm-h2-size: 26px;
	--ilpa-gm-text-size: 16px;
	--ilpa-gm-small-size: 14px;

	--ilpa-gm-mask-pt: 16px; /* spessore maschera sul lato orizzontale del testo */
	--ilpa-gm-mask-px: 12px; /* spessore maschera sul lato verticale del testo */

	position: relative;
	color: var(--ilpa-gm-ink);
}

.ilpa-gm *,
.ilpa-gm *::before,
.ilpa-gm *::after {
	box-sizing: border-box;
}

/* =========================================================================
 * VISIBILITÀ
 *
 * `body:not(.elementor-editor-active)` è la parte che conta: nell'editor i
 * widget restano visibili anche a viewport desktop, altrimenti sarebbero
 * invisibili e impossibili da selezionare mentre si costruisce la pagina.
 * ====================================================================== */

@media (min-width: 1025px) {
	body:not(.elementor-editor-active) .ilpa-gm--hide-lg:not(.ilpa-gm--desktop) {
		display: none !important;
	}
}

@media (min-width: 768px) {
	body:not(.elementor-editor-active) .ilpa-gm--hide-md:not(.ilpa-gm--desktop) {
		display: none !important;
	}
}

@media (min-width: 1025px) {
	body.elementor-editor-active .ilpa-gm:not(.ilpa-gm--desktop) {
		max-width: 393px;
		margin-inline: auto;
	}

	body.elementor-editor-active .ilpa-gm:not(.ilpa-gm--desktop)::before {
		content: 'solo mobile';
		position: absolute;
		top: -18px;
		left: 0;
		z-index: 2;
		font-size: 10px;
		font-weight: 700;
		letter-spacing: 0.08em;
		text-transform: uppercase;
		color: var(--ilpa-gm-blue);
		opacity: 0.6;
		pointer-events: none;
	}
}

/* ------------------------------ comuni ---------------------------------- */

.ilpa-gm__title {
	margin: 0;
	font-size: var(--ilpa-gm-h2-size);
	font-weight: 400; /* Open Sans Regular: nel mockup i titoli non sono bold */
	line-height: 1.2;
	color: var(--ilpa-gm-ink);
}

.ilpa-gm__text {
	font-size: var(--ilpa-gm-text-size);
	line-height: 1.5;
	color: var(--ilpa-gm-ink);
}

.ilpa-gm__text p {
	margin: 0 0 10px;
}

.ilpa-gm__text p:last-child {
	margin-bottom: 0;
}

.ilpa-gm__text--small {
	font-size: var(--ilpa-gm-small-size);
	line-height: 1.4;
}

.ilpa-gm__media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.ilpa-gm__sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/* =========================================================================
 * 0. HERO — foto a tutta larghezza con gradiente che sfuma nel fondo pagina
 * ====================================================================== */

.ilpa-gm--hero {
	--ilpa-gm-hero-ratio: 393 / 657;
	--ilpa-gm-hero-pt: 104px;
	--ilpa-gm-hero-gap: 24px;
	--ilpa-gm-hero-color: #ffffff;
	--ilpa-gm-hero-fade-from: 39.27%;

	display: grid;
}

.ilpa-gm--hero.is-fullbleed .ilpa-gm__hero-media {
	margin-inline: calc(50% - 50vw);
	width: 100vw;
	max-width: 100vw;
}

.ilpa-gm__hero-media,
.ilpa-gm__hero-body {
	grid-area: 1 / 1;
}

.ilpa-gm__hero-media {
	position: relative;
	aspect-ratio: var(--ilpa-gm-hero-ratio);
	overflow: hidden;
	background: var(--ilpa-gm-tint);
}

/*
 * Il gradiente del mockup: trasparente fino al 39,27% e poi giù fino al colore
 * di fondo pagina, così la foto si dissolve nella pagina invece di tagliarsi
 * di netto. Va sopra la foto ma sotto al testo.
 */
.ilpa-gm__hero-media::after {
	content: '';
	position: absolute;
	inset: 0;
	background: linear-gradient(
		180deg,
		rgba(242, 247, 253, 0) var(--ilpa-gm-hero-fade-from),
		var(--ilpa-gm-page-bg) 100%
	);
	pointer-events: none;
}

.ilpa-gm__hero-body {
	position: relative;
	z-index: 1;
	align-self: start;
	display: flex;
	flex-direction: column;
	gap: var(--ilpa-gm-hero-gap);
	padding-top: var(--ilpa-gm-hero-pt);
	color: var(--ilpa-gm-hero-color);
}

.ilpa-gm__hero-title {
	margin: 0;
	font-size: var(--ilpa-gm-h1-size);
	font-weight: 400;
	line-height: 1.2;
	color: inherit;
}

.ilpa-gm__hero-sub {
	margin: 0;
	font-size: var(--ilpa-gm-text-size);
	font-weight: 600; /* Text/Regular/Semibold */
	line-height: 1.5;
	color: inherit;
}

/* =========================================================================
 * 1. UN GRUPPO ITALIANO — card vetro, foto agganciata in basso e ritagliata
 *    in alto a sinistra intorno alla coda del testo
 * ====================================================================== */

.ilpa-gm--group {
	--ilpa-gm-group-ratio: 353 / 370;
	--ilpa-gm-group-img-h: 104.8159%; /* 370 / 353, in percentuale della larghezza */
	--ilpa-gm-group-overhang: 76px; /* quanto la foto scende sotto la card */
	--ilpa-gm-group-overlap: 84px; /* quanto il testo entra dentro la foto */

	padding-bottom: var(--ilpa-gm-group-overhang);
}

.ilpa-gm__group-card {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 16px var(--ilpa-gm-pad);
	/*
	 * Lo spazio in fondo alla card è quello che resta della foto una volta
	 * tolte la sporgenza sotto e la parte su cui il testo si appoggia. Così,
	 * se il testo si allunga, card e foto scendono insieme e la
	 * sovrapposizione resta quella del mockup.
	 */
	padding-bottom: calc(var(--ilpa-gm-group-img-h) - var(--ilpa-gm-group-overhang) - var(--ilpa-gm-group-overlap));
	border-radius: var(--ilpa-gm-radius);
	background: var(--ilpa-gm-glass);
	-webkit-backdrop-filter: blur(var(--ilpa-gm-glass-blur));
	backdrop-filter: blur(var(--ilpa-gm-glass-blur));
}

/* il testo deve stare sopra la foto, dentro il ritaglio */
.ilpa-gm__group-intro {
	position: relative;
	z-index: 2;
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding-right: var(--ilpa-gm-mask-px);
	padding-bottom: var(--ilpa-gm-mask-pt);
	margin-right: calc(-1 * var(--ilpa-gm-mask-px));
	margin-bottom: calc(-1 * var(--ilpa-gm-mask-pt));
}

.ilpa-gm__group-media {
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	aspect-ratio: var(--ilpa-gm-group-ratio);
	border-radius: var(--ilpa-gm-radius);
	overflow: hidden;
	background: var(--ilpa-gm-tint);
	z-index: 0;
}

/* Ripiego senza clip-path: path(): la card copre la foto dietro al testo. */
.ilpa-gm--group:not(.is-clipped) .ilpa-gm__group-card {
	background: var(--ilpa-gm-page-bg);
}

/* =========================================================================
 * 2. BRAND CARDS GALLERY — sezione tinta, testo e carosello con dots sopra
 * ====================================================================== */

.ilpa-gm--brands {
	--ilpa-gm-brand-w: 88.6685%; /* 313 / 353 */
	--ilpa-gm-brand-gap: 8px;
	--ilpa-gm-brand-pad: 20px;
	--ilpa-gm-brand-logo-h: 60px;
	--ilpa-gm-dot-size: 14px;
	--ilpa-gm-dot-gap: 16px;
	--ilpa-gm-dot-color: rgba(39, 106, 149, 0.3);
	--ilpa-gm-dot-active: var(--ilpa-gm-blue);

	padding: 16px 0;
	border-radius: var(--ilpa-gm-radius);
	background: var(--ilpa-gm-tint);
	overflow: hidden;
}

.ilpa-gm__brands-text {
	display: flex;
	flex-direction: column;
	gap: 12px;
	width: 93.2%; /* 329 / 353 */
	margin: 0 auto 40px;
}

.ilpa-gm__dots {
	display: flex;
	justify-content: center;
	gap: var(--ilpa-gm-dot-gap);
	margin-bottom: 12px; /* nel mockup i dots stanno SOPRA le card */
}

.ilpa-gm__dot {
	width: var(--ilpa-gm-dot-size);
	height: var(--ilpa-gm-dot-size);
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--ilpa-gm-dot-color);
	cursor: pointer;
	transition: background-color 0.25s ease;
	-webkit-appearance: none;
	appearance: none;
}

.ilpa-gm__dot.is-active {
	background: var(--ilpa-gm-dot-active);
}

.ilpa-gm__dot:focus {
	outline: none;
}

.ilpa-gm__dot:focus-visible {
	outline: 2px solid var(--ilpa-gm-blue);
	outline-offset: 3px;
}

.ilpa-gm__gallery {
	overflow: hidden;
}

.ilpa-gm__track {
	display: flex;
	gap: var(--ilpa-gm-brand-gap);
	transition: transform 0.45s ease;
	will-change: transform;
}

.ilpa-gm__brand {
	display: flex;
	flex: 0 0 var(--ilpa-gm-brand-w);
	padding: var(--ilpa-gm-brand-pad);
	border-radius: var(--ilpa-gm-radius);
	background: rgba(255, 255, 255, 0.8); /* Opacity/White 80% */
	color: var(--ilpa-gm-muted);
	text-decoration: none;
	opacity: 0.8;
	transition: opacity 0.45s ease, background-color 0.45s ease, color 0.45s ease;
}

.ilpa-gm__brand.is-active {
	background: #fff;
	color: var(--ilpa-gm-ink);
	opacity: 1;
	box-shadow: 0 4px 3px rgba(0, 0, 0, 0.03), 0 12px 8px rgba(0, 0, 0, 0.1);
}

.ilpa-gm__brand:hover,
.ilpa-gm__brand:focus,
.ilpa-gm__brand:active,
.ilpa-gm__brand:visited {
	color: inherit;
	text-decoration: none;
}

.ilpa-gm__brand-inner {
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	gap: 24px;
	width: 100%;
	min-width: 0;
	min-height: var(--ilpa-gm-brand-h, 320px);
}

.ilpa-gm__brand-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	height: var(--ilpa-gm-brand-logo-h);
}

/*
 * La classe del widget è ripetuta di proposito: Elementor normalizza ogni
 * immagine con `.elementor img { height: auto }` (0,1,1), che da sola
 * `.ilpa-gm__brand-logo` (0,1,0) non batte. Senza le due classi il logo
 * ignora l'altezza della riga e la sfonda, crescendo oltre i 60px del mockup.
 */
.ilpa-gm .ilpa-gm__brand-logo {
	display: block;
	width: auto;
	max-width: 70%;
	height: 100%;
	object-fit: contain;
	object-position: left center;
}

.ilpa-gm__brand-icon {
	flex: 0 0 auto;
	width: 24px;
	height: 24px;
	color: var(--ilpa-gm-blue);
}

.ilpa-gm__brand-icon svg {
	display: block;
	width: 100%;
	height: 100%;
}

.ilpa-gm__brand-text {
	font-size: var(--ilpa-gm-text-size);
	line-height: 1.5;
	color: inherit;
}

/* =========================================================================
 * 3. PROTAGONISTI — slider a due foto: quella davanti è la corrente, quella
 *    dietro sbuca a destra ed è la successiva
 * ====================================================================== */

.ilpa-gm--protagonists {
	--ilpa-gm-front-ratio: 333 / 236;
	--ilpa-gm-front-w: 94.3343%; /* 333 / 353 */
	--ilpa-gm-back-w: 93.2011%; /* 329 / 353 */
	--ilpa-gm-back-h: 78.8136%; /* 186 / 236 */
	--ilpa-gm-front-border: 5px;
	--ilpa-gm-stage-gap: 40px;
}

.ilpa-gm__prot-intro {
	display: flex;
	flex-direction: column;
	gap: 12px;
	margin-bottom: var(--ilpa-gm-stage-gap);
}

.ilpa-gm__stage {
	position: relative;
	cursor: pointer;
}

.ilpa-gm__front {
	position: relative;
	width: var(--ilpa-gm-front-w);
	aspect-ratio: var(--ilpa-gm-front-ratio);
	border: var(--ilpa-gm-front-border) solid #fff;
	border-radius: var(--ilpa-gm-radius);
	overflow: hidden;
	box-shadow: 0 4px 6px 0 rgba(0, 0, 0, 0.03), 0 12px 16px 0 rgba(0, 0, 0, 0.1); /* Shadow/m */
	z-index: 1;
}

.ilpa-gm__back {
	position: absolute;
	top: 50%;
	right: 0;
	width: var(--ilpa-gm-back-w);
	height: var(--ilpa-gm-back-h);
	transform: translateY(-50%);
	border-radius: var(--ilpa-gm-radius);
	overflow: hidden;
	background-position: center;
	background-size: cover;
	box-shadow: 0 8px 8px -4px rgba(0, 0, 0, 0.03), 0 20px 24px -4px rgba(0, 0, 0, 0.08); /* Shadow/l */
	z-index: 0;
}

.ilpa-gm__slide {
	position: absolute;
	inset: 0;
	opacity: 0;
	transition: opacity 0.45s ease;
}

.ilpa-gm__slide.is-active {
	opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
	.ilpa-gm__track,
	.ilpa-gm__brand,
	.ilpa-gm__dot,
	.ilpa-gm__slide {
		transition: none;
	}
}
