/* =========================================================
   Essenza — template Joomla semplice ed essenziale
   Palette chiara e neutra con un solo colore accento
   ========================================================= */

:root {
	--bg: #fbfbfa;
	--surface: #ffffff;
	--text: #1f2328;
	--text-muted: #5b6470;
	--border: #e7e5e2;
	--border-soft: #f0efec;
	--shadow: 0 1px 2px rgba(20, 20, 20, 0.04), 0 6px 20px rgba(20, 20, 20, 0.05);
	--radius: 14px;
	--radius-sm: 8px;
	--font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

	--accent: #2f6fed;
	--accent-dark: #1f52c2;
	--accent-soft: #eaf1ff;

	/* fasce di colore neutro per staccare visivamente barra di navigazione e footer
	   dal corpo pagina (--bg) e dalle card bianche (--surface) */
	--tint-navbar: #f2f0ec;
	--tint-footer-links: #eef1f4;
	--tint-footer-bottom: #e7e4de;
}

body.accent-green {
	--accent: #1f9d55;
	--accent-dark: #16793f;
	--accent-soft: #e8f7ee;
}

body.accent-violet {
	--accent: #7c5cff;
	--accent-dark: #6041e0;
	--accent-soft: #f0ecff;
}

body.accent-terracotta {
	--accent: #d96a3d;
	--accent-dark: #b8532b;
	--accent-soft: #fbece3;
}

/* ---------- reset di base ---------- */

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

html {
	-webkit-text-size-adjust: 100%;
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font-family: var(--font);
	font-size: 16px;
	line-height: 1.65;
	-webkit-font-smoothing: antialiased;
}

img {
	max-width: 100%;
	height: auto;
	display: block;
	border-radius: var(--radius-sm);
}

a {
	color: var(--accent);
	text-decoration: none;
}

a:hover {
	text-decoration: underline;
}

h1, h2, h3, h4, h5, h6 {
	line-height: 1.25;
	font-weight: 700;
	letter-spacing: -0.01em;
	margin: 1.6em 0 0.6em;
}

h1:first-child, h2:first-child, h3:first-child {
	margin-top: 0;
}

h1 { font-size: 2.1rem; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.05rem; }

p { margin: 0 0 1.1em; }

ul, ol { padding-left: 1.3em; }

blockquote {
	margin: 1.4em 0;
	padding: 0.2em 1.2em;
	border-left: 3px solid var(--accent);
	color: var(--text-muted);
	font-style: italic;
}

code, pre {
	font-family: 'SFMono-Regular', Consolas, Menlo, monospace;
	font-size: 0.9em;
}

pre {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	padding: 1em;
	overflow: auto;
}

hr {
	border: none;
	border-top: 1px solid var(--border);
	margin: 2em 0;
}

table {
	width: 100%;
	border-collapse: collapse;
	margin: 1.2em 0;
}

table th, table td {
	text-align: left;
	padding: 0.6em 0.8em;
	border-bottom: 1px solid var(--border);
}

table th {
	color: var(--text-muted);
	font-weight: 600;
}

/* ---------- utility ---------- */

.tpl-container {
	max-width: 1180px;
	margin: 0 auto;
	padding: 0 1.5rem;
}

.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	border: 0;
}

.skip-link {
	position: absolute;
	left: 1rem;
	top: -3rem;
	background: var(--accent);
	color: #fff;
	padding: 0.6em 1em;
	border-radius: var(--radius-sm);
	z-index: 1000;
	transition: top 0.15s ease;
}

.skip-link:focus {
	top: 1rem;
	text-decoration: none;
}

.tpl-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.4em;
	background: var(--accent);
	color: #fff;
	padding: 0.65em 1.3em;
	border-radius: 999px;
	font-weight: 600;
	border: none;
	cursor: pointer;
}

.tpl-btn:hover {
	background: var(--accent-dark);
	text-decoration: none;
}

/* ---------- barra superiore (loghi/immagini + descrizione a colori) ---------- */

.tpl-topbar {
	background: var(--surface);
	border-bottom: 1px solid var(--border-soft);
}

.tpl-topbar__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 1rem 1.5rem;
	padding: 0.9rem 1.5rem;
}

.tpl-topbar__images {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 1.4rem;
	min-width: 0;
}

.tpl-topbar__logo,
.tpl-topbar__extra {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 1.4rem;
}

