/*
 * Restauri – Raccolta fondi
 * I colori si possono cambiare dal tema o da Aspetto → Personalizza → CSS aggiuntivo:
 *   .rrf { --rrf-oro: #b0802a; --rrf-lapis: #24496d; }
 * Il font è ereditato dal tema.
 */
.rrf {
	--rrf-lapis: #2f5d8a;   /* testi d'accento, link */
	--rrf-oro: #c1922e;     /* riempimento delle barre */
	--rrf-verde: #5f8f7a;   /* completato */
	--rrf-rosso: #b23a2e;   /* fondi non ancora sufficienti per partire */
	--rrf-linea: rgba(128, 128, 128, 0.28);
	--rrf-fondo: rgba(128, 128, 128, 0.08);
	--rrf-tenue: rgba(128, 128, 128, 0.9);
	--rrf-raggio: 6px;
	font-variant-numeric: tabular-nums;
	line-height: 1.55;
}
.rrf *,
.rrf *::before,
.rrf *::after {
	box-sizing: border-box;
}
.rrf a:focus-visible {
	outline: 2px solid var(--rrf-lapis);
	outline-offset: 3px;
}

/* ---------- Barra di avanzamento ---------- */
.rrf-bar {
	position: relative;
	height: 8px;
	background: var(--rrf-fondo);
	border: 1px solid var(--rrf-linea);
	border-radius: 999px;
	overflow: hidden;
}
/* tacche al 25/50/75% */
.rrf-bar::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(90deg,
		transparent calc(25% - 0.5px), var(--rrf-linea) calc(25% - 0.5px), var(--rrf-linea) calc(25% + 0.5px), transparent calc(25% + 0.5px),
		transparent calc(50% - 0.5px), var(--rrf-linea) calc(50% - 0.5px), var(--rrf-linea) calc(50% + 0.5px), transparent calc(50% + 0.5px),
		transparent calc(75% - 0.5px), var(--rrf-linea) calc(75% - 0.5px), var(--rrf-linea) calc(75% + 0.5px), transparent calc(75% + 0.5px));
	pointer-events: none;
}
.rrf-bar__fill {
	display: block;
	height: 100%;
	background: var(--rrf-oro);
	border-radius: inherit;
}
.rrf-bar--completo .rrf-bar__fill { background: var(--rrf-verde); }
/* Fondi raccolti ma lavori in corso: fasce oblique come il nastro di un cantiere aperto */
.rrf-bar--finanziato .rrf-bar__fill {
	background: repeating-linear-gradient(-45deg,
		var(--rrf-oro) 0, var(--rrf-oro) 8px,
		var(--rrf-verde) 8px, var(--rrf-verde) 16px);
	background-size: 22.63px 22.63px;
}
.rrf-bar--finanziato.rrf-bar--small .rrf-bar__fill {
	background: repeating-linear-gradient(-45deg,
		var(--rrf-oro) 0, var(--rrf-oro) 5px,
		var(--rrf-verde) 5px, var(--rrf-verde) 10px);
	background-size: 14.14px 14.14px;
}
@media (prefers-reduced-motion: no-preference) {
	.rrf-bar--finanziato.rrf-bar--large .rrf-bar__fill {
		animation: rrf-riempi 0.9s ease-out both, rrf-cantiere 3s linear 0.9s infinite;
	}
	@keyframes rrf-cantiere { to { background-position: 22.63px 0; } }
}
.rrf-bar--large { height: 14px; }
.rrf-bar--small { height: 5px; }
@media (prefers-reduced-motion: no-preference) {
	.rrf-bar__fill { animation: rrf-riempi 0.9s ease-out both; transform-origin: left; }
	@keyframes rrf-riempi { from { transform: scaleX(0); } to { transform: scaleX(1); } }
}

/* Fondi sotto la soglia di avvio: barra rossa */
.rrf-bar--insufficiente .rrf-bar__fill { background: var(--rrf-rosso); }
/* Tacca sulla soglia di avvio */
.rrf-bar__soglia {
	position: absolute;
	top: -1px;
	bottom: -1px;
	width: 2px;
	margin-left: -1px;
	background: currentColor;
	opacity: 0.55;
	z-index: 1;
}

.rrf-soglia-label {
	position: relative;
	height: 1.4em;
	font-size: 0.78em;
	opacity: 0.8;
}
.rrf-soglia-label span {
	position: absolute;
	top: 0.25em;
	transform: translateX(-50%);
	white-space: nowrap;
}

