/*
 * Main navigation, 4 levels, same markup at every width (menu data: NEXO_DATA.menu).
 * Desktop (≥1025): centred row under the header bar; level 2 drops below its parent, levels 3–4 fly
 * out to the side (flipped by nav.js near the viewport edge). Tablet/mobile: accordion in the drawer.
 * Open state is driven by JS (.is-open + aria-expanded) for hover, tap and keyboard alike.
 */
.nx-nav {
  --nx-ink: #1E293B; --nx-ink-2: #334155; --nx-line: #E2E8F0; --nx-soft: #F8FAFC;
  --nx-accent: #DD5E1F; --nx-accent-ink: #C2410C; --nx-accent-tint: #FFF4ED;
}
.nx-nav .menu { list-style: none; margin: 0; padding: 0; }
.nx-nav .menu-item { position: relative; }
.nx-nav .menu-row { display: flex; align-items: center; }
.nx-nav .menu-link { display: block; }
.nx-nav .submenu-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; background: transparent; color: inherit; padding: 0;
}
.nx-nav .submenu-toggle svg { width: 14px; height: 14px; transition: transform .2s; }

/* ---------- Desktop (≥1025) */
@media (min-width: 1025px) {
  .nx-nav { border-top: 1px solid var(--nx-line); }
  .nx-nav__inner { padding: 0 var(--gutter); }
  .nx-nav .menu--main { display: flex; justify-content: center; flex-wrap: nowrap; gap: 4px; }
  .nx-nav .menu--main > .menu-item > .menu-row { position: relative; height: 50px; padding: 0 10px; color: var(--nx-ink); }
  .nx-nav .menu--main > .menu-item > .menu-row::after { /* accent indicator */
    content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px;
    background: var(--nx-accent); transform: scaleX(0); transition: transform .2s;
  }
  .nx-nav .menu--main > .menu-item:hover > .menu-row::after,
  .nx-nav .menu--main > .menu-item.is-open > .menu-row::after,
  .nx-nav .menu--main > .menu-item.is-current > .menu-row::after { transform: scaleX(1); }
  .nx-nav .menu--main > .menu-item > .menu-row > .menu-link {
    padding: 0 2px; font-size: 15px; line-height: 50px; font-weight: 600; letter-spacing: .01em; color: inherit; white-space: nowrap;
  }
  .nx-nav .menu--main > .menu-item > .menu-row > .submenu-toggle { width: 26px; height: 32px; margin-left: 2px; border-radius: 6px; color: var(--nx-ink-2); }
  .nx-nav .menu--main > .menu-item > .menu-row > .submenu-toggle:hover { background: var(--nx-soft); }
  .nx-nav .menu--main > .menu-item.is-open > .menu-row > .submenu-toggle svg { transform: rotate(180deg); }
  .nx-nav .menu--main > .menu-item > .menu-row > .menu-link:hover { color: var(--nx-accent-ink); }

  /* Panels */
  .nx-nav .sub-menu {
    position: absolute; top: 100%; left: 0; z-index: 120; display: none;
    min-width: 236px; margin: 0; padding: 8px; list-style: none;
    background: #fff; border: 1px solid var(--nx-line); border-radius: 0 0 10px 10px;
    box-shadow: 0 16px 36px rgba(15, 23, 42, .12);
  }
  .nx-nav .sub-menu .sub-menu { top: -9px; left: 100%; border-radius: 10px; }
  .nx-nav .sub-menu.is-flipped { left: auto; right: 0; }
  .nx-nav .sub-menu .sub-menu.is-flipped { left: auto; right: 100%; }
  .nx-nav .menu-item.is-open > .sub-menu { display: block; animation: nx-menu-in .16s ease-out; }

  .nx-nav .sub-menu .menu-row { border-radius: 6px; color: var(--nx-ink-2); }
  .nx-nav .sub-menu .menu-link { flex: 1; padding: 9px 12px; font-size: 14px; line-height: 20px; color: inherit; white-space: nowrap; }
  .nx-nav .sub-menu .submenu-toggle { align-self: stretch; width: 34px; border-radius: 0 6px 6px 0; }
  .nx-nav .sub-menu .submenu-toggle svg { transform: rotate(-90deg); width: 13px; height: 13px; }
  .nx-nav .sub-menu .menu-row:hover,
  .nx-nav .sub-menu .menu-item.is-open > .menu-row { background: var(--nx-accent-tint); color: var(--nx-ink); }
  .nx-nav .sub-menu .menu-item.is-current > .menu-row { color: var(--nx-accent-ink); }
}
@keyframes nx-menu-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* Mid desktop: tighten the row so all 8 top-level items stay on one line */
@media (min-width: 1025px) and (max-width: 1199px) {
  .nx-nav .menu--main { gap: 0; }
  .nx-nav .menu--main > .menu-item > .menu-row { padding: 0 7px; }
  .nx-nav .menu--main > .menu-item > .menu-row::after { left: 7px; right: 7px; }
  .nx-nav .menu--main > .menu-item > .menu-row > .menu-link { font-size: 14.5px; }
}

