/* ============================================================
   MOBILE NAVIGATION — hamburger + slide-down panel
   Activates at <= 980px viewport. Reuses existing .main-nav HTML.
   ============================================================ */

/* Hamburger button — hidden on desktop */
.menu-toggle {
  display: none;
  background: transparent;
  border: 1px solid #4A5363;
  border-radius: 8px;
  padding: 0;
  cursor: pointer;
  color: #FFFFFF;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  transition: background 200ms, border-color 200ms;
}
.menu-toggle:hover { background: rgba(255,255,255,.06); border-color: #FFFFFF; }
.menu-toggle svg {
  width: 22px; height: 22px;
  stroke: currentColor; stroke-width: 2;
  fill: none; stroke-linecap: round; stroke-linejoin: round;
}
.menu-toggle .icon-close { display: none; }
.menu-toggle[aria-expanded="true"] .icon-open { display: none; }
.menu-toggle[aria-expanded="true"] .icon-close { display: block; }

@media (max-width: 980px) {
  /* Show hamburger */
  .menu-toggle { display: inline-flex; }

  /* Reset the desktop grid so layout becomes: brand | spacer | hamburger */
  .header-main .row,
  .header-main .row[class] {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    grid-template-columns: none !important;
    gap: 16px !important;
  }
  .header-main .brand { flex: 1; }

  /* Main nav: closed by default, opens as slide-down panel */
  .main-nav {
    display: none !important;
    position: absolute !important;
    top: 100%; left: 0; right: 0;
    background: rgba(20, 25, 35, 0.98);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border-top: 1px solid #353D4B;
    border-bottom: 1px solid #353D4B;
    padding: 8px 24px 24px;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0 !important;
    font-size: 16px;
    max-height: calc(100vh - 70px);
    overflow-y: auto;
    z-index: 49;
  }
  .main-nav.is-open { display: flex !important; }

  /* Each nav-item becomes an accordion row */
  .nav-item {
    border-bottom: 1px solid #353D4B;
    padding: 0;
    position: relative;
  }
  .nav-item:last-child { border-bottom: none; }
  .nav-item::after { display: none; } /* kill desktop hover bridge */

  /* Top-level link in each item */
  .nav-item > a {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    padding: 16px 4px !important;
    color: #FFFFFF !important;
    font-weight: 700 !important;
    font-size: 17px !important;
    text-decoration: none;
  }
  .nav-item > a::after {
    content: '+';
    font-size: 22px;
    color: #6C7689;
    font-weight: 400;
    line-height: 1;
    transition: transform 200ms, color 200ms;
    flex-shrink: 0;
    margin-left: 12px;
  }
  .nav-item.expanded > a::after {
    content: '−';
    color: #A8253C;
  }

  /* Submenu — flatten and show only when expanded */
  .submenu {
    position: static !important;
    transform: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 0 12px 8px !important;
    margin: 0;
    min-width: 0;
    border-radius: 0 !important;
    width: 100%;
    display: none;
  }
  .nav-item.expanded .submenu { display: block; }
  /* Override desktop :hover behavior on touch */
  .nav-item:hover .submenu { display: none; }
  .nav-item.expanded:hover .submenu { display: block; }

  .submenu a {
    padding: 10px 0 !important;
    font-size: 14px !important;
    color: #A0AABC !important;
    display: block;
  }
  .submenu a.featured {
    color: #FFFFFF !important;
    font-weight: 700 !important;
  }
  .submenu-divider {
    margin: 8px 0 !important;
    background: #353D4B !important;
  }

  /* Hide distributor badges on mobile (they're already hidden < 980 elsewhere, this is a safety net) */
  .dist-badges { display: none !important; }

  /* Page should not horizontal-scroll when menu is open */
  body.menu-open { overflow: hidden; }
}
