/* ==========================================================================
   Class-based mega menu
   Desktop styles only apply to items with the "mega" class.
   ========================================================================== */

/* Mobile drawer: stack product details. The whole row is the link. */
.mega-product-title,
.mega-product-description {
  display: block;
}

.mega-product-description {
  font-size: 14px;
  font-weight: 400;
  opacity: .75;
}

.mega-product-cta {
  display: none;
}

@media (min-width: 992px) {
  .navbar .mega {
    --mega-accent: #e07a45;
    --mega-heading: #4b4f55;
    --mega-text: #4b4f55;
    --mega-title: #111;
    --mega-border: #e6e6ef;
  }

  /* Panel. The theme opens dropdowns on hover using opacity and visibility,
     so display stays grid and the !important margins match the theme's. */
  .navbar .mega > .mega-menu-panel,
  .navbar .mega > .mega-menu-panel.show {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    width: min(693px, calc(100vw - 32px));
    padding: 32px;
    border: 0;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 16px 40px rgba(0, 0, 0, .18);
  }

  .navbar .mega > .mega-menu-panel,
  .navbar .mega:hover > .mega-menu-panel {
    margin-top: 12px !important;
  }

  .navbar .mega:hover > .mega-menu-panel {
    border-radius: 18px;
  }

  /* Rounded notch: replaces the theme's triangle */
  .navbar .mega > .mega-menu-panel::before {
    top: -7px;
    left: 40px;
    width: 18px;
    height: 18px;
    border: 0;
    border-radius: 5px 0 0;
    background: #fff;
    transform: rotate(45deg);
  }

  /* Invisible bridge so the panel stays open as the mouse crosses the gap */
  .navbar .mega > .mega-menu-panel::after {
    content: "";
    position: absolute;
    top: -30px;
    right: 0;
    left: 0;
    height: 30px;
  }

  /* Columns */
  .navbar .mega .mega-column {
    min-width: 0;
    list-style: none;
  }

  .navbar .mega .mega-column:first-child {
    padding-right: 32px;
  }

  .navbar .mega .mega-column + .mega-column {
    padding-left: 40px;
    border-left: 1px solid var(--mega-border);
  }

  /* Column headings look like labels on desktop, but stay links for the mobile drawer */
  .navbar .mega .mega-heading {
    display: block;
    margin: 0 0 18px;
    padding: 0;
    color: var(--mega-heading);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .2em;
    line-height: 1.4;
    pointer-events: none;
    text-transform: uppercase;
  }

  .navbar .mega .mega-heading::before,
  .navbar .mega .mega-heading::after,
  .navbar .mega .mega-heading i {
    display: none;
  }

  /* Reset any sub-menu flyout styles */
  .navbar .mega .mega-column-list {
    position: static;
    display: block;
    width: auto;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
    list-style: none;
    opacity: 1;
    transform: none;
    visibility: visible;
  }

  /* Standard links */
  .navbar .mega .mega-link {
    display: block;
    padding: 9px 0 9px 24px;
    color: var(--mega-text);
    font-size: 18px;
    font-weight: 500;
    line-height: 1.33;
  }

  .navbar .mega .mega-link:hover,
  .navbar .mega .mega-link:focus-visible,
  .navbar .mega .active > .mega-link {
    color: var(--mega-accent);
  }

  /* Product links */
  .navbar .mega .mega-product + .mega-product {
    margin-top: 28px;
    padding-top: 28px;
    border-top: 1px solid var(--mega-border);
  }

  .navbar .mega .mega-product-link {
    display: block;
    padding: 0;
    color: var(--mega-text);
  }

  .navbar .mega .mega-product-title {
    margin-bottom: 8px;
    color: var(--mega-title);
    font-size: 18px;
    font-weight: 600;
    line-height: 1.33;
  }

  .navbar .mega .mega-product-description {
    margin-bottom: 10px;
    color: var(--mega-text);
    opacity: 1;
  }

  .navbar .mega .mega-product-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--mega-accent);
    font-size: 14px;
    font-weight: 600;
  }

  /* The theme hides icons in dropdown links */
  .navbar .mega .mega-product-cta svg {
    display: block;
    flex: none;
  }

  .navbar .mega .mega-product-link:hover .mega-product-cta,
  .navbar .mega .mega-product-link:focus-visible .mega-product-cta {
    text-decoration: underline;
  }
}
