/* ==========================================================================
   SLU Nav Menu Widget
   A WordPress-menu-driven nav with an optional centred logo (3-column grid)
   and two dropdown styles: Regular and Full-width Inline.
   One level of submenus deep.

   Hello Elementor's reset.css zeroes border-radius on <button> and has a
   high-specificity a:not([href]) colour rule; colour + button declarations
   here therefore carry !important where they contest the theme reset. See the
   CLAUDE.md "Elementor / theme CSS" gotcha.
   ========================================================================== */

.slu-nav {
    --slu-nav-sub-min: 200px;
    position: relative;
    width: 100%;
}

/* Reset list chrome */
.slu-nav__list,
.slu-nav__sub {
    list-style: none;
    margin: 0;
    padding: 0;
}

.slu-nav__list {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
}

.slu-nav__item {
    position: relative;
    display: flex;
    align-items: center;
}

.slu-nav__link-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

/* Bare-tag link reset — beat Hello reset + kit link colour with the widget's
   own control-driven colour (which is emitted with !important from PHP). */
.slu-nav__link {
    display: inline-block;
    text-decoration: none;
    line-height: 1.2;
    white-space: nowrap;
    transition: color .18s ease, background-color .18s ease;
}

.slu-nav__caret {
    display: inline-flex;
    align-items: center;
    pointer-events: none;
    transition: transform .2s ease;
}
.slu-nav__caret svg { width: 1em; height: 1em; }

/* The per-item sub-toggle is only used on mobile (accordion). Hidden on
   desktop; the whole item opens on hover there. */
.slu-nav__sub-toggle {
    display: none;
    background: none !important;
    border: 0 !important;
    border-radius: 0 !important;   /* neutralise Hello reset explicitly */
    padding: 0;
    margin: 0;
    cursor: pointer;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

/* ── 3-column grid (logo mode) ─────────────────────────────────────────── */
.slu-nav__grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    width: 100%;
}
.slu-nav__list--left  { justify-content: flex-end; }
.slu-nav__list--right { justify-content: flex-start; }

.slu-nav__logo-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
}
.slu-nav__logo { display: inline-flex; line-height: 0; }
.slu-nav__logo-img { display: block; width: auto; height: 48px; }

.slu-nav__list--single { justify-content: flex-start; }

/* ── Dropdown panels (shared) ──────────────────────────────────────────── */
.slu-nav__sub {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: var(--slu-nav-sub-min);
    z-index: 999;
    display: block;
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity .18s ease, transform .2s ease, visibility 0s linear .2s;
}
.slu-nav__sub .slu-nav__item--sub { display: block; }
.slu-nav__sub .slu-nav__link {
    display: block;
    white-space: nowrap;
    border-radius: 4px;
}

/* Open on hover / focus-within / JS .is-open (desktop) */
.slu-nav:not(.is-mobile) .slu-nav__item--has-sub:hover > .slu-nav__sub,
.slu-nav:not(.is-mobile) .slu-nav__item--has-sub:focus-within > .slu-nav__sub,
.slu-nav:not(.is-mobile) .slu-nav__item--has-sub.is-open > .slu-nav__sub {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition: opacity .18s ease, transform .2s ease, visibility 0s;
}
.slu-nav:not(.is-mobile) .slu-nav__item--has-sub:hover > .slu-nav__link-wrap .slu-nav__caret,
.slu-nav:not(.is-mobile) .slu-nav__item--has-sub:focus-within > .slu-nav__link-wrap .slu-nav__caret {
    transform: rotate(180deg);
}

/* Right-column dropdowns anchor to the right edge so they don't overflow. */
.slu-nav__list--right .slu-nav__sub { left: auto; right: 0; }

/* Regular style: the base .slu-nav__sub rules above already are the flyout. */

/* Full-width Inline style: panel spans the whole nav width, flush beneath it,
   edge to edge. The nav needs position: relative (it is) so the panel can pin
   to its full width. */
.slu-nav--full_inline .slu-nav__sub {
    position: absolute;
    left: 0;
    right: 0;
    width: 100%;
    min-width: 0;
    border-radius: 0 !important;
    display: flex;
    flex-wrap: wrap;
    gap: var(--slu-nav-inline-gap-row, 4px) var(--slu-nav-inline-gap-col, 24px);
    justify-content: center;
}
/* Anchor to the nav, not the item, so it truly spans full width. */
.slu-nav--full_inline .slu-nav__item--has-sub { position: static; }
.slu-nav--full_inline .slu-nav__list--right .slu-nav__sub { right: 0; left: 0; }

