/* Menu de acessibilidade do Verbum.
   Isolado do CSS global: o reset abaixo vale só para .a11y-root.
   As classes no <body> são o estado das três funções. */

/* ---------- Passos de fonte (relativo à raiz, em rem) ----------
   1em nos textos do site herda este valor. O passo 0 não tem classe
   e permanece no 1rem definido no body. */
body.a11y-font-m1 { font-size: 0.875rem; }
body.a11y-font-1 { font-size: 1.125rem; }
body.a11y-font-2 { font-size: 1.25rem; }
body.a11y-font-3 { font-size: 1.5rem; }
body.a11y-font-4 { font-size: 1.75rem; }
body.a11y-font-5 { font-size: 2rem; }

/* ---------- Alto contraste: preto + branco/amarelo, mínimo 7:1 ----------
   #FFFFFF no #000000 = 21:1. #FFFF00 no #000000 = 19,56:1. */
body.a11y-contrast {
  background: #000 !important;
  color: #fff !important;
}
body.a11y-contrast::before { display: none !important; }
body.a11y-contrast :is(header, main, footer, #subscribeModal),
body.a11y-contrast :is(header, main, footer, #subscribeModal) :where(
  div, section, nav, ul, ol, li, p, span, strong, b, small, em, i, label, form,
  h1, h2, h3, h4, h5, h6, article
) {
  background: #000 !important;
  color: #fff !important;
  border-color: #fff !important;
  box-shadow: none !important;
  text-shadow: none !important;
}
body.a11y-contrast :is(header, main, footer, #subscribeModal) :where(a, button) {
  background: #000 !important;
  color: #ff0 !important;
  border: 2px solid #ff0 !important;
  box-shadow: none !important;
  text-decoration: underline !important;
  text-decoration-thickness: 2px !important;
  text-underline-offset: 3px !important;
}
body.a11y-contrast :is(header, main, footer, #subscribeModal) :where(h1, h2, h3) {
  color: #ff0 !important;
}
body.a11y-contrast :is(header, main, footer, #subscribeModal) :where(input, select, textarea) {
  background: #000 !important;
  color: #fff !important;
  border: 2px solid #fff !important;
  box-shadow: none !important;
}
body.a11y-contrast :is(header, main, footer, #subscribeModal) :where(input, textarea)::placeholder {
  color: #ff0 !important;
  opacity: 1;
}
body.a11y-contrast :is(header, main, footer, #subscribeModal) svg {
  color: inherit !important;
}
body.a11y-contrast :is(header, main, footer, #subscribeModal) svg * {
  stroke: currentColor !important;
}
body.a11y-contrast img {
  background: #fff !important;
  padding: 4px;
}
body.a11y-contrast :focus-visible {
  outline: 4px solid #ff0 !important;
  outline-offset: 3px !important;
}
body.a11y-contrast ::selection {
  background: #ff0;
  color: #000;
}

/* ---------- Escala de cinza ----------
   O filtro fica nos blocos da página, não no body: filtro no body
   quebra position:fixed e o botão deixaria de flutuar. */
body.a11y-grayscale > :is(header, main, footer, .modal-overlay, .skip-link),
body.a11y-grayscale::before,
body.a11y-grayscale .a11y-fab,
body.a11y-grayscale .a11y-panel {
  filter: grayscale(1);
}

html.a11y-scroll-lock,
html.a11y-scroll-lock body { overflow: hidden; }

/* ---------- Reset local do widget ---------- */
.a11y-root,
.a11y-root *,
.a11y-root *::before,
.a11y-root *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border: 0;
  float: none;
  clear: none;
  font-family: "Work Sans", system-ui, sans-serif;
  font-style: normal;
  font-weight: 600;
  font-size: inherit;
  letter-spacing: normal;
  text-transform: none;
  text-decoration: none;
  text-indent: 0;
  text-shadow: none;
  line-height: 1.4;
  background: transparent;
  box-shadow: none;
  min-width: 0;
  max-width: none;
  vertical-align: baseline;
}

.a11y-root {
  position: fixed;
  z-index: 800;
  right: 0;
  bottom: 0;
  width: 0;
  height: 0;
  overflow: visible;
  color: #241f33;
  font-size: 1em;
  line-height: 1.4;
}

.a11y-sr {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Botão flutuante */
.a11y-fab {
  position: fixed;
  z-index: 1;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.5em;
  height: 3.5em;
  min-width: 3.5rem;
  min-height: 3.5rem;
  padding: 0;
  border-radius: 999px;
  border: 2px solid #322a70;
  background: #3e3488;
  color: #fff;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: 0 12px 28px -12px rgba(36, 31, 51, 0.55);
}
.a11y-fab svg {
  width: 1.7em;
  height: 1.7em;
  display: block;
}
.a11y-fab:hover { background: #322a70; }

/* Camada do menu */
.a11y-layer {
  position: fixed;
  z-index: 2;
  inset: 0;
  display: flex;
  justify-content: flex-end;
  align-items: flex-end;
  padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right))
    calc(5.25rem + env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
}
.a11y-layer[hidden] { display: none !important; }

.a11y-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 12, 24, 0.48);
}

