/* ==========================================================================
 * Header and navigation (design pass D1). Uses the design-system tokens.
 * Desktop ≥ 1024 px; below that the menu is a drawer.
 * ========================================================================== */

.nx-skip-link {
  background: var(--nx-purple);
  border-radius: var(--nx-radius-sm);
  color: #fff;
  font-weight: 700;
  left: 8px;
  padding: 12px 16px;
  position: absolute;
  top: -100px;
  z-index: 200;
}

.nx-skip-link:focus {
  top: 8px;
}

.nx-header {
  background: #fff;
  border-bottom: 1px solid var(--nx-border);
  font-family: var(--nx-font);
  position: sticky;
  top: 0;
  /* The parent's mega-menu script sets an inline z-index of 10 when "E-pood" opens, which let the sticky
     size bar and shop bar (z-index 20) slide over the open menu. */
  z-index: 50 !important;
}

.nx-header__bar {
  align-items: center;
  box-sizing: border-box;
  display: flex;
  gap: var(--nx-2);
  margin: 0 auto;
  max-width: 1264px;
  min-height: 64px;
  padding: 0 var(--nx-gutter);
}

.nx-header__logo {
  display: inline-flex;
  flex-shrink: 0;
}

.nx-header__logo img {
  display: block;
  height: 26px;
  /* The lowercase letters fill only the lower ~3/4 of the logo (the "l" makes it tall); lift it so the letters
     sit on the same line as the menu text. */
  transform: translateY(-12%);
  width: auto;
}

/* Icon buttons (phone, search, cart, menu) */
.nx-iconbtn {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: var(--nx-pill);
  color: var(--nx-purple);
  cursor: pointer;
  display: inline-flex;
  height: 44px;
  justify-content: center;
  margin: 0;
  padding: 0;
  position: relative;
  text-decoration: none;
  transition: background-color 0.2s ease;
  width: 44px;
}

.nx-iconbtn:hover {
  background: var(--nx-bg-alt);
}

.nx-iconbtn:focus-visible {
  outline: 3px solid var(--nx-purple);
  outline-offset: 2px;
}

.nx-iconbtn .nx-icon {
  height: 22px;
  width: 22px;
}

