/*
 * SEV84 — Restyling Progetti (Agenda 2030): card SDG e pagine di macro-area.
 * Caricato solo dove serve (pagine di area, pagine con gli shortcode [sev_macro_aree] / [sev_progetti]).
 *
 * Variabile per card/pagina: --sev-c = colore ufficiale dell'SDG.
 * Regole ONU sulle icone: niente ombre, ritagli o filtri sull'icona (.sev-card__icon, .sev-area-intro__icon img).
 */

.sev-area,
.sev-hub,
.sev-grid {
	--sev-ink: #212121;
	--sev-text: #666;
	--sev-muted: #6b6b6b;
	--sev-line: #ebe8df;
	--sev-sand: #f6f4ee;
	--sev-accent: #ffb422;
	--sev-radius: 6px;
}

/* ---------- Griglia ---------- */

.sev-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 30px;
	margin: 0 0 50px;
}
.sev-grid--1 { grid-template-columns: minmax(0, 1fr); }
.sev-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sev-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 1024px) {
	.sev-grid,
	.sev-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
}
@media (max-width: 600px) {
	.sev-grid,
	.sev-grid--2,
	.sev-grid--4 { grid-template-columns: minmax(0, 1fr); gap: 22px; }
}

/* Le 7 aree: l'ultima card, rimasta sola in fondo, va al centro e non a sinistra */
@media (min-width: 1025px) {
	.sev-grid--3.sev-grid--aree > .sev-card:last-child:nth-child(3n+1) { grid-column: 2; }
}
@media (min-width: 601px) and (max-width: 1024px) {
	.sev-grid--aree > .sev-card:last-child:nth-child(2n+1) {
		grid-column: 1 / -1;
		justify-self: center;
		width: calc(50% - 12px);
	}
}

/* ---------- Card ---------- */

.sev-card {
	--sev-c: #3c4650;
	position: relative;
	display: flex;
	flex-direction: column;
	min-width: 0;
	background: #fff;
	border-radius: var(--sev-radius);
	overflow: hidden;
	box-shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 10px 28px -12px rgba(0, 0, 0, .18);
	transition: transform .3s ease, box-shadow .3s ease;
}
.sev-card:hover {
	transform: translateY(-4px);
	box-shadow: 0 2px 4px rgba(0, 0, 0, .06), 0 18px 40px -14px rgba(0, 0, 0, .28);
}
.sev-card:focus-within {
	outline: 3px solid var(--sev-c);
	outline-offset: 3px;
}

.sev-card__media {
	position: relative;
	aspect-ratio: 4 / 3;
	overflow: hidden;
	background: var(--sev-c);
}
.sev-card__photo {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	filter: grayscale(1) contrast(1.08) brightness(1.05);
	transition: transform .6s ease;
}
.sev-card__tint {
	position: absolute;
	inset: 0;
	background: var(--sev-c);
	mix-blend-mode: multiply;
	opacity: .92;
	transition: opacity .35s ease;
}
.sev-card--no-photo .sev-card__tint { opacity: 1; mix-blend-mode: normal; }
.sev-card:hover .sev-card__photo { transform: scale(1.05); }
.sev-card:hover .sev-card__tint { opacity: .78; }

/* Icona SDG: intera, piatta, sul suo colore (linee guida ONU) */
.sev-card__icon {
	position: absolute;
	left: 50%;
	top: 50%;
	z-index: 1;
	width: 32%;
	max-width: 120px;
	height: auto;
	transform: translate(-50%, -50%);
}

.sev-card__body {
	display: flex;
	flex-direction: column;
	flex: 1;
	padding: 22px 24px 24px;
	border-top: 4px solid var(--sev-c);
}
.sev-card__kicker {
	margin: 0 0 8px;
	font-family: "Open Sans", sans-serif;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.5;
	letter-spacing: .05em;
	text-transform: uppercase;
	color: var(--sev-muted);
}
.sev-card__title {
	margin: 0 0 10px;
	font-family: Merriweather, serif;
	font-size: 18px;
	font-weight: 700;
	line-height: 1.45;
	color: var(--sev-ink);
}
.sev-card__title a {
	color: inherit;
	text-decoration: none;
	outline: none;
}
/* Tutta la card è cliccabile, ma il link vero resta il titolo (accessibile) */
.sev-card__title a::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 2;
}
.sev-card__text {
	margin: 0 0 18px;
	font-size: 14px;
	line-height: 24px;
	color: var(--sev-text);
}
.sev-card__more {
	margin: auto 0 0;
	font-family: "Open Sans", sans-serif;
	font-size: 14px;
	font-weight: 600;
	color: var(--sev-ink);
}
.sev-card__arrow {
	display: inline-block;
	margin-left: 4px;
	color: var(--sev-c);
	transition: transform .25s ease;
}
.sev-card:hover .sev-card__arrow { transform: translateX(4px); }

