/* ==========================================================================
   GHSM – main nav + category mega menu
   Loaded by wp-content/mu-plugins/ghsm-mega-menu.php ([ghsm_main_nav])
   ========================================================================== */

/* The panel is positioned against the blue nav band so it can span the full width,
   so nothing between it and the band may create a positioning context or clip it. */
.ghsm-mainnav { position: relative; z-index: 60; overflow: visible; }
.ghsm-mainnav > .e-con-inner { overflow: visible; }
.ghsm-mainnav .elementor-widget-shortcode,
.ghsm-mainnav .elementor-widget-shortcode > .elementor-widget-container { position: static; }

.ghsm-nav { position: static; min-width: 0; }
.ghsm-nav__list {
  display: flex; align-items: stretch; flex-wrap: wrap;
  gap: 1px; margin: 0; padding: 0; list-style: none;
}
/* The caret is a separate control so the label keeps navigating, but the two read as one
   target — so the hover/open highlight belongs on the item that holds them. Painting the
   link and the button each left a seam down the middle of the highlight. */
.ghsm-nav__item {
  position: static; display: flex; align-items: stretch;
  border-radius: var(--ghsm-radius-sm, 6px);
  transition: background-color .15s ease;
}
.ghsm-nav__item:hover,
.ghsm-nav__item:focus-within,
.ghsm-nav__item.is-open,
.ghsm-nav__item:has(> a.ghsm-nav__link.is-current) { background: rgba(255, 255, 255, .14); }

/* Elementor's kit styles link colour as `.elementor-kit-N a` and buttons as a bare `button`,
   so both of these have to out-specify it rather than sit at class level. */
