/* Wide navigation keeps child panels attached to their actual parent link. */
@media (min-width:1025px) {
  body header.nav { overflow:visible; }
  body header.nav #main-navigation { column-gap:clamp(10px,1.3vw,24px); }
  body header.nav #main-navigation > a,
  body header.nav #main-navigation > details > summary { padding:13px clamp(4px,.55vw,10px); }
  body header.nav #main-navigation > a:is([href="/ai"],[href="/referrals"]) { padding-inline:clamp(10px,1vw,19px); }
  body header.nav.mega-open > nav.mega-panel > div > a {
    display:block; box-sizing:border-box; width:100%; padding:10px 12px!important;
    white-space:normal!important; overflow-wrap:anywhere!important; line-height:1.5!important;
  }
  body:not([data-menu-direction="vertical"]) .site-nav { overflow:visible; }
  .site-nav #site-menu { row-gap:4px;column-gap:clamp(5px,1.1vw,24px);overflow:visible; }
  .site-nav #site-menu > .nav-group > a {
    display:block; padding:11px clamp(7px,.85vw,15px);line-height:1.45;overflow-wrap:anywhere;
  }
  .site-nav #site-menu .nav-children {
    min-width:min(196px,80vw);width:max-content;max-width:min(280px,80vw);
    padding:8px; box-sizing:border-box;border:1px solid #e4e7eb;border-radius:10px;
    z-index:40;background:#fff;color:#20242c;
  }
  .site-nav #site-menu .nav-children a {
    display:block;padding:10px 12px;white-space:normal;line-height:1.45;overflow-wrap:anywhere;
    color:inherit!important;border-radius:5px;
  }
  .site-nav #site-menu .nav-children a:is(:hover,:focus-visible) { background:#f1f3f5; }
  .site-nav #site-menu > .nav-group > .nav-children { left:0;right:auto;top:100%; }
  .site-nav #site-menu > .nav-group > .nav-children[data-edge="end"] {right:0;left:auto;}
  .site-nav #site-menu .nav-children .nav-children[data-edge="end"] {right:100%;left:auto;}
  body[data-menu-direction="vertical"] .site-nav #site-menu .nav-children {
    position:static;max-width:100%;width:100%;min-width:0;box-shadow:none;
    border:0;border-inline-start:1px solid #dce0e5;border-radius:0;
  }
}
@media (max-width:1024px) {
  body header.nav { display:flex!important;align-items:center;flex-wrap:wrap!important;gap:10px!important;padding:12px clamp(12px,3vw,26px)!important; }
  body header.nav > .logo { margin-right:auto; }
  body header.nav > .menu-toggle { display:block;order:3;min-width:44px;min-height:44px;border:1px solid #d6dbe2;border-radius:8px;background:#fff;color:#23292e;font-size:22px;cursor:pointer; }
  body header.nav > .language-switch { margin-left:0; }
  body header.nav > nav#main-navigation, body header.nav > #nav-user, body header.nav.mega-open > nav.mega-panel {display:none!important;}
  body header.nav.menu-open {max-height:100dvh;overflow-y:auto;overscroll-behavior:contain;}
  body header.nav.menu-open > nav#main-navigation {
    display:grid!important;order:5;flex:0 0 100%;width:100%;min-width:0;
    grid-template-columns:repeat(2,minmax(0,1fr));gap:8px 12px;
    box-sizing:border-box;padding:10px 0;border-top:1px solid #e2e6eb;
  }
  body header.nav.menu-open > #nav-user {display:flex!important;order:6;flex:1 1 100%;}
  body header.nav #main-navigation > a, body header.nav #main-navigation > details > summary {display:block;padding:12px;min-height:44px;box-sizing:border-box;line-height:1.45;}
  body header.nav #main-navigation > details {min-width:0;white-space:normal;}
  body header.nav #main-navigation > details > summary::after {display:none;}
  body header.nav #main-navigation > details[open] > div {
    display:grid!important;position:static!important;width:100%;min-width:0;
    box-sizing:border-box;padding:4px 8px;box-shadow:none;border:0;background:#f5f6f8;
  }
  body header.nav #main-navigation > details > div > a {min-height:42px;padding:10px 8px!important;white-space:normal!important;overflow-wrap:anywhere;}
  body .site-nav[data-mobile-menu="true"] .mobile-menu-toggle,
  body .shop-nav[data-mobile-menu="true"] .mobile-menu-toggle {display:block!important;min-height:44px;flex:0 0 auto;}
  body .site-nav[data-mobile-menu="true"] #site-menu,body .shop-nav[data-mobile-menu="true"] #shop-menu {display:none!important;}
  /* The dialog temporarily owns the same nav element, preserving its real links and state. */
  .viewport-menu409 #site-menu .nav-group > a,.viewport-menu409 #shop-menu a {min-height:44px;box-sizing:border-box;padding:13px 12px;line-height:1.45;}
  .viewport-menu409 #site-menu .nav-children {display:block!important;position:static!important;width:100%;min-width:0;max-width:100%;box-sizing:border-box;padding:2px 0 4px 14px;}
  .viewport-menu409 #site-menu a {white-space:normal;overflow-wrap:anywhere;}
  body[data-menu-direction="vertical"]:has(>.site-nav[data-mobile-menu="true"]) {padding-left:0!important;}
  body[data-menu-direction="vertical"]>.site-nav[data-mobile-menu="true"] {position:relative!important;inset:auto!important;width:100%!important;height:auto!important;min-height:64px!important;flex-direction:row!important;align-items:center!important;justify-content:space-between!important;padding:14px 20px!important;}
}
@media (max-width:520px) {
  body header.nav.menu-open > nav#main-navigation {grid-template-columns:minmax(0,1fr);}
}