/* Lavori finiti, spese da coprire: barra ocra, parte mancante tratteggiata in verde */
.rrf-bar--da-coprire {
	border-color: var(--rrf-verde);
	background: repeating-linear-gradient(-45deg,
		transparent 0, transparent 5px,
		rgba(95, 143, 122, 0.35) 5px, rgba(95, 143, 122, 0.35) 7px);
}

/* ---------- Badge di stato ---------- */
.rrf-stati { display: inline-flex; flex-wrap: wrap; gap: 0.4em; margin-bottom: 0.6em; }
.rrf-stati .rrf-stato { margin-bottom: 0; }
.rrf-stato--raccolta-aperta { color: #9a7322; }
.rrf-stato {
	display: inline-block;
	font-size: 0.8em;
	padding: 0.15em 0.65em;
	border-radius: 999px;
	border: 1px solid currentColor;
	color: var(--rrf-lapis);
	margin-bottom: 0.6em;
}
.rrf-stato--completato { color: var(--rrf-verde); }
.rrf-stato--progetto { color: var(--rrf-tenue); }

/* ---------- Importi ---------- */
.rrf-importi {
	margin: 0 0 0.6em;
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0.2em 0.5em;
}
.rrf-importi__raccolto {
	font-size: clamp(1.9rem, 5vw, 2.8rem);
	font-weight: 700;
	line-height: 1.1;
	letter-spacing: -0.01em;
}
.rrf-importi__costo { opacity: 0.8; }

/* ---------- Scheda progetto ---------- */
.rrf-scheda > * + * { margin-top: 2.2rem; }

.rrf-hero {
	display: grid;
	grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
	gap: 2rem;
	align-items: center;
	padding: 1.6rem;
	border: 1px solid var(--rrf-linea);
	border-radius: var(--rrf-raggio);
}
.rrf-hero__note { margin: 0.8em 0 0; opacity: 0.85; }
@media (max-width: 680px) {
	.rrf-hero { grid-template-columns: 1fr; padding: 1.2rem; }
}

/* anello */
.rrf-donut {
	display: grid;
	grid-template-columns: 140px minmax(0, 1fr);
	gap: 1.2rem;
	align-items: center;
}
.rrf-donut__svg { width: 140px; height: 140px; display: block; }
.rrf-donut__track { stroke: var(--rrf-fondo); }
.rrf-donut__pct { font-size: 7px; font-weight: 700; fill: currentColor; }
@media (max-width: 380px) {
	.rrf-donut { grid-template-columns: 1fr; justify-items: center; }
}
.rrf-legend {
	list-style: none;
	margin: 0;
	padding: 0;
	font-size: 0.9em;
}
.rrf-legend li {
	display: grid;
	grid-template-columns: 12px 1fr auto;
	gap: 0.5em;
	align-items: center;
	padding: 0.2em 0;
}
.rrf-legend__value { text-align: right; white-space: nowrap; }
.rrf-legend__gap { opacity: 0.75; }
.rrf-swatch { width: 12px; height: 12px; border-radius: 2px; }
.rrf-swatch--gap {
	background: var(--rrf-fondo);
	border: 1px dashed var(--rrf-tenue);
}

/* scheda tecnica */
.rrf-info {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
	gap: 1rem 1.5rem;
	margin: 0;
}
.rrf-info > div {
	border-top: 1px solid var(--rrf-linea);
	padding-top: 0.5rem;
}
.rrf-info dt { font-size: 0.82em; opacity: 0.75; margin: 0; }
.rrf-info dd { margin: 0.1em 0 0; font-weight: 600; }

.rrf-section h3 { margin: 0 0 0.9rem; }

/* tabella fonti */
.rrf-table-wrap { overflow-x: auto; }
.rrf-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.95em;
}
.rrf-table th,
.rrf-table td {
	text-align: left;
	padding: 0.65em 0.75em;
	border-bottom: 1px solid var(--rrf-linea);
	vertical-align: top;
}
.rrf-table thead th { font-size: 0.85em; opacity: 0.75; font-weight: 600; }
.rrf-table tfoot td { font-weight: 700; border-bottom: 0; border-top: 2px solid var(--rrf-linea); }
.rrf-table small { opacity: 0.75; }
.rrf-num { text-align: right !important; white-space: nowrap; }
@media (max-width: 560px) {
	.rrf-table thead { display: none; }
	.rrf-table tr { display: block; padding: 0.6em 0; border-bottom: 1px solid var(--rrf-linea); }
	.rrf-table td { display: flex; justify-content: space-between; gap: 1em; border: 0; padding: 0.2em 0; }
	.rrf-table td::before { content: attr(data-label); opacity: 0.7; }
	.rrf-table td:first-child { display: block; }
	.rrf-table td:first-child::before { content: none; }
	.rrf-table tfoot td { display: inline-block; border: 0; }
}

