/*
  ACCESSIBILITY
  Keyboard access, visible focus and related a11y fixes.

  This is a standalone stylesheet, enqueued (in inc/styles-scripts.php) AFTER
  the main bundle so its focus styles win. It is kept outside the SCSS build on
  purpose, so it always loads and is easy to find; edit it directly.
*/

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

/* ----------------------------------------------------------------------------
   Visible focus indicator (WCAG 2.4.7)
   Dual ring (dark outline + light halo) so it is visible on light, dark,
   yellow and image backgrounds alike.
   ---------------------------------------------------------------------------- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible,
[contenteditable]:focus-visible {
  outline: 3px solid #111111;
  outline-offset: 2px;
  box-shadow: 0 0 0 6px #ffffff;
  border-radius: 2px;
}

/* Fallback for browsers without :focus-visible support */
@supports not selector(:focus-visible) {
  a:focus,
  button:focus,
  input:focus,
  select:focus,
  textarea:focus,
  summary:focus,
  [tabindex]:focus,
  [contenteditable]:focus {
    outline: 3px solid #111111;
    outline-offset: 2px;
    box-shadow: 0 0 0 6px #ffffff;
    border-radius: 2px;
  }
}

/* The search field sets `outline: 0` in the theme (via a two-class selector);
   match that specificity so the focus ring is restored. */
.search-modal__form .search-modal__form__input:focus-visible,
.search-modal__form .search-modal__form__input:focus {
  outline: 3px solid #111111;
  outline-offset: 2px;
}

/* ----------------------------------------------------------------------------
   Skip link (WCAG 2.4.1 / 2.4.3)
   Off-screen until focused, then shown above everything else so it is never
   hidden behind the header (WCAG 2.4.11).
   ---------------------------------------------------------------------------- */
/* `a.skip-main` specificity matches/overrides the theme's own skip-link rule
   (defined in main.min.css) so this is consistent on every build. */
a.skip-main {
  position: absolute;
  left: -9999px;
  top: 0;
  width: auto;
  height: auto;
  overflow: visible;
  z-index: 100000;
  padding: 0.75em 1.25em;
  background: #ffcc00;
  color: #000000;
  font-weight: 700;
  text-decoration: none;
  border-radius: 0 0 5px 0;
}

a.skip-main:focus,
a.skip-main:active {
  left: 0;
  top: 0;
  margin: 0;
  width: auto;
  height: auto;
  overflow: visible;
  background: #000000;
  color: #ffffff;
  border: 0;
  box-shadow: none;
  outline: 3px solid #ffcc00;
  outline-offset: 0;
}

/* ----------------------------------------------------------------------------
   Icon buttons that replaced <a> elements.
   Reset native button chrome so they look like the original icons.
   ---------------------------------------------------------------------------- */
.header__mobile__search,
.header__mobile__menu,
.main-nav__search,
.search-modal__close,
.search-modal__form__submit,
.open-menu {
  -webkit-appearance: none;
  appearance: none;
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  line-height: 0;
}

.header__mobile__search,
.header__mobile__menu,
.main-nav__search,
.open-menu {
  cursor: pointer;
}

/* These icon buttons were <a> elements. A <button>'s UA `padding` and
   `text-align: center` shift the absolutely-positioned bars / icons inside
   them, so reset both to keep the hamburger and search icons looking exactly
   as before. */
.header__mobile__search,
.header__mobile__menu,
.open-menu {
  padding: 0;
  text-align: left;
}

/* The desktop search trigger kept the padding the <a> used to have. */
.main-nav__search {
  padding: 0.25em 0.5em;
  line-height: 1;
  color: #000000;
}

/* ----------------------------------------------------------------------------
   Keyboard access for the drop-down menus (WCAG 2.1.1).
   Reveal sub-menus while any descendant has focus, mirroring :hover.
   ---------------------------------------------------------------------------- */
@media screen and (min-width: 1025px) {
  .main-nav__primary__l1 > li:focus-within {
    border-bottom: 3px solid #ffcc00;
  }

  .main-nav__primary__l1 > li:focus-within > .main-nav__primary__l2 {
    display: inline-block;
    z-index: 9999;
  }

  .main-nav__primary__l2 > li:focus-within {
    background: #f2f2f2;
  }

  .main-nav__primary__l2 > li:focus-within > .main-nav__primary__l3 {
    display: inline-block;
    z-index: 9999;
  }
}

/* ----------------------------------------------------------------------------
   Back-to-top button (WCAG 2.4.3 tab order, 4.1.2 role)
   Rebuilt as a <button> and moved to the end of the page so it no longer
   precedes the skip link in the tab order. Its appearance and fixed position
   are left to the theme's own rule (map/css/styles.css), so it matches the
   live site.
   ---------------------------------------------------------------------------- */