/* immagini caricate tramite moduli (es. "HTML personalizzato") nelle posizioni
   header-logo / header-images: azzeriamo i margini che l'editor potrebbe aggiungere
   e uniformiamo l'altezza per allineare loghi di dimensioni diverse */
.tpl-topbar__logo :where(p, div),
.tpl-topbar__extra :where(p, div) {
	margin: 0;
	display: flex;
	align-items: center;
}

/* altezza massima delle immagini nella barra superiore: le immagini che carichi
   vengono sempre ridotte a questa altezza (mantenendo le proporzioni), qualunque
   sia la loro dimensione reale — alza il valore se le vuoi più grandi */
.tpl-topbar__logo img,
.tpl-topbar__extra img {
	max-height: 160px;
	width: auto;
	border-radius: 0;
}

.tpl-topbar__logo--text {
	font-weight: 700;
	font-size: 1.25rem;
	color: var(--text);
	letter-spacing: -0.01em;
}

.tpl-topbar__logo--text:hover {
	text-decoration: none;
}

.tpl-topbar__badge {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	flex-shrink: 0;
	text-align: right;
}

.tpl-topbar__badge :where(p, div) {
	margin: 0;
}

.tpl-topbar__badge img {
	max-height: 160px;
	width: auto;
	border-radius: var(--radius-sm);
}

/* ---------- barra di navigazione (menu + ricerca) ---------- */

.tpl-navbar {
	position: sticky;
	top: 0;
	z-index: 100;
	background: rgba(242, 240, 236, 0.92);
	backdrop-filter: saturate(180%) blur(8px);
	border-bottom: 1px solid var(--border);
}

.tpl-navbar__inner {
	display: flex;
	align-items: center;
	gap: 1.5rem;
	padding: 0.7rem 1.5rem;
}

/* menu (mod_menu, style "none") */

.tpl-nav ul {
	list-style: none;
	display: flex;
	align-items: center;
	gap: 1.6rem;
	margin: 0;
	padding: 0;
}

.tpl-nav ul ul {
	display: none;
	position: absolute;
	flex-direction: column;
	gap: 0;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	box-shadow: var(--shadow);
	padding: 0.4rem;
	margin-top: 0.6rem;
	min-width: 190px;
}

.tpl-nav li {
	position: relative;
}

.tpl-nav li:hover > ul,
.tpl-nav li:focus-within > ul {
	display: flex;
}

.tpl-nav ul ul a {
	display: block;
	padding: 0.5em 0.7em;
	border-radius: 6px;
	color: var(--text);
}

.tpl-nav ul ul a:hover {
	background: var(--accent-soft);
	color: var(--accent-dark);
	text-decoration: none;
}

.tpl-nav a {
	color: var(--text);
	font-weight: 500;
	padding: 0.4em 0.1em;
}

.tpl-nav a:hover,
.tpl-nav li.current > a,
.tpl-nav li.active > a {
	color: var(--accent);
	text-decoration: none;
}

.tpl-search {
	margin-left: auto;
}

.tpl-search input[type="text"],
.tpl-search input[type="search"] {
	border: 1px solid var(--border);
	background: var(--surface);
	border-radius: 999px;
	padding: 0.45em 1em;
	font-family: var(--font);
	font-size: 0.9rem;
	width: 180px;
}

.tpl-search form {
	display: flex;
	gap: 0.4em;
}

.tpl-search button {
	border: 1px solid var(--border);
	background: var(--surface);
	border-radius: 999px;
	padding: 0.45em 0.9em;
	cursor: pointer;
}

/* toggle mobile */

.tpl-nav-toggle {
	display: none;
	flex-direction: column;
	justify-content: center;
	gap: 4px;
	width: 38px;
	height: 38px;
	background: transparent;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	cursor: pointer;
	align-items: center;
}

.tpl-nav-toggle__bar {
	width: 18px;
	height: 2px;
	background: var(--text);
	border-radius: 2px;
	transition: transform 0.2s ease, opacity 0.2s ease;
}

.tpl-nav-toggle.is-open .tpl-nav-toggle__bar:nth-child(1) {
	transform: translateY(6px) rotate(45deg);
}

.tpl-nav-toggle.is-open .tpl-nav-toggle__bar:nth-child(2) {
	opacity: 0;
}

.tpl-nav-toggle.is-open .tpl-nav-toggle__bar:nth-child(3) {
	transform: translateY(-6px) rotate(-45deg);
}

/* ---------- sezione top (hero / banner) ---------- */

