/* Hummingbird 7LASER customizations v1.0.4 */

/* --- Desktop >=1200px: search centered in the top bar ---
   Below 1200px the search stays in its original place (header-bottom row), so the top bar
   keeps the original Hummingbird layout and can never overlap on tablets. */
.header-top__search { display: none; }
@media (min-width: 1200px) {
  .header-top .row {
    display: grid;
    /* side columns are never narrower than their content (no wrapping/overlap); search takes what is left */
    grid-template-columns: minmax(max-content, 1fr) minmax(9rem, 22rem) minmax(max-content, 1fr);
    column-gap: 1rem;
    align-items: center;
  }
  .header-top__left,
  .header-top__right { width: auto; max-width: none; min-width: 0; flex-wrap: nowrap; white-space: nowrap; }
  .header-top__left { justify-content: flex-start; }
  .header-top__right { justify-content: flex-end; }
  .header-top__search { min-width: 0; display: flex; justify-content: center; align-items: center; }
  .header-top__search #_desktop_ps_searchbar {
    display: flex !important; width: 100%; max-width: 22rem; margin: 0; padding: 0;
  }
  .header-top__search #ps_searchbar,
  .header-top__search .ps-searchbar__form { width: 100%; }
  .header-top__search .ps-searchbar { margin-block: 0; min-width: 0; width: 100%; }
  .header-top__search .ps-searchbar__dropdown {
    left: 50%; right: auto; transform: translateX(-50%); max-width: 30rem;
  }
}

/* --- Desktop menu: dropdown sized to its content and always kept inside the screen ---
   Width/height limits come from hummingbird7laser-1.0.3.js (CSS variables below);
   the calc() values are only a fallback if the script has not run yet. */
@media (min-width: 1200px) {
  .ps-mainmenu.ps-mainmenu--desktop .ps-mainmenu__tree > li.ps-mainmenu__tree-item--fit {
    position: relative;
  }
  .ps-mainmenu.ps-mainmenu--desktop .ps-mainmenu__tree > li.ps-mainmenu__tree-item--fit > .submenu {
    left: 0;                 /* the script shifts it left if it would leave the screen */
    right: auto;
    top: 100% !important;    /* theme JS sets an inline top for the full-width menu */
    width: max-content;
    min-width: 14rem;
    max-width: var(--h7l-submenu-max-w, calc(100vw - 3rem));
    max-height: var(--h7l-submenu-max-h, calc(100vh - 10rem));
    overflow-x: hidden;
    overflow-y: auto;        /* inner scroll when there are too many items for the screen height */
    overscroll-behavior: contain;
    border: .0625rem solid var(--bs-border-color);
    border-radius: 0 0 var(--bs-border-radius) var(--bs-border-radius);
  }
  .submenu--compact .container,
  .submenu--columns .container { width: auto; max-width: none; padding: 0; }
  .submenu--compact .submenu__row,
  .submenu--columns .submenu__row { display: block; margin: 0; --bs-gutter-x: 0; }

  /* 2 levels: simple list; with many items it flows into 2, 3 or 4 columns */
  .submenu--compact .submenu__left { width: 100%; max-width: none; padding: .5rem; border-right: 0; }
  .submenu--compact .submenu__right { display: none; }
  .submenu--compact .submenu__left:has(> :nth-child(9))  { display: block; column-count: 2; column-width: 12rem; column-gap: 1rem; }
  .submenu--compact .submenu__left:has(> :nth-child(17)) { column-count: 3; }
  .submenu--compact .submenu__left:has(> :nth-child(25)) { column-count: 4; }
  .submenu--compact .submenu__left > .submenu__left-item {
    break-inside: avoid;
    overflow-wrap: anywhere;
  }
  .submenu--compact .submenu__left:has(> :nth-child(9)) > .submenu__left-item { margin-bottom: .25rem; }

  /* 3+ levels: one column per subcategory; columns wrap onto new rows when the screen is narrow */
  .submenu__columns {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem 2rem;
    align-items: flex-start;
    padding: 1.25rem 1.5rem;
  }
  .submenu__column {
    flex: 0 0 13rem;         /* same width for every column so rows line up */
    width: 13rem;
    min-width: 0;
    overflow-wrap: anywhere;
  }
  .submenu__column-title {
    display: block;
    font-weight: 600;
    font-size: 1.0625rem;
    color: var(--bs-body-color);
    text-decoration: none;
  }
  .submenu__column-title:hover { color: var(--bs-link-hover-color); }
  .submenu__column-list,
  .submenu__column-sublist { list-style: none; margin: 0; padding: 0; }
  .submenu__column-list { margin-top: .5rem; display: flex; flex-direction: column; gap: .375rem; }
  .submenu__column-list .menu-item { color: var(--bs-body-color); text-decoration: none; }
  .submenu__column-list .menu-item:hover { color: var(--bs-link-hover-color); }
  .submenu__column-sublist { margin-top: .25rem; padding-inline-start: .75rem; }
}
