/*
 * JCAR Duxy | Mobile navigation refresh
 * Scoped to existing #globalnav at <=900px.
 * No links, child menus, click handlers, desktop navigation are modified.
 */
@media screen and (max-width: 900px) {
  #globalnav #spnav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    min-width: 44px;
    padding: 0;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 12px;
    background: rgba(255,255,255,.06);
    box-shadow: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
  #globalnav #spnav i {
    margin: 0;
    font-size: 24px;
    line-height: 1;
  }
  #globalnav #spnav:focus-visible {
    outline: 3px solid #7cc5ff;
    outline-offset: 3px;
  }

  /* Leave the original hamburger click handler in charge of the .open state. */
  #globalnav.open::before {
    content: "";
    position: fixed;
    z-index: 9900;
    inset: 0;
    background: rgba(7, 18, 35, .64);
    pointer-events: none;
  }

  #globalnav > ul {
    display: block !important;
    box-sizing: border-box;
    position: fixed !important;
    z-index: 9910 !important;
    top: 0 !important;
    right: 0 !important;
    left: auto !important;
    width: min(390px, calc(100vw - 26px)) !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    margin: 0 !important;
    padding: 78px 16px 32px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #dfe7f1;
    border-radius: 18px 0 0 18px !important;
    background: #f3f6fb !important;
    box-shadow: -14px 0 45px rgba(5, 18, 40, .29);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(100%);
    transition: transform .22s ease, opacity .18s ease, visibility .18s ease;
  }
  #globalnav.open > ul {
    display: block !important;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(0);
  }

  #globalnav > ul::before {
    content: "MENU";
    display: block;
    position: absolute;
    top: 26px;
    left: 22px;
    margin: 0;
    color: #16365c;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: .14em;
    line-height: 1.5;
    font-family: "Roboto", Arial, sans-serif;
  }

  #globalnav.open #spnav {
    position: fixed !important;
    z-index: 9920 !important;
    top: 17px;
    right: 17px;
    width: 44px;
    height: 44px;
    border: 1px solid #d3e0ee;
    border-radius: 12px;
    background: #e7eef8;
    box-shadow: 0 2px 9px rgba(10, 35, 68, .09);
  }
  #globalnav.open #spnav i,
  #globalnav.open #spnav i:focus,
  #globalnav.open #spnav i:hover { color: #163b68 !important; }

  #globalnav.open > ul > li.parent {
    display: block;
    float: none;
    box-sizing: border-box;
    margin: 0 0 12px !important;
    padding: 0 !important;
    overflow: hidden;
    border: 1px solid #e0e8f2 !important;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 4px 13px rgba(14, 52, 94, .045);
  }

  #globalnav.open > ul > li.parent > a {
    display: flex !important;
    align-items: center;
    gap: 12px;
    box-sizing: border-box;
    min-height: 56px;
    margin: 0 !important;
    padding: 12px 16px !important;
    border: 0;
    border-radius: 0 !important;
    background: #fff !important;
    color: #1c385b !important;
    font-size: 15px !important;
    font-weight: 800;
    line-height: 1.4;
    text-decoration: none !important;
    text-align: left;
  }

  #globalnav.open > ul > li.parent > a::before {
    content: "\f0c8";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #e9f2fc;
    color: #1964ad;
    font-family: FontAwesome;
    font-size: 17px;
    font-weight: normal;
    line-height: 1;
  }
  #globalnav.open > ul > li.parent:nth-of-type(1) > a::before { content: "\f1b9"; }
  #globalnav.open > ul > li.parent:nth-of-type(2) > a::before { content: "\f0ad"; }
  #globalnav.open > ul > li.parent:nth-of-type(3) > a::before { content: "\f041"; }
  #globalnav.open > ul > li.parent:nth-of-type(4) > a::before { content: "\f0c0"; }
  #globalnav.open > ul > li.parent:nth-of-type(5) > a::before { content: "\f02d"; }
  #globalnav.open > ul > li.parent.nav-contact > a::before { content: "\f0e0"; }

  #globalnav.open > ul > li.parent:not(:has(> ul.child)):not(.nav-contact) > a::after {
    content: "\f105";
    flex: 0 0 auto;
    margin-left: auto;
    color: #91a8be;
    font-family: FontAwesome;
    font-size: 18px;
    font-weight: normal;
  }

  #globalnav.open > ul > li.parent > a:focus-visible,
  #globalnav.open > ul > li.parent > a:hover {
    background: #f2f7fe !important;
    color: #0a60a6 !important;
    outline: 2px solid transparent;
  }

  #globalnav.open > ul > li.parent > ul.child {
    position: static !important;
    display: block !important;
    box-sizing: border-box;
    width: 100% !important;
    height: auto !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 12px 10px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: #fff !important;
    box-shadow: none !important;
    opacity: 1 !important;
    transform: none !important;
    visibility: visible !important;
  }
  #globalnav.open > ul > li.parent > ul.child > li {
    display: block;
    width: 100%;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
  }
  #globalnav.open > ul > li.parent > ul.child > li > a {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    box-sizing: border-box;
    width: 100%;
    min-height: 47px;
    margin: 0 !important;
    padding: 11px 7px 11px 13px !important;
    border: 0;
    border-top: 1px solid #e9eef5;
    border-radius: 0 !important;
    background: #fff !important;
    color: #34506d !important;
    font-size: 13px !important;
    font-weight: 600;
    line-height: 1.55;
    text-decoration: none !important;
    text-align: left;
    white-space: normal !important;
    overflow-wrap: anywhere;
  }
  #globalnav.open > ul > li.parent > ul.child > li > a::after {
    content: "\f105";
    flex: 0 0 auto;
    color: #99adc2;
    font-family: FontAwesome;
    font-size: 16px;
    font-weight: normal;
  }
  #globalnav.open > ul > li.parent > ul.child > li > a:hover,
  #globalnav.open > ul > li.parent > ul.child > li > a:focus-visible {
    background: #edf5fd !important;
    color: #0d5a9f !important;
    border-radius: 7px !important;
    outline: 2px solid #b7d5f1;
    outline-offset: -2px;
  }

  /* Contact remains a prominent and unambiguous CTA. */
  #globalnav.open > ul > li.parent.nav-contact {
    margin-top: 16px !important;
    border: 0 !important;
    background: transparent;
    box-shadow: none;
  }
  #globalnav.open > ul > li.parent.nav-contact > a {
    justify-content: center;
    min-height: 58px;
    border-radius: 12px !important;
    background: #15376f !important;
    color: #fff !important;
    font-size: 15px !important;
    box-shadow: 0 8px 20px rgba(20, 55, 111, .17);
  }
  #globalnav.open > ul > li.parent.nav-contact > a::before {
    flex: 0 0 auto;
    width: 20px;
    height: auto;
    background: none;
    color: #fff;
    font-size: 17px;
  }
  #globalnav.open > ul > li.parent.nav-contact > a:hover,
  #globalnav.open > ul > li.parent.nav-contact > a:focus-visible {
    background: #235399 !important;
    color: #fff !important;
  }
  @media (prefers-reduced-motion: reduce) {
    #globalnav > ul { transition: none !important; }
  }
}
