/* ==========================================================================
   Andrea Paolucci - Base: font, colori, tipografia, pulsanti.
   Caricato in tutte le pagine. I nomi delle variabili sono quelli del
   design system (e del kit Elementor): cambia un colore qui e cambia ovunque.
   ========================================================================== */

/* ---------- Font (nel tema, nessuna chiamata a Google) ---------- */

@font-face { font-family: "Fira Sans"; src: url("../fonts/FiraSans-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Fira Sans"; src: url("../fonts/FiraSans-Italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Fira Sans"; src: url("../fonts/FiraSans-SemiBold.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Fira Sans"; src: url("../fonts/FiraSans-Bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Fira Sans"; src: url("../fonts/FiraSans-ExtraBold.woff2") format("woff2"); font-weight: 800; font-style: normal; font-display: swap; }
@font-face { font-family: "Gelasio"; src: url("../fonts/Gelasio-VariableFont_wght.woff2") format("woff2"); font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Gelasio"; src: url("../fonts/Gelasio-Italic-VariableFont_wght.woff2") format("woff2"); font-weight: 400 700; font-style: italic; font-display: swap; }

/* ---------- Token del design system ---------- */

:root {
	--font-sans: "Fira Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
	--font-serif: "Gelasio", Georgia, "Times New Roman", serif;

	/* Rampa calda del logo */
	--brand-red-700: #8f2018; --brand-red-600: #a92c22; --brand-red-500: #cb3b2f; --brand-red-300: #e08379; --brand-red-100: #f6d8d4;
	--brand-orange-600: #c85f08; --brand-orange-500: #ef7a14; --brand-orange-300: #f5ab6b; --brand-orange-100: #fde3cd;
	--brand-yellow-600: #d29208; --brand-yellow-500: #fbb828; --brand-yellow-300: #fdd582; --brand-yellow-100: #fef2d5;

	/* Neutri: fondo "carta" quasi neutro */
	--neutral-000: #ffffff; --neutral-050: #fbfbfa; --neutral-100: #f4f4f2; --neutral-200: #eaeae7; --neutral-300: #dbdbd6;
	--neutral-400: #b3b3ad; --neutral-500: #8a8378; --neutral-600: #5f5a53; --neutral-700: #3d3a36; --neutral-800: #252626; --neutral-900: #131313;

	/* Semantici */
	--surface-page: var(--neutral-100);
	--surface-card: var(--neutral-050);
	--surface-raised: var(--neutral-000);
	--surface-sunken: var(--neutral-200);
	--surface-inverse: var(--neutral-800);
	--text-body: var(--neutral-800);
	--text-muted: var(--neutral-600);
	--text-subtle: var(--neutral-500);
	--text-inverse: var(--neutral-050);
	--text-link: var(--brand-red-500);
	--text-link-hover: var(--brand-red-700);
	--border-subtle: var(--neutral-300);
	--border-strong: var(--neutral-400);
	--border-focus: var(--brand-orange-500);
	--status-success: #2f8f5b; --status-success-bg: #e2f2e9;
	--status-danger: #cb3b2f;  --status-danger-bg: #f6d8d4;

	/* L'arco del logo: una sola volta per pagina (fascia finale) */
	--gradient-brand: linear-gradient(100deg, var(--brand-red-500) 0%, var(--brand-orange-500) 55%, var(--brand-yellow-500) 100%);
	/* Stesso arco per la fascia finale, col rosso che tiene più spazio:
	   il testo bianco resta sul rosso (contrasto 4,8:1), il pulsante sul giallo. */
	--gradient-cta: linear-gradient(100deg, var(--brand-red-500) 0%, var(--brand-red-500) 38%, var(--brand-orange-500) 74%, var(--brand-yellow-500) 100%);
	--gradient-cta-mobile: linear-gradient(172deg, var(--brand-red-500) 0%, var(--brand-red-500) 52%, var(--brand-orange-500) 80%, var(--brand-yellow-500) 100%);

	/* Tipografia */
	--text-display-size: 4.5rem;
	--text-h1-size: 3.25rem;
	--text-h2-size: 2.375rem;
	--text-h3-size: 1.5rem;
	--text-h4-size: 1.1875rem;
	--text-lead-size: 1.25rem;
	--text-small-size: 0.875rem;
	--text-eyebrow-size: 0.75rem;

	/* Spazi */
	--space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px;
	--space-6: 32px; --space-7: 48px; --space-8: 64px; --space-9: 96px; --space-10: 128px;
	--container-max: 1180px;
	--container-narrow: 720px;
	--gutter: 32px;
	--section-y: 96px;
	--header-h: 76px;

	/* Raggi */
	--radius-xs: 4px; --radius-sm: 8px; --radius-md: 12px; --radius-lg: 18px; --radius-xl: 28px; --radius-pill: 999px;

	/* Ombre calde */
	--shadow-xs: 0 1px 2px rgba(37, 38, 38, .06);
	--shadow-sm: 0 2px 6px rgba(37, 38, 38, .07);
	--shadow-md: 0 8px 20px -6px rgba(37, 38, 38, .12);
	--shadow-lg: 0 18px 40px -12px rgba(37, 38, 38, .18);
	--shadow-brand: 0 12px 28px -10px rgba(203, 59, 47, .45);
	--ring-focus: 0 0 0 3px rgba(239, 122, 20, .35);

	/* Movimento */
	--ease-standard: cubic-bezier(.2, .8, .2, 1);
	--ease-out: cubic-bezier(.16, 1, .3, 1);
	--duration-fast: 120ms;
	--duration-base: 200ms;
	--duration-slow: 400ms;
}

@media (max-width: 820px) {
	:root {
		--text-display-size: 3rem;
		--text-h1-size: 2.375rem;
		--text-h2-size: 1.75rem;
		--text-h3-size: 1.3125rem;
		--text-lead-size: 1.125rem;
		--gutter: 20px;
		--section-y: 64px;
		--header-h: 64px;
	}
}

/* ---------- Base (sostituisce i default di Hello Elementor) ---------- */

html {
	scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
	margin: 0;
	background: var(--surface-page);
	color: var(--text-body);
	font-family: var(--font-sans);
	font-size: 1rem;
	line-height: 1.65;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 {
	color: inherit;
	font-family: var(--font-sans);
	font-weight: 800;
	line-height: 1.15;
	letter-spacing: -.02em;
	text-wrap: balance;
}
p {
	text-wrap: pretty;
}

a {
	color: var(--text-link);
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
	transition: color var(--duration-fast) var(--ease-standard);
}
a:hover,
a:active {
	color: var(--text-link-hover);
}

:focus-visible {
	outline: 1px solid var(--border-focus);
	outline-offset: 2px;
	box-shadow: var(--ring-focus);
}

::selection {
	background: var(--brand-yellow-300);
	color: var(--neutral-800);
}

img {
	max-width: 100%;
	height: auto;
}

.ap-container {
	box-sizing: border-box;
	width: 100%;
	max-width: calc(var(--container-max) + var(--gutter) * 2);
	margin-inline: auto;
	padding-inline: var(--gutter);
}

.ap-icon {
	display: inline-block;
	flex: none;
	width: 20px;
	height: 20px;
	vertical-align: middle;
}

.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}
.skip-link:focus {
	position: fixed !important;
	top: 12px;
	left: 12px;
	z-index: 10000;
	width: auto;
	height: auto;
	padding: 12px 20px;
	clip: auto;
	border-radius: var(--radius-pill);
	background: var(--neutral-800);
	color: var(--neutral-050);
}

/* ---------- Pulsanti (sempre a pillola) ---------- */

.ap-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--space-2);
	box-sizing: border-box;
	padding: 12px 24px;
	border: 1px solid transparent;
	border-radius: var(--radius-pill);
	font-family: var(--font-sans);
	font-size: 1rem;
	font-weight: 700;
	line-height: 1.2;
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
	transition:
		transform var(--duration-fast) var(--ease-standard),
		background-color var(--duration-base) var(--ease-standard),
		box-shadow var(--duration-base) var(--ease-standard),
		color var(--duration-base) var(--ease-standard);
}
.ap-btn:hover {
	transform: translateY(-2px);
}
.ap-btn:active {
	transform: translateY(1px) scale(.985);
}
.ap-btn--lg {
	padding: 16px 32px;
	font-size: 1.0625rem;
}
.ap-btn--block {
	display: flex;
	width: 100%;
}

.ap-btn--primary,
.ap-btn--primary:hover,
.ap-btn--primary:active {
	color: var(--text-inverse);
}
.ap-btn--primary {
	background: var(--brand-red-500);
	box-shadow: var(--shadow-brand);
}
.ap-btn--primary:hover {
	background: var(--brand-red-600);
}

.ap-btn--secondary {
	border-color: var(--brand-red-500);
	background: transparent;
	color: var(--brand-red-500);
}
.ap-btn--secondary:hover {
	background: var(--brand-red-100);
	color: var(--brand-red-600);
}

.ap-btn--inverse,
.ap-btn--inverse:hover {
	color: var(--neutral-800);
}
.ap-btn--inverse {
	background: var(--neutral-050);
}
.ap-btn--inverse:hover {
	background: var(--neutral-000);
}

.ap-btn--ghost {
	background: transparent;
	color: var(--text-body);
}
.ap-btn--ghost:hover {
	background: var(--neutral-200);
	color: var(--text-body);
}

/* ---------- Testi ricorrenti ---------- */

.ap-eyebrow {
	margin: 0 0 var(--space-3);
	color: var(--brand-red-500); /* l'arancio su carta non arriva a 4,5:1 sui testi piccoli */
	font-size: var(--text-eyebrow-size);
	font-weight: 800;
	line-height: 1.2;
	letter-spacing: .16em;
	text-transform: uppercase;
}

.ap-heading {
	max-width: 46rem;
}
.ap-heading__title {
	margin: 0;
	font-size: var(--text-h2-size);
	font-weight: 800;
	line-height: 1.12;
	letter-spacing: -.025em;
}
h1.ap-heading__title {
	font-size: var(--text-h1-size);
	line-height: 1.08;
}
.ap-lead {
	margin: var(--space-4) 0 0;
	max-width: 60ch;
	color: var(--text-muted);
	font-family: var(--font-serif);
	font-size: var(--text-lead-size);
	line-height: 1.6;
}

/* Parole tra *asterischi* nei titoli */
.ap-hl {
	color: var(--brand-red-500);
	font-style: normal;
}

.ap-badge {
	display: inline-flex;
	align-items: center;
	gap: var(--space-1);
	margin: 0;
	padding: 5px 12px;
	border-radius: var(--radius-pill);
	background: var(--neutral-200);
	color: var(--neutral-700);
	font-size: var(--text-eyebrow-size);
	font-weight: 800;
	line-height: 1.2;
	letter-spacing: .12em;
	text-transform: uppercase;
	white-space: nowrap;
}
.ap-badge--accent {
	background: var(--brand-yellow-100);
	color: var(--brand-red-700);
}

/* Immagine mancante: segnaposto dichiarato, mai decorativo */
.ap-placeholder {
	display: grid;
	place-items: center;
	box-sizing: border-box;
	width: 100%;
	height: 100%;
	min-height: 120px;
	border: 1px dashed var(--border-strong);
	border-radius: var(--radius-lg);
	background: var(--surface-sunken);
	color: var(--text-subtle);
	font-size: var(--text-eyebrow-size);
	font-weight: 800;
	letter-spacing: .14em;
	text-transform: uppercase;
}

/* ---------- Sezioni ---------- */

.ap-main {
	display: block;
}

.ap-section {
	padding-block: var(--section-y);
}
.ap-section--top {
	padding-top: var(--space-8);
}
.ap-section--tight {
	padding-block: var(--space-8);
}
.ap-section--card {
	background: var(--surface-card);
}
.ap-section--ink {
	background: var(--surface-inverse);
	color: var(--text-inverse);
}
.ap-section--ink .ap-eyebrow {
	color: var(--brand-yellow-500);
}
.ap-section--ink .ap-lead {
	color: var(--neutral-300);
}

.ap-section__head {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: var(--space-4) var(--space-6);
}

.ap-more {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
	font-weight: 700;
	text-decoration: none;
}
.ap-more .ap-icon {
	width: 18px;
	height: 18px;
	transition: transform var(--duration-base) var(--ease-standard);
}
.ap-more:hover .ap-icon {
	transform: translateX(3px);
}

/* Fascia finale a gradiente */
.ap-cta-section {
	padding-block: 0 var(--section-y);
}
.ap-cta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-5) var(--space-6);
	padding: clamp(32px, 6vw, 64px);
	border-radius: var(--radius-xl);
	background: var(--gradient-cta);
	color: var(--neutral-050);
}
.ap-cta__text {
	max-width: 30rem;
}
.ap-cta__title {
	margin: 0 0 var(--space-2);
	font-size: var(--text-h2-size);
	letter-spacing: -.02em;
}
.ap-cta p {
	margin: 0;
	max-width: 48ch;
	font-size: 1.0625rem;
}

/* Contenuto libero (Gutenberg o Elementor) dentro i template del tema */
.ap-page-content {
	padding-bottom: var(--section-y);
}

/* ---------- Filtri, paginazione, link "indietro" (portfolio e blog) ---------- */

.ap-chips {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-2);
	margin-top: var(--space-6);
}
.ap-chip {
	padding: 8px 18px;
	border: 1px solid var(--border-subtle);
	border-radius: var(--radius-pill);
	background: var(--surface-card);
	color: var(--text-body);
	font-size: .9375rem;
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
	transition: background-color var(--duration-fast) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard);
}
.ap-chip:hover {
	border-color: var(--border-strong);
	color: var(--text-body);
}
.ap-chip.is-active {
	border-color: var(--neutral-800);
	background: var(--neutral-800);
	color: var(--neutral-050);
}