/* ── Mobile toggle (hamburger) ─────────────────────────────────────────── */
.slu-nav__toggle {
    display: none;
    background: none !important;
    border: 0 !important;
    border-radius: 0 !important;
    padding: 4px;
    margin: 0;
    cursor: pointer;
    line-height: 0;
    color: inherit;
}
.slu-nav__toggle svg { width: 28px; height: 28px; display: block; }
/* Icon swap: show the hamburger at rest, the X when open. Scoped to the toggle
   and forced with !important because Hello/Elementor's inline-SVG display rules
   otherwise win the specificity tie and leave BOTH icons visible. */
.slu-nav__toggle .slu-nav__toggle-open  { display: block !important; }
.slu-nav__toggle .slu-nav__toggle-close { display: none !important; }
.slu-nav.is-open .slu-nav__toggle .slu-nav__toggle-open  { display: none !important; }
.slu-nav.is-open .slu-nav__toggle .slu-nav__toggle-close { display: block !important; }

/* == Collapsed / mobile state (JS adds .is-mobile at/below breakpoint) ====== */
/* On mobile the nav becomes a wrapping flex bar. The logo (if any) and the
   hamburger sit on the first line; each menu list takes a full-width row below
   and stacks in normal flow. No absolute positioning, so the split left/right
   lists can't overlap each other or escape over the header. The lists collapse
   via max-height and only show when .is-open. */

.slu-nav.is-mobile {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

/* In logo mode the grid wraps logo + the two lists. Flatten it so those become
   direct flex children of the bar. */
.slu-nav.is-mobile .slu-nav__grid {
    display: contents;
}

/* First line = the bar: logo left, hamburger right. */
.slu-nav.is-mobile .slu-nav__logo-cell {
    order: 1;
    padding: 0;
    margin: 0 auto 0 0;       /* logo left, push toggle to the right */
    flex: 0 0 auto;
}
.slu-nav.is-mobile .slu-nav__toggle {
    display: inline-flex;
    order: 2;
    flex: 0 0 auto;
}

/* Each list is a full-width row beneath the bar. Left list first, right list
   directly under it (source order), so they read as one continuous menu. */
.slu-nav.is-mobile .slu-nav__list {
    order: 3;
    flex: 0 0 100%;
    width: 100%;
    position: static;
    flex-direction: column;
    align-items: stretch;
    background-color: var(--slu-nav-mobile-bg, #fff);
    max-height: 0;
    overflow: hidden;
    z-index: 998;
    transition: max-height .3s ease;
}
.slu-nav.is-mobile .slu-nav__list--right { order: 4; }

.slu-nav.is-mobile.is-open .slu-nav__list {
    max-height: 80vh;
    overflow-y: auto;
}

.slu-nav.is-mobile .slu-nav__item { display: block; }
.slu-nav.is-mobile .slu-nav__link-wrap { display: flex; justify-content: flex-start; align-items: center; width: 100%; }
.slu-nav.is-mobile .slu-nav__link { flex: 0 1 auto; }
/* Zero the list gap on mobile: the Item Spacing control is a horizontal desktop
   concept and leaks in as vertical row-gap, producing an uneven gap at the join
   between the left and right lists. Item rhythm on mobile comes from link
   padding instead, so both lists read as one evenly-spaced column. */
.slu-nav.is-mobile .slu-nav__list { gap: 0 !important; }

/* Mobile submenu = accordion, driven by JS .is-open on the item. */
.slu-nav.is-mobile .slu-nav__sub {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none !important;
    display: none;
    min-width: 0;
    width: 100%;
    transition: none;
}
.slu-nav.is-mobile .slu-nav__item--has-sub.is-open > .slu-nav__sub { display: block; }
.slu-nav.is-mobile .slu-nav__sub-toggle { display: block; }
/* Keep the caret visible on mobile as the expand affordance, sitting directly
   beside the item text (small gap via padding). It rotates when the item's
   submenu is open. */
.slu-nav.is-mobile .slu-nav__caret {
    display: inline-flex;
    flex: 0 0 auto;
    padding-left: 8px;
}
.slu-nav.is-mobile .slu-nav__item--has-sub.is-open > .slu-nav__link-wrap .slu-nav__caret {
    transform: rotate(180deg);
}

/* Editor-only notice */
.slu-nav__notice {
    padding: 12px 16px;
    background: #fff4e8;
    border: 1px dashed #fa6e00;
    border-radius: 6px;
    color: #7a3a00;
    font-size: 13px;
}

/* Reveal only after JS has classified the breakpoint, to avoid a flash of the
   desktop layout on small screens before .is-mobile is applied. */
.slu-nav:not(.slu-nav--ready) .slu-nav__list { visibility: hidden; }
.slu-nav.slu-nav--ready .slu-nav__list { visibility: visible; }
.slu-nav.is-mobile:not(.is-open) .slu-nav__list { visibility: hidden; }
.slu-nav.is-mobile.is-open .slu-nav__list { visibility: visible; }
