/* ===========================
   Huzzard Nav (cleaned 2025)
   Structure assumed:
   .hzd-nav-boundary
     .hzd-nav > li.menu-item.has-children
       > .hzd-mega
         > .hzd-mega__grid
             > ul.hzd-mega__left      (children; li[data-child-id])
             > .hzd-mega__right
                 > ul.hzd-mega__grandchildren[data-child]
   =========================== */

/* Scope variables to the header boundary (override as needed) */

.custom-logo {
  width: 180px;
  height: auto;
  margin: 1rem;
}

.hzd-nav-boundary {
  --hzd-bg: #fff;
  --hzd-ink: #0f172a;
  --hzd-sky: #0ea5e9;
  --hzd-left-w: 280px;
  position: relative;
  z-index: 20;
  color: var(--hzd-ink);
}

/* Base nav */
.hzd-nav {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
}
.hzd-nav > .menu-item > .hzd-link {
  display: inline-flex;
  gap: .5rem;
  align-items: center;
  text-decoration: none;
  color: inherit;
}

/* Mega panel: full width of boundary, positioned under the parent */
.hzd-nav-boundary .hzd-mega {
  position: absolute; left: 0; right: 0; top: 100%;

  /* hidden by default */
  visibility: hidden; opacity: 0; pointer-events: none;
  transition: opacity .18s ease;
}

/* Show mega when parent is open */
.hzd-nav > .menu-item.has-children.is-open > .hzd-mega {
  visibility: visible; opacity: 1; pointer-events: auto;
}

/* Inner grid: left rail + right pane */
.hzd-mega__grid {
  display: grid;
  grid-template-columns: var(--hzd-left-w) 1fr;
  position: relative;
}

/* Left rail (children) */
.hzd-mega__left {
  margin: 0; padding: 0; list-style: none;
}
.hzd-mega__left > .menu-item {
  list-style: none;
}
.hzd-mega__left > .menu-item > .hzd-link {
  text-decoration: none;
  color: inherit;
}
.hzd-mega__left > .menu-item:is(:hover, :focus-within) > .hzd-link {

}

/* Right pane: cross-fade lists */
.hzd-mega__right {
  display: grid;          /* key: a single grid cell stacking items */
  align-content: start;   /* keep content at top */
  /* remove height transitions driven by JS */
  transition: none;
  position: relative;
  min-height: 2rem;
}
.hzd-mega__panel {
  grid-area: 1/1;
  pointer-events: none;
  z-index: 0;
  opacity:0;
  visibility: 0;

  transform: translateY(4px);
  transition:
    opacity .18s ease,
    visibility .18s ease,
    transform .18s ease;

}

/* Every grandchildren list occupies the same grid cell */
.hzd-mega__right .hzd-mega__grandchildren {
  display: grid;    /* keep your inner 2-col layout */
  grid-template-columns: repeat(2, minmax(0, 1fr));
  height: auto;
  min-height: 0;
  box-sizing: border-box;
}

.hzd-mega__panel.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;    /* <-- can receive hover/click */
  transform: none;
  z-index: 1;
}

/* Active list is on top and visible */
.hzd-mega__right .hzd-mega__grandchildren.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
  z-index: 1;
}

/* If any panel markup ships with h-full, neutralize it */
.hzd-mega__right .hzd-mega__grandchildren { height: auto; min-height: 0; }
.hzd-mega__grid { align-items: start; }

.hzd-mega__grandchildren:empty { display: none; }
.hzd-mega__panel:has(> .hzd-mega__grandchildren:empty) { display: none; }

/* Mobile: keep your existing simplification */
@media (max-width: 959.98px) {
  .hzd-mega__right {
    display: block;
    height: auto !important;
  }
  .hzd-mega__right .hzd-mega__grandchildren {
    position: static; /* harmless, but not needed with grid */
    opacity: 1; visibility: visible; pointer-events: auto;
    transform: none; transition: none;
    display: grid;
  }
  .hzd-mega__panel {
    grid-area: auto;       /* normal flow */
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
    transition: none;
  }
}
html.js:not(.menu-ready) #responsive-nav {
  visibility: hidden;         /* no flash, layout preserved */
  height: 0;                  /* collapse just the mobile menu area */
  overflow: hidden;
}

/* mmenu’s off-canvas containers should also stay hidden until ready */
html.js:not(.menu-ready) .mm-ocd,
html.js:not(.menu-ready) .mm-wrapper__blocker {
  display: none !important;   /* avoids a brief off-canvas flash */
}

/* On desktop, never hide the nav (adjust breakpoint to your theme) */
@media (min-width: 1024px) {
  html.js:not(.menu-ready) #responsive-nav {
    visibility: visible;
    height: auto;
    overflow: visible;
  }
}

html.js:not(.menu-ready) #menu {
  visibility: hidden;
  /* If #menu takes up space in your layout, you can collapse it too: */
  height: 0;
  overflow: hidden;
}

/* Hide mmenu’s off-canvas containers until ready */
html.js:not(.menu-ready) .mm-ocd,
html.js:not(.menu-ready) .mm-wrapper__blocker {
  display: none !important;
}

/* Hide the hamburger until the menu is wired up */
html.js:not(.menu-ready) .responsive-menu-toggle {
  visibility: hidden;
}

/* Desktop header unaffected */
@media (min-width: 992px) {
  html.js:not(.menu-ready) .responsive-menu-toggle { visibility: hidden; }
}
/* hide/show */
@media (max-width: 992px){
  .desktop-primary-nav { display:none; }
  .responsive-menu-toggle { display:inline-flex; }
}
@media (min-width: 992.1px){
  .responsive-menu-toggle { display:none; }
}

/* Desktop vs mobile */
@media (max-width: 992px){
  .desktop-primary-nav { display:none; }
  .responsive-menu-toggle { display:inline-flex; }
}
@media (min-width: 992.1px){
  .responsive-menu-toggle { display:none; }
}
