/* ─── Home: reset wrapper GP ──────────────────────────────────────────────── */

body.home {
	padding-top: 0;
}

body.home #content {
	display: block;
	width: 100%;
	max-width: 100%;
	padding: 0;
}

/* ─── Header: invisibile al caricamento, compare allo scroll ─────────────── */

body.home #site-header {
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.4s ease, height 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
}

body.home #site-header:not(.is-sticky) {
	height: 60px;
}

body.home #site-header.is-sticky {
	opacity: 1;
	pointer-events: auto;
}

/* ─── Hero ────────────────────────────────────────────────────────────────── */

.home-hero {
	position: relative;
	height: 100vh;
	overflow: hidden;
}

.hero-bg {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100vh;
	z-index: -1;
	overflow: hidden;
}

/* Era uno sfondo CSS: il browser la scopriva solo dopo il foglio di stile e la
   serviva a tutti alla stessa risoluzione. Ora e' un <img> nel markup, e cover
   con object-position ripete esattamente il ritaglio di prima. */
.hero-bg img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center 30%;
}

.hero-bg::after {
	content: '';
	position: absolute;
	inset: 0;
	z-index: 1;
	background: linear-gradient(
		to bottom,
		rgba(0, 0, 0, 0.25) 0%,
		transparent 30%,
		transparent 55%,
		rgba(0, 0, 0, 0.6) 100%
	);
}

/* ─── Logo — alto sinistra ────────────────────────────────────────────────── */

.hero-logo-wrap {
	position: absolute;
	top: 8vh;
	left: 5vw;
	z-index: 2;
	will-change: transform, opacity;
}

.hero-logo {
	height: clamp(107px, 32.3vh, 321px);
	width: auto;
}

/* ─── Frase — basso destra ────────────────────────────────────────────────── */

.hero-phrase {
	position: absolute;
	bottom: 28vh;
	right: 48px;
	z-index: 2;
	max-width: 380px;
	text-align: right;
	will-change: transform, opacity;
}

.hero-phrase-main {
	font-family: var(--font-heading);
	font-size: clamp(1.6rem, 2.8vw, 2.6rem);
	font-weight: 100;
	color: var(--color-text);
	line-height: 1.2;
	letter-spacing: 0.01em;
	margin: 0 0 0.15em;
	text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
}

/* Apre la frase: stesso carattere delle righe grandi, corpo ridotto. */
.hero-phrase-kicker {
	font-family: var(--font-heading);
	font-size: clamp(1.05rem, 1.8vw, 1.7rem);
	font-weight: 100;
	color: var(--color-text);
	line-height: 1.2;
	letter-spacing: 0.01em;
	margin: 0 0 0.15em;
	text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
}

.hero-phrase-sub {
	font-family: var(--font-body);
	font-size: clamp(0.75rem, 1vw, 0.95rem);
	font-weight: 400;
	color: var(--color-accent);
	line-height: 1.4;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	margin: 0;
	text-shadow: none;
}

/* ─── Ingressi: tre lame verticali ───────────────────────────────────────── */
/* Proporzioni lame: aspect-ratio su .gateway-image (attuale: 1/6)          */

.home-gateways {
	position: relative;
	display: flex;
	flex-direction: row;
	width: 100%;
	margin-top: -14vh;
	background: transparent;
	padding: 2% 72px 80px;
	gap: 72px;
}

/* sfondo scuro parte esattamente dove finisce la hero (100vh dalla cima) */
.home-gateways::before {
	content: '';
	position: absolute;
	top: 14vh;
	left: 0;
	right: 0;
	bottom: 0;
	background: var(--color-bg);
	z-index: 0;
}

.gateway-block {
	flex: 1;
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	padding: 0;
	text-decoration: none;
	background: var(--color-gateway-bg);
	overflow: hidden;
}

/* ─── Barra titoli — contenitore fisso edge to edge ─────────────────────── */

.gateway-titles-bar {
	position: fixed;
	top: calc(86vh - 1rem);
	left: 0;
	width: 100vw;
	height: 2.2rem;
	display: flex;
	align-items: flex-end;
	padding: 0 72px;
	gap: 72px;
	z-index: 10;
	pointer-events: none;
}

.gateway-title {
	flex: 1;
	display: flex;
	align-items: flex-end;
	justify-content: flex-end;
	padding: 0;
	pointer-events: auto;
	text-decoration: none;
}

