// Breakpoint viewport sizes and media queries.
//
// Breakpoints are defined as a map of (name: minimum width), order from small to large:
//
//    (xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px, xxl: 1400px)
//
// The map defined in the `$grid-breakpoints` global variable is used as the `$breakpoints` argument by default.

// Name of the next breakpoint, or null for the last breakpoint.
//
//    >> breakpoint-next(sm)
//    md
//    >> breakpoint-next(sm, (xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px, xxl: 1400px))
//    md
//    >> breakpoint-next(sm, $breakpoint-names: (xs sm md lg xl xxl))
//    md
@function breakpoint-next($name, $breakpoints: $grid-breakpoints, $breakpoint-names: map-keys($breakpoints)) {
	$n: index($breakpoint-names, $name);
	@if not $n {
	  @error "breakpoint `#{$name}` not found in `#{$breakpoints}`";
	}
	@return if($n < length($breakpoint-names), nth($breakpoint-names, $n + 1), null);
  }
  
  // Minimum breakpoint width. Null for the smallest (first) breakpoint.
  //
  //    >> breakpoint-min(sm, (xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px, xxl: 1400px))
  //    576px
  @function breakpoint-min($name, $breakpoints: $grid-breakpoints) {
	$min: map-get($breakpoints, $name);
	@return if($min != 0, $min, null);
  }
  
  // Maximum breakpoint width.
  // The maximum value is reduced by 0.02px to work around the limitations of
  // `min-` and `max-` prefixes and viewports with fractional widths.
  // See https://www.w3.org/TR/mediaqueries-4/#mq-min-max
  // Uses 0.02px rather than 0.01px to work around a current rounding bug in Safari.
  // See https://bugs.webkit.org/show_bug.cgi?id=178261
  //
  //    >> breakpoint-max(md, (xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px, xxl: 1400px))
  //    767.98px
  @function breakpoint-max($name, $breakpoints: $grid-breakpoints) {
	$max: map-get($breakpoints, $name);
	@return if($max and $max > 0, $max - .02, null);
  }
  
  // Returns a blank string if smallest breakpoint, otherwise returns the name with a dash in front.
  // Useful for making responsive utilities.
  //
  //    >> breakpoint-infix(xs, (xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px, xxl: 1400px))
  //    ""  (Returns a blank string)
  //    >> breakpoint-infix(sm, (xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px, xxl: 1400px))
  //    "-sm"
  @function breakpoint-infix($name, $breakpoints: $grid-breakpoints) {
	@return if(breakpoint-min($name, $breakpoints) == null, "", "-#{$name}");
  }
  
  // Media of at least the minimum breakpoint width. No query for the smallest breakpoint.
  // Makes the @content apply to the given breakpoint and wider.
  @mixin media-breakpoint-up($name, $breakpoints: $grid-breakpoints) {
	$min: breakpoint-min($name, $breakpoints);
	@if $min {
	  @media (min-width: $min) {
		@content;
	  }
	} @else {
	  @content;
	}
  }
  
  // Media of at most the maximum breakpoint width. No query for the largest breakpoint.
  // Makes the @content apply to the given breakpoint and narrower.
  @mixin media-breakpoint-down($name, $breakpoints: $grid-breakpoints) {
	$max: breakpoint-max($name, $breakpoints);
	@if $max {
	  @media (max-width: $max) {
		@content;
	  }
	} @else {
	  @content;
	}
  }
  
  // Media that spans multiple breakpoint widths.
  // Makes the @content apply between the min and max breakpoints
  @mixin media-breakpoint-between($lower, $upper, $breakpoints: $grid-breakpoints) {
	$min: breakpoint-min($lower, $breakpoints);
	$max: breakpoint-max($upper, $breakpoints);
  
	@if $min != null and $max != null {
	  @media (min-width: $min) and (max-width: $max) {
		@content;
	  }
	} @else if $max == null {
	  @include media-breakpoint-up($lower, $breakpoints) {
		@content;
	  }
	} @else if $min == null {
	  @include media-breakpoint-down($upper, $breakpoints) {
		@content;
	  }
	}
  }
  
  // Media between the breakpoint's minimum and maximum widths.
  // No minimum for the smallest breakpoint, and no maximum for the largest one.
  // Makes the @content apply only to the given breakpoint, not viewports any wider or narrower.
  @mixin media-breakpoint-only($name, $breakpoints: $grid-breakpoints) {
	$min:  breakpoint-min($name, $breakpoints);
	$next: breakpoint-next($name, $breakpoints);
	$max:  breakpoint-max($next, $breakpoints);
  
	@if $min != null and $max != null {
	  @media (min-width: $min) and (max-width: $max) {
		@content;
	  }
	} @else if $max == null {
	  @include media-breakpoint-up($name, $breakpoints) {
		@content;
	  }
	} @else if $min == null {
	  @include media-breakpoint-down($next, $breakpoints) {
		@content;
	  }
	}
  }

  //
  /*---------------------------------------------------
    SASS ELements (based on LESS Elements 0.9 http://lesselements.com) 
  -------------------------------- -------------------
    LESS ELEMENTS made by Dmitry Fadeyev (http://fadeyev.net)
    SASS port by Samuel Beek (http://samuelbeek.com) 
  ---------------------------------------------------*/
 
