/* ── AI & Automazione page ───────────────────────────────────────── */

:root { --ai-cta-bg: #000; }
@media ( prefers-color-scheme: light ) {
	:root:not( [data-theme="dark"] ) { --ai-cta-bg: #d0d0d0; }
}
:root[data-theme="light"] { --ai-cta-bg: #d0d0d0; }

/* ── WP wrapper resets ─────────────────────────────────────────────── */
.page-ai-automazione .wp-block-post-title { display: none; }
.page-ai-automazione body,
.page-ai-automazione .wp-site-blocks { overflow-x: hidden; }
.page-ai-automazione .wp-block-post-content,
.page-ai-automazione .entry-content,
.page-ai-automazione article,
.page-ai-automazione main > *,
.page-ai-automazione .wp-site-blocks > * {
	padding-top: 0 !important;
	margin-top: 0 !important;
}
.page-ai-automazione .wp-block-post-content > *:first-child,
.page-ai-automazione .entry-content > *:first-child { margin-top: 0 !important; }

/* ── Outer wrapper ─────────────────────────────────────────────────── */
.ai-page {
	width: 100vw !important;
	max-width: 100vw !important;
	margin-left: calc( 50% - 50vw ) !important;
	margin-right: calc( 50% - 50vw ) !important;
	box-sizing: border-box;
	background: var( --bg );
	color: var( --text );
	overflow-x: hidden;
}

.ai-accent { color: var( --accent-orange ); }

/* ── Hero ──────────────────────────────────────────────────────────── */
.ai-hero {
	display: grid;
	grid-template-columns: 1fr 1fr;
	align-items: center;
	gap: clamp( 40px, 6vw, 80px );
	padding:
		clamp( 60px, 8vh, 100px )
		clamp( 24px, 6vw, 96px )
		clamp( 40px, 6vh, 80px );
	max-width: 1440px;
	margin: 0 auto;
	box-sizing: border-box;
}

.ai-hero__content { display: flex; flex-direction: column; }

.ai-hero__title {
	font-family: var( --wp--preset--font-family--manrope );
	font-weight: 800;
	font-size: clamp( 2.6rem, 5.2vw, 4.6rem );
	line-height: 1.05;
	letter-spacing: -0.02em;
	color: var( --text );
	margin: 0 0 clamp( 20px, 3vh, 36px );
}

.ai-hero__tagline {
	font-size: clamp( 1rem, 1.8vw, 1.35rem );
	font-weight: 600;
	color: var( --accent-orange );
	line-height: 1.35;
	margin: 0 0 clamp( 24px, 4vh, 40px );
}

.ai-hero__body {
	color: var( --text-muted );
	font-size: clamp( 0.88rem, 1.3vw, 1.02rem );
	line-height: 1.8;
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 1em;
}
.ai-hero__body p { margin: 0; }

.ai-hero__visual {
	display: flex;
	align-items: center;
	justify-content: center;
}
.ai-hero__visual img {
	width: 100%;
	max-width: 560px;
	height: auto;
	filter: drop-shadow( 0 24px 64px rgba( 255, 122, 26, 0.18 ) );
	animation: ai-float 6s ease-in-out infinite;
}
@keyframes ai-float {
	0%, 100% { transform: translateY( 0 ); }
	50%       { transform: translateY( -14px ); }
}

/* ── Services list ─────────────────────────────────────────────────── */
.ai-services {
	padding:
		clamp( 60px, 10vh, 120px )
		clamp( 24px, 6vw, 96px );
	max-width: 1440px;
	margin: 0 auto;
}

.ai-services__heading {
	font-family: var( --wp--preset--font-family--manrope );
	font-weight: 800;
	font-size: clamp( 2rem, 4vw, 3.5rem );
	line-height: 1.05;
	letter-spacing: -0.02em;
	color: var( --text );
	text-align: center;
	margin: 0 0 clamp( 40px, 6vh, 72px );
}

.ai-services__list {
	display: flex;
	flex-direction: column;
	gap: clamp( 10px, 1.4vw, 16px );
	max-width: 960px;
	margin: 0 auto;
}

/* Riga servizio — card orizzontale */
.ai-row {
	display: grid;
	grid-template-columns: 88px 1fr 52px;
	align-items: center;
	gap: clamp( 20px, 3vw, 36px );
	padding: clamp( 20px, 3vh, 28px ) clamp( 24px, 3vw, 36px );
	background: var( --surface );
	border: 1px solid var( --border );
	border-radius: 20px;
	text-decoration: none;
	color: var( --text );
	transition:
		transform 0.3s cubic-bezier( 0.34, 1.56, 0.64, 1 ),
		box-shadow 0.3s ease,
		border-color 0.25s ease;
}
.ai-row:hover {
	transform: translateY( -4px );
	border-color: var( --accent-orange );
	box-shadow: 0 16px 48px rgba( 255, 122, 26, 0.15 ), 0 0 0 1px var( --accent-orange );
}

.ai-row__icon {
	width: 88px;
	height: 88px;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}
.ai-row__icon img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	transition: transform 0.35s ease;
}
.ai-row:hover .ai-row__icon img { transform: scale( 1.08 ); }

.ai-row__body { min-width: 0; }

.ai-row__title {
	font-family: var( --wp--preset--font-family--manrope );
	font-weight: 800;
	font-size: clamp( 1.1rem, 2vw, 1.45rem );
	line-height: 1.2;
	color: var( --text );
	margin: 0 0 0.3em;
}
.ai-row__subtitle {
	font-size: clamp( 0.85rem, 1.2vw, 1rem );
	color: var( --text-muted );
	line-height: 1.5;
	margin: 0;
}

.ai-row__arrow {
	width: 44px;
	height: 44px;
	border-radius: 50%;
	border: 1.5px solid var( --accent-orange );
	color: var( --accent-orange );
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1rem;
	flex-shrink: 0;
	transition: background 0.25s ease, transform 0.25s ease;
}
.ai-row:hover .ai-row__arrow {
	background: var( --accent-orange );
	color: #fff;
	transform: translateX( 4px );
}

/* ── CTA finale ────────────────────────────────────────────────────── */
.ai-cta {
	position: relative;
	display: grid;
	grid-template-columns: 120px 1fr auto;
	align-items: center;
	gap: clamp( 24px, 4vw, 56px );
	padding:
		clamp( 48px, 8vh, 96px )
		clamp( 24px, 6vw, 96px );
	max-width: 1440px;
	margin: 0 auto;
	box-sizing: border-box;
}
.ai-cta::before {
	content: '';
	position: absolute;
	top: 0; bottom: 0;
	left: 50%;
	transform: translateX( -50% );
	width: 100vw;
	background: var( --ai-cta-bg );
	z-index: 0;
}
.ai-cta > * { position: relative; z-index: 1; }

.ai-cta__visual img {
	width: 120px;
	height: 120px;
	object-fit: contain;
	filter: drop-shadow( 0 8px 24px rgba( 255, 122, 26, 0.25 ) );
}

.ai-cta__content {}
.ai-cta__title {
	font-family: var( --wp--preset--font-family--manrope );
	font-weight: 800;
	font-size: clamp( 1.4rem, 2.8vw, 2.2rem );
	line-height: 1.15;
	letter-spacing: -0.01em;
	color: var( --text );
	margin: 0 0 0.5em;
}
.ai-cta__body {
	font-size: clamp( 0.88rem, 1.3vw, 1rem );
	color: var( --text-muted );
	line-height: 1.7;
	margin: 0;
}

.ai-cta__btn {
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
	padding: 0.85em 2em;
	background: var( --accent-orange );
	color: #fff;
	font-weight: 700;
	font-size: 0.95rem;
	letter-spacing: 0.02em;
	border-radius: 100px;
	text-decoration: none;
	white-space: nowrap;
	flex-shrink: 0;
	transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.ai-cta__btn:hover {
	background: #e06010;
	transform: translateY( -2px );
	box-shadow: 0 8px 24px rgba( 255, 122, 26, 0.35 );
}

/* ── Tablet ────────────────────────────────────────────────────────── */
@media ( max-width: 1100px ) {
	.ai-hero {
		grid-template-columns: 1fr;
		padding-top: clamp( 100px, 12vh, 140px );
	}
	.ai-hero__visual { order: -1; }
	.ai-hero__visual img { max-width: 360px; }

	.ai-cta {
		grid-template-columns: 80px 1fr;
		grid-template-rows: auto auto;
	}
	.ai-cta__visual { grid-column: 1; grid-row: 1; }
	.ai-cta__content { grid-column: 2; grid-row: 1; }
	.ai-cta__btn { grid-column: 1 / -1; grid-row: 2; justify-self: start; }
}

/* ── Mobile ────────────────────────────────────────────────────────── */
@media ( max-width: 600px ) {
	.ai-hero { padding: 90px 20px 48px; gap: 28px; }
	.ai-hero__content,
	.ai-hero__visual { padding-left: 20px; padding-right: 20px; }
	.ai-hero__visual img { max-width: 280px; }

	.ai-services { padding: 48px 20px; }

	/* Card orizzontale → icona sopra, testo + freccia sotto */
	.ai-row {
		grid-template-columns: 1fr auto;
		grid-template-rows: auto auto;
		gap: 12px 14px;
		padding: 20px;
	}
	.ai-row__icon {
		grid-column: 1 / -1;
		grid-row: 1;
		width: 60px;
		height: 60px;
	}
	.ai-row__body {
		grid-column: 1;
		grid-row: 2;
	}
	.ai-row__arrow {
		grid-column: 2;
		grid-row: 2;
		align-self: center;
		width: 38px;
		height: 38px;
	}

	/* CTA — reset esplicito dei grid-placement dal breakpoint tablet */
	.ai-cta {
		padding: 48px 20px;
		grid-template-columns: 1fr;
		grid-template-rows: auto auto;
		text-align: center;
	}
	.ai-cta__visual { display: none; }
	.ai-cta__content { grid-column: 1; grid-row: 1; }
	.ai-cta__btn    { grid-column: 1; grid-row: 2; justify-self: center; }
}