.nx-header__actions {
  align-items: center;
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.nx-cart-count {
  align-items: center;
  background: var(--nx-purple);
  border: 2px solid #fff;
  border-radius: var(--nx-pill);
  box-sizing: border-box;
  color: #fff;
  display: inline-flex;
  font-size: 11px;
  font-weight: 800;
  height: 20px;
  justify-content: center;
  line-height: 1;
  min-width: 20px;
  padding: 0 4px;
  position: absolute;
  right: 0;
  top: 2px;
}

.nx-cart-count.is-empty {
  display: none;
}

.nx-header__phone,
.nx-header__cta {
  display: none;
}

/* ---------- Menu: shared ---------- */

.nx-nav__menu {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nx-nav__menu li {
  list-style: none;
  margin: 0;
}

.nx-nav__menu li::before {
  display: none; /* parent theme bullets */
}

.nx-nav__menu a {
  color: var(--nx-purple);
  font-weight: 700;
  text-decoration: none;
}

.nx-nav__menu .sub-menu {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* ---------- Desktop ---------- */

@media (min-width: 1024px) {
  .nx-header__bar {
    gap: var(--nx-4);
    min-height: 80px;
  }

  .nx-header__logo img {
    height: 32px;
  }

  .nx-header__phone,
  .nx-header__cta {
    display: inline-flex;
  }

  .nx-header__cta {
    margin-left: var(--nx-1);
  }

  .nx-header__menu-toggle,
  .nx-nav__head,
  .nx-nav__contact,
  .nx-nav-backdrop {
    display: none !important;
  }

  .nx-nav {
    display: flex;
  }

  .nx-nav__menu {
    align-items: center;
    display: flex;
    gap: 4px;
  }

  .nx-nav__menu > li > a {
    align-items: center;
    border-radius: var(--nx-pill);
    display: inline-flex;
    font-size: 16px;
    gap: 6px;
    min-height: 44px;
    padding: 0 14px;
    white-space: nowrap;
  }

  .nx-nav__menu > li > a:hover,
  .nx-nav__menu > li.current-menu-item > a,
  .nx-nav__menu > li.current-menu-ancestor > a,
  .nx-nav__menu > li.megamenu__active > a {
    background: var(--nx-bg-alt);
  }

  /* Chevron on items with a dropdown */
  .nx-nav__menu > li.menu-item-has-children > a::after {
    border-bottom: 2px solid currentColor;
    border-right: 2px solid currentColor;
    content: "";
    height: 7px;
    margin: -3px 0 0 2px;
    transform: rotate(45deg);
    transition: transform 0.2s ease;
    width: 7px;
  }

  .nx-nav__menu > li.megamenu__active > a::after {
    margin-top: 3px;
    transform: rotate(-135deg);
  }

  /* Dropdown panel: full width under the header */
  .nx-nav__menu > li > .sub-menu {
    background: #fff;
    border-bottom: 1px solid var(--nx-border);
    border-top: 1px solid var(--nx-border);
    box-shadow: var(--nx-shadow);
    box-sizing: border-box;
    display: none;
    gap: var(--nx-4) var(--nx-5);
    grid-template-columns: repeat(4, minmax(0, 1fr));
    left: 0;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    padding: var(--nx-5) max(var(--nx-gutter), calc((100% - 1200px) / 2));
    position: absolute;
    right: 0;
    top: 100%;
  }

  .nx-nav__menu > li.megamenu__active > .sub-menu {
    display: grid;
  }

  .nx-nav__menu > li > .sub-menu > li > a {
    font-size: 17px;
    font-weight: 800;
  }

  .nx-nav__menu > li > .sub-menu .sub-menu {
    display: grid;
    gap: 6px;
    margin-top: 10px;
  }

  .nx-nav__menu > li > .sub-menu .sub-menu a {
    color: var(--nx-text);
    font-size: 15px;
    font-weight: 400;
  }

  .nx-nav__menu .sub-menu a:hover {
    color: var(--nx-purple);
    text-decoration: underline;
  }
}

/* ---------- Below 1024 px: drawer ---------- */

@media (max-width: 1023px) {
  .nx-nav {
    background: #fff;
    bottom: 0;
    box-shadow: var(--nx-shadow-strong);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    max-width: 420px;
    overflow-y: auto;
    padding: 0 var(--nx-3) var(--nx-3);
    position: fixed;
    right: 0;
    top: 0;
    transform: translateX(100%);
    transition: transform 0.25s ease, visibility 0.25s;
    visibility: hidden;
    width: 88vw;
    z-index: 100;
  }

  html.nx-menu-open .nx-nav {
    transform: none;
    visibility: visible;
  }

  html.nx-menu-open,
  html.nx-menu-open body {
    overflow: hidden;
  }

  .nx-nav-backdrop {
    background: rgba(44, 24, 68, 0.5);
    inset: 0;
    position: fixed;
    z-index: 90;
  }

  .nx-nav__head {
    align-items: center;
    display: flex;
    justify-content: space-between;
    min-height: 64px;
  }

  .nx-nav__title {
    color: var(--nx-text-muted);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  .nx-nav__menu > li {
    border-bottom: 1px solid var(--nx-border);
  }

  .nx-nav__menu > li > a {
    align-items: center;
    display: flex;
    font-size: 20px;
    justify-content: space-between;
    min-height: 56px;
  }

  .nx-nav__menu > li.menu-item-has-children > a::after {
    border-bottom: 2px solid currentColor;
    border-right: 2px solid currentColor;
    content: "";
    height: 9px;
    margin-right: 6px;
    transform: rotate(45deg);
    transition: transform 0.2s ease;
    width: 9px;
  }

  .nx-nav__menu > li.megamenu__active > a::after {
    transform: rotate(-135deg);
  }

  .nx-nav__menu > li > .sub-menu {
    display: none;
    padding: 0 0 var(--nx-2) var(--nx-2);
  }

  .nx-nav__menu > li.megamenu__active > .sub-menu {
    display: block;
  }

  .nx-nav__menu > li > .sub-menu > li > a {
    display: flex;
    font-size: 17px;
    min-height: 44px;
    align-items: center;
  }

  .nx-nav__menu > li > .sub-menu .sub-menu {
    display: flex;
    flex-wrap: wrap;
    gap: 0 var(--nx-2);
    padding: 0 0 var(--nx-1) var(--nx-2);
  }

  .nx-nav__menu > li > .sub-menu .sub-menu a {
    align-items: center;
    color: var(--nx-text);
    display: flex;
    font-size: 16px;
    font-weight: 400;
    min-height: 40px;
  }

  .nx-nav__contact {
    display: grid;
    gap: var(--nx-2);
    margin-top: auto;
    padding-top: var(--nx-4);
  }

  .nx-nav__contact-line {
    align-items: center;
    color: var(--nx-text);
    display: flex;
    font-size: 16px;
    gap: 10px;
    text-decoration: none;
  }

  .nx-nav__contact-line .nx-icon {
    color: var(--nx-purple);
    height: 20px;
    width: 20px;
  }

  a.nx-nav__contact-line {
    color: var(--nx-purple);
    font-weight: 700;
  }
}

/* ---------- Search panel ---------- */

.nx-search {
  background: #fff;
  border-bottom: 1px solid var(--nx-border);
  box-shadow: var(--nx-shadow);
  left: 0;
  position: absolute;
  right: 0;
  top: 100%;
}

.nx-search[hidden] {
  display: none;
}

.nx-search__inner {
  align-items: flex-start;
  box-sizing: border-box;
  display: flex;
  gap: var(--nx-1);
  margin: 0 auto;
  max-width: 800px;
  padding: var(--nx-2) var(--nx-gutter);
}

.nx-search .search__container {
  flex: 1 1 auto;
  min-width: 0;
  position: relative;
}

.nx-search .search__group {
  align-items: center;
  background: var(--nx-bg-alt);
  border: 1px solid var(--nx-border);
  border-radius: var(--nx-pill);
  display: flex;
  min-height: 48px;
  padding: 0 var(--nx-2);
}

.nx-search .search__button {
  background: none;
  border: 0;
  color: var(--nx-purple);
  display: inline-flex;
  padding: 0 8px 0 0;
}

.nx-search .search__input {
  background: transparent;
  border: 0;
  flex: 1 1 auto;
  font-family: var(--nx-font);
  font-size: 16px; /* 16 px keeps iOS from zooming in */
  min-width: 0;
  outline: none;
  padding: 12px 0;
}

/* ---------- Studio pages: bottom bar on phones and tablets ---------- */

.nx-bottom-bar {
  background: #fff;
  bottom: 0;
  box-shadow: 0 -6px 20px rgba(44, 24, 68, 0.12);
  box-sizing: border-box;
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1.4fr;
  left: 0;
  padding: 12px var(--nx-gutter) calc(12px + env(safe-area-inset-bottom));
  position: fixed;
  right: 0;
  z-index: 60;
}

.nx-bottom-bar .nx-btn {
  min-height: 48px;
}

body.has-nx-bottom-bar {
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}

@media (min-width: 1024px) {
  .nx-bottom-bar {
    display: none;
  }

  body.has-nx-bottom-bar {
    padding-bottom: 0;
  }
}

/* The search panel has its own close button; hide the dropdown's duplicate. */
.nx-search .search__close {
  display: none;
}

/* The sticky header is its own stacking context: lift it above the backdrop and the bottom bar while the drawer is open. */
html.nx-menu-open .nx-header {
  z-index: 110 !important; /* the parent's mega-menu script sets an inline z-index on the header */
}
