/*
 * Bussola Accessibility Widget — stili front-end
 * --bw-primary e --bw-z sono impostate via PHP (inline) e via JS.
 *
 * NOTA IMPORTANTE: quasi tutte le proprietà dei componenti del widget
 * (pulsante, pannello, toggle...) usano !important. Non è un vezzo: molti
 * temi WordPress includono reset generici tipo
 *   button, [type=button], [type=submit] { color:#c36; border:1px solid #c36; }
 * Questi selettori hanno la stessa specificità delle nostre classi
 * (.bw-a11y-btn ecc.), quindi in caso di parità vince chi viene dichiarato
 * per ultimo nel CSS combinato della pagina — che con plugin di cache come
 * WP Fastest Cache può cambiare in modo imprevedibile. !important rende il
 * widget indipendente dal tema e dall'ordine di caricamento dei CSS.
 */
:root {
  --bw-primary: #1a5276;
  --bw-z: 2147483000;
}

.bw-visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
}

.bw-skip-link {
  position: absolute !important;
  left: 8px !important;
  top: -60px !important;
  background: #fff !important;
  color: #111 !important;
  padding: 10px 16px !important;
  border-radius: 6px !important;
  font: 600 14px/1.3 system-ui, sans-serif !important;
  z-index: var(--bw-z) !important;
  transition: top 0.15s ease !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25) !important;
  text-decoration: none !important;
  margin: 0 !important;
}
.bw-skip-link:focus {
  top: 8px !important;
  outline: 3px solid var(--bw-primary) !important;
}

.bw-a11y-btn {
  all: unset !important;
  box-sizing: border-box !important;
  position: fixed !important;
  width: 56px !important;
  height: 56px !important;
  border-radius: 50% !important;
  background: var(--bw-primary) !important;
  color: #fff !important;
  border: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  z-index: var(--bw-z) !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28) !important;
  transition: transform 0.15s ease !important;
  margin: 0 !important;
  padding: 0 !important;
  line-height: normal !important;
}
.bw-a11y-btn:hover {
  transform: scale(1.06) !important;
}
.bw-a11y-btn:focus-visible {
  outline: 3px solid #fff !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 0 5px var(--bw-primary) !important;
}
.bw-a11y-btn svg {
  width: 30px !important;
  height: 30px !important;
  fill: #fff !important;
}

.bw-pos-bottom-right { bottom: 20px !important; right: 20px !important; }
.bw-pos-bottom-left  { bottom: 20px !important; left: 20px !important; }
.bw-pos-top-right    { top: 20px !important; right: 20px !important; }
.bw-pos-top-left     { top: 20px !important; left: 20px !important; }

.bw-a11y-panel {
  box-sizing: border-box !important;
  position: fixed !important;
  width: 340px !important;
  max-width: 92vw !important;
  max-height: 82vh !important;
  overflow-y: auto !important;
  background: #fff !important;
  color: #111 !important;
  border: none !important;
  border-radius: 14px !important;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3) !important;
  z-index: var(--bw-z) !important;
  font: 400 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif !important;
  display: none !important;
  margin: 0 !important;
}
.bw-a11y-panel * { box-sizing: border-box !important; }
.bw-a11y-panel.bw-open { display: block !important; }
.bw-a11y-panel.bw-pos-bottom-right { bottom: 86px !important; right: 20px !important; }
.bw-a11y-panel.bw-pos-bottom-left  { bottom: 86px !important; left: 20px !important; }
.bw-a11y-panel.bw-pos-top-right    { top: 86px !important; right: 20px !important; }
.bw-a11y-panel.bw-pos-top-left     { top: 86px !important; left: 20px !important; }

