/**
 * Fusion Resource Centre — WCAG 2.2 AA accessibility layer
 * Version: 260921.27
 * Load on all authenticated and public RC shells.
 */

/* ── Visually hidden (screen-reader only) ───────────────────────── */
.sr-only,
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

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

/* ── Skip link (2.4.1 Bypass Blocks) ────────────────────────────── */
.rc-skip-link {
  position: absolute;
  left: 0.75rem;
  top: 0.75rem;
  z-index: 10000;
  padding: 0.65rem 1rem;
  background: #0f172a;
  color: #fff;
  font-weight: 700;
  font-size: 0.875rem;
  border-radius: 0.5rem;
  text-decoration: none;
  transform: translateY(-150%);
  transition: transform 0.15s ease;
}
.rc-skip-link:focus,
.rc-skip-link:focus-visible {
  transform: translateY(0);
  outline: 3px solid #fbbf24;
  outline-offset: 2px;
}

/* ── Focus visibility (2.4.7, 2.4.11, 2.4.13) ──────────────────── */
:focus {
  outline: none;
}
:focus-visible {
  outline: 3px solid #2563eb !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.35) !important;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible,
[role="tab"]:focus-visible,
[tabindex]:not([tabindex="-1"]):focus-visible {
  outline: 3px solid #2563eb !important;
  outline-offset: 2px !important;
}

/* Sticky header must not fully obscure focused controls */
main header.sticky,
main .sticky,
.z-30.relative {
  scroll-margin-top: 4.5rem;
}
[tabindex]:focus-visible,
a:focus-visible,
button:focus-visible {
  scroll-margin-top: 5rem;
  scroll-margin-bottom: 5rem;
}

/* ── Minimum target size (2.5.8 Target Size — Minimum 24×24) ───── */
.rc-hit,
.ctrl-btn,
.bottom-nav a,
.bottom-nav button,
button.icon-only,
a.icon-only {
  min-width: 24px;
  min-height: 24px;
}
/* Prefer 44×44 touch targets for primary icon actions */
.rc-hit-lg,
button[aria-label]:not(.rc-hit-sm),
.bottom-nav a,
.bottom-nav button {
  min-width: 44px;
  min-height: 44px;
}
/* Enlarge hit area without changing visual icon size */
.rc-hit::before {
  content: "";
  position: absolute;
  inset: -8px;
}
.rc-hit {
  position: relative;
}

/* ── Reduced motion (2.3.3 Animation from Interactions / 2.2.2) ── */
@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;
  }
}

/* ── Form errors (3.3.1, 3.3.3) ─────────────────────────────────── */
.rc-field-error {
  color: #991b1b;
  font-size: 0.8125rem;
  margin-top: 0.25rem;
}
.rc-field-invalid {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 1px #dc2626;
}
[aria-invalid="true"] {
  border-color: #dc2626 !important;
}

/* ── Live region utility ────────────────────────────────────────── */
.rc-live {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

/* ── High-contrast text helpers (1.4.3) ─────────────────────────── */
.rc-text-muted-safe {
  color: #475569; /* ~4.6:1 on white */
}
.rc-text-on-dark {
  color: #f8fafc;
}

/* ── Dialog backdrop: inert background when open ────────────────── */
body.rc-modal-open {
  overflow: hidden;
}
body.rc-modal-open #rc-main-content[aria-hidden="true"] {
  /* pointer events handled by overlay */
}

/* ── Tables: keep headers sticky readable ───────────────────────── */
table.rc-a11y-table th {
  text-align: left;
  font-weight: 700;
}

/* ── WAI-ARIA Tooltip (role=tooltip) ─────────────────────────────── */
.rc-tooltip {
  max-width: min(20rem, calc(100vw - 1.5rem));
  padding: 0.4rem 0.65rem;
  border-radius: 0.4rem;
  background: #0f172a;
  color: #f8fafc;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.35;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.35);
  pointer-events: none; /* tooltip never receives pointer/focus */
  z-index: 10050;
}
@media (prefers-reduced-motion: reduce) {
  .rc-tooltip { transition: none !important; }
}

/* Dialog open body lock helper */
body.rc-modal-open {
  overflow: hidden !important;
}
