/* SST accessibility widget — self-contained, no framework dependencies.
   State classes live on <html>; settings persist in localStorage ('sst-a11y'). */

/* ── Floating button ─────────────────────────────────────────────────────── */
#a11y-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9998;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid #ca8a04;
  background: #FACC15;
  color: #1f2937;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
}
#a11y-btn:hover { background: #fde047; }
#a11y-btn:focus-visible { outline: 3px solid #1d4ed8; outline-offset: 2px; }

/* ── Panel ───────────────────────────────────────────────────────────────── */
#a11y-panel {
  position: fixed;
  bottom: 84px;
  right: 20px;
  z-index: 9999;
  width: 320px;
  max-width: calc(100vw - 32px);
  max-height: min(70vh, 560px);
  overflow-y: auto;
  background: #ffffff;
  color: #1f2937;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  padding: 16px;
  font-size: 14px;
  display: none;
}
#a11y-panel.open { display: block; }
#a11y-panel h2 { font-size: 15px; font-weight: 800; margin: 0 0 10px; }
#a11y-panel h3 {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; color: #6b7280; margin: 14px 0 6px;
}
#a11y-panel .a11y-row { margin-bottom: 8px; }
#a11y-panel .a11y-label { font-size: 12px; font-weight: 600; color: #374151; margin-bottom: 4px; }
#a11y-panel .a11y-group { display: flex; flex-wrap: wrap; gap: 6px; }
#a11y-panel .a11y-opt {
  border: 1px solid #d1d5db; background: #f9fafb; color: #1f2937;
  border-radius: 6px; padding: 5px 10px; font-size: 12px; font-weight: 600; cursor: pointer;
}
#a11y-panel .a11y-opt:hover { background: #f3f4f6; }
#a11y-panel .a11y-opt[aria-pressed="true"] { background: #1d4ed8; border-color: #1d4ed8; color: #fff; }
#a11y-panel .a11y-opt:focus-visible,
#a11y-panel .a11y-switch:focus-visible,
#a11y-close:focus-visible,
#a11y-reset:focus-visible { outline: 3px solid #1d4ed8; outline-offset: 1px; }

#a11y-panel .a11y-switch-row {
  display: flex; align-items: center; justify-content: space-between;
  margin: 8px 0; font-size: 13px; font-weight: 600;
}
#a11y-panel .a11y-switch {
  position: relative; width: 40px; height: 22px; border-radius: 11px;
  border: 1px solid #d1d5db; background: #e5e7eb; cursor: pointer; flex-shrink: 0;
}
#a11y-panel .a11y-switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  transition: left 0.15s;
}
#a11y-panel .a11y-switch[aria-checked="true"] { background: #1d4ed8; border-color: #1d4ed8; }
#a11y-panel .a11y-switch[aria-checked="true"]::after { left: 20px; }

#a11y-close {
  position: absolute; top: 10px; right: 12px; border: none; background: none;
  font-size: 18px; font-weight: 700; color: #9ca3af; cursor: pointer; line-height: 1;
}
#a11y-close:hover { color: #374151; }
#a11y-reset {
  width: 100%; margin-top: 12px; padding: 7px; border-radius: 6px;
  border: 1px solid #d1d5db; background: #f9fafb; font-size: 12px; font-weight: 700; cursor: pointer;
}
#a11y-reset:hover { background: #fee2e2; border-color: #fca5a5; }
#a11y-note { font-size: 11px; color: #9ca3af; text-align: center; margin: 8px 0 0; }

/* ── Effect classes (applied to <html>) ─────────────────────────────────── */

/* Text size is set inline as font-size % on <html> by a11y.js */

/* Line height */
html.a11y-lh-relaxed  body :not(script):not(style) { line-height: 1.8 !important; }
html.a11y-lh-spacious body :not(script):not(style) { line-height: 2.2 !important; }

/* Letter spacing */
html.a11y-ls-1 body :not(script):not(style) { letter-spacing: 0.05em !important; }
html.a11y-ls-2 body :not(script):not(style) { letter-spacing: 0.10em !important; }
html.a11y-ls-4 body :not(script):not(style) { letter-spacing: 0.20em !important; }

/* Contrast */
html.a11y-contrast-high body { filter: contrast(1.3); }
html.a11y-contrast-yb,
html.a11y-contrast-yb body { background: #000 !important; }
html.a11y-contrast-yb body *:not(img):not(video):not(svg):not(#a11y-panel):not(#a11y-panel *) {
  background-color: #000 !important;
  background-image: none !important;
  color: #FFD700 !important;
  border-color: #FFD700 !important;
}
html.a11y-contrast-yb body a { text-decoration: underline !important; }

/* Remove animations */
html.a11y-no-anim *,
html.a11y-no-anim *::before,
html.a11y-no-anim *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

/* Invert colors (media re-inverted to stay natural) */
html.a11y-invert { filter: invert(1) hue-rotate(180deg); background: #fff; }
html.a11y-invert img,
html.a11y-invert video,
html.a11y-invert picture { filter: invert(1) hue-rotate(180deg); }

/* Color-blind simulation/assist filters reference SVG defs injected by a11y.js */
html.a11y-cb-protanopia   body { filter: url(#a11y-f-protanopia); }
html.a11y-cb-deuteranopia body { filter: url(#a11y-f-deuteranopia); }
html.a11y-cb-tritanopia   body { filter: url(#a11y-f-tritanopia); }

/* ── Baseline site accessibility ─────────────────────────────────────────── */
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 10000;
  background: #1d4ed8; color: #fff; font-weight: 700;
  padding: 10px 16px; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid #1d4ed8 !important;
  outline-offset: 1px;
}
