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

  HAMBURGER ICONS COMPONENT
  from : http://callmenick.com/post/animating-css-only-hamburger-menu-icons
----------------------------------------------------------------------------- */

// vars
$button-width: 50px; // The width of the button area
$button-height: 50px; // The height of the button area
$bar-thickness: 2px; // The thickness of the button bars
$button-pad: 14px; // The left/right padding between button area and bars.
$button-bar-space: 4px; // The spacing between button bars
$button-transistion-duration: 0.2s; // The transition duration
$background: #fff;
$bars-color: #76828A;

/**
 * Toggle Switch Globals
 *
 * All switches should take on the class `c-hamburger` as well as their
 * variant that will give them unique properties. This class is an overview
 * class that acts as a reset for all versions of the icon.
 */

.c-hamburger {
    display: block;
    position: relative;
    overflow: hidden;
    margin: 0;
    padding: 0;
    width: $button-width;
    height: $button-height;
    font-size: 0;
    text-indent: -9999px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    box-shadow: none;
    border-radius: none;
    border: none;
    cursor: pointer;
    // border-radius: 24px;
    // background-color: #eee;
    transition: background $button-transistion-duration;
}

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

.c-hamburger span {
    display: block;
    position: absolute;
    top: ($button-height / 2) - ($bar-thickness / 2);
    left: $button-pad;
    right: $button-pad;
    height: $bar-thickness;
    // background: rgb(255, 255, 255);
    background-color: $bars-color;
}

.c-hamburger span::before,
.c-hamburger span::after {
    position: absolute;
    display: block;
    left: 0;
    width: 100%;
    height: $bar-thickness;
    background-color: $bars-color;
    content: "";
}

.c-hamburger span::before {
    top: -$bar-thickness - $button-bar-space;
}

.c-hamburger span::after {
    bottom: -$bar-thickness - $button-bar-space;
}


/**
 * Style 1
 *
 * Rotating hamburger icon (rot), that simply rotates 90 degrees when activated.
 * Nothing too fancy, simple transition.
 */

.c-hamburger--rot {
    background-color: rgb(40, 170, 220);
}

.c-hamburger--rot span {
    transition: transform $button-transistion-duration;
}


/* active state, i.e. menu open */

.c-hamburger--rot.is-active {
    background-color: darken(rgb(40, 170, 220), 20%);
}

.c-hamburger--rot.is-active span {
    transform: rotate(90deg);
}


/**
 * Style 2
 * 
 * Hamburger to "x" (htx). Takes on a hamburger shape, bars slide
 * down to center and transform into an "x".
 */

.c-hamburger--htx {
    // background-color: rgb(255, 50, 100);
}

.c-hamburger--htx span {
    transition: background 0s $button-transistion-duration;
}

.c-hamburger--htx span::before,
.c-hamburger--htx span::after {
    transition-duration: $button-transistion-duration, $button-transistion-duration;
    transition-delay: $button-transistion-duration, 0s;
}

.c-hamburger--htx span::before {
    transition-property: top, transform;
}

.c-hamburger--htx span::after {
    transition-property: bottom, transform;
}


/* active state, i.e. menu open */

.c-hamburger--htx.is-active {
    // background-color: darken(rgb(255, 50, 100), 20%);
}

.c-hamburger--htx.is-active span {
    background: none;
}

.c-hamburger--htx.is-active span::before {
    top: 0;
    transform: rotate(45deg);
}

.c-hamburger--htx.is-active span::after {
    bottom: 0;
    transform: rotate(-45deg);
}

.c-hamburger--htx.is-active span::before,
.c-hamburger--htx.is-active span::after {
    transition-delay: 0s, $button-transistion-duration;
}


/**
 * Style 3
 *
 * Hamburger to left-arrow (htla). Hamburger menu transforms to a left-pointing
 * arrow. Usually indicates an off canvas menu sliding in from left that
 * will be close on re-click of the icon.
 */

.c-hamburger--htla {
    background-color: rgb(50, 220, 100);
}

.c-hamburger--htla span {
    transition: transform $button-transistion-duration;
}

.c-hamburger--htla span::before,
.c-hamburger--htla span::after {}

.c-hamburger--htla span::before {
    transform-origin: top right;
    transition: transform $button-transistion-duration, width $button-transistion-duration, top $button-transistion-duration;
}

.c-hamburger--htla span::after {
    transform-origin: bottom right;
    transition: transform $button-transistion-duration, width $button-transistion-duration, bottom $button-transistion-duration;
}


/* active state, i.e. menu open */

.c-hamburger--htla.is-active {
    background-color: darken(rgb(50, 220, 100), 20%);
}

.c-hamburger--htla.is-active span {
    transform: rotate(180deg);
}

.c-hamburger--htla.is-active span::before,
.c-hamburger--htla.is-active span::after {
    width: 50%;
}

.c-hamburger--htla.is-active span::before {
    top: 0;
    transform: translateX($button-width/2 - $button-pad + $bar-thickness) translateY($bar-thickness/2) rotate(45deg);
}

.c-hamburger--htla.is-active span::after {
    bottom: 0;
    transform: translateX($button-width/2 - $button-pad + $bar-thickness) translateY(-$bar-thickness/2) rotate(-45deg);
}


/**
 * Style 4
 *
 * Hamburger to right-arrow (htra). Hamburger menu transforms to a
 * right-pointing arrow. Usually indicates an off canvas menu sliding in from 
 * right that will be close on re-click of the icon.
 */

.c-hamburger--htra {
    background-color: rgb(255, 150, 80);
}

.c-hamburger--htra span {
    transition: transform $button-transistion-duration;
}

.c-hamburger--htra span::before,
.c-hamburger--htra span::after {}

.c-hamburger--htra span::before {
    transform-origin: top left;
    transition: transform $button-transistion-duration, width $button-transistion-duration, top $button-transistion-duration;
}

.c-hamburger--htra span::after {
    transform-origin: bottom left;
    transition: transform $button-transistion-duration, width $button-transistion-duration, bottom $button-transistion-duration;
}


/* active state, i.e. menu open */

.c-hamburger--htra.is-active {
    background-color: darken(rgb(255, 150, 80), 20%);
}

.c-hamburger--htra.is-active span {
    transform: rotate(180deg);
}

.c-hamburger--htra.is-active span::before,
.c-hamburger--htra.is-active span::after {
    width: 50%;
}

.c-hamburger--htra.is-active span::before {
    top: 0;
    transform: translateX(-$bar-thickness) translateY($bar-thickness/2) rotate(-45deg);
}

.c-hamburger--htra.is-active span::after {
    bottom: 0;
    transform: translateX(-$bar-thickness) translateY(-$bar-thickness/2) rotate(45deg);
}
