/* Header mega-menu (inc/biplus-mega-menu.php + assets/js/biplus-mega-menu.js). Desktop: dropdown panels under each
   top item. At 960px and below the panels become accordions inside the mobile drawer. Tokens only. */

.bp-nav__list { display: flex; gap: var(--sp-2); list-style: none; margin: 0; padding: 0; }
.bp-nav__item { position: relative; margin: 0; }
.bp-header .bp-nav__trigger {
  display: inline-flex; align-items: center; gap: 6px; padding: var(--sp-2) var(--sp-3); margin: 0;
  background: none; border: 0; border-radius: var(--r-chip); cursor: pointer;
  font-family: var(--font-body); font-size: 15px; font-weight: 700; color: var(--ink); line-height: 1.4;
}
/* ".bp-header" prefix: Astra paints every button:focus/:hover with its theme colours */
.bp-header :is(.bp-nav__trigger, .bp-header__toggle):is(:focus, :hover, :active) { background: none; color: var(--ink); border: 0; box-shadow: none; }
.bp-header .bp-header__toggle:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.bp-header .bp-nav__trigger:hover, .bp-header .bp-nav__trigger[aria-expanded="true"] { background: var(--subtle); color: var(--ink); }
.bp-nav__item.is-current .bp-nav__label {
  text-decoration: underline; text-decoration-color: var(--y-deep); text-decoration-thickness: 2px; text-underline-offset: 6px;
}
.bp-nav__chev { transition: transform .18s cubic-bezier(.2,.7,.3,1); }
.bp-nav__trigger[aria-expanded="true"] .bp-nav__chev { transform: rotate(180deg); }
.bp-nav__trigger:focus { outline: none; }
.bp-nav__trigger:focus-visible, .bp-mega__link:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* Panel: hidden until JS opens it; without JS it still opens on hover and keyboard focus */
.bp-mega {
  display: none; position: absolute; top: calc(100% + 10px); left: calc(-1 * var(--sp-3)); z-index: 110;
  grid-auto-flow: column; grid-auto-columns: minmax(280px, max-content); gap: var(--sp-5); width: max-content;
  padding: var(--sp-5); background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--r-outer); box-shadow: var(--shadow-hero);
}
.bp-mega::before { content: ""; position: absolute; left: 0; right: 0; top: -12px; height: 12px; } /* hover bridge */
.bp-nav__item:last-child .bp-mega { left: auto; right: calc(-1 * var(--sp-3)); }
/* Middle items: centre the panel under its trigger so a two-column panel stays inside a 1024px screen */
.bp-nav__item:not(:first-child, :last-child) .bp-mega { left: 50%; translate: -50% 0; }
.bp-header__nav:not(.is-enhanced) .bp-nav__item:is(:hover, :focus-within) > .bp-mega,
.bp-nav__item.is-open > .bp-mega { display: grid; animation: bp-mega-in .16s cubic-bezier(.2,.7,.3,1); }
@keyframes bp-mega-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.bp-mega__col { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }
.bp-mega__col + .bp-mega__col { border-left: 1px solid var(--line-soft); padding-left: var(--sp-5); }
.bp-mega__title { margin: 0 0 var(--sp-1); padding: 0 var(--sp-3); font-family: var(--font-body); font-size: 13px; font-weight: 800; color: var(--gray); }
.bp-mega__links { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.bp-mega__links li { margin: 0; }
.bp-mega__link { display: grid; gap: 2px; padding: var(--sp-2) var(--sp-3); border-radius: var(--r-card); text-decoration: none; }
.bp-mega__link:hover { background: var(--y-pale); }
.bp-mega__link[aria-current="page"] { background: var(--subtle); }
.bp-mega__name { font-family: var(--font-body); font-size: 15px; font-weight: 800; color: var(--ink); line-height: 1.35; }
/* Collection links: their first three official app icons, overlapped, left of the name and tagline */
.bp-mega__link.has-icons { grid-template-columns: 48px minmax(0, 1fr); column-gap: var(--sp-3); }
.bp-mega__col:has(.has-icons) { width: 344px; }
.bp-mega__icons { grid-row: span 2; align-self: center; display: flex; }
.bp-mega__icons img { width: 20px; height: 20px; border-radius: 5px; background: var(--surface); box-shadow: 0 0 0 2px var(--surface); }
.bp-mega__icons img + img { margin-left: calc(-1 * var(--sp-2)); }
.bp-mega__desc { font-family: var(--font-body); font-size: 13px; font-weight: 500; color: var(--gray-mid); line-height: 1.4; }

/* Mobile drawer: top items become accordions, panels flow in place */
@media (max-width: 960px) {
  .bp-header__nav { max-height: calc(100vh - 76px); overflow-y: auto; overscroll-behavior: contain; }
  .bp-nav__list { flex-direction: column; gap: 0; }
  .bp-nav__item { border-bottom: 1px solid var(--line-soft); }
  .bp-header .bp-nav__trigger { width: 100%; justify-content: space-between; padding: var(--sp-4) 0; border-radius: 0; font-size: 17px; }
  .bp-header .bp-nav__trigger:hover, .bp-header .bp-nav__trigger[aria-expanded="true"] { background: none; }
  .bp-nav__item.is-current .bp-nav__label { text-underline-offset: 5px; }
  .bp-mega, .bp-nav__item:last-child .bp-mega {
    position: static; grid-auto-flow: row; grid-auto-columns: auto; gap: var(--sp-4); width: auto;
    padding: 0 0 var(--sp-4); border: 0; border-radius: 0; box-shadow: none; animation: none;
  }
  .bp-mega::before { display: none; }
  .bp-nav__item:not(:first-child, :last-child) .bp-mega { translate: none; }
  .bp-mega__col + .bp-mega__col { border-left: 0; padding-left: 0; }
  .bp-mega__col:has(.has-icons) { width: auto; }
  .bp-mega__title, .bp-mega__link { padding-left: 0; padding-right: 0; }
  .bp-mega__link:hover { background: none; }
  .bp-mega__link:hover .bp-mega__name { text-decoration: underline; text-decoration-color: var(--y-deep); text-underline-offset: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  .bp-nav__chev { transition: none; }
  .bp-nav__item.is-open > .bp-mega, .bp-header__nav:not(.is-enhanced) .bp-nav__item:is(:hover, :focus-within) > .bp-mega { animation: none; }
}
