//
// Name:           Material Shadows
// Description:    Paper shadows of material design.
// Version:        2.0.1
//
// Author:         Denis Malinochkin
// Git:            https://github.com/mrmlnc/material-shadows
//
// twitter:        @mrmlnc
//
// ------------------------------------

// Mixins
// ------------------------------------

// Generator for top shadow
@function md-z-depth-top($depth: 1) {
  $color:    .12, .19, .19, .21, .22;
  $offset-y: 2px, 6px, 17px, 25px, 40px;
  $blur:     10px, 20px, 50px, 55px, 77px;

  @return 0 nth($offset-y, $depth) nth($blur, $depth) rgba(0, 0, 0, nth($color, $depth));
}

@mixin md-z-depth-top($depth: 1) {
  box-shadow: md-z-depth-top($depth);
}

// Generator for bottom shadow
@function md-z-depth-bottom($depth: 1) {
  $color:    .16, .2, .24, .22, .2;
  $offset-y: 2px, 8px, 12px, 16px, 27px;
  $blur:     5px, 17px, 15px, 28px, 24px;

  @return 0 nth($offset-y, $depth) nth($blur, $depth) rgba(0, 0, 0, nth($color, $depth));
}

@mixin md-z-depth-bottom($depth: 1) {
  box-shadow: md-z-depth-bottom($depth);
}

// Generator for top and bottom shadow
@mixin md-z-depth($depth: 1) {
  box-shadow: md-z-depth-bottom($depth), md-z-depth-top($depth);
}

// Generator animation hover and focus effect
@mixin md-z-depth-animation($depth, $orientation: full) {
  &:hover,
  &:focus {
    @if $orientation == top {
      @include md-z-depth-top($depth);
    }
    @else if $orientation == bottom {
      @include md-z-depth-bottom($depth);
    }
    @else {
      @include md-z-depth($depth);
    }
  }
}

// Classes
// ------------------------------------

@mixin md-z-depth-class($animation: true, $time: .28s, $function: cubic-bezier(.4, 0, .2, 1)) {
  @for $i from 1 to 6 {
    &-#{$i} {
      @include md-z-depth($i);

      &-top {
        @include md-z-depth-top($i);
      }

      &-bottom {
        @include md-z-depth-bottom($i);
      }
    }


    // z-depth-animation
    &-animation {
      &:hover {
        .z-depth-1,
        .z-depth-2,
        .z-depth-3,
        .z-depth-4,
        .z-depth-5 {
          transition: box-shadow $time $function;
        }
      }
    }
  }
}