.a11y-panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: min(22rem, 100%);
  max-height: min(70vh, 34rem);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 1.15rem;
  border: 1px solid #d9d0c2;
  border-radius: 1.15rem;
  background: #fffdf8;
  color: #241f33;
  box-shadow: 0 24px 50px -24px rgba(20, 16, 28, 0.45);
}

.a11y-kicker {
  font-family: Fredoka, "Work Sans", sans-serif;
  font-size: 1.2em;
  font-weight: 600;
  line-height: 1.2;
  color: #241f33;
}
.a11y-lead {
  margin-top: -0.35rem;
  font-size: 0.875em;
  font-weight: 500;
  color: #4a445c;
}

.a11y-block__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.45rem;
  font-size: 0.95em;
}
.a11y-block__head span:last-child {
  font-variant-numeric: tabular-nums;
  color: #3e3488;
}

.a11y-font {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.a11y-root button {
  cursor: pointer;
  touch-action: manipulation;
  border-radius: 0.8rem;
}

.a11y-font button,
.a11y-toggle,
.a11y-close {
  min-height: 2.75rem;
  padding: 0.65rem 0.85rem;
  border: 2px solid #d9d0c2;
  background: #fff;
  color: #241f33;
  font-size: 1em;
  line-height: 1.2;
}
.a11y-font button {
  font-size: 1.15em;
  font-weight: 800;
}
.a11y-font button:hover,
.a11y-toggle:hover,
.a11y-close:hover { background: #f3f0e8; }
.a11y-font button:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  background: #fff;
}

.a11y-toggle {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  text-align: left;
}
.a11y-toggle__icon {
  display: inline-flex;
  flex: 0 0 auto;
  width: 1.35em;
  height: 1.35em;
}
.a11y-toggle__icon svg { width: 100%; height: 100%; display: block; }
.a11y-toggle__text { flex: 1 1 auto; }
.a11y-toggle__state {
  flex: 0 0 auto;
  font-size: 0.78em;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #4a445c;
}
.a11y-toggle[aria-pressed="true"] {
  background: #3e3488;
  border-color: #322a70;
  color: #fff;
}
.a11y-toggle[aria-pressed="true"] .a11y-toggle__state { color: #ffe14a; }
.a11y-toggle[aria-pressed="true"]:hover { background: #322a70; }

.a11y-close { width: 100%; }

.a11y-root :focus { outline: none; }
.a11y-root :focus-visible {
  outline: 4px solid #241f33;
  outline-offset: 3px;
  box-shadow: 0 0 0 7px #ffe14a;
}

@media (prefers-reduced-motion: reduce) {
  .a11y-panel { scroll-behavior: auto; }
}

/* O próprio menu acompanha o alto contraste, sem herdar o filtro do site. */
body.a11y-contrast .a11y-fab {
  background: #000;
  color: #ff0;
  border: 3px solid #ff0;
  box-shadow: none;
}
body.a11y-contrast .a11y-panel {
  background: #000;
  color: #fff;
  border: 3px solid #ff0;
  box-shadow: none;
}
body.a11y-contrast .a11y-kicker,
body.a11y-contrast .a11y-lead,
body.a11y-contrast .a11y-block__head,
body.a11y-contrast .a11y-block__head span:last-child { color: #fff; }
body.a11y-contrast .a11y-font button,
body.a11y-contrast .a11y-toggle,
body.a11y-contrast .a11y-close {
  background: #000;
  color: #ff0;
  border: 2px solid #ff0;
}
body.a11y-contrast .a11y-toggle__state { color: #ff0; }
body.a11y-contrast .a11y-toggle[aria-pressed="true"] {
  background: #ff0;
  color: #000;
  border-color: #ff0;
}
body.a11y-contrast .a11y-toggle[aria-pressed="true"] .a11y-toggle__state { color: #000; }
body.a11y-contrast .a11y-backdrop { background: rgba(0, 0, 0, 0.72); }
body.a11y-contrast .a11y-root :focus-visible {
  outline: 4px solid #ff0;
  outline-offset: 3px;
  box-shadow: 0 0 0 7px #000;
}

@media (forced-colors: active) {
  .a11y-fab,
  .a11y-font button,
  .a11y-toggle,
  .a11y-close,
  .a11y-panel {
    forced-color-adjust: none;
    background: Canvas;
    color: CanvasText;
    border: 2px solid ButtonText;
  }
  .a11y-toggle[aria-pressed="true"] {
    background: Highlight;
    color: HighlightText;
    border-color: Highlight;
  }
  .a11y-root :focus-visible {
    outline: 3px solid Highlight;
    box-shadow: none;
  }
}

@media print {
  .a11y-root { display: none !important; }
}
