/* =====================================================================
 * a11y.css — Accessibilita' WCAG 2.1 AA / EAA (Dir. UE 2019/882)
 * UNI CEI EN 301549 — principi POUR (Percepibile, Utilizzabile, Comprensibile, Robusto)
 * ===================================================================== */

/* 1. Skip link — appare al primo Tab per saltare al main */
.skip-link {
	position: absolute;
	left: -9999px;
	top: 8px;
	z-index: 10000;
	background: #148914;
	color: #fff;
	padding: 10px 16px;
	text-decoration: none;
	border-radius: 4px;
	font-weight: 700;
}
.skip-link:focus, .skip-link:focus-visible {
	left: 8px;
	outline: 3px solid #ffdd00;
	outline-offset: 2px;
}

/* 2. Focus visibile sempre — WCAG 2.4.7 */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
	outline: 3px solid #ffdd00;
	outline-offset: 2px;
	border-radius: 2px;
}

/* 3. Contrasto link nel footer scuro (WCAG 1.4.3, min 4.5:1) */
footer a, .bg-color a {
	color: #b6e8b6;
}
footer a:hover, .bg-color a:hover {
	color: #fff;
	text-decoration: underline;
}

/* 4. Screen reader only (testo nascosto visivamente, leggibile da screen reader) */
.sr-only {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden;
	clip: rect(0,0,0,0);
	white-space: nowrap;
	border: 0;
}
.sr-only-focusable:focus, .sr-only-focusable:focus-visible {
	position: static !important;
	width: auto; height: auto;
	clip: auto; margin: 0;
}

/* 5. Riduci motion per chi lo richiede (WCAG 2.3.3) */
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after {
		animation-duration: 0.001ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.001ms !important;
		scroll-behavior: auto !important;
	}
}

/* 6. Forza tema chiaro se l'utente forza alto contrasto Windows */
@media (forced-colors: active) {
	.box-onlus, .box-home {
		border: 1px solid CanvasText;
	}
	a {
		color: LinkText;
	}
}

/* 7. Touch target minimo 44x44 (WCAG 2.5.5) */
.btn, .navbar-nav > li > a, .page-link {
	min-height: 44px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

/* 8. Mappa: bordo visibile + descrizione testuale per chi non vede */
[role="application"] {
	position: relative;
}

/* 9. Tabelle dati con caption visibile per screen reader */
table caption {
	font-weight: 600;
	margin-bottom: 8px;
	text-align: left;
}

/* 10. Input focus piu' visibile */
.form-control:focus {
	border-color: #148914;
	box-shadow: 0 0 0 3px rgba(20,137,20,0.25);
	outline: none;
}
