/* Shared desktop navigation. The existing mobile drawer stays independent. */
.desktop-menu-toggle,
.desktop-drawer-overlay,
.desktop-drawer {
  display: none;
}

@media (min-width: 992px) {
  .navbar-main-links {
    display: none;
  }

  .site-homepage .navbar-main-links {
    display: flex;
  }

  .site-homepage .navbar-right {
    margin-left: 0;
  }

  .navbar-wrapper {
    flex-wrap: nowrap;
  }

  .navbar-right {
    flex-wrap: nowrap;
    gap: 12px;
    margin-left: auto;
  }

  .navbar-right > * {
    margin-right: 0;
  }
}

/* Menu button + drawer: same on every screen size (the mobile hamburger is gone) */
@media all {
  .desktop-menu-toggle {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 44px;
    margin: 0;
    padding: 10px 16px;
    border: 1px solid var(--ds-border-strong, #cbd5e1);
    border-radius: var(--ds-radius-md, 10px);
    background: var(--ds-bg, #fff);
    color: var(--ds-text, #0d131c);
    font-family: var(--ds-font, "Poppins", sans-serif);
    font-size: 16px;
    font-weight: 600;
    line-height: 22px;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 200ms ease, border-color 200ms ease;
  }

  .desktop-menu-toggle:hover,
  .desktop-menu-toggle[aria-expanded="true"] {
    border-color: var(--ds-primary, #40c7b1);
    background: var(--ds-bg-mint, #d9ffea);
  }

  .desktop-menu-toggle > svg {
    display: block;
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
  }

  .desktop-drawer-overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(13, 19, 28, 0.45);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 250ms ease, visibility 250ms ease;
  }

  .desktop-drawer-overlay.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .desktop-drawer {
    display: flex;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: auto;
    z-index: 10001;
    flex-direction: column;
    gap: 24px;
    width: 440px;
    max-width: 100vw;
    height: 100vh;
    height: 100dvh;
    min-width: 0;
    padding: 32px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    border-left: 1px solid var(--ds-border, #e2e8f0);
    background: var(--ds-bg, #fff);
    color: var(--ds-text, #0d131c);
    box-shadow: -12px 0 40px rgba(13, 19, 28, 0.12);
    font-family: var(--ds-font, "Poppins", sans-serif);
    font-size: 16px;
    font-weight: 400;
    line-height: 1.6;
    visibility: hidden;
    transform: translateX(100%);
    transition: transform 280ms cubic-bezier(0.4, 0, 0.2, 1), visibility 280ms ease;
    -webkit-overflow-scrolling: touch;
  }

  .desktop-drawer.open {
    visibility: visible;
    transform: translateX(0);
  }

  .desktop-drawer-header {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-width: 0;
  }

  .desktop-drawer-brand {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    min-height: 44px;
    color: inherit;
    text-decoration: none;
  }

  .desktop-drawer-brand img {
    display: block;
    width: 230px;
    max-width: 100%;
    height: auto;
    object-fit: contain;
  }

  .desktop-drawer-close {
    display: inline-flex;
    flex: 0 0 44px;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border: 1px solid var(--ds-border-strong, #cbd5e1);
    border-radius: var(--ds-radius-md, 10px);
    background: var(--ds-bg, #fff);
    color: var(--ds-text, #0d131c);
    font: inherit;
    cursor: pointer;
    transition: background-color 200ms ease;
  }

  .desktop-drawer-close:hover {
    background: var(--ds-bg-secondary, #f5f7f9);
  }

  .desktop-drawer-close > svg {
    display: block;
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
  }

  .desktop-drawer-content {
    display: flex;
    flex: 1 0 auto;
    flex-direction: column;
    gap: 24px;
    min-width: 0;
  }

  .desktop-drawer-nav {
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .desktop-drawer-nav > li {
    margin: 0;
    padding: 0;
    border-bottom: 1px solid var(--ds-border, #e2e8f0);
  }

  .desktop-drawer-nav > li:first-child {
    border-top: 1px solid var(--ds-border, #e2e8f0);
  }

  .desktop-drawer-nav a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 60px;
    margin: 0;
    padding: 16px 0;
    border-radius: var(--ds-radius-sm, 6px);
    color: var(--ds-text, #0d131c);
    font-size: 24px;
    font-weight: 600;
    line-height: 1.3;
    text-decoration: none;
    transition: background-color 200ms ease, color 200ms ease;
  }

  .desktop-drawer-nav a > span {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .desktop-drawer-nav a > svg {
    display: block;
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
  }

  .desktop-drawer-nav a:hover,
  .desktop-drawer-nav a[aria-current="page"] {
    background: var(--ds-bg-mint, #d9ffea);
    color: var(--ds-text, #0d131c);
  }

  .desktop-drawer-accounts {
    margin: 0;
    padding: 20px;
    border: 1px solid var(--ds-border, #e2e8f0);
    border-radius: var(--ds-radius-lg, 12px);
    background: var(--ds-bg-secondary, #f5f7f9);
  }

  .desktop-drawer-accounts > h3 {
    margin: 0 0 16px;
    color: var(--ds-text, #0d131c);
    font-family: inherit;
    font-size: 20px;
    font-weight: 600;
    line-height: 24px;
    letter-spacing: normal;
  }

  .desktop-drawer-account-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  .desktop-drawer-account {
    min-width: 0;
  }

  .desktop-drawer-account + .desktop-drawer-account {
    padding-top: 16px;
    border-top: 1px solid var(--ds-border, #e2e8f0);
  }

  .desktop-drawer-account h4 {
    margin: 0 0 8px;
    color: var(--ds-text-secondary, #475569);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    line-height: 22px;
    letter-spacing: normal;
  }

  .desktop-drawer-account ul {
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .desktop-drawer-account li {
    margin: 0;
    padding: 0;
  }

  .desktop-drawer-account-link {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 8px 0;
    border-radius: var(--ds-radius-sm, 6px);
    color: var(--ds-text, #0d131c);
    font-size: 16px;
    font-weight: 500;
    line-height: 22px;
    text-decoration: none;
    overflow-wrap: anywhere;
  }

  .desktop-drawer-account-link:hover {
    color: var(--ds-brand-text-aa, #087f70);
    text-decoration: underline;
    text-underline-offset: 3px;
  }

  .desktop-drawer-actions {
    margin-top: auto;
    padding-top: 8px;
  }

  .desktop-drawer-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 48px;
    margin: 0;
    padding: 12px 20px;
    border: 1px solid var(--ds-primary, #40c7b1);
    border-radius: var(--ds-radius-md, 10px);
    background: var(--ds-primary, #40c7b1);
    color: var(--ds-text, #0d131c);
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    line-height: 24px;
    text-align: center;
    text-decoration: none;
    transition: background-color 200ms ease, border-color 200ms ease;
  }

  .desktop-drawer-cta:hover {
    border-color: var(--ds-primary-hover, #34b19c);
    background: var(--ds-primary-hover, #34b19c);
    color: var(--ds-text, #0d131c);
  }

  .desktop-drawer-cta > span {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .desktop-drawer-cta > svg {
    display: block;
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
  }

  .desktop-menu-toggle:focus-visible,
  .desktop-drawer :is(a, button, [tabindex]):focus-visible {
    outline: var(--ds-focus-outline, 2px solid #0d131c);
    outline-offset: 3px;
    box-shadow: var(--ds-focus-ring, 0 0 0 3px rgba(64, 199, 177, 0.45));
  }

  .desktop-menu-toggle:disabled,
  .desktop-drawer button:disabled,
  .desktop-drawer [aria-disabled="true"] {
    opacity: 0.6;
    cursor: not-allowed;
  }

  body.desktop-menu-open .navbar {
    transform: translateY(0) !important;
  }

  body.mot-page:not(.mot-search) .desktop-menu-toggle,
  body.mot-page:not(.mot-search) .desktop-drawer,
  body.mot-page:not(.mot-search) .desktop-drawer-overlay {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .desktop-menu-toggle,
  .desktop-drawer-overlay,
  .desktop-drawer,
  .desktop-drawer * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* Icon-only version of the desktop menu button (shield with person, no "Menu" word) */
@media all {
  .desktop-menu-toggle--icon {
    min-width: 44px;
    padding: 2px;
    border: 0;
    background: transparent;
  }
  .desktop-menu-toggle--icon:hover,
  .desktop-menu-toggle--icon[aria-expanded="true"] {
    background: transparent;
    opacity: 0.85;
  }
  .desktop-menu-toggle--icon > svg {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
  }
}

/* Desktop: the shield button above is now the one account/menu button, so the separate account dropdown is hidden.
   (The lists inside it stay in the page: the menu drawer reads its Sellers / Traders links from them.) */
@media all {
  .navbar-account {
    display: none;
  }
}

/* Phones: drawer fills the screen width with a little less padding */
@media (max-width: 480px) {
  .desktop-drawer {
    width: 100vw;
    padding: 20px 16px;
  }
  .desktop-drawer-brand img {
    width: 190px;
  }
  .desktop-drawer-nav a {
    font-size: 20px;
  }
}
