/* Accessibility floating widget (v3) — estilo RadierHUB.
   Trigger pill escuro + painel branco de ações rápidas + diálogo de seções.
   Standalone, sem build. Namespace --a11y-* (overrides antigos --access-*
   dos sites são ignorados: o visual é padronizado em todo o portfólio).
   O botão flutuante próprio do VLibras fica oculto — Libras é acessado
   pelo painel deste widget. */

/* ===== Tokens (RadierHUB) ===== */
:root {
  --a11y-ink: #0f172a;          /* slate-900 — trigger/primário */
  --a11y-ink-hover: #1e40af;    /* blue-800 — hover do trigger/botões primários */
  --a11y-fg: #020617;           /* slate-950 — texto sobre branco */
  --a11y-muted: #475569;        /* slate-600 */
  --a11y-border: #cbd5e1;       /* slate-300 */
  --a11y-line: #e2e8f0;         /* slate-200 */
  --a11y-hover: #f8fafc;        /* slate-50 */
  --a11y-accent: #c2410c;       /* orange-700 — eyebrow */
  --a11y-accent-icon: #fb923c;  /* orange-400 — ícone do trigger */
  --a11y-contrast-bg: #fde047;  /* yellow-300 — alto contraste ativo */
  --a11y-contrast-border: #eab308; /* yellow-500 */
  --a11y-radius: 8px;
  --a11y-shadow-panel: 0 18px 45px -18px rgba(15, 23, 42, 0.65);
  --a11y-shadow-trigger: 0 12px 30px -12px rgba(15, 23, 42, 0.8);
  --a11y-z-trigger: 9980;
  --a11y-z-panel: 9979;
}

/* ===== Skip link ===== */
.a11y-skip {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 9999;
  padding: 12px 16px;
  color: #ffffff;
  background: var(--a11y-ink);
  text-decoration: none;
  font: 800 12px/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transform: translateY(-200%);
  transition: transform 0.15s ease;
  border: 2px solid var(--a11y-accent-icon);
}
.a11y-skip:focus {
  transform: translateY(0);
  outline: 3px solid var(--a11y-accent-icon);
  outline-offset: 2px;
}

/* ===== Trigger (pill) ===== */
.a11y-trigger {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: var(--a11y-z-trigger);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 18px 0 14px;
  border: 1px solid #334155;
  border-radius: 9999px;
  color: #ffffff;
  background: var(--a11y-ink);
  font: 700 14px/1 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  cursor: pointer;
  box-shadow: var(--a11y-shadow-trigger);
  isolation: isolate;
  transition: background-color 0.15s ease, transform 0.15s ease;
}
.a11y-trigger:hover {
  background: var(--a11y-ink-hover);
  transform: translateY(-2px);
}
.a11y-trigger:focus-visible {
  outline: 3px solid var(--a11y-accent-icon);
  outline-offset: 3px;
}
.a11y-trigger__icon {
  display: inline-flex;
  color: var(--a11y-accent-icon);
}
.a11y-trigger__icon svg { width: 20px; height: 20px; }
.a11y-trigger__label { white-space: nowrap; }

@media (max-width: 640px) {
  .a11y-trigger { left: 12px; bottom: 12px; padding: 0 14px; min-height: 48px; }
  .a11y-trigger__label { display: none; }
  .a11y-trigger__icon svg { width: 22px; height: 22px; }
}

/* ===== Painel rápido (ancora acima do trigger) ===== */
.a11y-panel {
  position: fixed;
  left: 16px;
  bottom: 76px;
  z-index: var(--a11y-z-panel);
  width: min(310px, calc(100vw - 2rem));
  padding: 12px;
  border: 1px solid var(--a11y-border);
  border-radius: var(--a11y-radius);
  color: var(--a11y-fg);
  background: #ffffff;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  box-shadow: var(--a11y-shadow-panel);
  isolation: isolate;
}
.a11y-panel[hidden] { display: none; }
.a11y-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding: 0 8px 10px;
  border-bottom: 1px solid var(--a11y-line);
}
.a11y-panel__head strong {
  font: 700 10px/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.a11y-panel__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  color: var(--a11y-fg);
  background: transparent;
  cursor: pointer;
}
.a11y-panel__close:hover { background: var(--a11y-hover); }
.a11y-panel__close svg { width: 16px; height: 16px; }