/* cronologia */
.rrf-timeline {
	list-style: none;
	margin: 0;
	padding: 0 0 0 1.4rem;
	border-left: 2px solid var(--rrf-linea);
}
.rrf-timeline__item {
	position: relative;
	padding: 0 0 1.3rem;
}
.rrf-timeline__item::before {
	content: "";
	position: absolute;
	left: calc(-1.4rem - 7px);
	top: 0.35em;
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: var(--rrf-lapis);
}
.rrf-timeline__item--inizio::before,
.rrf-timeline__item--fine::before { background: var(--rrf-oro); }
.rrf-timeline__item--obiettivo::before { background: var(--rrf-verde); }
.rrf-timeline__item--raccolta::before { border-color: var(--rrf-oro) !important; }
.rrf-timeline__item--aperto::before {
	background: transparent;
	border: 2px dashed var(--rrf-lapis);
}
.rrf-timeline time { display: block; font-size: 0.85em; opacity: 0.75; }
.rrf-timeline p { margin: 0.3em 0 0; }

/* restauratori */
.rrf-restauratori {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 1rem;
}
.rrf-restauratore {
	display: flex;
	gap: 1rem;
	padding: 1rem;
	border: 1px solid var(--rrf-linea);
	border-radius: var(--rrf-raggio);
}
.rrf-restauratore__img {
	width: 64px;
	height: 64px;
	object-fit: cover;
	border-radius: 50%;
	flex-shrink: 0;
}
.rrf-restauratore h4 { margin: 0 0 0.2em; }
.rrf-restauratore p { margin: 0.2em 0; font-size: 0.92em; }
.rrf-restauratore__meta { opacity: 0.8; }
.rrf-restauratore__contatti { margin-top: 0.5em !important; }

/* ---------- Sostieni questo restauro (bonifico) ---------- */
.rrf-dona {
	padding: 1.4rem 1.6rem;
	border: 1px solid var(--rrf-oro);
	border-radius: var(--rrf-raggio);
	background: rgba(193, 146, 46, 0.07);
}
.rrf-dona h3 { margin: 0 0 0.4rem; }
.rrf-dona__intro { margin: 0 0 1rem; max-width: 62ch; }
.rrf-dona__dati { margin: 0; }
.rrf-dona__riga {
	display: grid;
	grid-template-columns: 9rem minmax(0, 1fr);
	gap: 0.3rem 1rem;
	align-items: center;
	padding: 0.55rem 0;
	border-top: 1px solid var(--rrf-linea);
}
.rrf-dona__riga dt { font-size: 0.88em; opacity: 0.8; margin: 0; }
.rrf-dona__riga dd {
	margin: 0;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.4rem 0.8rem;
}
.rrf-dona__valore { font-weight: 600; overflow-wrap: anywhere; }
.rrf-dona__iban { letter-spacing: 0.04em; font-size: 1.08em; }
.rrf-copia {
	font: inherit;
	font-size: 0.82em;
	line-height: 1.2;
	padding: 0.3em 0.8em;
	border: 1px solid var(--rrf-lapis);
	border-radius: 999px;
	background: transparent;
	color: var(--rrf-lapis);
	cursor: pointer;
	min-height: 32px;
}
.rrf-copia:hover { background: rgba(47, 93, 138, 0.08); }
.rrf-copia:focus-visible { outline: 2px solid var(--rrf-lapis); outline-offset: 2px; }
.rrf-copia.is-copiato { border-color: var(--rrf-verde); color: var(--rrf-verde); }
.rrf-dona__nota { margin-top: 0.9rem; font-size: 0.92em; opacity: 0.9; }
.rrf-dona__nota p { margin: 0 0 0.4em; }
.rrf-dona__carta {
	margin-top: 1.1rem;
	padding-top: 1rem;
	border-top: 1px solid var(--rrf-oro);
}
.rrf-dona__carta-titolo { margin: 0 0 0.6rem; font-weight: 600; }
.rrf .rrf-dona__btn {
	display: inline-block;
	padding: 0.7em 1.5em;
	border-radius: 999px;
	background: var(--rrf-lapis);
	color: #fff !important;
	text-decoration: none !important;
	font-weight: 600;
	line-height: 1.2;
}
.rrf .rrf-dona__btn:hover { filter: brightness(1.12); }
.rrf .rrf-dona__btn:focus-visible { outline: 2px solid var(--rrf-lapis); outline-offset: 3px; }
.rrf-dona__carta-nota { margin: 0.6rem 0 0; font-size: 0.88em; opacity: 0.8; }
.rrf .screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}
@media (max-width: 560px) {
	.rrf-dona { padding: 1.1rem; }
	.rrf-dona__riga { grid-template-columns: 1fr; }
}