.tpl-top {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1.5rem;
	padding-top: 2rem;
}

.tpl-top:has(.tpl-top__col:only-child) {
	grid-template-columns: 1fr;
}

/* ---------- card (usata da moduli top / sidebar) ---------- */

.tpl-card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 1.4rem 1.5rem;
	box-shadow: var(--shadow);
	margin-bottom: 1.5rem;
}

.tpl-card:last-child {
	margin-bottom: 0;
}

.tpl-card__title {
	margin: 0 0 0.8rem;
	font-size: 1rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--text-muted);
	position: relative;
	padding-left: 0.9rem;
}

.tpl-card__title::before {
	content: '';
	position: absolute;
	left: 0;
	top: 0.15em;
	bottom: 0.15em;
	width: 3px;
	border-radius: 2px;
	background: var(--accent);
}

.tpl-card__body ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.tpl-card__body li {
	padding: 0.5em 0;
	border-bottom: 1px solid var(--border-soft);
}

.tpl-card__body li:last-child {
	border-bottom: none;
}

/* ---------- layout principale ---------- */

.tpl-main {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 240px;
	gap: 2rem;
	padding: 2.2rem 1.5rem 3rem;
}

body.no-sidebar .tpl-main {
	grid-template-columns: minmax(0, 1fr);
}

.tpl-main--component {
	grid-template-columns: minmax(0, 1fr);
	max-width: 860px;
}

.tpl-content {
	min-width: 0;
}

/* ---------- elementi tipici dei componenti Joomla (com_content, ecc.) ---------- */

#breadcrumbs,
.breadcrumb {
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	gap: 0.4em;
	padding: 0;
	margin: 0 0 1.4rem;
	font-size: 0.85rem;
	color: var(--text-muted);
}

#breadcrumbs li,
.breadcrumb li {
	display: flex;
	align-items: center;
	gap: 0.4em;
}

#breadcrumbs li + li::before,
.breadcrumb li + li::before {
	content: '/';
	color: var(--border);
}

.page-header {
	border-bottom: 1px solid var(--border);
	padding-bottom: 0.8rem;
	margin-bottom: 1.4rem;
}

/* contenitore del modulo "Articoli" in homepage (posizione home-grid):
   la griglia vera e propria arriva dal modulo stesso (items-row/cols-N),
   qui aggiungiamo solo un po' di respiro rispetto al resto del contenuto */
.tpl-home-grid {
	margin-bottom: 2rem;
}

.tpl-home-grid:empty {
	display: none;
}

.item, .com-content-category-blog__item, .com-content-featured__item {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 1.5rem 1.6rem;
	margin-bottom: 1.6rem;
	box-shadow: var(--shadow);
}

/* griglia di anteprime (es. "Articoli in evidenza" con Colonne > 1):
   si adatta da sola al numero di colonne scelto in Joomla, senza bisogno
   di media query dedicate per ogni valore di cols-N */
.items-row {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
	gap: 1.4rem;
	margin-bottom: 1.6rem;
}

/* boxini più piccoli e compatti quando l'item è dentro una griglia:
   la cornice/ombra viene applicata a OGNI figlio diretto di items-row
   (non solo a .item), così funziona anche con moduli (es. "Articoli",
   DPCalendar, ecc.) che possono usare nomi di classe diversi da quelli
   standard di Joomla per ogni singolo elemento */
.items-row > * {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	margin-bottom: 0;
	padding: 1.1rem 1.2rem;
	display: flex;
	flex-direction: column;
}

.items-row img {
	height: 140px;
	width: 100%;
	object-fit: cover;
	margin-bottom: 0.8rem;
	border-radius: var(--radius-sm);
}

.items-row h2,
.items-row h3 {
	font-size: 1.05rem;
	margin: 0 0 0.4rem;
}

.items-row p {
	font-size: 0.9rem;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
	margin-bottom: 0.8em;
}

.items-row .article-info,
.items-row .readmore {
	margin-top: auto;
}

/* ---------- modulo "Articoli" (mod_articles) — griglia in homepage ----------
   Joomla 6 genera qui un markup proprio (classi mod-articles-*), diverso da
   quello del componente com_content: lo stiliamo puntando alle classi reali */

.mod-articles-items {
	list-style: none;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 1.4rem;
	margin: 0 0 1.6rem;
	padding: 0;
}

.mod-articles-items > li {
	margin: 0;
	display: flex;
}