.a11y-panel__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}
.a11y-panel__grid button {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--a11y-border);
  border-radius: 6px;
  color: var(--a11y-fg);
  background: #ffffff;
  font: 700 12px/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  cursor: pointer;
}
.a11y-panel__grid button:hover:not(:disabled) { background: var(--a11y-hover); }
.a11y-panel__grid button:disabled { opacity: 0.4; cursor: not-allowed; }
.a11y-panel__grid button:focus-visible,
.a11y-row:focus-visible,
.a11y-btn:focus-visible {
  outline: 3px solid var(--a11y-ink-hover);
  outline-offset: 2px;
}

.a11y-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  margin-top: 8px;
  padding: 0 12px;
  border: 1px solid var(--a11y-border);
  border-radius: 6px;
  color: var(--a11y-fg);
  background: #ffffff;
  font: 700 12px/1.3 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  text-align: left;
  cursor: pointer;
}
.a11y-row:hover { background: var(--a11y-hover); }
.a11y-row__icon { display: inline-flex; flex: 0 0 auto; color: var(--a11y-muted); }
.a11y-row__icon svg { width: 16px; height: 16px; }
.a11y-row[aria-pressed="true"] {
  border-color: var(--a11y-contrast-border);
  background: var(--a11y-contrast-bg);
  color: #000000;
}
.a11y-row[aria-pressed="true"] .a11y-row__icon { color: #000000; }
.a11y-row--help {
  justify-content: center;
  border-color: transparent;
  color: var(--a11y-ink-hover);
  text-decoration: underline;
  text-underline-offset: 4px;
}
.a11y-row--help:hover { background: #eff6ff; }

/* ===== Diálogo de seções ===== */
.a11y-dialog {
  width: min(42rem, calc(100vw - 1.5rem));
  max-height: 92vh;
  margin: auto;
  padding: 0;
  border: 1px solid #94a3b8;
  border-radius: 12px;
  color: var(--a11y-fg);
  background: #ffffff;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: auto;
}
.a11y-dialog::backdrop {
  background: rgba(2, 6, 23, 0.8);
}
.a11y-dialog__head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--a11y-border);
  background: #ffffff;
}
.a11y-dialog__eyebrow {
  margin: 0;
  color: var(--a11y-accent);
  font: 700 10px/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.a11y-dialog__head h2 {
  margin: 8px 0 0;
  font-size: clamp(22px, 4vw, 30px);
  font-weight: 900;
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: -0.01em;
}
.a11y-dialog__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--a11y-border);
  border-radius: 6px;
  color: var(--a11y-fg);
  background: #ffffff;
  cursor: pointer;
}
.a11y-dialog__close:hover { background: var(--a11y-hover); }
.a11y-dialog__close svg { width: 20px; height: 20px; }

.a11y-dialog__body { padding: 20px 24px 24px; }
.a11y-dialog__body section[hidden] { display: none; }
.a11y-dialog__body h3 {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 700;
}
.a11y-dialog__body p {
  margin: 0 0 14px;
  color: var(--a11y-muted);
  font-size: 14px;
  line-height: 1.6;
}
.a11y-check {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  margin: 20px 0 0;
  padding: 12px 16px;
  border: 1px solid var(--a11y-border);
  background: var(--a11y-hover);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.a11y-check input { width: 20px; height: 20px; margin: 0; accent-color: var(--a11y-ink-hover); }
.a11y-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}
.a11y-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid #94a3b8;
  border-radius: 6px;
  color: var(--a11y-fg);
  background: #ffffff;
  font: 700 14px/1.2 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  cursor: pointer;
}
.a11y-btn:hover:not(:disabled) { background: var(--a11y-hover); }
.a11y-btn--primary {
  border-color: var(--a11y-ink-hover);
  background: var(--a11y-ink-hover);
  color: #ffffff;
}
.a11y-btn--primary:hover:not(:disabled) { background: #1e3a8a; }
.a11y-btn:disabled { cursor: not-allowed; opacity: 0.4; }
.a11y-status {
  margin-top: 16px !important;
  margin-bottom: 0 !important;
  padding: 16px;
  border-left: 4px solid var(--a11y-ink-hover);
  background: #eff6ff;
  color: var(--a11y-fg) !important;
  font-size: 14px;
  font-weight: 600;
}
.a11y-color-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.a11y-color-grid label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--a11y-border);
  border-radius: 6px;
  background: var(--a11y-hover);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.a11y-color-grid label:has(input:checked) {
  border-color: var(--a11y-ink-hover);
  box-shadow: inset 4px 0 0 var(--a11y-ink-hover);
}
.a11y-color-grid input { width: 18px; height: 18px; margin: 0; accent-color: var(--a11y-ink-hover); }

