/*
 * Accessibility helpers, shared by every layout.
 *
 * Kept in its own file rather than folded into the hand-written stylesheets,
 * so it is obvious what is here for accessibility and nothing removes it by
 * accident during a redesign.
 */

/* Text for screen readers only — present in the accessibility tree, absent
   from the page. Not `display:none`, which would hide it from both. */
.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;
}

/* Skip link: the first thing a keyboard reaches, hidden until focused, so
   nobody has to tab through a whole sidebar to get to the page. */
.skip-link {
  position: absolute;
  left: 8px;
  top: -60px;
  z-index: 10000;
  padding: 10px 16px;
  border-radius: 0 0 10px 10px;
  background: #0E7C5A;
  color: #fff;
  font: 600 14px/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  text-decoration: none;
  transition: top 120ms ease;
}

.skip-link:focus {
  top: 0;
}

/* A visible focus ring everywhere, including on elements a stylesheet may have
   stripped it from. :focus-visible keeps it off mouse clicks. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid #0E7C5A;
  outline-offset: 2px;
  border-radius: 4px;
}

@media (prefers-color-scheme: dark) {
  a:focus-visible,
  button:focus-visible,
  input:focus-visible,
  select:focus-visible,
  textarea:focus-visible,
  summary:focus-visible,
  [tabindex]:focus-visible {
    outline-color: #3FBF91;
  }
}

/* Respect a stated preference for less movement. The dashboard scrolls
   smoothly between screens; for some people that is nauseating. */
@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;
  }
}