.mod-articles-item {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	overflow: hidden;
	width: 100%;
	display: flex;
	flex-direction: column;
}

.mod-articles-item-content {
	padding: 1.1rem 1.2rem;
	display: flex;
	flex-direction: column;
	flex: 1;
}

.mod-articles-title {
	font-size: 1.05rem;
	margin: 0 0 0.5rem;
}

.mod-articles-title a {
	color: var(--text);
}

.mod-articles-title a:hover {
	color: var(--accent);
	text-decoration: none;
}

.mod-articles-item-content dl {
	display: flex;
	flex-wrap: wrap;
	gap: 0.2rem 0.8rem;
	margin: 0 0 0.7rem;
	padding: 0;
	color: var(--text-muted);
	font-size: 0.78rem;
}

.mod-articles-item-content dt {
	display: none;
}

.mod-articles-item-content dd {
	margin: 0;
	display: inline-flex;
	align-items: center;
	gap: 0.3em;
}

.mod-articles-item-content [class^="icon-"] {
	font-size: 0.9em;
	opacity: 0.8;
}

/* immagine piccola, tipo icona, non più a tutta larghezza */
.mod-articles-item-content img {
	width: 70px;
	height: 70px;
	object-fit: cover;
	border-radius: var(--radius-sm);
	margin: 0 0 0.6rem;
}

.mod-articles-item-content p:has(img) {
	margin: 0 0 0.7rem;
}

