/* layout.css – container e grid */
/* Container unico: stesso spazio laterale ovunque; minimo = --space-x (come su mobile), mai meno. */
.container {
	width: 100%;
	max-width: min(1200px, 100%);
	margin: 0 auto;
	padding-left: max(var(--space-x), env(safe-area-inset-left, 0px));
	padding-right: max(var(--space-x), env(safe-area-inset-right, 0px));
	padding-top: 0;
	padding-bottom: 0;
	min-width: 0;
	box-sizing: border-box;
}
.container > * {
	max-width: 100%;
	min-width: 0;
}
body { padding-top: var(--header-height, 10.5rem); }
/* Homepage: solo navbar (no title bar), fallback più basso per evitare barra bianca su Safari */
body.home { padding-top: var(--header-height, 5rem); }
/* Unica regola: distanza linea fine title bar → inizio contenuto (tutte le pagine, desktop e mobile) */
.site-main {
	position: relative;
	z-index: 0;
	min-height: 60vh;
	min-width: 0;
	max-width: 100%;
	overflow-x: hidden;
	padding-top: 1rem;
}
.site-main > * { margin-top: 0; padding-top: 0; }
.post-grid {
	display: grid;
	gap: 1.5rem;
	grid-template-columns: 1fr;
}
@media (min-width: 640px) {
	.post-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 960px) {
	.post-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1200px) {
	.post-grid { grid-template-columns: repeat(4, 1fr); }
}

/* Header fisso: barra lettura + navbar in un unico blocco sopra a tutto */
.site-header-fixed {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 100000;
}

/* Navbar – nero pieno, blocca contenuto sotto */
.navbar {
	position: relative;
	top: 0;
	left: 0;
	right: 0;
	color: #fff;
	padding: 0.75rem 0;
	min-height: 3.25rem;
	box-shadow: 0 1px 3px rgba(0,0,0,0.15);
	background: #000;
	overflow: hidden;
}
.navbar::before {
	content: "";
	position: absolute;
	inset: 0;
	background: #000;
	z-index: 0;
	pointer-events: none;
}
.navbar-inner {
	position: relative;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: space-between;
	pointer-events: auto;
	min-width: 0;
}
.navbar-brand {
	font-weight: 700;
	font-size: clamp(1.5rem, 4vw, 2.5rem);
	min-width: 0;
	overflow-wrap: break-word;
	word-break: break-word;
	text-shadow: 0 1px 2px rgba(0,0,0,0.8), 0 0 4px rgba(0,0,0,0.6);
}
.navbar-brand:hover { text-decoration: none; }
.navbar-toggle {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	background: transparent;
	border: none;
	color: inherit;
	cursor: pointer;
}
.navbar-toggle-icon { width: 24px; height: 2px; background: currentColor; box-shadow: 0 -6px 0, 0 6px 0; }
.navbar-menu { width: 100%; }
.navbar-list { display: flex; flex-wrap: wrap; gap: 0 1rem; }

/* Voci menu: animazione di zoom applicata al <li>, non direttamente al testo,
   per un comportamento più uniforme tra browser (incluso Safari). */
.navbar-list li {
	display: inline-flex;
	align-items: center;
	transition: transform 0.2s ease;
	transform-origin: center;
	transform: translateZ(0);
	will-change: transform;
}

.navbar-list li > a {
	display: inline-flex;
	align-items: center;
	padding: 0.5rem 0;
	font-weight: 700;
	line-height: 1.1;
	text-shadow: 0 1px 2px rgba(0,0,0,0.8), 0 0 4px rgba(0,0,0,0.6);
	transform-origin: center;
	backface-visibility: hidden;
	-webkit-backface-visibility: hidden;
}

.navbar-list li:hover {
	transform: translateZ(0) scale(1.05);
}

.navbar-brand,
.navbar-list a,
.navbar-list a:hover { text-decoration: none; }


.navbar-social { display: none; }