/* Variante compatta (elenco "Le altre aree") */
.sev-card--compact .sev-card__media { aspect-ratio: 16 / 9; }
.sev-card--compact .sev-card__icon { width: 26%; max-width: 84px; }
.sev-card--compact .sev-card__body { padding: 16px 20px 18px; }
.sev-card--compact .sev-card__title { font-size: 16px; margin-bottom: 6px; }
.sev-card--compact .sev-card__kicker { font-size: 11px; }

/* ---------- Pagina di area ---------- */

.sev-area { padding: 10px 0 40px; }

.sev-admin-note {
	margin: 0 0 30px;
	padding: 12px 16px;
	border-left: 4px solid var(--sev-accent);
	background: #fff8e6;
	font-size: 13px;
	line-height: 1.6;
	color: #5b4a1a;
}

.sev-area-intro {
	display: grid;
	grid-template-columns: 160px minmax(0, 1fr);
	gap: 40px;
	align-items: start;
	margin: 0 0 60px;
	padding: 0 0 50px;
	border-bottom: 1px solid var(--sev-line);
}
.sev-area-intro__icon img {
	display: block;
	width: 160px;
	height: auto;
}
.sev-area-intro__kicker {
	margin: 0 0 14px;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: .05em;
	text-transform: uppercase;
	color: var(--sev-muted);
}
.sev-area-intro__kicker::before {
	content: "";
	display: inline-block;
	width: 28px;
	height: 4px;
	margin-right: 10px;
	vertical-align: middle;
	background: var(--sev-c);
}
.sev-area-intro__text,
.sev-area-intro__text p {
	font-size: 17px;
	line-height: 30px;
	color: #555;
}
.sev-area-intro__text p:last-child { margin-bottom: 0; }
.sev-area-intro__text--todo {
	padding: 14px 16px;
	border: 1px dashed #c9c3b3;
	font-size: 14px;
	line-height: 24px;
	color: #8a8170;
}
.sev-area-intro__count {
	margin: 18px 0 0;
	font-family: Merriweather, serif;
	font-size: 15px;
	font-weight: 700;
	color: var(--sev-ink);
}

.sev-section { margin: 0 0 20px; }
.sev-section__title {
	margin: 0 0 34px;
	font-family: Merriweather, serif;
	font-size: 24px;
	font-weight: 700;
	line-height: 1.3;
	color: var(--sev-ink);
}
.sev-section__title::after {
	content: "";
	display: block;
	width: 60px;
	height: 3px;
	margin-top: 16px;
	background: var(--sev-accent);
}
.sev-section--altre { padding-top: 50px; border-top: 1px solid var(--sev-line); }

.sev-empty { font-size: 15px; color: var(--sev-text); }
.sev-back { margin: 10px 0 0; text-align: center; }

@media (max-width: 768px) {
	.sev-area-intro {
		grid-template-columns: 96px minmax(0, 1fr);
		gap: 22px;
		margin-bottom: 40px;
		padding-bottom: 36px;
	}
	.sev-area-intro__icon img { width: 96px; }
	.sev-area-intro__text,
	.sev-area-intro__text p { font-size: 15px; line-height: 26px; }
	.sev-section__title { font-size: 21px; margin-bottom: 26px; }
}

@media (prefers-reduced-motion: reduce) {
	.sev-card,
	.sev-card__photo,
	.sev-card__tint,
	.sev-card__arrow { transition: none; }
	.sev-card:hover { transform: none; }
	.sev-card:hover .sev-card__photo { transform: none; }
}
