/* ===========================================
   WP Accessibility Toolkit – v1.3
   =========================================== */

  /* --- Floating Button --- */
#a11y-button {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: #fff;
  color: #000;
  border: none;
  border-radius: 50%;
  width: 55px;
  height: 55px;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
  z-index: 9999;
  transition: background-color 0.3s ease, color 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

/* Hover effetto */
#a11y-button:hover {
  background-color: #000;
  color: #fff;
}

#a11y-button svg {
  width: 50px;
  height: 50px;
  fill: #000; /* icona nera su sfondo bianco */
  pointer-events: none;
}

#a11y-button:hover svg {
  fill: #fff; /* icona bianca su sfondo nero */
}


/* --- Accessibility Panel --- */
#a11y-panel {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 380px;
  max-height: 80vh;
  overflow-y: auto;
  background-color: #fff;
  border: 2px solid #000;
  border-radius: 12px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.25);
  padding: 15px;
  z-index: 10000;
  display: none;
}
#a11y-panel.active { display: block; }

#a11y-panel h3 {
  font-size: 18px;
  color: #000 !important;
  margin-top: 10px;
  border-bottom: 1px solid #ddd;
  padding-bottom: 6px;
}

#a11y-panel button {
  display: inline-block;
  margin: 4px 3px;
  padding: 6px 10px;
  border: 1px solid #000;
  background: #e3f2fd;
  cursor: pointer;
  border-radius: 6px;
  font-size: 14px;
  transition: background-color 0.3s ease, color 0.3s ease;
}

#a11y-panel button:hover { background-color: #000; }

#a11y-panel button.active {
  background-color: #000;
  color: #fff;
  border-color: #000;
}

/* --- Range Inputs --- */
#a11y-panel input[type="range"] {
  width: 100%;
  margin: 8px 0;
}

/* --- Close Button --- */
#close-panel {
  /* background-color: #fff;*/
  color: #000;
  border: none;
  padding: 10px;
  border-radius: 4px;
  cursor: pointer;
  float: right;
}

#close-panel:hover { 
  background-color: #000;
  color: #fff !important; 
}

/* --- Reset Button --- */
#a11y-panel .a11y-reset {
  width: 100%;
  background-color: #000 !important;
  color: #fff !important;
  border: none;
  padding: 10px;
  margin-top: 15px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease; /* <- aggiunta per il zoom */
}
#a11y-panel .a11y-reset:hover {
  transform: scale(1.05); /* <--- leggero zoom */
}

/* ===========================================
   REGOLAZIONI TESTO
   =========================================== */
.a11y-enabled,
.a11y-enabled body {
  font-size: var(--a11y-font-size, 16px) !important;
  line-height: var(--a11y-line-height, 1.5) !important;
  letter-spacing: var(--a11y-letter-spacing, 0px) !important;
}

.a11y-readable-font,
.a11y-readable-font body,
.a11y-readable-font p,
.a11y-readable-font h1,
.a11y-readable-font h2,
.a11y-readable-font h3,
.a11y-readable-font h4,
.a11y-readable-font h5,
.a11y-readable-font h6,
.a11y-readable-font a,
.a11y-readable-font span,
.a11y-readable-font div {
  font-family: Arial, Helvetica, sans-serif !important;
}

/* ===========================================
   REGOLAZIONE COLORI
   =========================================== */
//.a11y-contrast-dark { filter: contrast(150%) brightness(80%) !important; }
//.a11y-contrast-light { filter: contrast(120%) brightness(110%) !important; }
.a11y-low-brightness { filter: brightness(60%) !important; }
.a11y-high-brightness { filter: brightness(130%) !important; }
.a11y-low-contrast { filter: contrast(70%) !important; }
.a11y-high-contrast { filter: contrast(200%) !important; }
.a11y-low-saturation { filter: saturate(60%) !important; }
.a11y-high-saturation { filter: saturate(160%) !important; }
.a11y-monochrome { filter: grayscale(100%) !important; }

/* Contrasto scuro tramite filtro */
.a11y-contrast-dark {
    filter: invert(1) hue-rotate(180deg) brightness(80%) contrast(120%);
}

