/* The header menu on phones and tablets (below 992px). Stand-alone file, loaded by layouts/main_layout.php after
   style.css; the desktop bar (992px and up) is not touched by anything here.

   What it fixes (customer QA, 2026-11-04):
   - the open menu was see-through: the bar is 90% opaque with a blur, so the page photo showed through the links;
   - "Shop" sat left of centre: its row is the link plus an arrow button, centred as ONE group, so the word itself moved
     left by half the arrow's width while Home / About / Contact were truly centred;
   - rows differed in height, and the arrow was a 29 x 24 px tap target;
   - a menu taller than the screen could not be scrolled (the bar is fixed). */
@media (max-width:991.98px){

  /* 1. An open menu is a solid panel. */
  .navbar:has(.navbar-collapse.show),
  .navbar:has(.navbar-collapse.collapsing){
    background:#f8f7fc !important;
    -webkit-backdrop-filter:none;backdrop-filter:none;
    box-shadow:0 18px 32px rgba(31,27,46,.16);
  }
  /* A browser without :has() ignores the rule above; the panel itself is solid there. */
  .navbar-collapse.show,
  .navbar-collapse.collapsing{background:#f8f7fc;}

  /* 2. A menu taller than the screen scrolls inside itself. (Only while open: Bootstrap's height animation needs overflow hidden.) */
  .navbar-collapse.show{
    max-height:calc(100vh - 6.5rem);
    max-height:calc(100dvh - 6.5rem);
    overflow-y:auto;overscroll-behavior:contain;
  }

  /* 3. Every row the same height, the words centred on the same line. */
  #navbarNav .navbar-nav{margin-top:.25rem !important;margin-bottom:.25rem !important;gap:0 !important;}
  #navbarNav .navbar-nav.border-top{margin-top:.5rem !important;padding-top:.4rem !important;}
  #navbarNav .nav-link{
    display:flex;align-items:center;justify-content:center;
    min-height:3rem;margin:0;padding:0 1rem;
  }
  /* The Shop (and Sets) row: the arrow is a 44 px wide button tucked .75rem under the link's right padding, so the arrow
     sits right beside the word; an empty spacer on the left of the same net width (2rem) keeps the word itself in the middle. */
  #navbarNav .mega-menu-item > .d-flex::before{content:"";flex:0 0 2rem;}
  #navbarNav .mega-menu-caret{
    flex:0 0 2.75rem;width:2.75rem;height:3rem;margin-left:-.75rem;padding:0 0 0 .35rem;
    display:inline-flex;align-items:center;justify-content:flex-start;
    position:relative; /* the link is positioned too: without this it paints over the part of the button that tucks under its padding */
  }
  #navbarNav .mega-menu-caret i{transition:transform .2s ease;}
  #navbarNav .mega-menu-caret[aria-expanded="true"] i{transform:rotate(180deg);}
}
@media (max-width:991.98px) and (prefers-reduced-motion:reduce){
  #navbarNav .mega-menu-caret i{transition:none;}
}
