/* Mobile / tablet: robust drawer menu */

html,body{overflow-x:hidden}

.nav {
  padding-top: env(safe-area-inset-top, 0px);
}

.nav > .wrap {
  padding-left: max(var(--PX, 48px), env(safe-area-inset-left, 0px));
  padding-right: max(var(--PX, 48px), env(safe-area-inset-right, 0px));
}

.nav-toggle {
  display: none;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0 0 0 8px;
  padding: 0;
  border: 1px solid var(--border, #e8e8e6);
  border-radius: var(--r, 10px);
  background: #fff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.nav-toggle:focus-visible {
  outline: 2px solid var(--red, #e31e24);
  outline-offset: 2px;
}

.nav-toggle-bars {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 20px;
}

.nav-toggle-bars span {
  display: block;
  height: 2px;
  border-radius: 1px;
  background: var(--ink, #1c1c1a);
}

.mobile-drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  background: rgba(0,0,0,.38);
}

.mobile-drawer-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(90vw, 360px);
  max-width: 360px;
  background: #fff;
  z-index: 2147483001;
  transform: translateX(104%);
  transition: transform .24s ease;
  box-shadow: -12px 0 28px rgba(0,0,0,.16);
  display: flex;
  flex-direction: column;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 14px max(18px, env(safe-area-inset-bottom, 0px));
}

.mobile-drawer-head {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.mobile-drawer-close {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border, #e8e8e6);
  border-radius: 10px;
  background: #fff;
  font-size: 24px;
  line-height: 1;
  color: var(--g5, #5a5a58);
}

.mobile-drawer-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: auto;
}

.mobile-drawer-links a {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 10px;
  color: var(--ink, #1c1c1a);
  border: 1px solid var(--border, #e8e8e6);
  background: #fff;
  font-size: 15px;
  font-weight: 500;
}

.mobile-drawer-links a.hl,
.mobile-drawer-links a.active {
  color: var(--red, #e31e24);
  border-color: #ffd0d0;
  background: #fff3f3;
  font-weight: 600;
}

.mobile-drawer-cta {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border, #e8e8e6);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mobile-drawer-cta button {
  width: 100%;
  min-height: 46px;
  border-radius: var(--r, 10px);
}

html.nav-drawer-open .mobile-drawer-backdrop {
  display: block;
}

html.nav-drawer-open .mobile-drawer-panel {
  transform: translateX(0);
}

@media (max-width: 1100px) {
  .nav {z-index: 1200}

  .nav-inner {
    flex-wrap: nowrap !important;
    min-height: 58px !important;
    height: auto !important;
    padding-top: 6px !important;
    padding-bottom: 6px !important;
    align-items: center !important;
    row-gap: 0 !important;
  }

  .nav-inner > a:first-of-type {
    flex: 0 1 auto !important;
    min-width: 0 !important;
    margin-right: auto !important;
    max-width: 176px !important;
    display: inline-flex !important;
    flex-direction: column !important;
    justify-content: center !important;
  }

  .logo-name {
    font-size: 22px !important;
    line-height: 1 !important;
  }

  .logo-sub {
    display: block !important;
    font-size: 10px !important;
    line-height: 1.2 !important;
    color: #8f8f8d !important;
    margin-top: 1px !important;
    letter-spacing: .2px !important;
  }

  .nav-toggle {display: inline-flex}
  .nav-links {display: none !important}
  .nav-right {display: none !important}
}

@media (max-width: 720px) {
  .nav > .wrap {
    padding-left: max(10px, env(safe-area-inset-left, 0px)) !important;
    padding-right: max(10px, env(safe-area-inset-right, 0px)) !important;
  }

  .nav-inner > a:first-of-type {
    max-width: 156px !important;
  }

  .logo-name {font-size: 20px !important}
  .logo-sub {font-size: 9px !important}

  .mobile-drawer-panel {
    width: min(94vw, 340px);
  }
}