.ap-empty {
	margin-top: var(--space-6);
	color: var(--text-muted);
	font-family: var(--font-serif);
	font-size: var(--text-lead-size);
}

.ap-pagination {
	margin-top: var(--space-7);
}
.ap-pagination .nav-links {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: var(--space-2);
}
.ap-pagination .page-numbers {
	display: grid;
	place-items: center;
	min-width: 44px;
	height: 44px;
	padding: 0 8px;
	box-sizing: border-box;
	border: 1px solid var(--border-subtle);
	border-radius: var(--radius-pill);
	color: var(--text-body);
	font-weight: 700;
	text-decoration: none;
}
.ap-pagination .page-numbers.current {
	border-color: var(--brand-red-500);
	background: var(--brand-red-500);
	color: var(--neutral-050);
}

.ap-back {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
	margin-bottom: var(--space-6);
	color: var(--text-muted);
	font-size: .9375rem;
	font-weight: 600;
	text-decoration: none;
}
.ap-back .ap-icon {
	width: 18px;
	height: 18px;
}

@media (max-width: 600px) {
	/* filtri su una riga che scorre */
	.ap-chips {
		flex-wrap: nowrap;
		margin-inline: calc(var(--gutter) * -1);
		padding: 2px var(--gutter) 6px;
		overflow-x: auto;
		scrollbar-width: none;
	}
	.ap-chips::-webkit-scrollbar {
		display: none;
	}
}

/* Fascia finale subito dopo una sezione chiara: serve spazio sopra */
.ap-section--card + .ap-cta-section,
.ap-section--ink + .ap-cta-section {
	padding-top: var(--section-y);
}

@media (max-width: 600px) {
	.ap-btn--lg {
		padding: 14px 24px;
		font-size: 1rem;
	}
	.ap-cta {
		background: var(--gradient-cta-mobile);
	}
	.ap-cta .ap-btn {
		width: 100%;
	}
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		transition-duration: 0s !important;
		animation-duration: 0s !important;
	}
	.ap-btn:hover,
	.ap-btn:active {
		transform: none;
	}
}
