/* Max Mega Menu: Above Header bar menu (location above-topnav). Loaded after the plugin's own stylesheet on the front
   end and in the editor (inc/megamenu.php). Its colours, type, height and padding are in theme.json
   settings.custom.aboveHeader. */

#mega-menu-wrap-above-topnav #mega-menu-above-topnav a.mega-menu-link {
  font-family: var(--wp--custom--above-header--font-family) !important;
  font-size: var(--wp--custom--above-header--font-size) !important;
  font-weight: var(--wp--custom--above-header--font-weight) !important;
  letter-spacing: var(--wp--custom--above-header--letter-spacing) !important;
  text-transform: var(--wp--custom--above-header--text-transform) !important;
}

#mega-menu-wrap-above-topnav
  #mega-menu-above-topnav
  > li.mega-menu-item
  > a.mega-menu-link {
  height: auto !important;
  padding: var(--wp--custom--above-header--link-padding--top)
    var(--wp--custom--above-header--link-padding--right)
    var(--wp--custom--above-header--link-padding--bottom)
    var(--wp--custom--above-header--link-padding--left) !important;
  line-height: var(--wp--custom--above-header--height) !important;
}

/* Dividers: a 1px line on the right of every item but the last, in the link colour (theme.json
   settings.custom.aboveHeader.linkColor, which the menu setting reads too). It is 2px taller than the text (Inter's capitals 0.73em + descenders
   0.21em, in em so it follows the menu's font size; re-measure if the Navigation font changes) and centred in the
   link row, drawn as a pseudo-element so the links keep that full height. */
#mega-menu-wrap-above-topnav
  #mega-menu-above-topnav
  > li.mega-menu-item:not(:last-child)::after {
  content: "" !important;
  display: block !important; /* the plugin hides li::after */
  position: absolute !important;
  top: 50% !important;
  right: 0 !important;
  height: calc(0.94em + 2px) !important;
  font-size: var(--wp--custom--above-header--font-size) !important;
  border-right: 1px solid var(--wp--custom--above-header--link-color) !important;
  transform: translateY(-50%) !important;
  pointer-events: none !important;
}

/* theme.json settings.custom.aboveHeader.dividers false. */
.swiss-above-header-dividers-off
  #mega-menu-wrap-above-topnav
  #mega-menu-above-topnav
  > li.mega-menu-item:not(:last-child)::after {
  display: none !important;
}

#mega-menu-wrap-above-topnav
  #mega-menu-above-topnav
  > li.mega-menu-item:last-child {
  margin-right: 0 !important;
}

/* theme.json settings.custom.aboveHeader.alignEdges: the first and last links have no outer padding, so the bar's
   text lines up with the edges. Set false to give them full padding. */
body:not(.swiss-above-header-edges-padded)
  #mega-menu-wrap-above-topnav
  #mega-menu-above-topnav
  > li.mega-menu-item:first-child
  > a.mega-menu-link {
  padding-left: 0 !important;
}

body:not(.swiss-above-header-edges-padded)
  #mega-menu-wrap-above-topnav
  #mega-menu-above-topnav
  > li.mega-menu-item:last-child
  > a.mega-menu-link {
  padding-right: 0 !important;
}