/* Mobile: menu laterale (drawer) – non modifica l’altezza della navbar */
@media (max-width: 899px) {
	.navbar-drawer-overlay {
		display: none;
		position: fixed;
		inset: 0;
		background: rgba(0, 0, 0, 0.4);
		z-index: 100000;
		opacity: 0;
		transition: opacity 0.25s ease;
	}
	.navbar-drawer-overlay.is-visible {
		display: block;
		opacity: 1;
	}
	.navbar-menu {
		position: fixed;
		top: 0;
		right: 0;
		width: 280px;
		max-width: 85vw;
		height: 100vh;
		background: #000;
		display: flex;
		flex-direction: column;
		justify-content: flex-start;
		padding: 4rem 0 2rem;
		box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
		transform: translateX(100%);
		/* Evita flash/scatti al passaggio desktop -> mobile durante resize. */
		transition: none;
		z-index: 100001;
		overflow-y: auto;
	}
	.navbar-menu.is-open {
		transform: translateX(0);
	}
	.navbar-menu .navbar-list {
		flex-direction: column;
		flex-wrap: nowrap;
		gap: 0;
		padding: 0 1.25rem;
	}
	/* Drawer: ogni voce del menu deve coprire tutta la larghezza cliccabile */
	.navbar-menu .navbar-list li {
		display: block;
		width: 100%;
	}
	.navbar-menu .navbar-list a {
		padding: 0.75rem 0;
		display: block;
		width: 100%;
		font-size: 1.0625rem;
		border-bottom: 1px solid rgba(255, 255, 255, 0.1);
		transition: transform 0.2s ease;
	}
	.navbar-menu .navbar-list a:hover {
		background: rgba(255, 255, 255, 0.06);
		margin: 0 -1.25rem;
		padding-left: 1.25rem;
		padding-right: 1.25rem;
		text-decoration: none;
		transform: scale(1.05);
	}

	.navbar-menu .navbar-social {
		display: block;
		margin-top: auto;
		padding: 1.25rem 1.25rem 0.75rem;
		border-top: 1px solid rgba(255, 255, 255, 0.1);
	}
	.navbar-menu .navbar-social .brand-social {
		margin-top: 0;
		gap: 0.9rem;
		justify-content: flex-start;
	}
	.navbar-menu .navbar-social .brand-social-link {
		color: #fff;
		background: rgba(255, 255, 255, 0.02);
		border: none;
		width: auto;
		height: auto;
		padding: 0.25rem 0;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		border-radius: 8px;
		transition: background 0.2s ease, color 0.2s ease;
	}
	.navbar-menu .navbar-social .brand-social-link:hover {
		background: rgba(255, 255, 255, 0.14);
		color: #fff;
		transform: scale(1.05);
	}
	.navbar-menu .navbar-social .brand-social-icon {
		width: 22px;
		height: 22px;
	}
}
@media (min-width: 900px) {
	.navbar {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding-top: 1.125rem;
		padding-bottom: 1.125rem;
		padding-right: var(--space-x);
		min-height: 4.875rem;
	}
	.navbar-inner {
		flex: 1;
	}
	.navbar-toggle { display: none; }
	.navbar-drawer-overlay { display: none !important; }
	.navbar-menu {
		width: auto;
		display: block;
		position: relative;
		z-index: 1;
		height: auto;
		transform: none;
		padding: 0;
		background: transparent;
		box-shadow: none;
		overflow: visible;
		flex-shrink: 0;
		color: #fff;
	}
	.navbar-menu .navbar-list a {
		color: #fff;
	}

	/* HOME visibile solo in mobile: nasconde il primo item della navbar (che tipicamente è Home). */
	.navbar-list li:first-child {
		display: none;
	}
}

/* Blocco titolo: subito sotto la navbar, attaccato (tutte le pagine) — sfondo nero, testo chiaro */
.article-title-bar {
	margin: 0;
	padding: 1rem 0;
	min-height: 5rem;
	background: #000;
	color: #fff;
	box-shadow: 0 1px 0 rgba(255, 255, 255, 0.12);
}
.article-title-bar .container { padding-top: 0; padding-bottom: 0; min-width: 0; }
.article-title-bar .article-title {
	margin: 0 0 0.25em;
	min-width: 0;
	overflow-wrap: break-word;
	word-break: break-word;
	color: #fff;
}
.article-title-bar .article-title a {
	color: #fff;
	text-decoration: underline;
	text-decoration-color: rgba(255, 255, 255, 0.45);
}
.article-title-bar .article-title a:hover {
	color: #fff;
	text-decoration-color: rgba(255, 255, 255, 0.9);
}
.article-title-bar .article-meta { margin: 0; min-width: 0; overflow-wrap: break-word; word-break: break-word; }
/* Pill autore/data/categorie su singolo articolo: leggibili sulla barra scura */
.article-title-bar .post-card-term {
	background: rgba(255, 255, 255, 0.14);
	color: #f0f0f0;
}
.article-title-bar .post-card-term:hover {
	background: rgba(255, 255, 255, 0.24);
	color: #fff;
}
.article-title-bar .post-card-term-author {
	background: rgba(255, 255, 255, 0.18);
}
.article-title-bar .post-card-term-author:hover {
	background: rgba(255, 255, 255, 0.28);
}
.article-title-bar .post-card-term-date {
	background: rgba(255, 255, 255, 0.1);
	color: rgba(255, 255, 255, 0.88);
}
.article-title-bar .post-card-term-date:hover {
	background: rgba(255, 255, 255, 0.2);
	color: #fff;
}
.article-title-bar .post-card-term-category {
	background: rgba(255, 255, 255, 0.12);
}
.article-title-bar .post-card-term-category:hover {
	background: rgba(255, 255, 255, 0.22);
}
.article-title-bar .post-card-term-tag {
	background: rgba(255, 255, 255, 0.12);
}
.article-title-bar .post-card-term-tag:hover {
	background: rgba(255, 255, 255, 0.22);
}

/* Su singolo articolo il contenuto inizia sotto navbar + blocco titolo (padding su body) */

/* Pagination */
.nav-links { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 2rem 0; justify-content: center; }
.nav-links a, .nav-links span { padding: 0.5rem 0.75rem; background: #f0f0f0; border-radius: 4px; }
.nav-links .current { font-weight: 700; }
.nav-links a:hover { background: #e0e0e0; }
.no-results { padding: 2rem 0; text-align: center; color: #555; }