.mod-articles-item-content p:not(.readmore):not(:has(img)) {
	font-size: 0.9rem;
	margin: 0 0 0.7em;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.mod-articles-item-content .readmore {
	margin-top: auto;
	padding-top: 0.3rem;
}

/* pulsanti tipo "Leggi tutto" generati da Joomla (classi Bootstrap-like,
   qui senza Bootstrap: li stiliamo noi in coerenza col resto del template) */
.btn {
	display: inline-flex;
	align-items: center;
	gap: 0.35em;
	padding: 0.5em 1.1em;
	border-radius: 999px;
	font-weight: 600;
	font-size: 0.85rem;
	border: 1px solid transparent;
	cursor: pointer;
}

.btn-secondary {
	background: var(--accent-soft);
	color: var(--accent-dark);
}

.btn-secondary:hover {
	background: var(--accent);
	color: #fff;
	text-decoration: none;
}

.article-info, .com-content-article__info {
	color: var(--text-muted);
	font-size: 0.85rem;
	margin-bottom: 0.6rem;
}

.article-info-term { font-weight: 600; }

.badge, .label {
	display: inline-block;
	background: var(--accent-soft);
	color: var(--accent-dark);
	border-radius: 999px;
	padding: 0.15em 0.7em;
	font-size: 0.78rem;
	font-weight: 600;
}

.readmore a {
	font-weight: 600;
}

.pagination,
.pagination-list {
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	gap: 0.4em;
	padding: 0;
	margin: 2rem 0 0;
}

.pagination a,
.pagination span {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2.2em;
	height: 2.2em;
	padding: 0 0.5em;
	border-radius: 999px;
	border: 1px solid var(--border);
	color: var(--text);
}

.pagination a:hover {
	border-color: var(--accent);
	color: var(--accent);
	text-decoration: none;
}

/* alert / messaggi di sistema */

.alert {
	border-radius: var(--radius-sm);
	padding: 0.9em 1.2em;
	margin-bottom: 1.3rem;
	border: 1px solid var(--border);
	background: var(--surface);
}

.alert-success { border-color: #bfe3cc; background: #f1faf4; }
.alert-danger, .alert-error { border-color: #f0c2c2; background: #fdf3f3; }
.alert-warning { border-color: #f2ddb0; background: #fdf8ec; }
.alert-info { border-color: #bcd6f5; background: var(--accent-soft); }

/* moduli elenco (articoli recenti, popolari, ecc.) */

.tpl-sidebar ul, .tpl-card ul {
	list-style: none;
}

/* form (login, ricerca, contatti) */

input, select, textarea, button {
	font-family: var(--font);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="tel"],
input[type="url"],
select,
textarea {
	width: 100%;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	padding: 0.6em 0.8em;
	background: var(--surface);
	color: var(--text);
	margin-bottom: 0.8em;
}

button, input[type="submit"], input[type="button"] {
	background: var(--accent);
	color: #fff;
	border: none;
	border-radius: 999px;
	padding: 0.6em 1.3em;
	font-weight: 600;
	cursor: pointer;
}

button:hover, input[type="submit"]:hover {
	background: var(--accent-dark);
}

/* ---------- sidebar ---------- */

.tpl-sidebar {
	min-width: 0;
}

/* ---------- footer ---------- */

.tpl-footer {
	margin-top: 2rem;
	color: var(--text-muted);
	font-size: 0.9rem;
}

/* ogni blocco del footer è una fascia a piena larghezza con un colore proprio
   (diverso dal corpo pagina e dagli altri blocchi), con dentro un contenitore
   centrato che allinea il contenuto come nel resto del sito */
.tpl-footer__links-band {
	background: var(--tint-footer-links);
	border-top: 1px solid var(--border);
}

.tpl-footer__banners-band {
	background: var(--accent-soft);
}

.tpl-footer__bottom-band {
	background: var(--tint-footer-bottom);
}

/* blocco superiore: link e informazioni di servizio, a colonne */
.tpl-footer__links {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	gap: 1.6rem;
	padding: 2rem 1.5rem;
}

.tpl-footer__links ul {
	list-style: none;
	padding: 0;
	margin: 0;
}

.tpl-footer__links li {
	margin-bottom: 0.4em;
}

.tpl-footer__links :where(h3, h4) {
	color: var(--text);
	font-size: 0.95rem;
	margin: 0 0 0.7em;
}

/* blocco intermedio: banner, in riga */
.tpl-footer__banners {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 1.2rem;
	padding: 1.6rem 1.5rem;
}

.tpl-footer__banners :where(p, div) {
	margin: 0;
	display: flex;
}

/* altezza massima dei banner: alza il valore se li vuoi più grandi */
.tpl-footer__banners img {
	max-height: 220px;
	width: auto;
	border-radius: var(--radius-sm);
}

.tpl-footer__bottom {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	flex-wrap: wrap;
	padding: 1.1rem 1.5rem;
}

.tpl-footer__bottom p {
	margin: 0;
}

.tpl-back-top {
	color: var(--text-muted);
	font-weight: 600;
}

.tpl-back-top:hover {
	color: var(--accent);
}

/* ---------- pagina di errore ---------- */

.tpl-error {
	min-height: 70vh;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 2rem;
}

.tpl-error__box {
	text-align: center;
	max-width: 420px;
}

.tpl-error__code {
	font-size: 3.5rem;
	font-weight: 700;
	color: var(--accent);
	margin: 0;
}

/* ---------- responsive ---------- */

@media (max-width: 880px) {
	.tpl-nav-toggle {
		display: inline-flex;
	}

	.tpl-nav {
		display: none;
		position: absolute;
		left: 0;
		right: 0;
		top: 100%;
		background: var(--surface);
		border-bottom: 1px solid var(--border);
		box-shadow: var(--shadow);
		padding: 1rem 1.5rem;
	}

	.tpl-nav.is-open {
		display: block;
	}

	.tpl-nav ul {
		flex-direction: column;
		align-items: flex-start;
		gap: 0.2rem;
	}

	.tpl-nav ul ul {
		position: static;
		box-shadow: none;
		border: none;
		margin: 0 0 0 0.8rem;
		padding: 0;
		display: none;
	}

	.tpl-nav li.is-open > ul,
	.tpl-nav li:focus-within > ul {
		display: flex;
	}

	.tpl-navbar {
		position: relative;
	}

	.tpl-search {
		display: none;
	}

	.tpl-topbar__inner {
		justify-content: center;
		text-align: center;
	}

	.tpl-topbar__badge {
		justify-content: center;
		text-align: center;
	}

	.tpl-topbar__logo img,
	.tpl-topbar__extra img {
		max-height: 90px;
	}

	.tpl-main {
		grid-template-columns: 1fr;
	}

	.tpl-top {
		grid-template-columns: 1fr;
	}

	.items-row,
	.mod-articles-items {
		grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
		gap: 1rem;
	}
}

@media (max-width: 420px) {
	.items-row,
	.mod-articles-items {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 560px) {
	h1 { font-size: 1.7rem; }
	h2 { font-size: 1.35rem; }

	.tpl-topbar__inner,
	.tpl-navbar__inner {
		padding: 0.7rem 1rem;
	}

	.tpl-container {
		padding: 0 1rem;
	}

	.tpl-main {
		padding: 1.6rem 1rem 2.4rem;
	}

	.tpl-footer__bottom {
		flex-direction: column;
		align-items: flex-start;
	}
}
