/* assets/css/a11y.css — Accessibilità (v188): link «Salta al contenuto», pannello delle opzioni e le opzioni stesse.
   Le classi stanno su <html> (ga-a11y-t1/t2, -c, -l, -s, -m) e le mette lo script in testa alla pagina. */

/* Correzioni di contrasto valide per tutti (controllo axe, WCAG 2.1 AA: testo almeno 4,5:1) */
[data-bs-theme=light] .btn-outline-secondary, html:not([data-bs-theme]) .btn-outline-secondary{ --bs-btn-color:#565e64; --bs-btn-border-color:#6c757d; }
.badge.bg-warning, .badge.bg-info{ color:#212529; }                       /* testo scuro sul giallo e sull'azzurro */
.text-warning:not(i):not(.bi){ color:var(--bs-warning-text-emphasis) !important; }   /* il giallo puro su bianco è illeggibile */
.text-info:not(i):not(.bi){ color:var(--bs-info-text-emphasis) !important; }
[class*="bg-"][class*="-subtle"].text-primary{ color:var(--bs-primary-text-emphasis) !important; }
[class*="bg-"][class*="-subtle"].text-secondary{ color:var(--bs-secondary-text-emphasis) !important; }
[class*="bg-"][class*="-subtle"].text-success{ color:var(--bs-success-text-emphasis) !important; }
[class*="bg-"][class*="-subtle"].text-danger{ color:var(--bs-danger-text-emphasis) !important; }
[class*="bg-"][class*="-subtle"].text-warning{ color:var(--bs-warning-text-emphasis) !important; }
[class*="bg-"][class*="-subtle"].text-info{ color:var(--bs-info-text-emphasis) !important; }
.bg-dark .text-info:not(i), .text-bg-dark .text-info:not(i){ color:#6edff6 !important; }        /* su sfondo scuro resta chiaro */
.bg-dark .text-warning:not(i), .text-bg-dark .text-warning:not(i){ color:#ffda6a !important; }
[class*="bg-opacity-"] .text-success:not(i){ color:var(--bs-success-text-emphasis) !important; }  /* riquadri colorati tenui */
[class*="bg-opacity-"] .text-danger:not(i){ color:var(--bs-danger-text-emphasis) !important; }
[class*="bg-opacity-"] .text-primary:not(i){ color:var(--bs-primary-text-emphasis) !important; }
[data-bs-theme=dark] .btn-outline-secondary{ --bs-btn-color:#c4cbd2; --bs-btn-border-color:#8c959f; }   /* tema scuro */
[data-bs-theme=dark] .text-primary:not(i):not(.bi){ color:var(--bs-primary-text-emphasis) !important; }
[data-bs-theme=dark] .text-danger:not(i):not(.bi){ color:var(--bs-danger-text-emphasis) !important; }
[data-bs-theme=dark] .text-success:not(i):not(.bi){ color:var(--bs-success-text-emphasis) !important; }
[data-bs-theme=dark] .text-secondary:not(i):not(.bi){ color:var(--bs-secondary-color) !important; }
[data-bs-theme=dark] a:not([class*="btn"]):not(.side-link):not(.nav-link):not(.dropdown-item):not(.list-group-item):not([class*="text-"]){ color:color-mix(in srgb,var(--bs-link-color) 78%,#fff); }   /* il colore del marchio è troppo scuro sul nero */
[data-bs-theme=dark] .btn-outline-danger{ --bs-btn-color:#ea868f; --bs-btn-border-color:#ea868f; }
.text-white .modal-title, .text-white > h1, .text-white > h2, .text-white > h3, .text-white > h4, .text-white > h5{ color:inherit; }   /* titoli nelle intestazioni colorate */

/* Salta al contenuto: compare solo quando ci arrivi con il tasto Tab */
.ga-skip{ position:absolute; left:.75rem; top:-4rem; z-index:2000; background:#fff; color:#0a3a7a; padding:.6rem 1rem; border-radius:.5rem;
  border:2px solid #0a3a7a; font-weight:600; text-decoration:underline; box-shadow:0 4px 16px rgba(0,0,0,.2); }
.ga-skip:focus{ top:.75rem; outline:3px solid #ff7900; outline-offset:2px; }
#contenuto:focus{ outline:none; }

/* Pulsante fisso (sito pubblico e pagine di accesso) */
.ga-a11y-fab{ position:fixed; left:1rem; bottom:1rem; z-index:1035; width:3rem; height:3rem; border-radius:50%; border:2px solid #fff;
  background:#0a3a7a; color:#fff; font-size:1.6rem; line-height:1; display:flex; align-items:center; justify-content:center;
  box-shadow:0 4px 14px rgba(0,0,0,.25); cursor:pointer; padding:0; }
.ga-a11y-fab:hover{ background:#062a5a; }
.ga-a11y-fab:focus-visible{ outline:3px solid #ff7900; outline-offset:3px; }
@media (max-width:767.98px){ .ga-a11y-fab{ bottom:5rem; width:2.75rem; height:2.75rem; font-size:1.45rem; } }
@media print{ .ga-a11y-fab, .ga-skip, .ga-a11y-dlg{ display:none !important; } }

/* Pannello */
.ga-a11y-dlg{ width:min(26rem, calc(100vw - 2rem)); max-height:calc(100vh - 2rem); overflow:auto; border:0; border-radius:1rem; padding:1.25rem;
  background:var(--bs-body-bg,#fff); color:var(--bs-body-color,#212529); box-shadow:0 20px 60px rgba(0,0,0,.35); }
.ga-a11y-dlg::backdrop{ background:rgba(8,14,24,.5); }
.ga-a11y-dlg fieldset{ border:0; padding:0; margin:0; }
.ga-a11y-dlg .list-group-item{ cursor:pointer; }
.ga-a11y-dlg .form-check-input{ width:2.4em; height:1.3em; border-radius:2em; }

/* Dimensione del testo: Bootstrap misura tutto in rem, quindi cresce tutto in proporzione */
html.ga-a11y-t1{ font-size:112.5%; }
html.ga-a11y-t2{ font-size:125%; }

/* Link sottolineati */
html.ga-a11y-l a:not(.btn):not(.ga-a11y-fab){ text-decoration:underline !important; text-underline-offset:.18em; text-decoration-thickness:.08em; }

/* Testo più spaziato (valori del criterio WCAG 1.4.12) */
html.ga-a11y-s body{ line-height:1.7 !important; }
html.ga-a11y-s body *:not(.bi):not(i){ letter-spacing:.06em !important; word-spacing:.16em !important; }
html.ga-a11y-s p, html.ga-a11y-s li, html.ga-a11y-s td, html.ga-a11y-s label{ line-height:1.75 !important; }
html.ga-a11y-s p{ margin-bottom:1.25em; }

/* Animazioni ferme */
html.ga-a11y-m *, html.ga-a11y-m *::before, html.ga-a11y-m *::after{ animation:none !important; transition:none !important; scroll-behavior:auto !important; }

/* Contrasto elevato — tema chiaro */
html.ga-a11y-c:not([data-bs-theme=dark]){ --bs-secondary-color:#1f2328; --bs-tertiary-color:#343a40; --bs-border-color:#5c636a; --bs-body-color:#000;
  --bs-link-color:#003a8c; --bs-link-color-rgb:0,58,140; --bs-link-hover-color:#002a66; }
html.ga-a11y-c:not([data-bs-theme=dark]) body{ color:#000; }
html.ga-a11y-c:not([data-bs-theme=dark]) .text-muted, html.ga-a11y-c:not([data-bs-theme=dark]) .text-secondary,
html.ga-a11y-c:not([data-bs-theme=dark]) .text-body-secondary, html.ga-a11y-c:not([data-bs-theme=dark]) .form-text{ color:#1f2328 !important; }
html.ga-a11y-c:not([data-bs-theme=dark]) ::placeholder{ color:#495057 !important; opacity:1; }
html.ga-a11y-c:not([data-bs-theme=dark]) .form-control, html.ga-a11y-c:not([data-bs-theme=dark]) .form-select,
html.ga-a11y-c:not([data-bs-theme=dark]) .form-check-input{ border-color:#343a40; }
html.ga-a11y-c:not([data-bs-theme=dark]) .btn-outline-secondary{ --bs-btn-color:#1f2328; --bs-btn-border-color:#1f2328; }
html.ga-a11y-c:not([data-bs-theme=dark]) .card, html.ga-a11y-c:not([data-bs-theme=dark]) .list-group-item{ border-color:#5c636a; }
html.ga-a11y-c:not([data-bs-theme=dark]) .navbar .nav-link{ color:#000; }
/* Su sfondo scuro (piè di pagina, fasce colorate) i testi «attenuati» diventano bianchi */
html.ga-a11y-c .text-white-50, html.ga-a11y-c .text-white-50 a{ color:#fff !important; }
/* Contrasto elevato — tema scuro */
html.ga-a11y-c[data-bs-theme=dark]{ --bs-body-color:#fff; --bs-secondary-color:#f1f3f5; --bs-tertiary-color:#dee2e6; --bs-border-color:#adb5bd; }
html.ga-a11y-c[data-bs-theme=dark] .text-muted, html.ga-a11y-c[data-bs-theme=dark] .text-secondary,
html.ga-a11y-c[data-bs-theme=dark] .text-body-secondary, html.ga-a11y-c[data-bs-theme=dark] .form-text{ color:#f1f3f5 !important; }
/* Contorno ben visibile sull'elemento raggiunto con la tastiera */
html.ga-a11y-c :focus-visible{ outline:3px solid #ff7900 !important; outline-offset:2px !important; }

/* Testo grande: il menu del sito pubblico (navbar-expand-xl) non ci sta più in una riga fino a 1400/1600 px di larghezza:
   lo si mostra come sul telefono, con il pulsante che lo apre */
@media (min-width:1200px) and (max-width:1399.98px){
  html.ga-a11y-t1 .navbar-expand-xl{ flex-wrap:wrap; }
  html.ga-a11y-t1 .navbar-expand-xl .navbar-toggler{ display:block; }
  html.ga-a11y-t1 .navbar-expand-xl .navbar-collapse{ flex-basis:100%; }
  html.ga-a11y-t1 .navbar-expand-xl .navbar-collapse:not(.show):not(.collapsing){ display:none !important; }
  html.ga-a11y-t1 .navbar-expand-xl .navbar-collapse.show{ display:block !important; }
  html.ga-a11y-t1 .navbar-expand-xl .navbar-nav{ flex-direction:column; }
}
@media (min-width:1200px) and (max-width:1699.98px){
  html.ga-a11y-t2 .navbar-expand-xl{ flex-wrap:wrap; }
  html.ga-a11y-t2 .navbar-expand-xl .navbar-toggler{ display:block; }
  html.ga-a11y-t2 .navbar-expand-xl .navbar-collapse{ flex-basis:100%; }
  html.ga-a11y-t2 .navbar-expand-xl .navbar-collapse:not(.show):not(.collapsing){ display:none !important; }
  html.ga-a11y-t2 .navbar-expand-xl .navbar-collapse.show{ display:block !important; }
  html.ga-a11y-t2 .navbar-expand-xl .navbar-nav{ flex-direction:column; }
}
/* Con testo grande o spaziato le etichette lunghe vanno a capo invece di uscire dallo schermo */
html.ga-a11y-t1 .badge, html.ga-a11y-t2 .badge, html.ga-a11y-s .badge{ white-space:normal; }
/* Chi nel sistema ha scelto di ridurre i movimenti: niente animazioni ovunque, anche sul sito pubblico (v189) */
@media (prefers-reduced-motion: reduce){
  *, *::before, *::after{ animation:none !important; transition:none !important; scroll-behavior:auto !important; }
}
