/* Keep the megamenu in its own horizontal layer from other blocks */
#block-nlrb-megamenu-nlrb-megamenu {
  clear: both;
  margin: 0.5em auto 0.25em;
}

/* Make sizing adjacent elements easier and use less math fudgery */
nav.megamenu * {
  box-sizing: border-box !important;
}

/* Make big text extra big */
nav.megamenu big {
  font-size: 1.5em;
}

/* Sit the menubar flush with its container */
nav.megamenu > ul {
  margin: 0;
  padding: 0;
}

/* Hide the close-every-menu radio, even from screen readers? */
nav.megamenu .close-all {
  display: none;
  position: absolute;
    top: 0;
    right: 0;
}

/* Make the header of a submenu align with its left border */
nav.megamenu .expanded > a {
  text-align: left;
}

/* Stylize top level menu items to be more buttony */
nav.megamenu .menu.depth-1 > li > a {
  color: #FFF;
  display: block;
  text-align: center;
  text-decoration: none;
}

/* Prepend a default icon to top level menu items */
nav.megamenu .menu.depth-1 > li > a:before {
  /* content: "\2AF6\2630"; */
  /* display: block; */
  /* font-size: 2em; */
  /* line-height: 2em; */
}

/* Highlight top level menu items when hovered */
/* nav.megamenu .menu.depth-1 > li[aria-expanded], */
/* nav.megamenu .menu.depth-1 > li[focus], */
nav.megamenu .menu.depth-1 > li:hover,
nav.megamenu .menu.depth-1 > li > label:hover,
nav.megamenu .menu.depth-1 > li[aria-expanded],
nav.megamenu .menu.depth-1 > li[focus] {
  /* box-shadow: 0 0 2em -1em #FFF inset; */
  box-shadow: 0 -0.5em 6em -1em #111 inset;
}

/* Highlight top level menu items when hovered */
nav.megamenu .menu.depth-1 > li > a:hover,
nav.megamenu .menu.depth-1 > li > label:hover {
  /* color: #2879A1; */
  color: #79C6EC;
}
nav.megamenu .menu.depth-1 > li > a:hover img {
  filter: invert(40%) sepia(100%) hue-rotate(155deg) saturate(180%);
}

/* Hide dropdown menus when inert */
nav.megamenu .menu > li > input,
nav.megamenu .menu.depth-1 > li > ul,
nav.megamenu .menu > li.has-submenu > ul,
nav.megamenu input[type=radio]:checked ~ .menu-opener,
nav.megamenu input[type=radio]:not(:checked) ~ .menu-closer {
  height: 0px;
  opacity: 0;
  z-index: -1;
}

nav.megamenu .menu > li.has-submenu > ul:not([aria-expanded]):not([focus]) * {
  position: fixed;
    bottom: -10rem;
}

nav.megamenu .menu.depth-1 > li > a {
  z-index: 1;
}

/* Show dropdown menus when hovered, checked, or focused */
/* Use JavaScript to make this work with keyboard shortcuts */
nav.megamenu.hover .menu > li > a:focus + ul,
nav.megamenu.hover .menu > li[focus] > a + ul,
nav.megamenu.hover .menu:not([focus]) > li:hover > a + ul,
nav.megamenu:not(.hover) .menu > li > a:focus + ul,
nav.megamenu:not(.hover) .menu > li[focus] > a + ul,
nav.megamenu:not(.hover) .menu.depth-1:not([aria-expanded]) > li:hover > a + ul,
nav.megamenu:not(.hover) .menu.depth-1[aria-expanded] > li[aria-expanded]:hover > a + ul,
nav.megamenu input[type=radio]:checked ~ .menu,
nav.megamenu input[type=radio]:checked ~ .menu-closer,
nav.megamenu input[type=radio]:not(:checked) ~ .menu-opener {
  height: auto;
  opacity: 1;
  z-index: 3;
}

/* Position click toggles below their menu items */
nav.megamenu .menu.depth-1 > li > input,
nav.megamenu .menu.depth-1 > li > label {
  color: #FFF;
  position: absolute;
    bottom: 0;
    right: 0;
  text-align: center;
  width: 100%;
}

/* Align submenu items within the dropdown, and remove list decorations */
nav.megamenu .menu:not(.depth-1) > li {
  list-style-image: none;
  list-style-type: none;
  vertical-align: top;
}

/* Render hyperlinks as blocks so that they clear each other */
nav.megamenu .menu:not(.depth-1) > li > a {
  border-radius: 0.333em;
  color: #2879A1;
  display: inline-block;
  margin: 0.25em 0.5em;
  padding: 0.25em 0.5em;
}

/* Only decorate hyperlinks when hovered, focused, or active */
nav.megamenu .menu:not(.depth-1) > li > a:not(:hover):not(:focus):not(:active) {
  text-decoration: none;
}

/* Help submenus render adjacent to their siblings */
nav.megamenu .menu.tabset:not(.depth-1) > li,
nav.megamenu .menu.tabset-1:not(.depth-1) > li,
nav.megamenu .menu.tabset-2:not(.depth-1) > li,
nav.megamenu .menu.tabset-3:not(.depth-1) > li,
nav.megamenu .menu.tabset-4:not(.depth-1) > li,
nav.megamenu .menu.tabset-5:not(.depth-1) > li {
  display: inline-block;
  margin: 1em auto;
  padding: 0 0.5em;
}

/* Add indentation guides to submenus */
nav.megamenu li > .menu > .expanded > ul {
  border-left: 3px solid #CCC;
  padding: 0em 0.25em;
  text-align: left;
}

