/* Base */

#site-header,
#site-header * {
  box-sizing: border-box;
}

#site-header li {
  border: none;
}

#site-header,
#site-header.header {
  z-index: 2000;
}

.header {
  position: relative;
}

/* Accessibility helpers */

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 9999;
  padding: 0.6rem 0.9rem;
  background: #fff;
  color: #000;
  border: 2px solid var(--ak-gold);
  border-radius: 0;
}

.skip-link:focus,
.skip-link:focus-visible {
  left: 0.75rem;
  top: 0.75rem;
  outline: none;
}

/* Container */

.site-header__container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px;
}

/**
 * IMPORTANT:
 * Do NOT force link color to inherit globally inside the header,
 * because it overrides the intended white links in the utility/nav bars.
 */
#site-header a {
  text-decoration: none;
}

/* Topbar / Utility */

.site-header__topbar {
  background: var(--ak-navy);
  color: #fff;
  border-top: 6px solid var(--ak-gold);
}

.site-header__topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 8px;
  padding-bottom: 8px;
}

.site-header__utility-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
}

/* Ensure utility links stay white even if upstream theme styles anchors */
#site-header .site-header__utility-link,
#site-header .site-header__utility-link:visited {
  color: #fff !important;
}

#site-header .site-header__utility-link:hover,
#site-header .site-header__utility-link:focus-visible {
  text-decoration: underline;
}

#site-header .site-header__utility-link:focus-visible {
  outline: 2px solid var(--ak-gold);
  outline-offset: 2px;
}

/* Masthead */

.site-header__masthead {
  background: var(--ak-bg);
  color: #fff;
  border-bottom: 0;
  position: relative;
}

.site-header__masthead-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
}

.site-header__brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-width: 240px;
  color: #fff;
}

.site-header__brand:focus-visible {
  outline: 2px solid var(--ak-gold);
  outline-offset: 4px;
}

.site-header__seal {
  height: 52px;
  width: 52px;
  max-width: none;
  display: block;
}

.site-header__wordmark {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.site-header__dept {
  font-size: 14px;
  letter-spacing: 0.02em;
}

.site-header__name {
  font-size: 28px;
  line-height: 1.1;
}

.site-header__tools {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.65rem;
}

/* Search */

.site-header__search {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.site-header__search input[type="search"] {
  height: 32px;
  width: min(260px, 46vw);
  border-radius: 0;
  border: 1px solid rgba(255, 255, 255, 0.95);
  padding: 0 10px;
  font-size: 14px;
  background: #fff;
  color: #000;
}

.site-header__search input[type="search"]:focus-visible {
  outline: 2px solid var(--ak-gold);
  outline-offset: 2px;
}

.site-header__search button {
  height: 32px;
  border-radius: 0;
  background: #ccc;
  color: #000;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.site-header__search button:hover {
  background: #f3f3f3;
}

.site-header__search button:focus-visible {
  outline: 2px solid var(--ak-gold);
  outline-offset: 2px;
}

/* Primary Navigation */

.header .hamburger {
  padding: 0;
}

.site-header__nav {
  background: var(--ak-bg);
  border-top: 0 !important;
  box-shadow: none !important;
}

.site-header__nav {

  & .has-grid,
  & .has-children {
    & ul {
      color: #fff;
      background-color: var(--ak-blue);
      z-index: 1;
    }
  }
}

#site-header .main-nav>ul>li>.main-nav-link,
#site-header .main-nav>ul>li>.main-nav-link:visited {
  padding: 14px 0;
  font-size: 16px;
  color: #fff !important;
  text-decoration: none;
}

#site-header .main-nav>ul>li>.main-nav-link:focus-visible {
  outline: 2px solid var(--ak-gold);
  outline-offset: 2px;
}

.site-header__mobile-actions {
  display: none;
}

.site-header__search-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
}

@media (max-width: 1023px) {
  .site-header__masthead-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding-bottom: 14px;
  }

  .site-header__seal {
    width: 64px;
    height: 64px;
  }

  .site-header__dept {
    font-size: 12px;
    line-height: 1.2;
  }

  .site-header__name {
    font-size: 14px;
    line-height: 1.2;
  }

  .site-header__brand {
    flex: 1 1 0;
    min-width: 0;
  }

  .site-header__nav .main-nav {
    color: #fff;
  }

  .site-header__utility {
    display: none;
  }

  .site-header__tools {
    order: 3;
    flex: 0 0 100%;
    width: 100%;
    display: none;
    padding-top: 10px;
    align-items: stretch;
  }

  .site-header__masthead.is-search-open .site-header__tools {
    display: block;
  }

  .site-header__search {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 auto;
  }

  .site-header__search input[type="search"] {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
  }

  .site-header__search button {
    flex: 0 0 auto;
  }

  .site-header__mobile-actions {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    margin-left: auto;
  }

  #site-header .main-nav-link .expand {
    display: flex;
  }

  #site-header .main-nav-link>i {
    display: none;
  }

  /**
   * Fix alignment of +/x icons on mobile for big navigation items
   */
  #site-header .main-nav>ul>li.has-grid {
    position: relative;
  }

  /**
   * Fix for issue where desktop menu dropdowns would still appear on mobile devices
   */
  #site-header .has-grid:hover>ul,
  #site-header .has-grid:focus-within>ul,
  #site-header .has-children:hover>ul,
  #site-header .has-children:focus-within>ul {
    display: none;
  }

  #site-header .has-grid>ul.mobile-open,
  #site-header .has-children>ul.mobile-open {
    display: block;
  }

  #site-header .main-nav>ul,
  #site-header .secondary-nav>ul {
    flex-direction: column;
  }
}

@media (min-width: 1024px) {

  .site-header__nav .main-nav>ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 22px;
    align-items: center;
    min-height: 52px;
    flex-wrap: wrap;
  }

  .site-header__tools {
    display: flex !important;
    order: initial;
    flex: initial;
    width: auto;
    padding-top: 0;
    align-items: flex-end;
  }

  .site-header__mobile-actions {
    display: none !important;
  }

  .site-header__search {
    display: inline-flex !important;
    position: static;
    transform: none;
    width: auto;
    max-width: none;
    margin: 0;
    padding: 0;
  }

.site-header__nav {
  & .has-grid,
  & .has-children {
    & ul {
      background-color: color-mix(in srgb, var(--ak-blue) 85%, black);

      & li:hover {
        background-color: color-mix(in srgb, var(--ak-blue) 75%, black);
      }
    }
  }
}

  /**
   * Fix to prevent secondary menu dropdowns from overlapping the parent dropdown
   */
  .header .main-nav li li.has-children>ul {
    left: 100%;
    top: 0;
  }
}
