/* Custom Mixins -------------------- */
// –––––––––––––––––––––––––––––––––––––––––––––––––––––––––
//  Google Fonts  v.2.0.0
// –––––––––––––––––––––––––––––––––––––––––––––––––––––––––
//
//  Subset config
//
//  Note!
//  The Latin subset is always included if available and need not be specified.
//  Please note that if a client browser supports unicode-range the subset parameter
//  is ignored; the browser will select from the subsets supported by the font to
//  get what it needs to render the text.
//  Source: https://developers.google.com/fonts/docs/getting_started
//
$google-font-subsets: (
	'arabic'      : false
	, 'bengali'     : false
	, 'cyrillic'    : false
	, 'cyrillic-ext': false
	, 'devanagari'  : false
	, 'greek'       : false
	, 'greek-ext'   : false
	, 'gujarati'    : false
	, 'hebrew'      : false
	, 'khmer'       : false
	, 'latin'       : false
	, 'latin-ext'   : false
	, 'tamil'       : false
	, 'telugu'      : false
	, 'thai'        : false
	, 'vietnamese'  : false
	) !default;

//
//   Google Fonts
//
@mixin google-font(
	$name   : null,     //  string (unquoted will work too)
	$weights: 400,      //  list or numeric value (100 200 300 400 ...)
	$styles : normal,   //  list or string (normal and or italic)
	$text   : null      //  string (don\'t forget to unescape )
	){
		//  base url
		$URL: '//fonts.googleapis.com/css?family=';

		//  create global variables
		@if not variable-exists(__gf__combine){ $__gf__combine: false !global; }
		@if not variable-exists(__gf__map){ $__gf__map: () !global; }
		@if not variable-exists(google-font-subsets){ $google-font-subsets: () !global; }

		//  append italic to weights
		@if index($styles, italic) and not str-index($weights+'',i){
			$wgt: if(index($styles, normal), $weights, ());
			@each $weight in $weights { $wgt: append($wgt, $weight + i); }
			$weights: $wgt;
		}

		//  reduce and encode text
		@if $text {
			$list: __gf__list-unique(__gf__str-explode($text));
			$text:'&text=';
			$encode:('!':'%21','#':'%23','$':'%24','&':'%26','\'':'%27',
				'(':'%28',')':'%29','*':'%2A','+':'%2B',',':'%2C',
				'/':'%2F',':':'%3A',';':'%3B','=':'%3D','?':'%3F',
				'@':'%40','[':'%5B',']':'%5D',' ':'%20');
			@for $i from 1 through length($list) {
				$char: map-get($encode,nth($list,$i)) or nth($list,$i);
				$text: $text + $char;
			}
		}

		//  subsets from config
		$subset: '';
		@each $set, $enabled in $google-font-subsets {
			@if $enabled {
				$subset: $subset + if($subset == '', '', ',') + $set;
			}
		}
		$subset: if(str-length($subset) > 0 and $subset != latin, '&subset=' + $subset, '');

		@if $name {
			//  replace name whitespaces
			$name: if(type-of($name) == string, unquote($name),$name);
			$name: __gf__str-replace(inspect($name),' ','+');
			@if $__gf__combine and not $text {
				//  add weights to combine map
				$wgt: map-get($__gf__map, $name) or ();
				$wgt: __gf__list-unique(join($wgt, $weights, comma));
				$__gf__map: map-merge($__gf__map, ($name: $wgt)) !global;
				} @else {
				//  create query
				$query: '';
				@each $weight in $weights { $query: $query + if($query != '', ',', '') + $weight; }
				$query: __gf__str-replace($query, ' ');
				$query: $name + if(str-length($query) > 0 and $query != '400',  ':'+ $query, '');

				//  create single immport
				@at-root { @import url($URL + $query + if($text, $text, '') + $subset); }
			}
			} @else {
			//  set combine flag
			$__gf__combine: true  !global;

			//  nested includes
			@content;

			//  convert combine map to query
			//  (remove weights if just 400)
			$query:'';
			@each $font, $weights in $__gf__map {
				$query: $query + if($query != '', '|', '') + $font +
				if(length($weights) == 1 and (nth($weights, 1) == '400'),
					'', ':' + join((), $weights, comma));
			}

			//  remove query whitespaces
			$query: __gf__str-replace($query,' ');

			//  create combined immport
			@at-root { @import url($URL + $query + $subset); }

			//  reset combine flag
			$__gf__combine: false !global;
		}
	}
//
//  Helper functions
//
@function __gf__list-unique($list) {
	$result: ();
	@each $item in $list { @if not index($result, $item+''){ $result: append($result, $item+'');} }
	@each $item in $result { $result: set-nth($result, index($result, $item),unquote($item)); }
	@return $result;
}
@function __gf__str-replace($string, $search, $replace: '') {
	$index: str-index($string, $search);
	@return if($index,
		str-slice($string, 1, $index - 1) + $replace +
		__gf__str-replace(str-slice($string, $index +
			str-length($search)), $search, $replace),
		$string);
}
@function __gf__str-explode($string){
	$list:();
	@for $i from 1 through str-length($string) { $list: append($list, str-slice($string, $i, $i)); }
	@return $list;
}
//@include google-font(Roboto, 400 500 700);



@mixin transition($args...) {
	-webkit-transition: $args;
	-moz-transition: $args;
	-ms-transition: $args;
	-o-transition: $args;
	transition: $args;
}
//@include transition(color .3s ease);




%clearfix {
	*zoom: 1;
	&:before, &:after {
		content: " ";
		display: table;
	}
	&:after {
		clear: both;
	}
}
// .container-with-floated-children {
//   @extend %clearfix;
// }




@function calculateRem($size) {
	$remSize: $size / 16px;
	@return $remSize * 1rem;
}

@mixin font-size($size) {
	font-size: $size;
	font-size: calculateRem($size);
}
//@include font-size(14px)




@mixin keyframes($animation-name) {
	@-webkit-keyframes #{$animation-name} {
		@content;
	}
	@-moz-keyframes #{$animation-name} {
		@content;
	}
	@-ms-keyframes #{$animation-name} {
		@content;
	}
	@-o-keyframes #{$animation-name} {
		@content;
	}
	@keyframes #{$animation-name} {
		@content;
	}
}
@mixin animation($str) {
	-webkit-animation: #{$str};
	-moz-animation: #{$str};
	-ms-animation: #{$str};
	-o-animation: #{$str};
	animation: #{$str};
}

// @include keyframes(slide-down) {
// 	0% { opacity: 1; }
// 	90% { opacity: 0; }
// }

// .element {
// 	width: 100px;
// 	height: 100px;
// 	background: black;
// 	@include animation('slide-down 5s 3');
// }


@mixin opacity($opacity) {
	opacity: $opacity;
	$opacity-ie: $opacity * 100;
	filter: alpha(opacity=$opacity-ie); //IE8
}
//@include opacity(0.8);

%visuallyhidden {
	margin: -1px;
	padding: 0;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip: rect(0, 0, 0, 0);
	position: absolute;
}
// <button class="mobile-navigation-trigger">
// 	<b class="visually-hidden">Open the navigation</b>
// 	<img src="img/mobile-navigation-icon.svg">
// </button>
// .visually-hidden {
// 	@extend %visuallyhidden;
// }
