/* Accessibility rules that have to win.
 *
 * The name is deliberate. Stylesheets are served in alphabetical order, so this file loads last and can override
 * what came before it. That matters because fourteen stylesheets and several inline style attributes set
 * `outline: none` on things you can tab to - which, with nothing put back, leaves a keyboard user with no way of
 * knowing where they are. Inline styles beat any stylesheet rule, so the focus ring below needs !important as
 * well as the late loading. Both are here for that one reason rather than from carelessness.
 */

/* ---- A visible focus ring (WCAG 2.4.7) ----------------------------------------------------------------- */

/* :focus-visible, not :focus, so a ring appears for the keyboard and not on every mouse click - which is what the
   outline: none rules were trying to avoid in the first place. */
:focus-visible {
  outline: 3px solid var(--c-cyan) !important;
  outline-offset: 2px !important;
  /* The dark themes put cyan on near-black; the halo keeps the ring visible on the light theme and on a photo. */
  box-shadow: 0 0 0 5px rgba(0, 0, 0, 0.6) !important;
}

/* A plane on the map is an image inside a link; the ring belongs round the aircraft, not its data tag. */
.leaflet-marker-icon:focus-visible {
  outline-offset: 0 !important;
}

/* ---- Skip to the content (WCAG 2.4.1) ------------------------------------------------------------------ */

/* Off screen until tabbed to, then the first thing you reach. Without it, reaching the page means tabbing past
   the whole header and side panel every single time. */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 10000;
  padding: 10px 16px;
  background: var(--c-amber);
  color: #000000;
  font-weight: bold;
  text-decoration: none;
  border-radius: 0 0 4px 0;
}

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

/* ---- Reduced motion (WCAG 2.3.3) ----------------------------------------------------------------------- */

/* Flyaboo has a sweeping radar, pulsing emergency banners, a spinning reticle and a bouncing wave. For somebody
   with vestibular trouble that is not decoration, it is a reason to shut the page. Honour the setting their
   operating system already carries.
 *
 * Nothing here waits on transitionend or animationend, so switching them off breaks no behaviour. The map's own
 * flight already checks the same setting in map_controller.js. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  /* The sweep is the whole point of the element, so it goes rather than sitting frozen mid-arc. */
  #radar-sweeper {
    display: none !important;
  }
}
