/**
 * Keyboard access: main menu dropdown toggles, phone menu and search overlays,
 * and the home page slideshow controls. See js/keyboard.js and js/scripts.js.
 */

/* ---- Main menu (desktop) ---------------------------------------------- */

/* The toggle after each link with a submenu. Hidden until it has keyboard
   focus or its submenu is open, so the menu looks unchanged to mouse users. */
#main-navigation-wrapper .region-primary-menu li {
  position: relative;
}

#main-navigation-wrapper .region-primary-menu .submenu-toggle {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  border: 0;
  background: none;
  color: #fff;
}

#main-navigation-wrapper .region-primary-menu .submenu-toggle:focus-visible,
#main-navigation-wrapper .region-primary-menu li.is-open > .submenu-toggle {
  z-index: 2;
  width: 28px;
  height: 22px;
  margin: 0;
  overflow: visible;
  clip: auto;
  cursor: pointer;
}

#main-navigation-wrapper .region-primary-menu .submenu-toggle:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 1px;
}

/* Chevron. */
#main-navigation-wrapper .region-primary-menu .submenu-toggle::before {
  content: "";
  display: block;
  width: 8px;
  height: 8px;
  margin: 3px auto 0;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}

#main-navigation-wrapper .region-primary-menu li.is-open > .submenu-toggle::before {
  margin-top: 8px;
  transform: rotate(-135deg);
}

/* Top level: below the link text. */
#main-navigation-wrapper .region-primary-menu .root-menu > li > .submenu-toggle {
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
}

/* Inside a dropdown: at the right end of the item, pointing right. */
#main-navigation-wrapper .region-primary-menu li li > .submenu-toggle {
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
}

#main-navigation-wrapper .region-primary-menu li li > .submenu-toggle::before {
  margin-top: 7px;
  transform: rotate(-45deg);
}

#main-navigation-wrapper .region-primary-menu li li.is-open > .submenu-toggle::before {
  margin-top: 7px;
  transform: rotate(135deg);
}

/* Open submenus look the same as on hover (style.css). */
#main-navigation-wrapper .menu li.menu-item--expanded.is-open > .menu {
  display: block;
  background: #558097;
}

#main-navigation-wrapper .menu li li.menu-item--expanded.is-open > .menu {
  border-left: 5px solid #45748d;
}

/* Esc hides a dropdown shown by hovering, until the mouse leaves the menu. */
#main-navigation-wrapper .root-menu.no-hover li.menu-item--expanded:not(.is-open):hover > .menu {
  display: none;
}

/* ---- Phone menu and search overlays ------------------------------------ */

/* The close "X" and the submenu arrows are buttons. Their icons are drawn
   with a CSS mask, which would also clip the focus outline, so the mask
   moves to a ::before. */
#main-navigation-wrapper #mobile_nav button#close,
#main-navigation-wrapper #mobile_search button#close {
  width: 34px;
  height: 34px;
  top: 12px;
  right: 23px;
  padding: 0;
  border: 0;
  background: none;
  -webkit-mask: none;
  mask: none;
  cursor: pointer;
}

#main-navigation-wrapper #mobile_nav button#close::before,
#main-navigation-wrapper #mobile_search button#close::before {
  content: "";
  display: block;
  width: 18px;
  height: 18px;
  margin: 8px;
  background: #fff;
  -webkit-mask: url(../img/nav-close.svg) no-repeat center;
  mask: url(../img/nav-close.svg) no-repeat center;
}

#main-navigation-wrapper #mobile_nav ul.nav-items li.menu-item--expanded > button.toggle,
#main-navigation-wrapper #mobile_nav ul.nav-items li.menu-item--expanded.active > button.toggle {
  border: 0;
  background-color: transparent;
  -webkit-mask: none;
  mask: none;
  cursor: pointer;
}

#main-navigation-wrapper #mobile_nav ul.nav-items li.menu-item--expanded > button.toggle::before {
  content: "";
  position: absolute;
  inset: 0;
  background: #fff;
  -webkit-mask: url(../img/nav-carat.svg) no-repeat center;
  mask: url(../img/nav-carat.svg) no-repeat center;
}

#main-navigation-wrapper #mobile_nav :focus-visible,
#main-navigation-wrapper #mobile_search :focus-visible,
#main-navigation-wrapper .navbar-toggler:focus-visible,
#main-navigation-wrapper .search-toggler:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* ---- Home page slideshow ------------------------------------------------ */

/* Previous/Next: the links fill the arrow so their focus outline is on it.
   (The text is moved off-screen by the span's text-indent.) */
.view--homepage-slideshow .views_slideshow_controls_text_previous a,
.view--homepage-slideshow .views_slideshow_controls_text_next a {
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.view--homepage-slideshow .views_slideshow_controls_text a:focus-visible,
.view--homepage-slideshow .slide-dot:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
  box-shadow: 0 0 0 5px #002676;
}

/* Pause/Play, at the bottom right of the slideshow. */
.view--homepage-slideshow .views_slideshow_controls_text_pause {
  display: block;
  position: absolute;
  z-index: 100;
  right: 20px;
  bottom: 6px;
}

.view--homepage-slideshow .views_slideshow_controls_text_pause a {
  display: block;
  padding: 2px 10px;
  border-radius: 3px;
  background: rgba(0, 38, 118, 0.85);
  color: #fff;
  font-size: 13px;
  line-height: 20px;
  text-decoration: none;
  box-shadow: none;
}

.view--homepage-slideshow .views_slideshow_controls_text_pause a:hover {
  text-decoration: underline;
}

/* Pager dots: the button fills the dot. */
.view--homepage-slideshow .views-slideshow-pager-bullets > li {
  position: relative;
}

.view--homepage-slideshow .slide-dot {
  position: absolute;
  inset: 0;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: inherit;
  background: transparent;
  cursor: pointer;
}

/* ---- Small fixes -------------------------------------------------------- */

/* A link around a block image has no size of its own, so its focus outline
   doesn't show. Outline the image instead. */
a:focus-visible > img:only-child {
  outline: 2px solid #2e637f;
  outline-offset: 2px;
}

/* Text boxes: an outline on focus, like the filter dropdowns. */
main input.form-text:focus-visible,
main input.form-email:focus-visible,
main input.form-search:focus-visible,
main input.form-tel:focus-visible,
main input.form-url:focus-visible,
main input.form-number:focus-visible,
main textarea.form-textarea:focus-visible {
  outline: 2px solid #2e637f;
  outline-offset: 2px;
}
