/* ==========================================================================
   Atalho de Acessibilidade — estilos
   Baseado no painel de acessibilidade do site cdc.org.br
   ========================================================================== */

#a11y-widget,
#a11y-widget * {
  box-sizing: border-box;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

#a11y-widget {
  --a11y-azul: #1d7fd6;
  --a11y-azul-escuro: #0f5ea3;
  --a11y-texto: #22303c;
  --a11y-borda: #d7dee6;
  --a11y-fundo: #ffffff;

  position: fixed;
  right: 18px;
  bottom: 18px;
  /* acima da camada de filtro, para o widget nunca ser filtrado */
  z-index: 2147483000;
  font-size: 14px;
  line-height: 1.3;
  color: var(--a11y-texto);
}

/* -------- botão flutuante -------- */
#a11y-toggle {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid var(--a11y-azul);
  background: var(--a11y-fundo);
  color: var(--a11y-azul);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  margin-left: auto;
  box-shadow: 0 3px 12px rgba(0, 0, 0, .22);
  transition: transform .2s ease, background .2s ease, color .2s ease;
}

#a11y-toggle:hover,
#a11y-toggle[aria-expanded="true"] {
  background: var(--a11y-azul);
  color: #fff;
  transform: scale(1.06);
}

#a11y-toggle svg {
  width: 30px;
  height: 30px;
  fill: currentColor;
}

/* -------- painel -------- */
#a11y-panel {
  width: 236px;
  margin-bottom: 10px;
  padding: 8px;
  background: var(--a11y-fundo);
  border: 1px solid var(--a11y-borda);
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .18);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#a11y-panel[hidden] {
  display: none;
}

#a11y-panel .a11y-linha {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  padding: 7px 10px;
  border: 1px solid var(--a11y-borda);
  border-radius: 7px;
  background: #fff;
}

#a11y-panel .a11y-rotulo {
  margin: 0;
  font-size: 13px;
  font-weight: 400;
  user-select: none;
}

#a11y-panel .a11y-amostra {
  margin: 0;
  flex: 1;
  text-align: center;
  font-size: 14px;
  user-select: none;
}

/* botões redondos de + / - */
#a11y-widget .a11y-step {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border-radius: 50%;
  border: 1.5px solid var(--a11y-azul);
  background: #fff;
  color: var(--a11y-azul);
  font-size: 16px;
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

#a11y-widget .a11y-step:hover:not(:disabled) {
  background: var(--a11y-azul);
  color: #fff;
}

#a11y-widget .a11y-step:disabled {
  opacity: .35;
  cursor: not-allowed;
}

/* interruptor (switch) */
#a11y-widget .a11y-switch {
  position: relative;
  width: 36px;
  height: 20px;
  flex: 0 0 36px;
}

#a11y-widget .a11y-switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

#a11y-widget .a11y-switch .a11y-trilho {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #c3ccd6;
  transition: background .2s ease;
}

#a11y-widget .a11y-switch .a11y-bola {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .35);
  transition: transform .2s ease;
}

#a11y-widget .a11y-switch input:checked ~ .a11y-trilho {
  background: var(--a11y-azul);
}

#a11y-widget .a11y-switch input:checked ~ .a11y-bola {
  transform: translateX(16px);
}

/* botão redefinir */
#a11y-widget #a11y-reset {
  border: 1px solid var(--a11y-borda);
  background: #f4f7fa;
  color: var(--a11y-texto);
  border-radius: 7px;
  padding: 8px;
  font-size: 13px;
  cursor: pointer;
  width: 100%;
}

#a11y-widget #a11y-reset:hover {
  background: #e8eef5;
}

/* foco visível em todos os controles do widget */
#a11y-widget button:focus-visible,
#a11y-widget input:focus-visible {
  outline: 3px solid #ff9800;
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Camada de filtro
   Um painel fixo cobrindo a janela inteira, sem capturar cliques, que aplica
   backdrop-filter sobre tudo o que é pintado atrás dele. Assim a página não
   precisa ser envolvida em nenhuma <div> extra e elementos com
   position: fixed (navbar fixed-top, modais) continuam funcionando.
   -------------------------------------------------------------------------- */
#a11y-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147482000;
  pointer-events: none;
  display: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

#a11y-overlay.a11y-ativo { display: block; }

#a11y-overlay.a11y-cinza {
  -webkit-backdrop-filter: grayscale(1);
  backdrop-filter: grayscale(1);
}

#a11y-overlay.a11y-contraste {
  -webkit-backdrop-filter: contrast(1.75) saturate(1.35);
  backdrop-filter: contrast(1.75) saturate(1.35);
}

#a11y-overlay.a11y-negativo {
  -webkit-backdrop-filter: invert(1) hue-rotate(180deg);
  backdrop-filter: invert(1) hue-rotate(180deg);
}

/* Navegadores sem backdrop-filter: cai para filter no <html>, que filtra
   a página inteira (inclusive o widget, mas o recurso continua utilizável). */
@supports not ((backdrop-filter: grayscale(1)) or (-webkit-backdrop-filter: grayscale(1))) {
  html.a11y-fb-cinza     { filter: grayscale(1); }
  html.a11y-fb-contraste { filter: contrast(1.75) saturate(1.35); }
  html.a11y-fb-negativo  { filter: invert(1) hue-rotate(180deg); }
}

/* link "pular para o conteúdo" */
#a11y-skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 2147483001;
  background: #0f5ea3;
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 6px 0;
  text-decoration: none;
}

#a11y-skip:focus {
  left: 0;
}

@media (max-width: 480px) {
  #a11y-panel { width: 210px; }
  #a11y-widget { right: 12px; bottom: 12px; }
}

@media print {
  #a11y-widget, #a11y-overlay, #a11y-skip { display: none !important; }
}
