/**
 * Accessibility styles (P5-04)
 *
 * Global rules that support WCAG 2.1 AA compliance. Kept in a single
 * file so reviewers can see the whole a11y CSS surface at once; the
 * rest of the CSS tree imports this before any component styles.
 */

/* ---------------------------------------------------------------------
 * 2.4.7 Focus Visible + 1.4.11 Non-text Contrast
 *
 * Replace the browser default focus outline with one that has high
 * contrast against both light and dark backgrounds. :focus-visible
 * only fires for keyboard focus (not mouse), so mouse users still see
 * a clean UI while keyboard users get a clear indicator.
 * ------------------------------------------------------------------ */
:focus-visible {
  outline: 2px solid #f59e0b;
  outline-offset: 2px;
  border-radius: 2px;
}

/* Suppress the outline on elements that already render a focus ring
 * via box-shadow (Bootstrap form controls, our own button system).
 * Belt-and-braces: keep focus-visible; add a separate shadow ring. */
button:focus-visible,
[role="button"]:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid #f59e0b;
  outline-offset: 2px;
}

/* ---------------------------------------------------------------------
 * Skip link
 *
 * Baseline sr-only / sr-only-focusable helpers for the skip-to-content
 * link. Bootstrap ships these but we redefine locally so pages that
 * don't pull Bootstrap still get them.
 * ------------------------------------------------------------------ */
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.sr-only-focusable:focus,
.sr-only-focusable:focus-visible,
.sr-only-focusable:active {
  position: static !important;
  width: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* ---------------------------------------------------------------------
 * 2.2.2 Pause, Stop, Hide — reduced motion
 *
 * Respect the user's OS-level reduced-motion preference. Turns off
 * animations, transitions, and scroll-triggered effects.
 * ------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
