/* ═══════════════════════════════════════════════════════════════════
   App Dev In A Box — Shared accessibility primitives
   (skip-links, focus rings, screen-reader-only utility, reduced motion)
   ═══════════════════════════════════════════════════════════════════ */

/* ── Skip-link ───────────────────────────────────────────────────── */
/* Visually hidden until focused; then becomes a pill that jumps to
   the element with id="main-content". Used as the very first focusable
   element of every page. */
.skip-link {
  position: fixed;
  top: -100px;
  left: 16px;
  background: var(--accent, #00d4ff);
  color: #04151d;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.875rem;
  z-index: 100000;
  text-decoration: none;
  transition: top 0.2s ease;
}
.skip-link:focus,
.skip-link:focus-visible {
  top: 16px;
  outline: 2px solid var(--accent, #00d4ff);
  outline-offset: 3px;
}

/* ── Global focus ring on interactive elements ───────────────────── */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:not([tabindex="-1"]):focus-visible {
  outline: 2px solid var(--accent, #00d4ff);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Buttons that paint a custom :focus ring keep it — but make sure the
   custom rule does not introduce a non-visible focus ring on click. */
button:focus:not(:focus-visible) {
  outline: none;
}

/* ── Screen-reader-only utility ──────────────────────────────────── */
/* Visually hidden but still in the accessibility tree. */
.sr-only {
  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;
}

/* Remove default focus outline only when we paint our own visible ring. */
:focus-visible {
  outline: 2px solid var(--accent, #00d4ff);
  outline-offset: 3px;
}

/* ── Background-scroll lock for open modals/drawers ──────────────── */
body.modal-open {
  overflow: hidden;
}

/* ── Respect `prefers-reduced-motion` ───────────────────────────── */
/* Disable transitions, animations, smooth-scroll and hover transforms
   when the user has requested reduced motion. Does NOT touch contrast
   or color — text colors stay readable. */
@media (prefers-reduced-motion: reduce) {
  :where(*, *::before, *::after) {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  html { scroll-behavior: auto !important; }
  /* Defuse hover lift transforms common across pages. */
  :hover { transform: none !important; }
}