.bw-panel-header {
  background: var(--bw-primary) !important;
  color: #fff !important;
  padding: 16px 18px !important;
  border-radius: 14px 14px 0 0 !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: flex-start !important;
  gap: 10px !important;
  margin: 0 !important;
}
.bw-panel-header h2 { margin: 0 !important; font-size: 17px !important; font-weight: 700 !important; color: #fff !important; line-height: 1.3 !important; }
.bw-panel-header p { margin: 4px 0 0 !important; font-size: 12.5px !important; opacity: 0.9 !important; color: #fff !important; line-height: 1.4 !important; }

.bw-panel-close {
  all: unset !important;
  box-sizing: border-box !important;
  background: transparent !important;
  border: none !important;
  color: #fff !important;
  font-size: 20px !important;
  line-height: 1 !important;
  cursor: pointer !important;
  padding: 4px 6px !important;
  border-radius: 6px !important;
}
.bw-panel-close:hover,
.bw-panel-close:focus-visible {
  background: rgba(255, 255, 255, 0.2) !important;
  outline: 2px solid #fff !important;
}

.bw-panel-body { padding: 14px 18px 18px !important; }
.bw-section { margin: 0 0 16px !important; }
.bw-section h3 {
  font-size: 12.5px !important;
  text-transform: uppercase !important;
  letter-spacing: 0.04em !important;
  color: #555 !important;
  margin: 0 0 8px !important;
  font-weight: 600 !important;
  line-height: 1.3 !important;
}

.bw-row { display: flex !important; gap: 8px !important; flex-wrap: wrap !important; margin: 0 !important; padding: 0 !important; }
.bw-btn {
  all: unset !important;
  box-sizing: border-box !important;
  border: 1.5px solid #d0d5dd !important;
  background: #fff !important;
  color: #111 !important;
  border-radius: 8px !important;
  padding: 8px 12px !important;
  font: 400 14px/1.3 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  text-decoration: none !important;
  text-align: left !important;
}
.bw-btn:hover { border-color: var(--bw-primary) !important; }
.bw-btn:focus-visible { outline: 3px solid var(--bw-primary) !important; outline-offset: 1px !important; }

.bw-toggle { width: 100% !important; justify-content: space-between !important; margin: 0 0 8px !important; }
.bw-toggle[aria-pressed="true"] {
  background: var(--bw-primary) !important;
  color: #fff !important;
  border-color: var(--bw-primary) !important;
}

.bw-switch {
  box-sizing: border-box !important;
  width: 34px !important;
  height: 20px !important;
  border-radius: 999px !important;
  background: #ccc !important;
  position: relative !important;
  flex: none !important;
  transition: background 0.15s ease !important;
  display: block !important;
}
.bw-toggle[aria-pressed="true"] .bw-switch { background: rgba(255, 255, 255, 0.9) !important; }
.bw-switch::after {
  content: "" !important;
  position: absolute !important;
  top: 2px !important;
  left: 2px !important;
  width: 16px !important;
  height: 16px !important;
  border-radius: 50% !important;
  background: #fff !important;
  transition: transform 0.15s ease !important;
}
.bw-toggle[aria-pressed="true"] .bw-switch::after {
  background: var(--bw-primary) !important;
  transform: translateX(14px) !important;
}

.bw-reset {
  width: 100% !important;
  justify-content: center !important;
  font-weight: 600 !important;
  color: #b42318 !important;
  border-color: #f3a19a !important;
}
.bw-reset:hover { background: #fef3f2 !important; }

.bw-statement {
  font-size: 11.5px !important;
  color: #667085 !important;
  border-top: 1px solid #eee !important;
  padding-top: 10px !important;
  margin: 6px 0 0 !important;
  line-height: 1.4 !important;
}
.bw-shortcut-hint { font-size: 11px !important; color: #8a94a6 !important; margin: 4px 0 0 !important; line-height: 1.4 !important; }
.bw-tts-controls { display: flex !important; gap: 8px !important; flex-wrap: wrap !important; margin: 0 !important; padding: 0 !important; }

/* --- effetti applicati alla pagina --- */
/*
 * Usiamo "zoom" (oltre a font-size come fallback) perché molti temi/page
 * builder (Elementor incluso) impostano dimensioni del testo fisse in px:
 * cambiare il font-size della radice non li scala. "zoom" invece
 * ridimensiona l'intera pagina, testo compreso, indipendentemente
 * dall'unità usata dal tema. Il JS applica inoltre lo stesso valore come
 * stile inline "important" direttamente sull'elemento <html>, che ha
 * priorità massima e batte qualsiasi regola del tema o della cache.
 */
html.bw-fontstep-1 { font-size: 106.25% !important; zoom: 110% !important; }
html.bw-fontstep-2 { font-size: 112.5% !important; zoom: 120% !important; }
html.bw-fontstep-3 { font-size: 118.75% !important; zoom: 130% !important; }
html.bw-fontstep-4 { font-size: 125% !important; zoom: 140% !important; }

html.bw-contrast body { background: #000 !important; color: #fff !important; }
html.bw-contrast body * { background-color: #000 !important; color: #fff !important; border-color: #fff !important; }
html.bw-contrast a, html.bw-contrast a * { color: #ffd600 !important; }
html.bw-contrast img, html.bw-contrast video, html.bw-contrast svg { filter: grayscale(40%) contrast(120%) !important; }

html.bw-dark body { background: #15181c !important; color: #e7e9ea !important; }
html.bw-dark body * { background-color: transparent !important; color: #e7e9ea !important; }

html.bw-dyslexia body, html.bw-dyslexia body * {
  font-family: "Comic Sans MS", "Comic Sans", Verdana, sans-serif !important;
  letter-spacing: 0.03em !important;
  word-spacing: 0.12em !important;
  line-height: 1.6 !important;
}

html.bw-spacing body { line-height: 1.9 !important; }
html.bw-spacing body * { letter-spacing: 0.05em !important; word-spacing: 0.12em !important; }

html.bw-links a {
  text-decoration: underline !important;
  background: #fff59d !important;
  color: #111 !important;
  outline: 1px dashed #b8860b !important;
}

html.bw-noanim * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }

html.bw-kbnav *:focus { outline: 3px solid #ffbf00 !important; outline-offset: 2px !important; box-shadow: 0 0 0 5px rgba(255, 191, 0, 0.35) !important; }

.bw-reading-highlight { background: #fff59d !important; color: #111 !important; }
