/* Mobile menu drill-down + animations (SAV-style, CSS-only) */
@media (max-width: 767px) {
  html.nav-menu-open,
  body.nav-menu-open {
    overflow: hidden;
  }

  header.nav--open {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
    height: 100vh;
    height: 100dvh;
    width: 100%;
    animation: mobile-menu-open 0.38s cubic-bezier(0.19, 1, 0.22, 1) both;
  }

  header.nav--open .nav,
  header.nav--open .nav > .grid,
  header.nav--open .nav > .grid > .row--stretch {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    overflow: hidden;
  }

  header.nav--open .nav > .grid {
    position: relative;
  }

  header.nav--open .nav > .grid > .nav__toggle {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 30;
    flex: 0 0 auto;
  }

  header.nav--open .nav > .grid > .nav__breadcrumb {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    z-index: 20 !important;
    flex: 0 0 auto;
    order: 1;
    width: 100%;
    min-height: 50px;
    margin: 0;
    padding: 10px 56px 10px 0;
    display: flex !important;
    align-items: center;
    background: #fff;
    border-bottom: 1px solid rgba(0, 35, 149, 0.08);
  }

  header.nav--open .nav > .grid > .row--stretch {
    order: 2;
  }

  header.nav--open .nav__back {
    position: relative;
    z-index: 21;
    padding: 8px 0 8px 15px;
  }

  header.nav--open .nav__top--wrapper {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    width: 100%;
  }

  /* Hide logo while menu open — avoids overlap with Back button */
  header.nav--open .logo {
    display: none !important;
  }

  /* Submenu: hide toolbar so list gets full height */
  header.nav--open.mobile-nav-drilled .toolbar--wrapper {
    display: none !important;
  }

  header.nav--open.mobile-nav-drilled .nav__top--wrapper {
    flex: 1 1 auto;
    min-height: 0;
  }

  @keyframes mobile-menu-open {
    from {
      opacity: 0;
    }
    to {
      opacity: 1;
    }
  }

  .nav.nav--open {
    min-height: 0 !important;
    height: 100% !important;
    flex: 1 1 auto !important;
    overflow: hidden !important;
  }

  .nav__top.mobile-nav-viewport {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    height: 0;
    overflow-x: hidden;
    overflow-y: scroll;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
  }

  .nav--open .nav__top {
    opacity: 1 !important;
    height: 0 !important;
    max-height: none !important;
    overflow-x: hidden !important;
    overflow-y: scroll !important;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    display: block !important;
    flex: 1 1 auto;
    min-height: 0;
  }

  header.nav--open.mobile-nav-drilled .nav__top--wrapper,
  header.nav--open.mobile-nav-drilled .nav__top.mobile-nav-viewport,
  header.nav--open.mobile-nav-drilled .nav--open .nav__top {
    flex: 1 1 auto;
    height: 0 !important;
    min-height: 0 !important;
    max-height: none !important;
  }

  .nav--open .nav__top ul.show,
  .nav--open .nav__top ul.mobile-nav-panel {
    display: block !important;
    padding: 15px 0 max(30px, env(safe-area-inset-bottom, 0px));
    width: 100%;
  }

  .nav--open .nav__top li {
    display: block;
  }

  .nav--open .nav__top .nav__list-item-anchor:not(.nav__list-item-anchor--mobile) {
    display: none;
  }

  .nav--open .nav__top .nav__list-item-anchor--mobile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    font-size: 23px;
    line-height: 1.2;
    color: #002395;
    text-decoration: none;
    border-bottom: 1px solid rgba(0, 35, 149, 0.08);
    transition: background-color 0.15s ease, color 0.15s ease;
  }

  .nav--open .nav__top .nav__list-item-anchor--mobile:active {
    background-color: rgba(0, 35, 149, 0.06);
  }

  .nav--open .nav__top .nav__list-item--has-mobile-string .nav__list-item-anchor--mobile {
    padding-right: 16px;
  }

  /* Child / drill-down panels — smaller text than root menu */
  .nav--open .nav__top ul.mobile-nav-panel .nav__list-item-anchor--mobile {
    font-size: 17px;
    padding: 11px 18px;
    line-height: 1.3;
  }

  .nav--open .nav__top ul.mobile-nav-panel .mobile-nav-chevron {
    font-size: 22px;
    margin-left: 8px;
  }

  .mobile-nav-chevron {
    font-size: 28px;
    line-height: 1;
    color: #002395;
    margin-left: 12px;
    flex-shrink: 0;
    transition: transform 0.25s cubic-bezier(0.19, 1, 0.22, 1);
  }

  .nav__list-item-anchor--mobile:active .mobile-nav-chevron {
    transform: translateX(4px);
  }

  /* Staggered item entrance */
  .nav--open .nav__top ul.mobile-nav-stagger > li {
    opacity: 0;
    transform: translateY(-14px);
    animation: mobile-nav-item-in 0.42s cubic-bezier(0.19, 1, 0.22, 1) forwards;
  }

  .nav--open .nav__top ul.mobile-nav-stagger > li:nth-child(1) {
    animation-delay: 0.04s;
  }
  .nav--open .nav__top ul.mobile-nav-stagger > li:nth-child(2) {
    animation-delay: 0.08s;
  }
  .nav--open .nav__top ul.mobile-nav-stagger > li:nth-child(3) {
    animation-delay: 0.12s;
  }
  .nav--open .nav__top ul.mobile-nav-stagger > li:nth-child(4) {
    animation-delay: 0.16s;
  }
  .nav--open .nav__top ul.mobile-nav-stagger > li:nth-child(5) {
    animation-delay: 0.2s;
  }
  .nav--open .nav__top ul.mobile-nav-stagger > li:nth-child(6) {
    animation-delay: 0.24s;
  }
  .nav--open .nav__top ul.mobile-nav-stagger > li:nth-child(7) {
    animation-delay: 0.28s;
  }
  .nav--open .nav__top ul.mobile-nav-stagger > li:nth-child(8) {
    animation-delay: 0.32s;
  }
  .nav--open .nav__top ul.mobile-nav-stagger > li:nth-child(9) {
    animation-delay: 0.36s;
  }
  .nav--open .nav__top ul.mobile-nav-stagger > li:nth-child(10) {
    animation-delay: 0.4s;
  }
  .nav--open .nav__top ul.mobile-nav-stagger > li:nth-child(n + 11) {
    animation-delay: 0.44s;
  }

  @keyframes mobile-nav-item-in {
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  /* Drill-down panel slides */
  .mobile-nav-exit-left {
    animation: mobile-nav-exit-left 0.28s cubic-bezier(0.55, 0.06, 0.68, 0.19) forwards;
    pointer-events: none;
  }

  .mobile-nav-exit-right {
    animation: mobile-nav-exit-right 0.28s cubic-bezier(0.55, 0.06, 0.68, 0.19) forwards;
    pointer-events: none;
  }

  .mobile-nav-enter-right {
    animation: mobile-nav-enter-right 0.34s cubic-bezier(0.19, 1, 0.22, 1) forwards;
    overflow: visible;
  }

  .mobile-nav-enter-left {
    animation: mobile-nav-enter-left 0.34s cubic-bezier(0.19, 1, 0.22, 1) forwards;
    overflow: visible;
  }

  .nav--open .nav__top ul.mobile-nav-panel,
  .nav--open .nav__top ul.show {
    overflow: visible;
  }

  @keyframes mobile-nav-exit-left {
    to {
      transform: translateX(-32%);
      opacity: 0;
    }
  }

  @keyframes mobile-nav-exit-right {
    to {
      transform: translateX(32%);
      opacity: 0;
    }
  }

  @keyframes mobile-nav-enter-right {
    from {
      transform: translateX(32%);
      opacity: 0;
    }
    to {
      transform: translateX(0);
      opacity: 1;
    }
  }

  @keyframes mobile-nav-enter-left {
    from {
      transform: translateX(-32%);
      opacity: 0;
    }
    to {
      transform: translateX(0);
      opacity: 1;
    }
  }

  /* Hamburger → close icon */
  .nav__toggle svg {
    transition: transform 0.45s cubic-bezier(0.19, 1, 0.22, 1);
  }

  .nav__toggle svg path {
    transform-origin: 13px 13px;
    transition: transform 0.28s cubic-bezier(0.19, 1, 0.22, 1), opacity 0.2s ease;
  }

  header.nav--open .nav__toggle svg {
    transform: rotate(-180deg);
  }

  header.nav--open .nav__toggle svg path:nth-of-type(1) {
    transform: translateY(7px) rotate(45deg);
  }

  header.nav--open .nav__toggle svg path:nth-of-type(2) {
    opacity: 0;
    transform: scaleX(0);
  }

  header.nav--open .nav__toggle svg path:nth-of-type(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  .nav--open .toolbar nav,
  .nav--open .toolbar .user-links {
    opacity: 1 !important;
    display: block !important;
    animation: mobile-nav-item-in 0.45s cubic-bezier(0.19, 1, 0.22, 1) 0.15s both;
  }

  .nav--open .toolbar--wrapper,
  .nav--open .row--stretch-right {
    display: block !important;
    width: 100%;
    opacity: 1 !important;
    flex: 0 0 auto;
  }

  .nav--open .toolbar .search-site,
  .nav--open .toolbar .search-product {
    display: flex !important;
    align-items: center;
    width: 100%;
    min-height: 56px;
    padding: 0 20px;
    position: relative !important;
    opacity: 1 !important;
    visibility: visible !important;
    animation: mobile-nav-item-in 0.42s cubic-bezier(0.19, 1, 0.22, 1) forwards;
  }

  .nav--open .toolbar .search-site {
    animation-delay: 0.06s;
  }

  .nav--open .toolbar .search-product {
    animation-delay: 0.12s;
  }

  .nav--open .toolbar .search-site .icon,
  .nav--open .toolbar .search-product .icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-right: 14px;
  }

  .nav--open .toolbar .search-site .icon svg,
  .nav--open .toolbar .search-product .icon svg {
    width: 24px;
    height: 24px;
    display: block;
  }

  .nav--open .toolbar .search-site a,
  .nav--open .toolbar .search-product a {
    display: inline-flex;
    align-items: center;
    flex: 1;
    padding-left: 0;
    line-height: 1.3;
  }

  .nav--open .toolbar .search-site .text-label,
  .nav--open .toolbar .search-product .text-label {
    display: inline !important;
    font-size: 18px;
  }

  .nav--open .toolbar .search-site svg,
  .nav--open .toolbar .search-product svg {
    fill: currentColor;
    color: inherit;
  }

  .nav--open .nav__top .mobile-nav-utility .nav__list-item-anchor--mobile {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
  }

  .nav--open .mobile-nav-item-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
  }

  .nav--open .mobile-nav-item-icon svg {
    width: 24px;
    height: 24px;
    display: block;
    fill: #002395;
    color: #002395;
  }

  header.nav--open .nav.nav--active .nav__breadcrumb {
    opacity: 1;
    pointer-events: auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    animation: mobile-breadcrumb-in 0.35s cubic-bezier(0.19, 1, 0.22, 1) both;
  }

  @keyframes mobile-breadcrumb-in {
    from {
      opacity: 0;
      transform: translateY(-8px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .nav__breadcrumb .mobile-crumb {
    color: #002395;
    font-size: 14px;
    text-decoration: none;
  }

  .nav__breadcrumb .mobile-crumb:not(:last-child)::after {
    content: ' / ';
    margin-left: 6px;
    color: #666;
  }

  .nav__toggle {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .nav__back {
    cursor: pointer;
    transition: opacity 0.2s ease;
  }

  .nav__back:active {
    opacity: 0.65;
  }

  .nav.mobile-nav-busy .nav__list-item-anchor--mobile {
    pointer-events: none;
  }
}

@media (min-width: 768px) {
  .nav__list-item-anchor--mobile {
    display: none;
  }

  .mobile-nav-chevron {
    display: none;
  }

  .mobile-nav-utility {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  header.nav--open,
  .nav--open .nav__top ul.mobile-nav-stagger > li,
  .mobile-nav-exit-left,
  .mobile-nav-exit-right,
  .mobile-nav-enter-right,
  .mobile-nav-enter-left,
  .nav.nav--active .nav__breadcrumb,
  .nav--open .toolbar nav,
  .nav--open .toolbar .user-links,
  .nav__toggle svg,
  .nav__toggle svg path {
    animation: none !important;
    transition: none !important;
  }

  .nav--open .nav__top ul.mobile-nav-stagger > li {
    opacity: 1;
    transform: none;
  }
}