@mixin gradient-img($start: #EEE,$stop: #FFF) {
  background-color: $start;
  background-image: -webkit-linear-gradient(top,$start,$stop);
  background-image: linear-gradient(to top,$start,$stop);
}

@mixin gradient($color: #F5F5F5,$start: #EEE,$stop: #FFF) {
    background:$color;
    background:-webkit-gradient(linear,left bottom,left top,color-stop(0,$start),color-stop(1,$stop));
    background:-ms-linear-gradient(bottom,$start,$stop);
    background:-moz-linear-gradient(center bottom,$start 0%,$stop 100%);
    background:-o-linear-gradient($stop,$start);
    filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=$start,endColorstr=$stop)
}

@mixin bw-gradient($color: #F5F5F5,$start: 0,$stop: 255) {
    background:$color;
    background:-webkit-gradient(linear,left bottom,left top,color-stop(0,#000),color-stop(1,#000));
    background:-ms-linear-gradient(bottom,#000 0%,#000 100%);
    background:-moz-linear-gradient(center bottom,#000 0%,#000 100%);
    background:-o-linear-gradient(#000,#000);
    filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=rgb($start,$start,$start),endColorstr=rgb($stop,$stop,$stop))
}

@mixin bordered($top-color: #EEE,$right-color: #EEE,$bottom-color: #EEE,$left-color: #EEE) {
    border-top:solid 1px $top-color;
    border-left:solid 1px $left-color;
    border-right:solid 1px $right-color;
    border-bottom:solid 1px $bottom-color
}

@mixin drop-shadow($x-axis: 0,$y-axis: 1px,$blur: 2px,$alpha: 0.1) {
    //-webkit-box-shadow:$x-axis $y-axis $blur rgba(0,0,0,$alpha);
    //-moz-box-shadow:$x-axis $y-axis $blur rgba(0,0,0,$alpha);
    box-shadow:$x-axis $y-axis $blur rgba(0,0,0,$alpha)
}

@mixin rounded($radius: 2px) {
    border-radius:$radius
}

@mixin border-radius($topright: 0,$bottomright: 0,$bottomleft: 0,$topleft: 0) {
    border-top-right-radius:$topright;
    border-bottom-right-radius:$bottomright;
    border-bottom-left-radius:$bottomleft;
    border-top-left-radius:$topleft
}

@mixin opacity($opacity: 0.5) {
    -moz-opacity:$opacity;
    -khtml-opacity:$opacity;
    -webkit-opacity:$opacity;
    opacity:$opacity;
    $opperc:$opacity * 100
/*
  -ms-filter: ~"progid:DXImageTransform.Microsoft.Alpha(opacity=${opperc})";
  filter: ~"alpha(opacity=${opperc})";
*/
}

@mixin transition-duration($duration: 0.2s) {
    -moz-transition-duration:$duration;
    -webkit-transition-duration:$duration;
    -o-transition-duration:$duration;
    transition-duration:$duration
}

@mixin transform($arguments) {
    -webkit-transform:$arguments;
    -moz-transform:$arguments;
    -o-transform:$arguments;
    -ms-transform:$arguments;
    transform:$arguments
}

@mixin rotation($deg:5deg) {
}

@mixin scale($ratio:1.5) {
}

@mixin transition($duration:0.2s,$ease:ease-out) {
    -webkit-transition:all $duration $ease;
    -moz-transition:all $duration $ease;
    -o-transition:all $duration $ease;
    transition:all $duration $ease
}

@mixin transition-color($duration:0.2s,$ease:ease-out) {
    -webkit-transition:color $duration $ease;
    -moz-transition:color $duration $ease;
    -o-transition:color $duration $ease;
    transition:color $duration $ease
}

@mixin transition-border($duration:0.2s,$ease:ease-out) {
    -webkit-transition:border $duration $ease;
    -moz-transition:border $duration $ease;
    -o-transition:border $duration $ease;
    transition:border $duration $ease
}

@mixin transition-background-color($duration:0.2s,$ease:ease) {
    -webkit-transition:background-color $duration $ease;
    -moz-transition:background-color $duration $ease;
    -o-transition:background-color $duration $ease;
    transition:background-color $duration $ease
}

@mixin transition-fill($duration:0.2s,$ease:ease) {
    -webkit-transition:fill $duration $ease;
    -moz-transition:fill $duration $ease;
    -o-transition:fill $duration $ease;
    transition:fill $duration $ease
}

@mixin inner-shadow($horizontal:0,$vertical:1px,$blur:2px,$alpha: 0.4) {
    -webkit-box-shadow:inset $horizontal $vertical $blur rgba(0,0,0,$alpha);
    -moz-box-shadow:inset $horizontal $vertical $blur rgba(0,0,0,$alpha);
    box-shadow:inset $horizontal $vertical $blur rgba(0,0,0,$alpha)
}

@mixin box-shadow($arguments) {
    //-webkit-box-shadow:$arguments;
    //-moz-box-shadow:$arguments;
    box-shadow:$arguments
}

@mixin box-sizing($sizing: border-box) {
    //-ms-box-sizing:$sizing;
    //-moz-box-sizing:$sizing;
    //-webkit-box-sizing:$sizing;
    box-sizing:$sizing
}

@mixin user-select($argument: none) {
    -webkit-user-select:$argument;
    -moz-user-select:$argument;
    -ms-user-select:$argument;
    user-select:$argument
}

@mixin columns($colwidth: 250px,$colcount: 0,$colgap: 50px,$columnRuleColor: #EEE,$columnRuleStyle: solid,$columnRuleWidth: 1px) {
    -moz-column-width:$colwidth;
    -moz-column-count:$colcount;
    -moz-column-gap:$colgap;
    -moz-column-rule-color:$columnRuleColor;
    -moz-column-rule-style:$columnRuleStyle;
    -moz-column-rule-width:$columnRuleWidth;
    -webkit-column-width:$colwidth;
    -webkit-column-count:$colcount;
    -webkit-column-gap:$colgap;
    -webkit-column-rule-color:$columnRuleColor;
    -webkit-column-rule-style:$columnRuleStyle;
    -webkit-column-rule-width:$columnRuleWidth;
    column-width:$colwidth;
    column-count:$colcount;
    column-gap:$colgap;
    column-rule-color:$columnRuleColor;
    column-rule-style:$columnRuleStyle;
    column-rule-width:$columnRuleWidth
}

@mixin translate($x:0,$y:0) {
    -webkit-transform: translate($x,$y);
    -moz-transform: translate($x,$y);
    -ms-transform: translate($x,$y);
    -o-transform: translate($x,$y);
    transform: translate($x,$y);
}

@mixin translate3d($x:0,$y:0,$z:0) {
  -webkit-transform: translate3d($x, $y, $z);
      -ms-transform: translate3d($x, $y, $z); 
          transform: translate3d($x, $y, $z); 
}

@mixin background-clip($argument: padding-box) {
    -moz-background-clip:$argument;
    -webkit-background-clip:$argument;
    background-clip:$argument
}

@mixin transform($transforms) {
     -moz-transform: $transforms;
       -o-transform: $transforms;
      -ms-transform: $transforms;
  -webkit-transform: $transforms;
          transform: $transforms;
}
// rotate
@mixin rotate ($deg) {
  @include transform(rotate(#{$deg}deg));
}
 
// scale
@mixin scale($scale) {
   @include transform(scale($scale));
} 
// translate
@mixin translate ($x, $y) {
   @include transform(translate($x, $y));
}
// skew
@mixin skew ($x, $y) {
   @include transform(skew(#{$x}deg, #{$y}deg));
}
//transform origin
@mixin transform-origin ($origin) {
    -moz-transform-origin: $origin;
       -o-transform-origin: $origin;
      -ms-transform-origin: $origin;
  -webkit-transform-origin: $origin;
          transform-origin: $origin;
}

//return rgb value 
/*------------------------
    Usage

  $color-white: hexToRGBString(#fff) => "255,255,255"
  $color-white: hexToRGBString(rgb(255,255,255)) => "255,255,255"
  $color-white: hexToRGBString(rgba(#fff,1)) => "255,255,255"
  
------------------------*/
@function hexToRGBString($hexColor) {
  @return "#{red($hexColor)},#{green($hexColor)},#{blue($hexColor)}";
}

//Rem size support

/*------------------------
    Usage

    h1 {
      font-size: rem(32);
    }

    OR:

    h1 {
      font-size: rem(32px);
    }
------------------------*/

$browser-context: 16;

@function rem($pixels, $context: $browser-context) {
  @if (unitless($pixels)) {
    $pixels: $pixels * 1px;
  }

  @if (unitless($context)) {
    $context: $context * 1px;
  }

  @return $pixels / $context * 1rem;
}

/*------------------------
  FADE IN
  e.g. @include fadeIn( 2s );
------------------------*/

//$prefix:'-moz-', '-webkit-', '-o-', '-ms-', '';
//
//@mixin keyframe-fadeIn {
//  0%   { opacity:0; }
//  100% { opacity:1; }
//}
//
//@-moz-keyframes fadeIn {
//  @include keyframe-fadeIn;
//}
//@-webkit-keyframes fadeIn {
//  @include keyframe-fadeIn;
//}
//@-o-keyframes fadeIn {
//  @include keyframe-fadeIn;
//}
//@-ms-keyframes fadeIn {
//  @include keyframe-fadeIn;
//}
//@keyframes fadeIn {
//  @include keyframe-fadeIn;
//}
//
//@mixin fadeIn( $arg ) {
//  $keyframe-name:fadeIn;
//  $duration:$arg;
//  @each $p in $prefix {
//    #{$p}animation:$keyframe-name $duration;
//  }
//}

/*------------------------
mixin that calculates if text needs to be light or dark
depending on the background color passed.

From this W3C document: http://www.webmasterworld.com/r.cgi?f=88&d=9769&url=http://www.w3.org/TR/AERT#color-contrast

usage:
@include text-contrast($bgcolor)
      
Color brightness is determined by the following formula: 
((Red value X 299) + (Green value X 587) + (Blue value X 114)) / 1000
------------------------*/

@mixin text-contrast($n:#333) {
  $color-brightness: round((red($n) * 299) + (green($n) * 587) + (blue($n) * 114) / 1000);
  $light-color: round((red(#ffffff) * 299) + (green(#ffffff) * 587) + (blue(#ffffff) * 114) / 1000);
  
  @if abs($color-brightness) < ($light-color/1.70){
    color: rgba(255,255,255,1);
  }

  @else {
    color: rgba(0,0,0,0.8);
  }
}

/*------------------------
 color factory 
  eg: contrast-ink($contrastvalue)
------------------------*/

@function contrast($n:#333) {
  $color-brightness: round((red($n) * 299) + (green($n) * 587) + (blue($n) * 114) / 1000);
  $light-color: round((red(#ffffff) * 299) + (green(#ffffff) * 587) + (blue(#ffffff) * 114) / 1000);
  
  @if abs($color-brightness) < ($light-color/1.70){
    @return #ffffff;
  }

  @else {
    @return #000000;
  }
}

/*------------------------
 color factory 
  eg: @include paint($blue-grey-50, bg-blue-grey-50);
------------------------*/


@mixin paint($paint:#333333,$make:bg-blue-grey-50) {

    .#{$make} {
      background-color: $paint;
      @include text-contrast($paint);
      &:hover {
        @include text-contrast($paint)
      }
    }
}

@mixin brush($brush: #333,$make: red-50) {
    .#{$make} {
      color: $brush;
    }
}

//mixen for settings side buttons
@mixin set-settings($class-element: nav-function-fixed) {

    .#{$class-element} .btn-switch[data-class="#{$class-element}"] {
      @extend %set-settings;
    }

}

//mixen for settings side buttons
@mixin paint-gradient($paint: $fusion-500, $make:bg-fusion-gradient) {

    .#{$make} {
      background-image: -webkit-linear-gradient(250deg, rgba($paint, 0.7), transparent);
      background-image: linear-gradient(250deg, rgba($paint, 0.7), transparent);
    }

}

/* backface visibility */
@mixin backface-visibility($argument: none) {
  -webkit-backface-visibility: hidden;
  -moz-backface-visibility:    hidden;
  -ms-backface-visibility:     hidden;
   backface-visibility:        hidden;
}

/* generate theme button */
@mixin theme-button-color ($theme-fusion:none, $theme-primary:none, $theme-info:none, $theme-success:none, $theme-warning:none, $theme-danger:none) {
  background-image: -webkit-linear-gradient(left, #{$theme-fusion}, #{$theme-fusion} 70%, #{$theme-primary} 70%, #{$theme-primary} 76%, #{$theme-info} 76%, #{$theme-info} 82%, #{$theme-success} 82%, #{$theme-success} 88%, #{$theme-warning} 88%, #{$theme-warning} 94%, #{$theme-danger} 94%, #{$theme-danger} 94%, #{$theme-danger} 100%);
  background-image: -moz-linear-gradient(left, #{$theme-fusion}, #{$theme-fusion} 70%, #{$theme-primary} 70%, #{$theme-primary} 76%, #{$theme-info} 76%, #{$theme-info} 82%, #{$theme-success} 82%, #{$theme-success} 88%, #{$theme-warning} 88%, #{$theme-warning} 94%, #{$theme-danger} 94%, #{$theme-danger} 94%, #{$theme-danger} 100%);
  background-image: -ms-linear-gradient(left, #{$theme-fusion}, #{$theme-fusion} 70%, #{$theme-primary} 70%, #{$theme-primary} 76%, #{$theme-info} 76%, #{$theme-info} 82%, #{$theme-success} 82%, #{$theme-success} 88%, #{$theme-warning} 88%, #{$theme-warning} 94%, #{$theme-danger} 94%, #{$theme-danger} 94%, #{$theme-danger} 100%);
  background-image: linear-gradient(to right, #{$theme-fusion}, #{$theme-fusion} 70%, #{$theme-primary} 70%, #{$theme-primary} 76%, #{$theme-info} 76%, #{$theme-info} 82%, #{$theme-success} 82%, #{$theme-success} 88%, #{$theme-warning} 88%, #{$theme-warning} 94%, #{$theme-danger} 94%, #{$theme-danger} 94%, #{$theme-danger} 100%);
}

// IE flexbox details:
//
// - Flexbox in IE 10:
//   https://msdn.microsoft.com/en-us/library/hh673531(v=vs.85).aspx
//
// - IE 11 flexbox changes (includes property/value names for IE 10)
//   https://msdn.microsoft.com/library/dn265027(v=vs.85).aspx

@mixin flexbox ($important: false) {
  display: unquote("-ms-flexbox #{if($important, '!important', null)}");
  display: unquote("flex #{if($important, '!important', null)}");
}

@mixin inline-flexbox ($important: false) {
  display: unquote("-ms-inline-flexbox #{if($important, '!important', null)}");
  display: unquote("inline-flex #{if($important, '!important', null)}");
}

@mixin align-content ($value) {
  $ms-map: (
    flex-start: start,
    flex-end: end
  );
  -ms-flex-line-pack: map-get($ms-map, $value) or $value;
  align-content: $value;
}

@mixin align-items ($value) {
  $ms-map: (
    flex-start: start,
    flex-end: end
  );
  -ms-flex-align: map-get($ms-map, $value) or $value;
  align-items: $value;
}

@mixin align-self ($value) {
  $ms-map: (
    flex-start: start,
    flex-end: end
  );
  -ms-flex-item-align: map-get($ms-map, $value) or $value;
  align-self: $value;
}

@mixin flex ($value) {
  -ms-flex: $value;
  flex: $value;
}

@mixin flex-direction ($value) {
  -ms-flex-direction: $value;
  flex-direction: $value;
}

@mixin flex-wrap ($value) {
  $ms-map: (
    nowrap: none
  );
  -ms-flex-wrap: map-get($ms-map, $value) or $value;
  flex-wrap: $value;
}

@mixin justify-content ($value) {
  $ms-map: (
    flex-start: start,
    flex-end: end,
    space-around: distribute,
    space-between: justify
  );
  -ms-flex-pack: map-get($ms-map, $value) or $value;
  justify-content: $value;
}

@mixin order ($value) {
  -ms-flex-order: $value;
  order: $value;
}

//////////////////////--------------
/// 