/* ===== VLibras embutido: esconde o botão flutuante próprio do plugin ===== */
body [vw-access-button] { display: none !important; }

/* ===== Alto contraste ===== */
body.a11y-hc {
  --a11y-ink: #000000;
  --a11y-ink-hover: #000000;
  --a11y-fg: #ffffff;
  --a11y-muted: #ffffff;
  --a11y-border: #ffffff;
  --a11y-line: #ffffff;
  --a11y-hover: #000000;
  background: #000000 !important;
  color: #ffffff !important;
}
body.a11y-hc :focus-visible {
  outline-color: #ffdf00 !important;
  outline-width: 4px !important;
}
body.a11y-hc :is(header, nav, main, section, article, aside, footer, div, p, h1, h2, h3, h4, h5, h6, li, blockquote, dd, dt, figcaption, span, a, button, label, address, summary, figure):not(.a11y-trigger):not(.a11y-panel):not(.a11y-panel *):not(.a11y-dialog):not(.a11y-dialog *) {
  color: #ffffff !important;
  background-color: #000000 !important;
  border-color: #ffffff !important;
  text-shadow: none !important;
}
body.a11y-hc a:not(.a11y-dialog *):not(.a11y-panel *) {
  color: #ffdf00 !important;
  text-decoration: underline !important;
}
body.a11y-hc button:not(.a11y-dialog *):not(.a11y-panel *):not(.a11y-trigger),
body.a11y-hc input:not(.a11y-dialog *):not(.a11y-panel *),
body.a11y-hc select:not(.a11y-dialog *):not(.a11y-panel *),
body.a11y-hc textarea:not(.a11y-dialog *):not(.a11y-panel *) {
  background: #000000 !important;
  color: #ffffff !important;
  border: 2px solid #ffffff !important;
  box-shadow: none !important;
}
body.a11y-hc .a11y-trigger,
body.a11y-hc .a11y-btn--primary {
  background: var(--a11y-ink) !important;
  color: #ffffff !important;
}
body.a11y-hc .a11y-row[aria-pressed="true"] {
  background: var(--a11y-contrast-bg) !important;
  color: #000000 !important;
}
body.a11y-hc img:not(.a11y-dialog *):not(.a11y-panel *) {
  filter: grayscale(1) contrast(1.25) brightness(0.95) !important;
}
body.a11y-hc *::placeholder {
  color: #cccccc !important;
  opacity: 1 !important;
}

/* ===== Visão (daltonismo): SVG filter em tudo, exceto o widget ===== */
body.a11y-vision-protanopia *:not(.a11y-trigger):not(.a11y-panel):not(.a11y-panel *):not(.a11y-dialog):not(.a11y-dialog *):not(.a11y-skip):not(.a11y-skip *):not(#a11y-color-filters):not(#a11y-color-filters *) {
  filter: url(#a11y-protanopia);
}
body.a11y-vision-deuteranopia *:not(.a11y-trigger):not(.a11y-panel):not(.a11y-panel *):not(.a11y-dialog):not(.a11y-dialog *):not(.a11y-skip):not(.a11y-skip *):not(#a11y-color-filters):not(#a11y-color-filters *) {
  filter: url(#a11y-deuteranopia);
}
body.a11y-vision-tritanopia *:not(.a11y-trigger):not(.a11y-panel):not(.a11y-panel *):not(.a11y-dialog):not(.a11y-dialog *):not(.a11y-skip):not(.a11y-skip *):not(#a11y-color-filters):not(#a11y-color-filters *) {
  filter: url(#a11y-tritanopia);
}

@media (max-width: 640px) {
  .a11y-panel { left: 12px; bottom: 72px; }
  .a11y-color-grid { grid-template-columns: 1fr; }
  .a11y-actions { display: grid; }
  .a11y-btn { width: 100%; justify-content: center; }
}

@media print {
  .a11y-trigger,
  .a11y-panel,
  .a11y-skip,
  [vw],
  [vw-access-button] { display: none !important; }
}
