/* =============================================
 *
 *   RESPONSIVE NAV STYLES (LAYOUT SHIFT FIX)
 *
 * ============================================= */

/* --- Core Styles for the Menu Bar --- */
#menu {
  background: #33366A;
  position: relative;
  z-index: 100;
  width: 100%;
  min-height: 55px; /* Reserves space for the menu on all screen sizes */
}

/* --- Mobile First: Navigation & Toggle Button --- */
.nav-collapse ul {
  margin: 0;
  padding: 0;
  width: 100%;
  display: block;
  list-style: none;
}

.nav-collapse li {
  width: 100%;
  display: block;
}

.nav-collapse a {
  color: #fff;
  background: #33366A;
  border-top: 1px solid #4a4e8a;
  padding: 0.8em 1em;
  text-decoration: none;
  width: 100%;
  display: block;
}

.nav-collapse a:hover,
.nav-collapse .active a {
  background: #4a4e8a;
}

/* JS-driven states for hiding/showing the navigation on mobile */
.js .nav-collapse {
  clip: rect(0 0 0 0);
  max-height: 0;
  position: absolute;
  display: block;
  overflow: hidden;
  zoom: 1;
}

.nav-collapse.opened {
  clip: auto;
  max-height: 9999px;
}

/* The mobile menu toggle button (hamburger icon) */
.nav-toggle {
  -webkit-tap-highlight-color: rgba(0,0,0,0);
  -webkit-user-select: none;
  user-select: none;
  text-decoration: none;
  text-indent: -999px;
  position: absolute;
  overflow: hidden;
  width: 70px;
  height: 55px;
  right: 0;
  top: 0;
}

/* Style for the mobile phone call icon */
.mobile-phone-icon {
  position: absolute;
  left: 15px;
  top: 12px; /* Vertically centers the 30px icon in the 55px menu bar */
}

/* The hamburger and close icons, created with text characters */
.nav-toggle:before {
  color: #fff;
  font-family: sans-serif;
  font-size: 2.5em;
  line-height: 55px;
  text-transform: none;
  text-align: center;
  position: absolute;
  content: "≡";
  text-indent: 0;
  width: 100%;
  left: 0;
  top: 0;
}

.nav-toggle.active:before {
  font-size: 2em;
  content: "×";
}

/* --- Overlay Mask for Mobile Menu --- */
.mask {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0, .6);
  z-index: 99;
  visibility: hidden;
  opacity: 0;
  transition: opacity 300ms;
}

.js-nav-active .mask {
  visibility: visible;
  opacity: 1;
}

/* --- Desktop Styles (for screens wider than 640px) --- */
@media screen and (min-width: 40em) {
  /* Hide mobile-only elements on desktop */
   .nav-toggle,
  .mask,
  .mobile-phone-icon {
    display: none !important;
  }

  /* Use Flexbox to center the navigation bar */
  #menu {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    /* min-height is already set to 55px globally, no need to reset to 0 */
  }

  /* Reset nav container styles for desktop view */
  .js .nav-collapse {
    position: relative;
    max-height: none;
    clip: auto;
    overflow: visible;
    width: auto;
  }

  .nav-collapse ul {
    display: flex;
    width: auto;
  }

  .nav-collapse li {
    width: auto;
    display: flex;
  }

  .nav-collapse a {
    border-top: 0;
    border-left: 1px solid #4a4e8a;
    padding: 1em 1.5em;
    width: auto;
    display: flex;
    align-items: center;
  }

  .nav-collapse li:first-child a {
    border-left: 0;
  }
}
