/* =============================================================================
  MM - MATERIAL MENU
============================================================================= */

/**
 * MM - Material Menu
 *
 * All the styles for the material menu here! I've prefixed them all with "mm",
 * which means material menu.
 */

/**
 * Toggle Button
 *
 * a.k.a. hamburger icon. See the "resets" section for global button resets.
 */

$menu-toggle-width: 24px;
$menu-toggle-height: 18px;
$menu-toggle-layer-thickness: 4px;
$menu-gradient-stop-1: $menu-toggle-height/2 - $menu-toggle-layer-thickness/2;
$menu-gradient-stop-2: $menu-gradient-stop-1 + $menu-toggle-layer-thickness;

.mm-menu-toggle {
  position: fixed;
  top: 12px; left: 12px;
  z-index: 20;
  width: $menu-toggle-width;
  height: $menu-toggle-height;
  background: linear-gradient(0deg, rgba($color--text-primary,0), rgba($color--text-primary,0) $menu-gradient-stop-1, $color--text-primary $menu-gradient-stop-1, $color--text-primary $menu-gradient-stop-2, rgba($color--text-primary,0) $menu-gradient-stop-2, rgba($color--text-primary,0) $menu-toggle-height);
  font-size: 0;
  text-indent: -9999px;
}

.mm-menu-toggle::before,
.mm-menu-toggle::after {
  display: block;
  position: absolute;
  left: 0;
  width: 100%;
  height: $menu-toggle-layer-thickness;
  background-color: $color--text-primary;
  content: "";
}

.mm-menu-toggle::before {
  top: 0;
  transform-origin: bottom left;
}

.mm-menu-toggle::after {
  bottom: 0;
  transform-origin: top left;
}

.mm-menu-toggle,
.mm-menu-toggle::before,
.mm-menu-toggle::after {
  transition: all 0.5s;
}

/* active states */

.mm-menu-toggle.active {
  transform: rotate(360deg);
}

.mm-menu-toggle.active::before {
  width: 75%;
  transform: translateY(7px) rotate(-45deg);
}

.mm-menu-toggle.active::after {
  width: 75%;
  transform: translateY(-7px) rotate(45deg);
}

/**
 * The actual menu
 *
 * Here be all the stuff for the menu itself.
 */

.mm-menu {
  position: fixed;
  top: 0; left: 0;
  z-index: 10;
  background-color: #fff;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  box-shadow: 0;
  transform: translateX(-100%);
  transition: transform 0.5s, box-shadow 0.5s;
}

.mm-menu.active {
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  transform: translateX(0);
}

@media all and ( min-width: 300px ) {
  .mm-menu {
    width: 300px;
    transform: translateX(-300px);
  }
}

/* header */

.mm-menu__header {
  position: relative;
  width: 100%;
  height: 188px;
  background-color: $color--accent;
}

.mm-menu__title {
  position: absolute;
  bottom: 12px; left: 12px;
  margin: 0;
  padding: 0;
  color: #fff;
  font-size: $font-size--medium;
}

/* list */

.mm-menu__items {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mm-menu__item {
  display: block;
  width: 100%;
  opacity: 0;
  transform: translateX(-50%);
}

.mm-menu__item.in-view {
  opacity: 1;
  transform: translateX(0);
}

$delay: 0.1;
@for $i from 1 through 20 {
  .mm-menu__item.item-#{$i} {
    transition: opacity 0.5s #{$delay}s, transform 0.5s #{$delay}s;
  }
  $delay: $delay + 0.1;
}

.mm-menu__link {
  display: block;
  position: relative;
  overflow: hidden;
  margin: 4px 0;
  padding: 12px;
  color: $color--text-secondary;
  font-size: $font-size--small;
  text-decoration: none;
  transition: background 0.5s, color 0.5s;
}

.mm-menu__link-text {
  position: relative;
  z-index: 2;
}

/* the touch effect, for when a link is touched */

.mm-menu__link--touch-effect {
  display: block;
  position: absolute;
  z-index: 1;
  width: 0; height: 0;
  border-radius: 100%;
  background-color: $color--divider;
  transform: scale(0);
  transform-origin: 50% 50%;
}

.mm-menu__link--touch-effect.animating {
  transform: scale(1);
  transition: transform 0.5s;
}

/**
 * Menu mask
 *
 * A mask that comes in and covers the wrapper when the menu is active.
 */

.mm-menu-mask {
  display: block;
  position: fixed;
  top: 0; left: 0;
  z-index: 8;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.8);
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.5s, visibility 0.5s;
}

.mm-menu-mask.active {
  visibility: visible;
  opacity: 1;
}