/**
 * @file
 * This file contains extra overrides, and few more to save headaches.
 *
 * You can disable this file inclusion via UI: /admin/structure/ultimenu,
 *
 * Tips:
 * If flyout was covered by another content, add higher z-index layering to its
 * parent block, e.g.: .block-ultimenu {position: relative; z-index: 9999;}
 */

/* Remove this box-sizing if your theme is already using one globally */
.ultimenu *,
.ultimenu *::before,
.ultimenu *::after {
  box-sizing: border-box;
}

/** Prevents flyout from being covered by other contents, adjust it.
Adjust it to the relevant block class, e.g.: .block--ultimenu, etc. */
.block-ultimenu {
  position: relative;
  z-index: 98;
  visibility: visible;
  pointer-events: auto;
}

/** Adjust it to the relevant sidebar class, e.g.: .l-sidebar, etc. */
.sidebar .block-ultimenu {
  z-index: 96;
}

.block .ultimenu {
  margin: 0;
  padding: 0;
}

/** Prevents overflowing block contents. */
.ultimenu__flyout .block {
  max-width: 100%;
  padding: 1em 0;
}

/** Generally Ultimenu mobile menu items have background color. */
.is-ultimenu-canvas--active .ultimenu--main .is-active-trail > a {
  color: #fff;
}

/**
 * Link.
 */
.ultimenu--main .ultimenu__link,
.ultimenu .ultimenu__ajax {
  min-height: 42px;
  padding: 1em 1.75em;
}

.ultimenu .ultimenu__ajax {
  display: block;
}

/**
 * Menu description.
 */
.ultimenu__link small {
  display: block;
  line-height: 1;
}

/**
 * Default icon styling.
 */
.ultimenu__icon,
.ultimenu__title,
.ultimenu__icon::before {
  display: inline-block;
  vertical-align: bottom;
}

.ultimenu__icon {
  width: 42px;
  text-align: center;
  font-size: 28px;
}

/* Mobile needs a handler for click event. */
.has-ultimenu .caret {
  position: absolute;
  top: 0;
  right: 0; /* LTR */
  display: block;
  width: 48px;
  height: 100%;
  min-height: 34px;
  cursor: pointer;
  background-color: rgba(0, 0, 0, 0.2);
}

[dir="rtl"] .has-ultimenu .caret {
  right: auto;
  left: 0;
}

.has-ultimenu .caret::before {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  display: block;
  width: 0;
  height: 0;
  content: "";
  transition: all 0.2s;
  transform: translate(-50%, -50%);
  border: 8px solid transparent;
  border-top: 12px solid #fff;
}

.has-ultimenu .is-ultimenu-active .caret::before {
  border-top: 0;
  border-bottom: 12px solid #fff;
}

/**
 * Core Bartik do not have clearfix for region, add support for floating blocks
 * with micro clearfix.
 */
.ultimenu__flyout::after,
.ultimenu__region::after {
  display: table;
  clear: both;
  content: " ";
}

/** Overrides Bartik footer region. */
.block .ultimenu__flyout .ultimenu__region {
  margin: 0;
}

/**
 * Overrides Bartik to avoid confusion with disappearing Ultimenu menu items.
 * One prime sample why Ultimenu refuses to deal with theme compatibility.
 */
body:not(:target) .ultimenu .ultimenu__region .menu-item {
  height: auto;
}

/**
 * 944px+ with 16px base font.
 */
@media all and (min-width: 59em) {
  .ultimenu .ultimenu__link {
    line-height: 1.4;
  }

  .ultimenu--htb .ultimenu__region {
    box-shadow: 0 2px 2px rgba(0, 0, 0, 0.2);
  }

  .ultimenu--htb .ultimenu__flyout,
  .ultimenu--htb .ultimenu__region {
    border-radius: 0 0 9px 0;
  }

  .ultimenu--htt .ultimenu__flyout,
  .ultimenu--htt .ultimenu__region {
    border-radius: 0 9px 0 0;
  }

  /** The AJAX fallback link. Do not display block so to have correct throbber. */
  .ultimenu .ultimenu__ajax {
    display: inline-block;
    padding: 0 1.25em;
    vertical-align: middle;
  }

  /** Different themes different markups, and CSS rules, this is just an idea. */
  .sidebar .ultimenu__flyout,
  #header .ultimenu--hover .ultimenu__flyout,
  #footer .ultimenu--hover .ultimenu__flyout {
    min-width: 600px;
  }
}
