/**
  * Nifty Nav 2
  * A JavaScript menu framework.
  * Author: Eric Stout, Factor1 Studios
  * https://github.com/factor1/nifty-nav-2
**/

// icon placeholder
%burger {
  span {
    display: block;
    position: relative;
    left: calc(50% - 20px);
    width: 40px;
    height: 3px;
    background-color: teal;
    transition: all 200ms ease;
    &:nth-child(2) {
      margin: 8px 0;
    }
  }
}


/**
 *
 * Icon Styles
 *
**/
.nifty-button {
  display: block;
  position: relative;
  width: auto;
  appearance: none;
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  &__container {
    display: flex;
    flex-flow: row nowrap;
    justify-content: space-between;
    align-content: center;
    position: relative;
    min-width: 60px;
    width: auto;
  }
  &:after { // 🤡 this after prevents the <span>(s) from being the click target 🤡
    content: '';
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
  }
}

.nifty-icon {
  display: flex;
  flex-flow: column;
  justify-content: center;
  align-items: center;
  position: relative;
  flex: 0 1 auto;
  height: 30px;
  width: 60px;

  /**
   * Square Icon
  **/
  &--square {
    @extend %burger;
  }

  /**
   * Rounded Icon
  **/
  &--rounded {
    @extend  %burger;
    span {
      height: 5px;
      border-radius: 10px;
    }
  }

  /**
   * Active State
  **/
  &.nifty-active {
    span {
      &:nth-child(1) {
        top: 11px;
        transform: rotate(45deg);
      }
      &:nth-child(2) {
        background-color: transparent !important;
      }
      &:nth-child(3) {
        bottom: 12px;
        transform: rotate(-45deg);
      }
    }
    &.nifty-icon--rounded {
      span {
        &:nth-child(1) {
          top: 13px;
        }
      }
    }
  }

  /**
   * Menu Text Container
  **/
  &--text {
    display: flex;
    flex-flow: column;
    justify-content: center;
    align-items: center;
    position: relative;
    flex: 0 1 auto;
    font-size: 16px;
    text-transform: uppercase;
  }

}

/**
 *
 * Panel Styles
 *
**/
.nifty-panel {
  position: absolute;
  top: 0;
  width: 100%;
  overflow: hidden;
  z-index: 999;

  // Top Origin
  &--top {
    left: 0;
    // Closed State
    &.nifty-panel--closed {
      max-height: 0;
    }
    // Open State
    &.nifty-panel--open {
      max-height: 100vh;
    }
  }

  // left origin
  &--left {
    // Closed State
    &.nifty-panel--closed {
      max-width: 0;
    }
    // Open State
    &.nifty-panel--open {
      max-width: 100vw;
    }
  }

  // right origin
  &--right {
    left: initial;
    left: unset;
    right: 0;
    // Closed State
    &.nifty-panel--closed {
      max-width: 0;
    }
    // Open State
    &.nifty-panel--open {
      max-width: 100vw;
    }
  }

  // -- Animation Options-- //
  //fade-in
  &--fade-in {
    &.nifty-panel--closed {
      opacity: 0;
      visibility: hidden;
      max-height: 100vh;
    }
    &.nifty-panel--open {
      opacity: 1;
      visibility: visible;
      max-height: 100vh;
    }
    &.nifty-panel--left,
    &.nifty-panel--right,
    &.nifty-panel--open,
    &.nifty-panel--closed {
      max-height: 100vh;
      max-width: 100vw;
    }
  }

  // off
  &--off {
    transition: none;
  }

}

/**
 *
 * Mask Styles
 *
**/
.nifty-mask {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 0;
  opacity: 0;
  z-index: 998;
  &--active {
    height: 100vh;
    opacity: 1;
  }
  &--closing {
    height: 100vh;
    opacity: 0;
    pointer-events: none;
  }
  &--disabled {
    background-color: transparent;
  }
  &--animation-off {
    transition: none;
  }
}
