/**
 * Aprovando OAB — Kit de acessibilidade (add-on, não invasivo).
 * Skip-link, botões circulares (Acessibilidade + Libras dedicado),
 * alto contraste, tamanho de fonte, redução de movimento e Libras via
 * VLibras (gratuito, gov.br). Atalho: Alt+P.
 *
 * Baseado no mesmo kit publicado em klemmseguros.com.br, adaptado
 * para este site: posicionado no topo direito (mesmo alinhamento à
 * direita da Corujinha, mas mais acima, perto do menu) para não brigar
 * com o widget da Corujinha, que fica fixo no canto inferior direito.
 *
 * v2 (06/08/2026): redesenho para copiar o padrão definitivo do
 * klemm-site — dois botões circulares separados: dourado (Acessibilidade,
 * abre painel só com contraste/fonte/movimento) e verde quando ativo
 * (Libras, atalho direto para o VLibras, sem precisar abrir o painel).
 * Cada botão expande numa pílula com o texto ao passar o mouse/focar.
 *
 * O botão do VLibras (a "mãozinha azul") vem com um bug do próprio
 * script do governo: ele cria o elemento sem top/right/bottom/left
 * definidos, então o navegador usa a posição estática dele no fluxo do
 * documento — que numa página longa cai muito abaixo da área visível.
 * Corrigimos isso fixando a posição no canto inferior esquerdo.
 */

:focus-visible {
  outline: 3px solid #c9a227 !important;
  outline-offset: 2px !important;
  border-radius: 4px;
}
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid #c9a227 !important;
  outline-offset: 2px !important;
}

.oab-skip-link {
  position: fixed;
  top: -60px;
  left: 12px;
  z-index: 1000001;
  background: #0c2a45;
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid #c9a227;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  text-decoration: none;
  transition: top 0.2s ease;
}
.oab-skip-link:focus { top: 12px; }

.oab-a11y-stack {
  position: fixed;
  top: 110px;
  right: 28px;
  z-index: 1000000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

.oab-a11y-chip {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
}
.oab-a11y-chip-label {
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  white-space: nowrap;
  height: 52px;
  display: flex;
  align-items: center;
  background: #0c2a45;
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  border-radius: 999px 0 0 999px;
  border: 1px solid rgba(201,162,39,0.4);
  border-right: none;
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
  transition: max-width 0.25s ease, opacity 0.2s ease, padding 0.25s ease;
}
.oab-a11y-chip:hover .oab-a11y-chip-label,
.oab-a11y-chip:focus-visible .oab-a11y-chip-label,
.oab-a11y-chip.oab-open .oab-a11y-chip-label {
  max-width: 220px;
  opacity: 1;
  padding: 0 18px 0 18px;
}
.oab-a11y-chip-icon {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #c9a227;
  border: 1px solid rgba(255,255,255,0.5);
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0c2a45;
  position: relative;
  z-index: 1;
  transition: background 0.2s;
}
.oab-a11y-chip-icon svg { width: 24px; height: 24px; }
.oab-a11y-chip:hover .oab-a11y-chip-icon,
.oab-a11y-chip:focus-visible .oab-a11y-chip-icon,
.oab-a11y-chip.oab-open .oab-a11y-chip-icon { background: #ddb843; }
.oab-a11y-chip[aria-pressed="true"] .oab-a11y-chip-icon {
  background: #6fcf97;
  color: #0c2a45;
}
.oab-a11y-chip.oab-libras-loading .oab-a11y-chip-icon {
  background: #7eb6e8;
  animation: oab-libras-pulse 1s ease-in-out infinite;
}
.oab-a11y-chip.oab-libras-ready[aria-pressed="true"] .oab-a11y-chip-icon {
  background: #6fcf97;
}
.oab-a11y-chip.oab-libras-error .oab-a11y-chip-icon {
  background: #e24b4a;
  color: #fff;
}
@keyframes oab-libras-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.06); opacity: 0.85; }
}

#oab-a11y-panel {
  position: fixed;
  top: 226px;
  right: 28px;
  z-index: 1000000;
  width: 260px;
  background: #0c2a45;
  border: 1px solid rgba(201,162,39,0.4);
  border-radius: 14px;
  padding: 16px;
  display: none;
  flex-direction: column;
  gap: 10px;
  color: #ffffff;
  font-family: 'Inter', sans-serif;
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}
#oab-a11y-panel.oab-open { display: flex; }
#oab-a11y-panel h2 { font-size: 0.9rem; font-weight: 700; margin-bottom: 4px; }
.oab-a11y-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
}
.oab-a11y-row span { font-size: 0.82rem; }
.oab-a11y-btns { display: flex; gap: 6px; }
.oab-a11y-btns button {
  width: 30px; height: 30px; border-radius: 6px; border: none;
  background: rgba(201,162,39,0.25); color: #ddb843; font-weight: 700;
  cursor: pointer; font-size: 0.9rem;
}
.oab-a11y-btns button:hover { background: rgba(201,162,39,0.4); }

/* Alto contraste */
html.oab-high-contrast body { background: #000814 !important; color: #ffffff !important; }
html.oab-high-contrast .site-header,
html.oab-high-contrast header,
html.oab-high-contrast footer,
html.oab-high-contrast .site-footer { background: #0a1420 !important; }
html.oab-high-contrast a { color: #ddb843 !important; }

html.oab-font-md { font-size: 108%; }
html.oab-font-lg { font-size: 120%; }

html.oab-reduce-motion *, html.oab-reduce-motion *::before, html.oab-reduce-motion *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* Em telas pequenas, evita colidir com o menu — reduz um pouco a distância do topo */
@media (max-width: 600px) {
  .oab-a11y-stack { top: 96px; right: 16px; gap: 10px; }
  .oab-a11y-chip-label { height: 46px; font-size: 0.8rem; }
  .oab-a11y-chip-icon { width: 46px; height: 46px; }
  .oab-a11y-chip-icon svg { width: 21px; height: 21px; }
  #oab-a11y-panel { top: 214px; right: 16px; width: 220px; }
}

/* VLibras à esquerda (position: 'L' no Widget). Corujinha fica à direita.
   Não forçar left/right no container inteiro — o próprio plugin posiciona. */
div[vw] {
  z-index: 999990 !important; /* abaixo da Corujinha (999999) se cruzarem */
}
div[vw] [vw-access-button] {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
}
div[vw] [vw-plugin-wrapper],
div[vw] .vw-plugin-top-wrapper {
  visibility: visible !important;
  opacity: 1 !important;
}
div[vw] canvas {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}
/* Reforço: se o plugin esquecer a classe .left, mantém no lado esquerdo */
div[vw].enabled {
  left: 0 !important;
  right: auto !important;
}
