/* -----------------------------------------------------------------------------

  SLIDE AND PUSH MENUS COMPONENT
  
----------------------------------------------------------------------------- */

$menu-break: 320px;
$menu-width: 300px;
$menu-height: 60px;

/**
 * Menu overview.
 */

.c-menu {
  position: fixed;
  z-index: 200;
  background-color: $color--theme;
  transition: transform 0.3s;
}

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

/**
 * Left and right menus
 *
 * Slide and push menus coming in from the left and right inherit a lot of
 * common styles. We'll start each of them off by doing up the common styles
 * for each version, followed by individual styles.
 *
 * The various versions are governed by modifier classes.
 */

/**
 * Common modifiers for left/right menus.
 */

.c-menu--slide-left,
.c-menu--slide-right,
.c-menu--push-left,
.c-menu--push-right {
  width: 100%;
  height: 100%;
  overflow-y: scroll;
  
  @media all and (min-width: $menu-break) {
    width: $menu-width;
  }
}

.c-menu--slide-left .c-menu__item,
.c-menu--slide-right .c-menu__item,
.c-menu--push-left .c-menu__item,
.c-menu--push-right .c-menu__item {
  display: block;
  text-align: center;
  border-top: solid 1px $color--theme-light;
  border-bottom: solid 1px $color--theme-dark;

  &:first-child {
    border-top: none;
  }

  &:last-child {
    border-bottom: none;
  }
}

.c-menu--slide-left .c-menu__link,
.c-menu--slide-right .c-menu__link,
.c-menu--push-left .c-menu__link,
.c-menu--push-right .c-menu__link {
  display: block;
  padding: 12px 24px;
  color: #fff;
}

.c-menu--slide-left .c-menu__close,
.c-menu--slide-right .c-menu__close,
.c-menu--push-left .c-menu__close,
.c-menu--push-right .c-menu__close {
  display: block;
  padding: 12px 24px;
  width: 100%;
}

/**
 * Slide/Push Menu Left.
 */

.c-menu--slide-left,
.c-menu--push-left {
  top: 0;
  left: 0;
  transform: translateX(-100%);

  @media all and (min-width: $menu-break) {
    transform: translateX(-$menu-width);
  }
}

.c-menu--slide-left.is-active,
.c-menu--push-left.is-active {
  transform: translateX(0);
}

/**
 * Slide/Push Menu Right.
 */

.c-menu--slide-right,
.c-menu--push-right {
  top: 0;
  right: 0;
  transform: translateX(100%);

  @media all and (min-width: $menu-break) {
    transform: translateX($menu-width);
  }
}

.c-menu--slide-right.is-active,
.c-menu--push-right.is-active {
  transform: translateX(0);
}

/**
 * Top and bottom menus
 *
 * Slide and push menus coming in from the top and bottom inherit a lot of
 * common styles. We'll start each of them off by doing up the common styles
 * for each version, followed by individual styles.
 *
 * The various versions are governed by modifier classes.

/**
 * Common modifiers for top/bottom menus
 */

.c-menu--slide-top,
.c-menu--slide-bottom,
.c-menu--push-top,
.c-menu--push-bottom {
  vertical-align: middle;
  width: 100%;
  height: $menu-height;
  text-align: center;
  overflow-x: scroll;
}

.c-menu--slide-top .c-menu__items,
.c-menu--slide-bottom .c-menu__items,
.c-menu--push-top .c-menu__items,
.c-menu--push-bottom .c-menu__items {
  display: inline-block;
  text-align: center;
}

.c-menu--slide-top .c-menu__item,
.c-menu--slide-bottom .c-menu__item,
.c-menu--push-top .c-menu__item,
.c-menu--push-bottom .c-menu__item {
  display: inline-block;
  line-height: $menu-height;
}

.c-menu--slide-top .c-menu__link,
.c-menu--slide-bottom .c-menu__link,
.c-menu--push-top .c-menu__link,
.c-menu--push-bottom .c-menu__link {
  display: block;
  padding: 0 4px;
  color: #fff;
}

.c-menu--slide-top .c-menu__close,
.c-menu--slide-bottom .c-menu__close,
.c-menu--push-top .c-menu__close,
.c-menu--push-bottom .c-menu__close {
  display: inline-block;
  margin-right: 12px;
  padding: 0 24px;
  height: $menu-height;
  line-height: $menu-height;
}

/**
 * Slide/Push Menu Top.
 */

.c-menu--slide-top,
.c-menu--push-top {
  top: 0;
  left: 0;
  transform: translateY(-$menu-height);
}

.c-menu--slide-top.is-active,
.c-menu--push-top.is-active {
  transform: translateY(0);
}

/**
 * Slide/Push Menu Bottom.
 */

.c-menu--slide-bottom,
.c-menu--push-bottom {
  bottom: 0;
  left: 0;
  transform: translateY($menu-height);
}

.c-menu--slide-bottom.is-active,
.c-menu--push-bottom.is-active {
  transform: translateY(0);
}

/**
 * Wrapper states.
 *
 * Various wrapper states occur depending on if a menu is pushing into view, in
 * which case, the wrapper has to be pushed by the respective distance.
 */

.o-wrapper.has-push-left {
  transform: translateX(100%);

  @media all and (min-width: $menu-break) {
    transform: translateX($menu-width);
  }
}

.o-wrapper.has-push-right {
  transform: translateX(-100%);

  @media all and (min-width: $menu-break) {
    transform: translateX(-$menu-width);
  }
}

.o-wrapper.has-push-top {
  transform: translateY($menu-height);
}

.o-wrapper.has-push-bottom {
  transform: translateY(-$menu-height);
}

/**
 * Body states.
 *
 * When a menu is active, we want to hide the overflows on the body to prevent
 * awkward document scrolling.
 */

body.has-active-menu {
  overflow: hidden;
}

/**
 * Close button resets.
 */

.c-menu__close {
  color: #fff;
  background-color: $color--theme-dark;
  font-size: $font-size--small;
  border: none;
  box-shadow: none;
  border-radius: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  cursor: pointer;
}

.c-menu__close:focus {
  outline: none;
}