/* ---------- Tablet + mobile: accordion inside the drawer */
@media (max-width: 1024px) {
  .nx-nav { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
  .nx-nav__inner { padding: 8px 0; }
  .nx-nav .menu-row { min-height: 50px; padding: 0 6px 0 18px; color: var(--nx-ink); border-bottom: 1px solid var(--nx-line); }
  .nx-nav .menu-link { flex: 1; padding: 13px 0; font-size: 16px; line-height: 24px; font-weight: 600; color: inherit; }
  .nx-nav .menu-link:hover { color: var(--nx-accent-ink); }
  .nx-nav .submenu-toggle { width: 44px; height: 44px; border-radius: 8px; color: var(--nx-ink-2); }
  .nx-nav .submenu-toggle:hover { background: var(--nx-soft); }
  .nx-nav .menu-item.is-open > .menu-row > .submenu-toggle svg { transform: rotate(180deg); }
  .nx-nav .menu-item.is-open > .menu-row { color: var(--nx-accent-ink); }
  .nx-nav .menu-item.is-current > .menu-row > .menu-link { color: var(--nx-accent-ink); }
  .nx-nav .sub-menu { display: none; list-style: none; margin: 0; padding: 0; background: var(--nx-soft); }
  .nx-nav .menu-item.is-open > .sub-menu { display: block; }
  .nx-nav .sub-menu .menu-row { min-height: 46px; padding-left: 32px; }
  .nx-nav .sub-menu .menu-link { padding: 11px 0; font-size: 15px; font-weight: 500; color: var(--nx-ink-2); }
  .nx-nav .sub-menu .sub-menu .menu-row { padding-left: 46px; }
  .nx-nav .sub-menu .sub-menu .menu-link { font-size: 14.5px; }
  .nx-nav .sub-menu .sub-menu .sub-menu .menu-row { padding-left: 60px; }
}

@media (prefers-reduced-motion: reduce) {
  .nx-nav .menu-item.is-open > .sub-menu { animation: none; }
  .nx-nav .submenu-toggle svg, .nx-nav .menu-row::after { transition: none; }
}

/* ---------- Mega menu (2026-10-27): one row of departments; a full-width panel per department. */
@media (min-width: 1025px) {
  .nx-nav { position: relative; background: #fff; }
  .nx-nav .menu--main > .menu-item.has-mega { position: static; }
  .nx-nav .sub-menu.mega, .nx-nav .sub-menu.mega.is-flipped {
    left: 0; right: 0; top: 100%; min-width: 0; padding: 0; border: 0; border-top: 1px solid var(--nx-line); border-radius: 0 0 16px 16px;
    box-shadow: 0 24px 48px rgba(15, 23, 42, .14);
  }
  .mega__inner { display: grid; grid-template-columns: max-content max-content minmax(220px, 1fr); gap: 0; max-width: var(--container); margin: 0 auto; padding: 0 max(var(--gutter), 24px); }
  .mega__inner--no-products { grid-template-columns: max-content minmax(220px, 1fr); }
  .mega__cols { display: grid; grid-template-columns: repeat(var(--mega-cols, 3), 160px); gap: 28px 32px; align-content: start; padding: 28px 36px 32px 0; }
  .mega__cols[style*="--mega-cols:4"] + .mega__products ul { grid-template-columns: 160px; }
  .mega__cols[style*="--mega-cols:4"] + .mega__products li:nth-child(n+2) { display: none; }
  .mega__label { display: block; margin: 0 0 4px; font-size: 11px; font-weight: 700; letter-spacing: .12em; color: #8a8f98; }
  .mega__label:hover { color: var(--nx-accent-ink); }
  .mega__heading { display: block; margin: 0 0 10px; padding-bottom: 8px; border-bottom: 1px solid var(--nx-line); font-family: var(--f-display); font-size: 16px; font-weight: 700; color: var(--nx-ink); }
  .mega__links { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
  .mega__links a { display: block; padding: 5px 0; font-size: 14px; color: #4b5563; }
  .mega__heading:hover, .mega__links a:hover, .mega__links a.is-current, .mega__heading.is-current { color: var(--nx-accent-ink); }
  /* Products + department card fill the right side instead of empty space. */
  .mega__products { padding: 28px 28px 32px; border-left: 1px solid var(--nx-line); }
  .mega__aside-title { margin: 0 0 12px; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #8a8f98; }
  .mega__products ul { display: grid; grid-template-columns: repeat(2, 160px); gap: 16px; margin: 0; padding: 0; list-style: none; }
  .mega__product { display: grid; gap: 6px; color: var(--nx-ink); }
  .mega__product img { width: 100%; aspect-ratio: 5 / 6; border-radius: 10px; object-fit: cover; background: #f3f3f4; }
  .mega__product-name { font-size: 13.5px; font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .mega__product-price { font-family: var(--f-display); font-size: 14px; font-weight: 700; }
  .mega__product-price ins { text-decoration: none; color: var(--nx-accent-ink); }
  .mega__product-price del { margin-right: 4px; font-weight: 400; color: #8a8a8a; }
  .mega__product-price .price__suffix { display: none; }
  .mega__product:hover .mega__product-name { color: var(--nx-accent-ink); }
  .mega__promo { position: relative; display: block; align-self: stretch; min-height: 260px; margin: 20px 0 24px; overflow: hidden; border-radius: 14px; background: #e5e7eb; color: #fff; }
  .mega__promo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
  .mega__promo::after { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(10, 14, 24, .75), rgba(10, 14, 24, 0) 55%); }
  .mega__promo:hover img { transform: scale(1.05); }
  .mega__promo-copy { position: absolute; left: 18px; right: 56px; bottom: 16px; z-index: 1; display: grid; gap: 2px; }
  .mega__promo-title { font-family: var(--f-display); font-size: 19px; font-weight: 700; }
  .mega__promo-count { font-size: 13px; opacity: .85; }
  .mega__promo > svg { position: absolute; right: 14px; bottom: 16px; z-index: 1; width: 36px; height: 36px; padding: 9px; border-radius: 50%; background: #fff; color: var(--nx-ink); }
  .mega a:focus-visible { outline: 3px solid var(--nx-accent); outline-offset: 2px; border-radius: 4px; }

  /* Hide the menu row while scrolling down; it slides back on scroll up (nav.js). The header keeps
     its height (no layout shift): the row slides under the bar and the empty band lets content show. */
  .nx-header { transition: background-color .2s; }
  .nx-header .nx-header__bar { position: relative; z-index: 3; background: #fff; }
  .nx-header .nx-drawer { position: relative; z-index: 2; transition: transform .25s ease; }
  .nx-header.is-nav-hidden { background: transparent; border-bottom-color: transparent; box-shadow: none; pointer-events: none; }
  .nx-header.is-nav-hidden .nx-header__bar { pointer-events: auto; box-shadow: 0 6px 20px rgba(15, 23, 42, .08); border-bottom: 1px solid var(--nx-line); }
  .nx-header.is-nav-hidden .nx-drawer { transform: translateY(-100%); visibility: hidden; transition: transform .25s ease, visibility 0s linear .25s; }
}
/* Drawer (tablet/mobile): the panel content opens inline under the department. */
@media (max-width: 1024px) {
  .mega__inner { padding: 8px 0 12px; background: var(--nx-soft); }
  .mega__col { padding: 6px 18px 6px 32px; }
  .mega__label { display: block; padding: 8px 0 0; font-size: 11px; font-weight: 700; letter-spacing: .12em; color: #8a8f98; }
  .mega__heading { display: block; padding: 6px 0; font-size: 15px; font-weight: 700; color: var(--nx-ink); }
  .mega__products { display: none; }
  .mega__links { margin: 0 0 6px; padding: 0; list-style: none; }
  .mega__links a { display: block; padding: 8px 0 8px 12px; font-size: 14.5px; color: var(--nx-ink-2); }
  .mega__deep a { padding-left: 24px; font-size: 14px; color: #6b7280; }
  .mega__promo { display: flex; align-items: center; justify-content: space-between; margin: 6px 18px 4px 32px; padding: 12px 14px; border-radius: 10px; background: #fff; font-family: var(--f-display); font-weight: 700; color: var(--nx-accent-ink); }
  .mega__promo img, .mega__promo-count { display: none; }
  .mega__promo > svg { width: 18px; height: 18px; }
}
@media (prefers-reduced-motion: reduce) { .nx-header .nx-drawer, .mega__promo img { transition: none; } }
/* Narrower desktops: flexible columns, no product strip, smaller department card. */
@media (min-width: 1025px) and (max-width: 1279px) {
  .mega__inner, .mega__inner--no-products { grid-template-columns: minmax(0, max-content) minmax(180px, 1fr); }
  .mega__cols { grid-template-columns: repeat(var(--mega-cols, 3), minmax(110px, 150px)); gap: 24px 22px; padding-right: 24px; }
  .mega__products { display: none; }
}
