/* Mega-menu sub-category flyouts (iqitmegamenu .cbp-hrsub-level2 / level3).
   Open beside the category text (not the far edge of the column), level with the hovered row,
   with a hover bridge and a short close delay so they are easy to reach.
   js/ift-megamenu-flyout.js adds .ift-flyout-left when there is no room on the right. */

@media (min-width: 992px) {
  #cbp-hrmenu li.cbp-hrsub-haslevel2,
  #cbp-hrmenu li.cbp-hrsub-haslevel3 {
    position: relative;
  }
  #cbp-hrmenu li.cbp-hrsub-haslevel2 > .cbp-category-link-w,
  #cbp-hrmenu li.cbp-hrsub-haslevel3 > .cbp-category-link-w {
    position: relative;
    display: inline-block;
    max-width: 100%;
  }
  #cbp-hrmenu .cbp-category-link-w > ul li.cbp-hrsub-haslevel3 > .cbp-category-link-w {
    display: block;
  }

  #cbp-hrmenu li.cbp-hrsub-haslevel2 > .cbp-category-link-w > ul,
  #cbp-hrmenu li.cbp-hrsub-haslevel3 > .cbp-category-link-w > ul {
    position: absolute;
    top: -8px;
    left: calc(100% + 10px) !important;
    right: auto !important;
    z-index: 30;
    min-width: 230px;
    margin: 0 !important;
    padding: 6px !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 12px;
    background: #fff !important;
    box-shadow: 0 18px 40px -14px rgba(15, 23, 42, .28), 0 2px 6px rgba(15, 23, 42, .06) !important;
    white-space: nowrap;
    visibility: hidden;
    opacity: 0;
    transform: translateX(-6px);
    transition: opacity .15s ease .2s, transform .15s ease .2s, visibility 0s linear .35s !important;
  }
  /* Invisible bridge over the gap so the pointer can cross to the flyout. */
  #cbp-hrmenu li.cbp-hrsub-haslevel2 > .cbp-category-link-w > ul::before,
  #cbp-hrmenu li.cbp-hrsub-haslevel3 > .cbp-category-link-w > ul::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: -14px;
    width: 14px;
  }

  #cbp-hrmenu li.cbp-hrsub-haslevel2:hover > .cbp-category-link-w > ul,
  #cbp-hrmenu li.cbp-hrsub-haslevel2:focus-within > .cbp-category-link-w > ul,
  #cbp-hrmenu li.cbp-hrsub-haslevel3:hover > .cbp-category-link-w > ul,
  #cbp-hrmenu li.cbp-hrsub-haslevel3:focus-within > .cbp-category-link-w > ul {
    visibility: visible;
    opacity: 1;
    transform: none;
    transition-delay: 0s !important;
  }

  /* Flip to the left near the right edge of the screen. */
  #cbp-hrmenu li.ift-flyout-left > .cbp-category-link-w > ul {
    left: auto !important;
    right: calc(100% + 10px) !important;
    transform: translateX(6px);
  }
  #cbp-hrmenu li.ift-flyout-left > .cbp-category-link-w > ul::before {
    left: auto;
    right: -14px;
  }

  /* Rows inside the flyout */
  #cbp-hrmenu .cbp-category-link-w > ul > li {
    margin: 0;
    padding: 0;
  }
  #cbp-hrmenu li.cbp-hrsub-haslevel2 > .cbp-category-link-w > ul a,
  #cbp-hrmenu li.cbp-hrsub-haslevel3 > .cbp-category-link-w > ul a {
    display: block;
    padding: 7px 12px !important;
    border-radius: 8px;
    color: #334155 !important;
    font-size: 13.5px;
    line-height: 1.3;
    transition: background .12s ease, color .12s ease;
  }
  #cbp-hrmenu li.cbp-hrsub-haslevel2 > .cbp-category-link-w > ul a:hover,
  #cbp-hrmenu li.cbp-hrsub-haslevel2 > .cbp-category-link-w > ul a:focus-visible,
  #cbp-hrmenu li.cbp-hrsub-haslevel3 > .cbp-category-link-w > ul a:hover {
    background: #f2f8e8;
    color: #3f6212 !important;
  }
  #cbp-hrmenu li.cbp-hrsub-haslevel2 > .cbp-category-link-w > ul a::before {
    display: none !important;
  }

  /* Category bullets: the theme slides the "›" into the text on hover; keep it still. */
  #cbp-hrmenu .cbp-links li a {
    padding-left: 12px;
  }
  #cbp-hrmenu .cbp-links li a::before {
    transition: color .15s ease;
  }
  #cbp-hrmenu .cbp-links li a:hover::before {
    left: 0 !important;
    color: #65a30d !important;
  }

  /* Parent category stays highlighted while its flyout is open */
  #cbp-hrmenu li.cbp-hrsub-haslevel2:hover > .cbp-category-link-w > a,
  #cbp-hrmenu li.cbp-hrsub-haslevel3:hover > .cbp-category-link-w > a {
    color: #3f6212 !important;
  }
  #cbp-hrmenu .cbp-links li.cbp-hrsub-haslevel2 > div > a::after,
  #cbp-hrmenu .cbp-links li .cbp-hrsub-haslevel3 > div > a::after {
    opacity: .45;
  }
  #cbp-hrmenu .cbp-links li.cbp-hrsub-haslevel2:hover > div > a::after,
  #cbp-hrmenu .cbp-links li .cbp-hrsub-haslevel3:hover > div > a::after {
    opacity: 1;
  }
}

@media (min-width: 992px) and (prefers-reduced-motion: reduce) {
  #cbp-hrmenu li.cbp-hrsub-haslevel2 > .cbp-category-link-w > ul,
  #cbp-hrmenu li.cbp-hrsub-haslevel3 > .cbp-category-link-w > ul {
    transform: none !important;
  }
}