/* Make dropdown menus appear to hover above other elements */
nav.megamenu .menu.depth-2 {
  background: #FFFEFD;
  border: 1px solid #444;
  box-shadow: 0em 0.5em 1em 0.25em #444;
  display: table;
  padding: 1em;
  position: absolute;
    top: 100%;
    left: 0;
  /* text-align: center; */
}

/* Position earmarked menu items in the bottom right corner of the dropdown */
nav.megamenu .menu.earmarked {
  padding-bottom: 2em;
}
nav.megamenu .menu.depth-2 > li[earmark] {
  margin: 0;
  padding: 1px;
  position: absolute;
    bottom: 0;
    right: 0;
  width: auto !important;
}
nav.megamenu .menu.depth-2 > li[earmark] > a {
  background-color: #555;
  border-radius: 0;
  border-top-left-radius: 1.5em;
  color: #79C6EC;
  display: block;
  margin: 0;
  padding: 0.5em 1em;
  text-decoration: none;
}
nav.megamenu .menu.depth-2 > li[earmark] > a:not(:hover):not(:focus):not(:active) {
  color: #FFF;
}
nav.megamenu .menu.depth-2 > li[earmark] img {
  display: inline-block;
  margin: 0 0.25em;
  max-height: 2em;
  max-width: 2em;
  vertical-align: middle;
}

/* Colorize highlighted menu items */
nav.megamenu .menu:not(.depth-1) > .menu-item.highlight > a,
nav.megamenu .menu:not(.depth-1) > .menu-item.highlight > label {
  background-color: #494949;
  color: #79C6EC;
}
nav.megamenu .menu.depth-1 > .menu-item.highlight:not(:hover):not(:focus):not(:active) > a,
nav.megamenu .menu.depth-1 > .menu-item.highlight:not(:hover):not(:focus):not(:active) > label,
nav.megamenu .menu:not(.depth-1) > .menu-item.highlight > a:not(:hover):not(:focus):not(:active),
nav.megamenu .menu:not(.depth-1) > .menu-item.highlight > label:not(:hover):not(:focus):not(:active) {
  background-color: #494949;
  color: #FED57D;
}

/* Highlight menu items within the current active trail. */
nav.megamenu .menu.depth-1 > .active-trail {
  box-shadow: 0 -0.5em 6em -1em #888 inset;
}
nav.megamenu .menu:not(.depth-1) > .active-trail > .menu-link {
  background-color: #FFE;
  border: 2px solid #FFC;
}


/*******************************************************************************
** Adjust sizing & spacing for each menu level
*******************************************************************************/
nav.megamenu .menu.depth-1 > li {
  border-radius: 0.5em;
  font-size: 0.875rem;
  font-weight: bold;
  padding: 0.25em;
  vertical-align: bottom;
}
nav.megamenu .menu > li > a > img {
  display: inline-block;
  filter: drop-shadow(0 0 2px #444);
  max-height: 2em;
  max-width: 2em;
  margin: 0 auto;
  padding: 0.125em;
  vertical-align: -50%;
}
nav.megamenu .menu.depth-1 > li > a > img {
  display: block;
  max-height: 2.25em;
  max-width: 2.25em;
  padding-right: 0;
  vertical-align: bottom;
}
nav.megamenu .menu.depth-1 > li > label {
  font-size: 1.125em;
}
nav.megamenu .menu.depth-1 > li.leaf > a {
  font-size: 1.0625em;
  padding-bottom: 1.125em;
}
nav.megamenu.hybrid .menu.depth-1 > li > a,
nav.megamenu.toggle .menu.depth-1 > li > a {
  padding-bottom: 1.25em;
}
nav.megamenu .menu.depth-2 > li {
  font-size: 0.875rem;
  font-weight: bold;
}
nav.megamenu .menu.depth-3 > li {
  font-size: 0.875rem;
  font-weight: normal;
}
nav.megamenu .menu.depth-4 > li {
  font-size: 0.75rem;
  font-weight: normal;
}

/* Add indentation guides to submenus */
nav.megamenu li > .menu > li {
  padding: 0.25em 0.25em;
  position: relative;
  text-align: left;
}
nav.megamenu .menu:not(.depth-1) > li > input {
  display: none;
}
nav.megamenu .menu:not(.depth-1) > li > label {
  color: #2E8AB8;
  color: #555;
  position: absolute;
}
nav.megamenu .menu:not(.depth-1) > li > label.directional {
  font-size: 1.25em;
    left: -0.25em;
    top: 0.5em;
}
nav.megamenu .menu:not(.depth-1) > li > label.geometric {
  font-size: 1.5em;
    left: -0.05em;
}
nav.megamenu .menu:not(.depth-1) > li > label.mathematical {
  font-size: 0.85em;
    left: -0.25em;
    top: 0.75em;
}
nav.megamenu .menu:not(.depth-1) > li > .menu-closer {
  color: #555;
}
nav.megamenu .menu.depth-2 > li > label {
  font-size: 1.75em;
    left: -2px;
    top: 0px;
}

/* Hide bullet symbols for leaf items or 2nd level headers. */
nav.megamenu label.menu-empty,
nav.megamenu .menu.depth-2 > li:not(.has-submenu) > label {
  /* display: none; */
}


/*******************************************************************************
** RESPONSIVE MEDIA QUERIES
*******************************************************************************/

@media (max-width: 767px) {
  
  /* Hide the megamenu on mobile screens. Another menu module takes over. */
  nav.megamenu {
    display: none;
  }
  
}


/*******************************************************************************
** TECHNICAL DEBTS BELOW! FIXUP BEFORE COMMITTING TO PRODUCTION!!!!!!!!!!!!!!!!!
*******************************************************************************/
#block-nlrb-megamenu-nlrb-megamenu + #block-superfish-1 {
  display: none;
}
