/* Navigation refinements introduced with the simplified information architecture. */

.site-header__inner {
  gap: clamp(.75rem, 1.4vw, 1.5rem);
  max-width: 1440px;
}

.site-header .brand {
  flex: 0 1 auto;
  min-width: 0;
}

.site-header .brand__text {
  min-width: 0;
}

.site-header .brand__name {
  white-space: nowrap;
}

.main-nav {
  margin-left: auto;
}

.main-nav ul {
  gap: clamp(.55rem, 1.05vw, 1.1rem);
}

.main-nav a {
	font-size: clamp(.66rem, .66vw, .76rem);
	letter-spacing: .06em;
}

.header-actions {
  flex: 0 0 auto;
}

.main-nav a:focus-visible,
.nav-toggle:focus-visible {
  outline: 3px solid var(--c-purple);
  outline-offset: 4px;
}

.submenu-toggle { display: none; }

@media (min-width: 1321px) {
	.site-header .brand--custom-logo .custom-logo {
		height: 76px;
		max-height: 76px;
		max-width: 225px;
	}

  .onetap-container-toggle .onetap-toggle {
    /* Keep the existing accessibility launcher clear of the header CTA. */
    top: auto !important;
    bottom: 20px !important;
  }

  .main-nav li:focus-within > .sub-menu {
    display: flex;
  }
}

@media (max-width: 767px) {
  .onetap-container-toggle .onetap-toggle {
    /* Keep the launcher away from the right-aligned card actions on touch screens. */
    right: auto !important;
    left: 15px !important;
  }
}

@media (max-width: 1320px) {
  .nav-open .a2a_floating_style,
  .nav-open .onetap-container-toggle {
    /* Floating widgets must not cover links or open another panel over this one. */
    display: none !important;
  }

  .site-header {
    /* Keep the fixed drawer relative to the viewport, not the filtered header. */
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: #fff;
  }

  html,
  body {
    overflow-x: clip;
  }

  body.nav-open .site-header {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    width: 100%;
    z-index: 102;
  }

  body.admin-bar.nav-open .site-header {
    top: var(--keb-admin-height, 46px);
  }

  body.nav-open {
    overflow: hidden;
  }

  .main-nav {
    position: fixed;
    inset: var(--header-h) 0 0 auto;
    width: min(360px, 88vw);
    margin-left: 0;
    padding: 2rem;
    overflow-y: auto;
    background: #fff;
    box-shadow: var(--shadow-md);
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transform: translateX(100%);
    transition: transform .3s ease, opacity .2s ease, visibility 0s linear .3s;
  }

  .admin-bar .main-nav {
    inset: calc(var(--header-h) + 32px) 0 0 auto;
  }

  .nav-open .main-nav {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
    transform: translateX(0);
    transition-delay: 0s;
  }

  .main-nav ul {
    flex-direction: column;
    align-items: stretch;
    gap: .5rem;
  }

  .main-nav a {
    display: block;
    padding: .75rem 0;
    font-size: 1rem;
  }

  .main-nav .menu-item-has-children > a { padding-right: 3rem; }

  .submenu-toggle {
    position: absolute;
    top: .45rem;
    right: 0;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: #f3edf9;
    color: #51227e;
    cursor: pointer;
  }

  .submenu-toggle::before,
  .submenu-toggle::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    transition: transform .2s ease;
  }

  .submenu-toggle::after { transform: rotate(90deg); }
  .submenu-toggle[aria-expanded="true"]::after { transform: rotate(0); }
  .submenu-toggle:focus-visible { outline: 3px solid var(--c-purple); outline-offset: 2px; }

  .main-nav .sub-menu,
  .main-nav li:hover > .sub-menu {
    position: static;
    display: none;
    gap: .25rem;
    margin: .15rem 0 .8rem;
    padding: .65rem .7rem .7rem 1rem;
    border: 0;
    border-left: 3px solid #d7c4ef;
    border-radius: 18px;
    background: #faf7fd;
    box-shadow: none;
  }

  .main-nav li.menu-item-has-children.is-submenu-open > .sub-menu { display: flex; }

  .main-nav .sub-menu a {
    position: relative;
    padding: .5rem .65rem .5rem 1rem;
    border-radius: 8px;
    color: #5f5270;
    font-size: .88rem;
    font-weight: 500;
    line-height: 1.35;
    text-transform: none;
    letter-spacing: 0;
    white-space: normal;
  }

  .main-nav .sub-menu a::before {
    content: '';
    position: absolute;
    left: .15rem;
    top: 1.05rem;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #8b5fc4;
  }

  .main-nav .sub-menu a:hover,
  .main-nav .sub-menu a:focus-visible,
  .main-nav .sub-menu .current-menu-item > a {
    color: #3f1f69;
    background: #efe6f8;
  }

  .nav-toggle {
    display: grid;
  }

  .header-actions .btn {
    display: none;
  }
}

@media screen and (max-width: 782px) {
  .admin-bar .main-nav {
    inset: calc(var(--header-h) + 46px) 0 0 auto;
  }
}

@media (max-width: 560px) {
  .site-header__inner {
    gap: .65rem;
  }

  .brand {
    gap: .5rem;
  }

  .brand__mark {
    width: 36px;
    height: 36px;
  }

  .brand__kicker {
    font-size: .5rem;
    letter-spacing: .16em;
  }

  .brand__name {
    font-size: clamp(.8rem, 4vw, 1rem);
  }

  .nav-toggle {
    width: 42px;
    height: 42px;
  }

  .main-nav {
    padding: 1.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .main-nav,
  .nav-toggle span,
  .nav-toggle span::before,
  .nav-toggle span::after {
    transition: none;
  }
}