.gateway-title span {
	font-family: var(--font-heading);
	font-size: clamp(1.4rem, 2.2vw, 2.2rem);
	font-weight: 300;
	line-height: 1;
	color: var(--color-text);
	letter-spacing: 0.04em;
	text-transform: none;
	padding: 0.15em 0.5em;
	margin-right: 0;
	background: transparent;
	border: 2px solid transparent;
	border-right: none;
	transition: color 0.2s ease, background-color 0.5s ease, border-color 0.5s ease;
}

.gateway-titles-bar.home-bar-visible .gateway-title span {
	background: var(--color-bg);
	border-color: var(--color-gateway-bg);
}

.gateway-title:hover span { color: var(--color-accent); }

.gateway-title .title-m { display: none; }

.gateway-image {
	position: relative;
	overflow: hidden;
	width: 95%;
	margin: 4% 4% 4% 1%;
	aspect-ratio: 1 / 6;
	filter: grayscale(100%);
	transition: filter 0.5s ease;
}

.gateway-image img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	/* Ancoraggio a destra e in alto: l'eccedenza viene tolta dal lato
	   sinistro e da quello inferiore, non ripartita sui quattro lati. */
	object-position: right top;
}

.gateway-block:hover .gateway-image {
	filter: grayscale(0%);
}


/* ─── Responsive tablet (769–1024px) ─────────────────────────────────────── */

@media (min-width: 769px) and (max-width: 1024px) {

	.hero-logo {
		height: clamp(100px, 28vh, 280px);
	}

	.hero-phrase {
		right: 32px;
		max-width: 300px;
	}

	.home-gateways {
		padding: 2% 32px 60px;
		gap: 24px;
	}

	.gateway-titles-bar {
		padding: 0 32px;
		gap: 24px;
	}
}

/* ─── Responsive mobile (≤768px) ─────────────────────────────────────────── */

@media (max-width: 768px) {

	/* Hero: position fixed → absolute per evitare il bug mobile (Problema 7) */
	.hero-bg {
		position: absolute;
	}

	.hero-logo-wrap {
		top: 6vh;
		left: 5vw;
	}

	.hero-logo {
		height: clamp(90px, 22vh, 180px);
	}

	.hero-phrase {
		bottom: 27vh;
		right: 24px;
		max-width: 260px;
	}

	.hero-phrase-main {
		font-size: clamp(1.25rem, 5.6vw, 1.6rem);
	}

	.hero-phrase-kicker {
		font-size: clamp(0.82rem, 3.6vw, 1.05rem);
	}

	.hero-phrase-sub {
		font-size: clamp(0.65rem, 2.4vw, 0.78rem);
	}

	/* Gateways mobile: tre lame affiancate come su desktop */
	.home-gateways {
		flex-direction: row;
		align-items: stretch;
		margin-top: -14vh;
		padding: 0 8px 48px;
		gap: 6px;
		background: transparent;
	}

	/* sfondo scuro da 100vh, come su desktop */
	.home-gateways::before {
		display: block;
	}

	.gateway-block {
		flex: 1;
		flex-direction: column;
		position: relative;
		width: auto;
		height: 72vh;
		min-height: 300px;
		padding: 0;
		background: var(--color-gateway-bg);
		gap: 0;
	}

	/* titolo fuori dal flusso: l'immagine occupa tutta la lama */
	.gateway-image {
		flex: 1;
		width: 100%;
		height: auto;
		margin: 0;
		aspect-ratio: auto;
		filter: grayscale(100%);
	}

	.gateway-image img {
		object-position: right top;
	}

	/* Tocco: rivela il colore mentre il dito resta sulla lama (equivalente
	   touch dell'hover desktop, gestito in header.js via classe .is-touched) */
	.gateway-block.is-touched .gateway-image {
		filter: grayscale(0%);
	}

	/* barra titoli mobile */
	.gateway-titles-bar {
		top: 82vh;
		height: 1.3rem;
		padding: 0 8px;
		gap: 6px;
	}

	.gateway-title {
		padding: 0;
	}

	.gateway-title span {
		font-size: clamp(1rem, 4.2vw, 1.3rem);
		line-height: 1;
		text-align: right;
		letter-spacing: 0.04em;
		margin-right: 0;
	}

	/* sfondo allineato al bordo destro della lama: si confonde con
	   --color-bg dietro (gap tra le lame), stesso meccanismo desktop/gateway */
	.gateway-titles-bar.home-bar-visible .gateway-title span {
		background: var(--color-bg);
		border-color: transparent;
	}

	.gateway-title .title-d { display: none; }
	.gateway-title .title-m { display: inline; }
}
