/**
 * Top-level menu fixes for the Drupal 11 Superfish module.
 *
 * The item boxes themselves are already right: both sites wrap the menu in
 * <nav class="navbar navbar-default nus-main-nav">, and style.css sizes them
 * from there —
 *
 *   nav.nus-main-nav ul > li > a { padding: 15px; width: 100%;
 *                                  border-bottom: 1px solid #f5f5f5 }
 *
 * — which at (0,1,3) already outranks the module's "ul.sf-menu a {padding: 1em
 * 1.5em}". Nothing here may redefine that padding: a selector with two classes
 * beats it and silently shrinks the whole strip.
 *
 * Three things do slip past it, and this file addresses only those.
 *
 * Loaded after nus-nav.css; ties below are decided by source order.
 */

/**
 * 0. Gap between the items. nus-nav.css already carries Drupal 7's rule,
 *
 *      .sf-menu.menu, .sf-menu.menu ul, .sf-menu.menu li { margin: 0px; margin-right: 15px }
 *
 *    but the Drupal 11 Superfish stylesheet resets the very same elements with
 *
 *      ul.sf-menu.menu, ul.sf-menu.menu ul, ul.sf-menu.menu li { margin: 0; padding: 0 }
 *
 *    which has an extra element selector — (0,2,2) against (0,2,1) — and so wins.
 *    The 15px never applied: each item sat flush against the next, 15px closer
 *    than on D7. Measured left-to-right pitch of the five top-level items:
 *    D7 82 / 89 / 156 / 92, here 67 / 74 / 141 / 77, with identical item widths.
 *
 *    Same selector list, with the "ul" prefix so it ties with the module's rule
 *    and wins on load order. Applied to the nested lists too, as D7's was.
 */
ul.sf-menu.menu,
ul.sf-menu.menu ul,
ul.sf-menu.menu li {
  margin-right: 15px;
}

/**
 * 1. "About Us" has no URL. Drupal 7's Superfish rendered such an item as
 *    <a class="nolink" tabindex="0">, so it matched the nav.nus-main-nav rule
 *    like any other link. Drupal 11 renders <span class="nolink">, which that
 *    rule's trailing "a" excludes, leaving the item with the module's own
 *    padding, no border and no width — which is why it sat higher and tighter
 *    than its neighbours. Mirror the rule for the span.
 */
nav.nus-main-nav ul > li > span.nolink {
  display: block;
  position: relative;
  padding: 15px;
  width: 100%;
  /* Bootstrap fixes this on ".navbar-nav > li > a" only; the span would
     otherwise inherit the body's ratio and set its text on a different line
     box from its neighbours. */
  line-height: 20px;
  border-bottom: 1px solid #f5f5f5;
  /* Bootstrap greys the menu with ".navbar-default .navbar-nav > li > a", which
     at (0,2,2) beats nus-nav.css's ".nus-main-nav a {color: #003d7c}" at (0,1,1)
     — so every item is grey and only the active one turns blue, through
     ".sf-horizontal .sf-depth-1.active-trail > a" at (0,3,1). The span matches
     none of them, so it needs the grey spelled out. */
  color: #777;
}

/**
 * Hover colour, matching what the links get from
 *
 *   .sf-horizontal .sf-depth-1 > a:hover,
 *   .sf-horizontal .sfHover:hover { color: #000 }
 *
 * The second selector does reach the <li>, but the colour above is set on the
 * span itself and so is not overridden by inheritance — the item would stay
 * blue while the rest turn black.
 */
nav.nus-main-nav ul > li:hover > span.nolink,
nav.nus-main-nav ul > li.sfHover > span.nolink {
  color: #000;
}

/**
 * Mouse pointer over "About Us". nus-nav.css has
 *
 *   a.nolink { cursor: default; }
 *
 * so on Drupal 7 the item showed the plain arrow — it has no URL, so there is
 * nothing to click. Drupal 11's Superfish renders a <route:<nolink>> item as a
 * <span> (superfish.theme.inc), which that selector skips, and the browser falls
 * back to the text-insertion I-beam it uses over any plain text. Same rule for
 * the span, at every menu depth as the original was.
 */
.sf-menu span.nolink {
  cursor: default;
}

/**
 * 2. Parent items get a wide right gutter from the module:
 *
 *      ul.sf-menu .sf-with-ul { padding-right: 3em }
 *
 *    At (0,2,1) that beats the nav.nus-main-nav rule on the right-hand side
 *    only, which is what strands the arrow far from the word "Browse". Drupal
 *    7's stylesheet set no gutter at all — its arrow sat inside the ordinary
 *    padding — so put the padding back to 15px on that side too.
 */
nav.nus-main-nav ul > li > .sf-with-ul {
  padding-right: 15px;
}

/**
 * 3. The arrow itself. Drupal 7 drew a 10x10 sprite pinned to the right edge:
 *
 *      .sf-sub-indicator { position: absolute; width: 10px; height: 10px;
 *                          overflow: hidden; text-indent: -999em }
 *      .sf-sub-indicator { right: 0 }                    (nus-nav.css)
 *      a > .sf-sub-indicator { top: 1.4em }              (nus-nav.css)
 *
 *    Drupal 11 makes it a 1em box at right: 0.75em, vertically centred by
 *    transform, with a ▼ pseudo-element instead of the sprite. Those selectors
 *    carry two classes to nus-nav.css's one, so both of its rules lose.
 *
 *    The sprite is still in the theme and still referenced by nus-nav.css, so
 *    restoring D7's geometry and switching off the pseudo-element is enough.
 */
ul.sf-menu .sf-sub-indicator {
  width: 10px;
  height: 10px;
  right: 0;
  top: 1.4em;
  line-height: normal;
  text-indent: -999em;
  opacity: 1;
  transform: none;
  background-position: 0 -100px;
}

ul.sf-menu .sf-sub-indicator:after {
  content: none;
}