/* Contrasto chiaro - rimuove il filtro */
.a11y-contrast-light {
    filter: none !important;
}

/* Escludi immagini dal filtro per non invertirle */
.a11y-contrast-dark img,
.a11y-contrast-dark video,
.a11y-contrast-dark iframe {
    filter: invert(1) hue-rotate(180deg) !important;
}

.a11y-contrast-dark body, 
.a11y-contrast-dark p, 
.a11y-contrast-dark h1, 
.a11y-contrast-dark h2, 
.a11y-contrast-dark h3, 
.a11y-contrast-dark h4, 
.a11y-contrast-dark h5, 
.a11y-contrast-dark h6, 
.a11y-contrast-dark a {
    background-color: #000 !important;
    color: #fff !important;
}

.a11y-contrast-light body, 
.a11y-contrast-light p, 
.a11y-contrast-light h1, 
.a11y-contrast-light h2, 
.a11y-contrast-light h3, 
.a11y-contrast-light h4, 
.a11y-contrast-light h5, 
.a11y-contrast-light h6, 
.a11y-contrast-light a {
    background-color: #fff !important;
    color: #000 !important;
}

.a11y-contrast-dark .wp-block-button__link { color: #fff !important; }
.a11y-contrast-light .wp-block-button__link { color: #000 !important; }


/* ===========================================
   REGOLAZIONE NAVIGAZIONE
   =========================================== */
.a11y-highlight-headings h1,
.a11y-highlight-headings h2,
.a11y-highlight-headings h3,
.a11y-highlight-headings h4,
.a11y-highlight-headings h5,
.a11y-highlight-headings h6 {
  outline: 3px solid #f9a825 !important;
  background-color: rgba(255, 235, 59, 0.2) !important;
}

.a11y-highlight-links a {
  outline: 2px solid #2196f3 !important;
  background-color: rgba(33, 150, 243, 0.15) !important;
}

/* ===========================================
   GUIDA ALLA LETTURA
   =========================================== */
.reading-guide {
  position: fixed;
  left: 20%;
  width: 60%;
  height: 6px;
  background-color: #000;
  pointer-events: none;
  z-index: 999999;
  transition: top 0.05s linear;
}

/* ===========================================
   MASCHERA DI LETTURA
   =========================================== */
.reading-mask {
  position: fixed;
  left: 0;
  width: 100%;
  background-color: rgba(0,0,0,0.6);
  z-index: 999998;
  pointer-events: none;
}

.reading-mask.top { top: 0; }
.reading-mask.bottom { bottom: 0; }

/* ===========================================
   SCROLLBAR PERSONALIZZATA (solo pannello)
   =========================================== */
#a11y-panel::-webkit-scrollbar { width: 8px; }
#a11y-panel::-webkit-scrollbar-track { background: #f1f1f1; }
#a11y-panel::-webkit-scrollbar-thumb { background: #888; border-radius: 4px; }
#a11y-panel::-webkit-scrollbar-thumb:hover { background: #555; }

/*
button {
  background-color: #fff !important;
  color: #000 !important;
}

button:hover{
  background-color: #000 !important;
  color: #fff !important;
}
*/
#reset-accessibility:hover {
  background-color: #000;
  color:#fff;
}

h6 {
  color: #000 !important;
}

/* Pulsanti nel pannello (esclusi Close e Reset) */
#a11y-panel button:not(#close-panel):not(.a11y-reset) {
  background-color: #fff;
  color: #000;
  border: 1px solid #000;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Hover */
#a11y-panel button:not(#close-panel):not(.a11y-reset):hover {
  background-color: #000;
  color: #fff;
}

/* CLICK (rimane attivo finché non riclicchi) */
#a11y-panel button.active {
  background-color: #000 !important;
  color: #fff !important;
  border-color: #000 !important;
}

/* Nascondi il plugin su mobile (sotto 768px) */
@media screen and (max-width: 768px) {
    #a11y-button,
    #a11y-panel {
        display: none !important;
    }
}
