/* ============================================================================
   a11y.css — WCAG 2.2 AA accessibility baseline. REQUIRED on every site built
   with the ada-compliant-build skill.

   Provides:
     - Skip link (bypass blocks, 2.4.1)
     - Visible focus indicator with DUAL :focus and :focus-visible rules (2.4.7)
     - .sr-only screen-reader-only utility
     - prefers-reduced-motion handling (2.3.3 / motion)

   Copyright (c) 2026 Sean Wilson.
   ============================================================================ */

/* --- Skip link: first focusable element; hidden until focused (2.4.1) ------ */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 1000;
  padding: 0.75rem 1rem;
  background: #ffffff;
  color: #111111;          /* #111 on #fff = 18.9:1 — passes AA + AAA */
  font-weight: 700;
  text-decoration: underline;
}
.skip-link:focus,
.skip-link:focus-visible {
  left: 0;                 /* slide into view for keyboard users */
}

/* --- Visible focus indicator (2.4.7) --------------------------------------
   Dual rule for broad support. :focus guarantees a visible indicator in every
   browser; :focus-visible refines it for keyboard interaction. Both keep the
   outline VISIBLE — never replace either with `outline: none` alone. ---------*/
:focus {
  outline: 3px solid #1a5fb4;   /* #1a5fb4 vs #fff = 5.9:1 — visible focus */
  outline-offset: 2px;
}
:focus-visible {
  outline: 3px solid #1a5fb4;
  outline-offset: 2px;
}

/* --- Screen-reader-only utility -------------------------------------------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
/* Visible again when focused (e.g. a hidden-but-focusable skip target) */
.sr-only-focusable:focus,
.sr-only-focusable:focus-visible {
  position: static;
  width: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* --- Respect reduced-motion preference ------------------------------------- */
@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;
  }
}
