/* Rete CAT – Mappa delle scuole */
.rcm {
	--rcm-colore: #1f5fa8;
	--rcm-attivo: #e07b00;
	--rcm-vuoto: #dfe5ec;
	--rcm-bordo: rgba(0, 0, 0, .12);
	--rcm-testo-tenue: #5b6470;
	display: grid;
	gap: 2rem;
	margin: 1.5rem 0;
	line-height: 1.45;
}
.rcm *, .rcm *::before, .rcm *::after { box-sizing: border-box; }

@media (min-width: 900px) {
	.rcm--affiancato { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
	.rcm--affiancato .rcm__mappa { position: sticky; top: 2rem; }
}

/* ---------- Cartina ---------- */
.rcm__mappa { position: relative; max-width: 560px; width: 100%; margin: 0 auto; }
.rcm__svg { display: block; width: 100%; height: auto; overflow: visible; }

.rcm__regione {
	fill: var(--rcm-vuoto);
	stroke: #fff;
	stroke-width: 1.2;
	stroke-linejoin: round;
	transition: fill .2s ease, filter .2s ease;
	outline: none;
}
.rcm__regione.has-scuole { fill: var(--rcm-colore); }
.rcm__regione[role="button"] { cursor: pointer; }
.rcm__regione[role="button"]:hover { filter: brightness(1.12) saturate(1.1); }
.rcm__regione:not(.has-scuole)[role="button"]:hover { filter: brightness(.94); }
.rcm__regione.is-selezionata { fill: var(--rcm-attivo); }
.rcm__regione:focus-visible { stroke: #111; stroke-width: 2.5; }
.rcm__regione.is-attenuata { fill-opacity: .35; }

.rcm__badge { pointer-events: none; }
.rcm__badge circle { fill: #fff; stroke: var(--rcm-colore); stroke-width: 2; filter: drop-shadow(0 1px 1.5px rgba(0,0,0,.25)); }
.rcm__badge text { fill: var(--rcm-colore); font: 700 12px/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; text-anchor: middle; }
.rcm__badge.is-selezionata circle { stroke: var(--rcm-attivo); }
.rcm__badge.is-selezionata text { fill: var(--rcm-attivo); }

.rcm__tooltip {
	position: absolute;
	z-index: 5;
	pointer-events: none;
	transform: translate(-50%, calc(-100% - 12px));
	background: #1d2327;
	color: #fff;
	font-size: .85rem;
	padding: .35rem .6rem;
	border-radius: 6px;
	white-space: nowrap;
	box-shadow: 0 4px 12px rgba(0,0,0,.2);
}
.rcm__tooltip strong { display: block; }

.rcm__legenda { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem 1.2rem; margin: .8rem 0 0; font-size: .85rem; color: var(--rcm-testo-tenue); }
.rcm__legenda-voce { display: inline-flex; align-items: center; gap: .4rem; }
.rcm__chip { display: inline-block; width: .9em; height: .9em; border-radius: 3px; }
.rcm__chip--pieno { background: var(--rcm-colore); }
.rcm__chip--vuoto { background: var(--rcm-vuoto); }

/* ---------- Elenco ---------- */
.rcm__titolo-elenco { margin: 0 0 .25rem; }
.rcm__riepilogo { margin: 0 0 1rem; color: var(--rcm-testo-tenue); }

.rcm__ricerca { margin: 0 0 1rem; }
.rcm__cerca {
	width: 100%;
	padding: .65rem .9rem;
	font: inherit;
	border: 1px solid var(--rcm-bordo);
	border-radius: 8px;
	background: #fff;
}
.rcm__cerca:focus { outline: 2px solid var(--rcm-colore); outline-offset: 1px; border-color: transparent; }
.rcm__nessun-risultato { margin: .6rem 0 0; color: var(--rcm-testo-tenue); font-style: italic; }

.rcm__fisarmonica { border-top: 1px solid var(--rcm-bordo); }
.rcm__voce { border-bottom: 1px solid var(--rcm-bordo); scroll-margin-top: 6rem; }
.rcm__intestazione { margin: 0 !important; padding: 0 !important; font-size: 1rem; }
.rcm__bottone {
	all: unset;
	box-sizing: border-box;
	display: flex;
	align-items: center;
	gap: .75rem;
	width: 100%;
	padding: .85rem .75rem;
	cursor: pointer;
	font-weight: 600;
	color: inherit;
	border-left: 4px solid transparent;
	transition: background-color .15s ease, border-color .15s ease;
}
.rcm__bottone:hover { background: rgba(0,0,0,.035); }
.rcm__bottone:focus-visible { outline: 2px solid var(--rcm-colore); outline-offset: -2px; }
.rcm__nome-regione { flex: 1; }
.rcm__conta {
	min-width: 1.9em;
	padding: .1rem .5rem;
	border-radius: 999px;
	background: var(--rcm-colore);
	color: #fff;
	font-size: .8rem;
	text-align: center;
}
.rcm__voce.is-vuota .rcm__conta { background: var(--rcm-vuoto); color: var(--rcm-testo-tenue); }
.rcm__voce.is-vuota .rcm__nome-regione { font-weight: 500; color: var(--rcm-testo-tenue); }
.rcm__freccia { width: 1.1rem; height: 1.1rem; flex: none; transition: transform .2s ease; }
.rcm__bottone[aria-expanded="true"] { border-left-color: var(--rcm-attivo); background: rgba(0,0,0,.03); }
.rcm__bottone[aria-expanded="true"] .rcm__freccia { transform: rotate(180deg); }

.rcm__pannello { padding: .25rem .75rem 1rem 1.25rem; }
.rcm__vuoto { margin: .25rem 0 0; color: var(--rcm-testo-tenue); font-style: italic; }

.rcm__scuole { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
@media (min-width: 700px) {
	.rcm:not(.rcm--affiancato) .rcm__scuole { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.rcm__scuola {
	margin: 0;
	padding: .75rem .9rem;
	border: 1px solid var(--rcm-bordo);
	border-radius: 8px;
	background: #fff;
}
.rcm__scuola-testa { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .25rem .6rem; }
.rcm__scuola-nome { font-weight: 600; }
.rcm__codice { font-size: .75rem; letter-spacing: .03em; color: var(--rcm-testo-tenue); font-family: ui-monospace, Menlo, Consolas, monospace; }
.rcm__scuola-luogo { margin-top: .15rem; font-size: .9rem; color: var(--rcm-testo-tenue); }
.rcm__contatti { display: flex; flex-wrap: wrap; gap: .2rem 1rem; margin-top: .4rem; font-size: .88rem; }
.rcm__contatti a { color: var(--rcm-colore); text-decoration: none; word-break: break-all; }
.rcm__contatti a:hover { text-decoration: underline; }

.rcm .is-nascosta { display: none !important; }
.rcm__sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
	.rcm *, .rcm *::before, .rcm *::after { transition: none !important; }
}