/* ---------- Griglia di card ---------- */
.rrf-griglia {
	display: grid;
	grid-template-columns: repeat(var(--rrf-colonne, 3), minmax(0, 1fr));
	gap: 1.5rem;
}
@media (max-width: 900px) { .rrf-griglia { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .rrf-griglia { grid-template-columns: 1fr; } }

.rrf-card {
	border: 1px solid var(--rrf-linea);
	border-radius: var(--rrf-raggio);
	overflow: hidden;
}
.rrf-card__link {
	display: flex;
	flex-direction: column;
	height: 100%;
	color: inherit !important;
	text-decoration: none !important;
}
.rrf-card__link:hover .rrf-card__title { text-decoration: underline; text-underline-offset: 3px; }
.rrf-card__img img {
	display: block;
	width: 100%;
	aspect-ratio: 4 / 3;
	object-fit: cover;
	height: auto;
}
.rrf-card__body {
	padding: 1rem 1.1rem 1.1rem;
	display: flex;
	flex-direction: column;
	flex: 1;
}
.rrf-card__body .rrf-stati { align-self: flex-start; }
.rrf-card__stato { margin: 0.3em 0 0; font-size: 0.85em; color: var(--rrf-verde); }
.rrf-card__title { margin: 0 0 0.25em; font-size: 1.1em; line-height: 1.3; }
.rrf-card__luogo { margin: 0 0 0.9em; font-size: 0.88em; opacity: 0.75; }
.rrf-card__body .rrf-bar { margin-top: auto; }
.rrf-card__cifre { margin: 0.5em 0 0; }
.rrf-card__cifre span { font-weight: 700; }
.rrf-card__cifre small { opacity: 0.75; }

/* ---------- Totale complessivo ---------- */
.rrf-totale { max-width: 640px; }

/* ---------- Archivio ---------- */
.rrf-excerpt { margin-top: 0.8em; max-width: 420px; }

/* ---------- Widget ---------- */
.rrf-widget__list { list-style: none; margin: 0; padding: 0; }
.rrf-widget__list li { margin: 0; padding: 0.7em 0; border-bottom: 1px solid var(--rrf-linea); }
.rrf-widget__list li:first-child { padding-top: 0; }
.rrf-widget__item {
	display: flex;
	gap: 0.75em;
	align-items: center;
	color: inherit !important;
	text-decoration: none !important;
}
.rrf-widget__item:hover .rrf-widget__title { text-decoration: underline; text-underline-offset: 3px; }
.rrf-widget__thumb {
	width: 52px;
	height: 52px;
	object-fit: cover;
	border-radius: 4px;
	flex-shrink: 0;
}
.rrf-widget__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.3em; }
.rrf-widget__title { font-weight: 600; line-height: 1.3; }
.rrf-widget__cifre { font-size: 0.82em; opacity: 0.8; }
.rrf-widget__stato { font-size: 0.8em; line-height: 1.35; color: var(--rrf-lapis); }
.rrf-widget__stato--finanziato,
.rrf-widget__stato--completato { color: var(--rrf-verde); }
.rrf-widget__stato--da-coprire { color: #9a7322; }
.rrf-widget__stato--insufficiente { color: var(--rrf-rosso); }
.rrf-card__stato--insufficiente { color: var(--rrf-rosso); }
.rrf-dona__urgente { margin: 0 0 0.8rem; font-weight: 600; color: var(--rrf-rosso); }
.rrf-widget__totale { margin-bottom: 1em; }
.rrf-widget__totale p { margin: 0 0 0.4em; font-weight: 600; }
.rrf-widget__all { margin: 0.8em 0 0; font-size: 0.9em; }

.rrf-empty { opacity: 0.8; font-style: italic; }

/* ---------- Blocchi ---------- */
.rrf-blocco { margin-block: 1.8rem; }
.rrf-blocco--vuoto {
	padding: 1rem 1.2rem;
	border: 1px dashed var(--rrf-linea);
	border-radius: var(--rrf-raggio);
	font-size: 0.9em;
	opacity: 0.85;
}
.rrf-blocco--vuoto p { margin: 0; }
.rrf-restauratore__profilo { margin-top: 0.4em !important; }
