/**
 * @file
 * Keeps every TB Mega Menu submenu permanently expanded on desktop.
 *
 * Why this file exists: TB Mega Menu has no "expand all" option. Its one
 * related setting -- the builder's "Always show submenu" toggle (block_config
 * `always-show-submenu`, which puts .always-show on .nav-collapse) -- is
 * small-screen only. Its rules live inside `@media (max-width: 979px)` in
 * tb_megamenu/css/tb_megamenu.default.css, so above that breakpoint they do
 * nothing. There, submenus are display:none until tb-megamenu-frontend.js adds
 * .open on mouseenter. Forcing them open therefore has to be done in CSS.
 *
 * Scope: every mega menu on the site. Today that is only the footer sitemap
 * (block ba_bootstrap5_footer_2 = tb_megamenu_menu_block:footer). A header mega
 * menu added later would also render permanently open -- to prevent that,
 * change `.tb-megamenu` to `.tb-megamenu-footer` in the selectors below.
 *
 * The extra `.nav-collapse` in each selector is deliberate. The module's own
 * `.tb-megamenu .mega > .mega-dropdown-menu` is (0,3,0); ours must outrank it
 * rather than depend on stylesheet load order, since tb_megamenu ships module
 * CSS and load order between the two is not something to rely on.
 */

@media (min-width: 980px) {

  /**
   * Reveal the panels, and drop them out of the dropdown's absolute
   * positioning. Without `position: static` every panel would render at
   * top:100%/left:0 of its parent and stack on top of the next one.
   *
   * The background/border/shadow resets matter here: .dropdown-menu ships a
   * white background, a 1px border, a 6px radius and a drop shadow -- fine for
   * a floating panel, wrong for a block sitting flat inside the footer.
   */
  .tb-megamenu .nav-collapse .mega > .mega-dropdown-menu,
  .tb-megamenu .nav-collapse .dropdown-menu {
    display: block;
    position: static;
    float: none;
    width: auto;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;

    /* Bootstrap 5 sets `color: var(--bs-body-color)` (#212529) on .dropdown-menu
       for its light floating panel. That reset lands on the panel element, so
       every descendant would inherit it regardless of the footer's own colour.
       Resetting it here lets the footer's colour flow down the tree. */
    color: inherit;
  }

  /**
   * Hide the disclosure carets. Nothing discloses any more, so they are just
   * misleading. The module hides them for exactly this reason inside its
   * small-screen .always-show block.
   *
   * The long second selector is required, not belt-and-braces: tb_megamenu
   * re-shows the caret with `.tb-megamenu .nav > .dropdown > .dropdown-toggle
   * .caret` (0,4,0) in tb_megamenu.base.css, which outranks a plain
   * `.tb-megamenu .nav-collapse .caret` (0,3,0). Verified in the browser --
   * with only the short selector the carets stayed inline-block.
   */
  .tb-megamenu .nav-collapse .caret,
  .tb-megamenu .nav-collapse .nav > .dropdown > .dropdown-toggle .caret,
  .tb-megamenu .nav-collapse .dropdown-submenu > a::after {
    display: none;
  }

  /**
   * Bootstrap 5 draws its own caret as a ::after triangle on .dropdown-toggle,
   * entirely separate from the module's .caret <span>. Hiding one leaves the
   * other on screen, so both are needed.
   */
  .tb-megamenu .nav-collapse .dropdown-toggle::after {
    display: none;
  }

  /**
   * Submenu link colour is NOT set here.
   *
   * tb_megamenu paints submenu links #333 (`.tb-megamenu .dropdown-menu li > a`,
   * 0,3,0) because it assumes the white floating panel neutralised above, which
   * has to be overridden once that panel is transparent. This file used to do
   * that with `color: inherit`. css/theme-overrides.css now owns the colour of
   * every footer link (normal and hover) as part of the site-wide link scheme,
   * with selectors one element more specific than the ones that would live
   * here -- so a rule in this file would only be a race it loses. Left out
   * deliberately; see section 3 of css/theme-overrides.css.
   */
}