.ghsm-nav a.ghsm-nav__link {
  display: inline-flex; align-items: center;
  padding: 12px 9px;
  font-family: inherit; font-size: 13.5px; font-weight: 700; line-height: 1.2; letter-spacing: -.01em;
  color: #fff; background: none; text-decoration: none; white-space: nowrap;
  border: 0; border-radius: var(--ghsm-radius-sm, 6px);
  transition: background-color .15s ease;
}
.ghsm-nav a.ghsm-nav__link:hover,
.ghsm-nav a.ghsm-nav__link:focus-visible,
.ghsm-nav a.ghsm-nav__link.is-current { background: none; color: #fff; text-decoration: none; }

/* The caret is its own control so the category link keeps navigating. */
.ghsm-nav button.ghsm-nav__toggle {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 20px; min-width: 0; height: auto; padding: 0; margin: 0 0 0 -7px;
  background: none; background-color: transparent; border: 0; box-shadow: none;
  cursor: pointer; color: #fff;
  border-radius: var(--ghsm-radius-sm, 6px);
}
.ghsm-nav button.ghsm-nav__toggle:hover,
.ghsm-nav button.ghsm-nav__toggle:focus-visible { background-color: transparent; color: #fff; }
/* Which of the two controls has focus is no longer carried by the fill. */
.ghsm-nav a.ghsm-nav__link:focus-visible,
.ghsm-nav button.ghsm-nav__toggle:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }
.ghsm-nav__caret {
  width: 0; height: 0;
  border-left: 4px solid transparent; border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  transition: transform .15s ease;
}
.ghsm-nav__item.is-open .ghsm-nav__caret { transform: rotate(180deg); }

/* --------------------------------------------------------------------------
   The panel
   -------------------------------------------------------------------------- */
.ghsm-mega {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 60;
  background: #fff;
  border-bottom: 3px solid var(--ghsm-red, #B01218);
  box-shadow: 0 18px 40px rgba(16, 24, 40, .16);
}
.ghsm-mega[hidden] { display: none; }
.ghsm-mega__in {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 36px;
  width: 100%; max-width: 1400px; margin: 0 auto;
  padding: 26px 24px 28px;
  box-sizing: border-box;
}

.ghsm-mega__label {
  margin: 0 0 12px;
  font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ghsm-muted, #5c6675);
}

/* Subcategory list */
.ghsm-mega__list {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px 18px; margin: 0 0 16px; padding: 0; list-style: none;
}
.ghsm-mega .ghsm-mega__list a {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 7px 10px; border-radius: var(--ghsm-radius-sm, 6px);
  font-size: 14.5px; font-weight: 600; line-height: 1.35;
  color: var(--ghsm-ink, #151a22); text-decoration: none;
  transition: background-color .12s ease, color .12s ease;
}
.ghsm-mega .ghsm-mega__list a:hover,
.ghsm-mega .ghsm-mega__list a:focus-visible,
.ghsm-mega .ghsm-mega__list a.is-active { background: var(--ghsm-band, #F5F5F7); color: var(--ghsm-blue, #2456C4); text-decoration: none; }
.ghsm-mega__count {
  flex: none; font-size: 11.5px; font-weight: 700; color: var(--ghsm-muted, #5c6675);
  background: var(--ghsm-line-soft, #EDEFF2); border-radius: 999px; padding: 2px 7px;
}
.ghsm-mega__list a:hover .ghsm-mega__count,
.ghsm-mega__list a.is-active .ghsm-mega__count { background: #fff; }

.ghsm-mega a.ghsm-mega__all, .ghsm-mega a.ghsm-mega__more {
  display: inline-block; padding: 0 10px;
  font-size: 14px; font-weight: 700; color: var(--ghsm-red, #B01218); text-decoration: none;
}
.ghsm-mega a.ghsm-mega__all:hover, .ghsm-mega a.ghsm-mega__more:hover { text-decoration: underline; color: var(--ghsm-red, #B01218); }

/* Product picks — one view per subcategory, swapped on hover */
.ghsm-mega__products { border-left: 1px solid var(--ghsm-line, #E1E3E8); padding-left: 36px; min-width: 0; }
.ghsm-mega__view[hidden] { display: none; }
.ghsm-mega__cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.ghsm-mega a.ghsm-mega__card {
  display: flex; flex-direction: column; min-width: 0;
  border: 1px solid var(--ghsm-line, #E1E3E8); border-radius: var(--ghsm-radius, 10px);
  overflow: hidden; text-decoration: none;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.ghsm-mega a.ghsm-mega__card:hover { border-color: var(--ghsm-blue, #2456C4); box-shadow: var(--ghsm-shadow-md, 0 6px 20px rgba(16, 24, 40, .10)); text-decoration: none; }
.ghsm-mega__thumb { display: block; background: var(--ghsm-placeholder, #E8EBF0); aspect-ratio: 4 / 3; }
.ghsm-mega__thumb img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 0; }
.ghsm-mega__card-body { display: flex; flex-direction: column; gap: 4px; padding: 10px 11px 12px; }
.ghsm-mega__card-name {
  font-size: 13px; font-weight: 600; line-height: 1.35; color: var(--ghsm-ink, #151a22);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ghsm-mega__card-price { font-size: 13px; font-weight: 800; color: var(--ghsm-blue, #2456C4); }
.ghsm-mega__card-price del { font-weight: 500; color: var(--ghsm-muted, #5c6675); }
.ghsm-mega__quote { font-size: 12.5px; font-weight: 700; color: var(--ghsm-red, #B01218); }

/* --------------------------------------------------------------------------
   Narrower viewports
   -------------------------------------------------------------------------- */
@media (max-width: 1100px) {
  .ghsm-mega__in { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .ghsm-mega__products { border-left: 0; border-top: 1px solid var(--ghsm-line, #E1E3E8); padding-left: 0; padding-top: 20px; }
}

@media (max-width: 960px) {
  /* The links wrap rather than scroll sideways: a horizontal scroller inside the
     positioned nav band pushes the page's own scroll width out past the viewport. */
  .ghsm-nav__list { gap: 1px; }
  .ghsm-nav__link { padding: 9px 9px; font-size: 13px; }
  .ghsm-mega { max-height: min(70vh, 560px); overflow-y: auto; }
  .ghsm-mega__in { padding: 20px 16px 24px; }
  .ghsm-mega__list { grid-template-columns: minmax(0, 1fr); }
  .ghsm-mega__cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
  .ghsm-mega__cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .ghsm-nav__link, .ghsm-nav__caret, .ghsm-mega__list a, .ghsm-mega__card { transition: none; }
}

/* ==========================================================================
   Phones and small tablets — the bar becomes a drawer
   Six group labels plus "Shop All" wrap over five rows below ~900px, which pushed
   every page's real content a full screen down. Under that width the same list is
   hidden behind one trigger and opens as an off-canvas accordion instead.
   ========================================================================== */

/* Drawer chrome is markup-only on desktop. */
.ghsm-nav__bar,
.ghsm-nav__scrim,
.ghsm-nav__drawer-head { display: none; }
.ghsm-nav__scrim[hidden] { display: none; }

@media (max-width: 900px) {
  /* ---- the trigger ---- */
  .ghsm-nav button.ghsm-nav__bar {
    display: flex; align-items: center; gap: 12px;
    width: 100%; min-height: 52px; padding: 11px 2px; margin: 0;
    background: none; background-color: transparent; border: 0; box-shadow: none;
    border-radius: var(--ghsm-radius-sm, 6px);
    font-family: inherit; font-size: 15px; font-weight: 800; letter-spacing: -.01em; line-height: 1.2;
    color: #fff; text-align: left; cursor: pointer;
  }
  .ghsm-nav button.ghsm-nav__bar:hover,
  .ghsm-nav button.ghsm-nav__bar:focus-visible { background-color: rgba(255, 255, 255, .14); color: #fff; }
  .ghsm-nav__burger { display: flex; flex-direction: column; justify-content: center; gap: 4px; flex: none; width: 20px; height: 20px; }
  .ghsm-nav__burger span { display: block; height: 2px; width: 100%; border-radius: 2px; background: currentColor; }

  /* ---- the panel ---- */
  .ghsm-nav__scrim { display: block; position: fixed; inset: 0; z-index: 10000; background: rgba(10, 16, 28, .5); }
  .ghsm-nav__scrim[hidden] { display: none; }

  .ghsm-nav__drawer {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 10001;
    display: flex; flex-direction: column;
    width: min(86vw, 360px);
    background: #fff; color: var(--ghsm-ink, #151a22);
    overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
    box-shadow: 0 0 40px rgba(16, 24, 40, .3);
    transform: translateX(-100%); visibility: hidden;
    transition: transform .24s ease, visibility 0s linear .24s;
  }
  .ghsm-nav__drawer.is-open { transform: none; visibility: visible; transition: transform .24s ease; }

  .ghsm-nav__drawer-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    position: sticky; top: 0; z-index: 1;
    padding: 10px 6px 10px 18px; background: #fff;
    border-bottom: 1px solid var(--ghsm-line, #E1E3E8);
  }
  .ghsm-nav__drawer-title { font-size: 15px; font-weight: 800; letter-spacing: -.01em; color: var(--ghsm-ink, #151a22); }
  .ghsm-nav button.ghsm-nav__close {
    display: flex; align-items: center; justify-content: center; flex: none;
    width: 44px; height: 44px; padding: 0; margin: 0;
    background: none; background-color: transparent; border: 0; box-shadow: none;
    border-radius: var(--ghsm-radius-sm, 6px);
    font-size: 26px; line-height: 1; color: var(--ghsm-muted, #5c6675); cursor: pointer;
  }
  .ghsm-nav button.ghsm-nav__close:hover,
  .ghsm-nav button.ghsm-nav__close:focus-visible { background-color: var(--ghsm-band, #F5F5F7); color: var(--ghsm-ink, #151a22); }

  /* ---- the list, stacked ---- */
  .ghsm-nav__drawer .ghsm-nav__list { display: block; gap: 0; }
  /* In the drawer the panel sits in flow inside the item, so the item must not take the
     fill — it would paint behind the whole expanded accordion. Here the link and the
     caret are divided by a rule and are meant to highlight separately. */
  .ghsm-nav__drawer .ghsm-nav__item { display: block; border-bottom: 1px solid var(--ghsm-line-soft, #EDEFF2); }
  .ghsm-nav__drawer .ghsm-nav__item,
  .ghsm-nav__drawer .ghsm-nav__item:hover,
  .ghsm-nav__drawer .ghsm-nav__item:focus-within,
  .ghsm-nav__drawer .ghsm-nav__item.is-open,
  .ghsm-nav__drawer .ghsm-nav__item:has(> a.ghsm-nav__link.is-current) { background: none; border-radius: 0; }
  .ghsm-nav__drawer .ghsm-nav__item--mega { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: stretch; }

  .ghsm-nav .ghsm-nav__drawer a.ghsm-nav__link {
    display: flex; align-items: center; width: 100%; min-height: 52px;
    padding: 12px 18px; border-radius: 0;
    font-size: 15px; font-weight: 700; white-space: normal;
    color: var(--ghsm-ink, #151a22); background: none;
  }
  .ghsm-nav .ghsm-nav__drawer a.ghsm-nav__link:hover,
  .ghsm-nav .ghsm-nav__drawer a.ghsm-nav__link:focus-visible,
  .ghsm-nav .ghsm-nav__drawer a.ghsm-nav__link.is-current { background: var(--ghsm-band, #F5F5F7); color: var(--ghsm-blue, #2456C4); }

  .ghsm-nav .ghsm-nav__drawer button.ghsm-nav__toggle {
    width: 56px; min-height: 52px; height: auto; margin: 0; border-radius: 0;
    border-left: 1px solid var(--ghsm-line-soft, #EDEFF2);
    color: var(--ghsm-muted, #5c6675);
  }
  .ghsm-nav .ghsm-nav__drawer button.ghsm-nav__toggle:hover,
  .ghsm-nav .ghsm-nav__drawer button.ghsm-nav__toggle:focus-visible { background-color: var(--ghsm-band, #F5F5F7); color: var(--ghsm-ink, #151a22); }
  .ghsm-nav__drawer .ghsm-nav__item.is-open > a.ghsm-nav__link,
  .ghsm-nav__drawer .ghsm-nav__item.is-open > button.ghsm-nav__toggle { background-color: var(--ghsm-band, #F5F5F7); }

  /* ---- panels become accordion content ---- */
  .ghsm-nav__drawer .ghsm-mega {
    position: static; grid-column: 1 / -1;
    max-height: none; overflow: visible;
    background: #fff; border-bottom: 0; box-shadow: none;
    border-top: 1px solid var(--ghsm-line-soft, #EDEFF2);
  }
  .ghsm-nav__drawer .ghsm-mega__in { display: block; padding: 6px 0 12px; }
  /* Product picks are a desktop affordance — three cards per panel is a lot of scrolling
     to get past on a phone, and the subcategory links are what the drawer is for. */
  .ghsm-nav__drawer .ghsm-mega__products { display: none; }
  .ghsm-nav__drawer .ghsm-mega__label { margin: 0; padding: 10px 18px 2px 30px; }
  .ghsm-nav__drawer .ghsm-mega__list { display: block; margin: 0; }
  .ghsm-nav__drawer .ghsm-mega .ghsm-mega__list a {
    min-height: 44px; padding: 10px 18px 10px 30px; border-radius: 0;
    font-size: 14.5px; font-weight: 600;
  }
  .ghsm-nav__drawer .ghsm-mega a.ghsm-mega__all {
    display: flex; align-items: center; min-height: 44px; padding: 0 18px 0 30px;
  }

  /* The drawer has to clear the fixed quote banner (z-index 9999) and the nav band's
     own stacking context, which would otherwise trap it at z-index 60. */
  body.ghsm-nav-open .ghsm-mainnav { z-index: 10000; }
  body.ghsm-nav-open { overflow: hidden; }
  body.ghsm-nav-open .ghsm-quote-banner { display: none; }
}

@media (max-width: 900px) and (prefers-reduced-motion: reduce) {
  .ghsm-nav__drawer { transition: none; }
}
