$screen-xs-max: ($screen-sm-min - 1);
$screen-sm-max: ($screen-md-min - 1);
$screen-md-max: ($screen-lg-min - 1);

$ipad-pro-portrait-breakpoint: "(min-device-width : 1024px) and (max-device-width : 1024px) and (min-device-height : 1366px) and (max-device-height : 1366px) and (min-width: 1024px) and (max-width: 1024px)";
$ipad-pro-landscape-breakpoint: "(min-device-width : 1024px) and (max-device-width : 1024px) and (min-device-height : 1366px) and (max-device-height : 1366px) and (min-width: 1366px) and (max-width: 1366px)";

$mq_portrait: "and (orientation: portrait)";
$ipad1: "only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (-webkit-min-device-pixel-ratio: 1)";
$ipad1_portrait: "#{$ipad1} #{$mq_portrait}";
$ipad2: "only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (-webkit-min-device-pixel-ratio: 2)";
$ipad2_portrait: "#{$ipad2} #{$mq_portrait}";
$ipad3: "only screen and (min-device-width: 834px) and (max-device-width: 1112px)and (-webkit-min-device-pixel-ratio: 2)";
$ipad3_portrait: "only screen and (min-device-width: 834px) and (max-device-width: 834px) and (orientation: portrait) and (-webkit-min-device-pixel-ratio: 2)";
$ipad4: "only screen and (min-device-width: 1024px) and (max-device-width: 1366px)and (-webkit-min-device-pixel-ratio: 2)";
$ipad4_portrait: "only screen and (min-device-width: 1024px) and (max-device-width: 1024px) and (orientation: portrait) and (-webkit-min-device-pixel-ratio: 2)";

$galaxy1: "(min-device-width: 800px) and (max-device-width: 1280px)";
$galaxy1_portrait: "(max-device-width: 800px) and (orientation: portrait)";

$all_phones: "(-webkit-min-device-pixel-ratio:3.333) and (orientation: portrait)"; // 1440
$all_phones: "(-webkit-min-device-pixel-ratio:2.5) and (orientation: portrait)"; // 1080

@mixin mq-maxw($val) {
	@media only screen and (max-width: $val) {
		@content;
	}
}

@mixin mq-minw($val) {
	@media only screen and (min-width: $val) {
		@content;
	}
}

@mixin mqx2() {
	@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { 
	    @content;
	}
}

@mixin mqminratio($w, $h) {
	@media only screen and (min-aspect-ratio: #{$w} / #{$h}) {
		@content;
	}
}

@mixin mqmaxratio($w, $h) {
	@media only screen and (max-aspect-ratio: #{$w} / #{$h}) {
		@content;
	}
}

@mixin mqminw($val) {
	@media only screen and (min-width: $val + 0px) {
		@content;
	}
}

@mixin mqmaxw($val) {
	@media only screen and (max-width: $val + 0px) {
		@content;
	}
}

@mixin mqmaxh($val) {
	@media only screen and (max-height: $val + 0px) {
		@content;
	}
}

@mixin mqmaxhd($val) { // max heigth for desktop
	@media only screen and (max-height: $val + 0px) and (min-width: 1280px) {
		@content;
	}
}

@mixin mqmob() {
	@media only screen and (max-width: 1280px) {
		@content;
	}
}

@mixin mqdk() {
	@media only screen and (min-width: 1281px) {
		@content;
	}
}

@mixin mqtbl() {
	@media only screen and (min-width: 940px) and (max-width: 1280px) {
		@content;
	}
}

@mixin mqq($val) {
	@if $val < 0 {
		@media only screen and (max-width: $val * -1px) {
			@content;
		}
	}
	@if $val > 0 {
		@media only screen and (min-width: $val * 1px) {
			@content;
		}
	}
}

@mixin mqh($val) {
	@if $val < 0 {
		@media only screen and (max-height: $val * -1px) {
			@content;
		}
	}
	@if $val > 0 {
		@media only screen and (min-height: $val * 1px) {
			@content;
		}
	}
}




@mixin mq($breakpoint) {
	@if $breakpoint == "tablet" {
		@media #{$ipad1_portrait}, #{$ipad2_portrait} {
			@content;
		}
	}
	@if $breakpoint == "xxs" {
		@media only screen and (max-width: $screen-xs-min) {
			@content;
		}
	}
	@if $breakpoint == "xs-up" {
		@media only screen and (min-width: ($screen-xs-min + 1)) {
			@content;
		}
	}
	// xs - 768 - sm - 970 - md - 1200 - lg
	// <-->
	@if $breakpoint == "xs" {
		@media only screen and (max-width: $screen-xs-max) {
			@content;
		}
	}
	
	// xs - 768 - sm - 970 - md - 1200 - lg
	//      <-------->
	@if $breakpoint == "sm" {
		@media only screen and (min-width: $screen-sm-min) and (max-width: $screen-sm-max) {
			@content;
		}
	}
	
	// xs - 768 - sm - 970 - md - 1200 - lg
	//                 <-------->
	@if $breakpoint == "md" {
		@media only screen and (min-width: $screen-md-min) and (max-width: $screen-md-max) {
			@content;
		}
	}
	
	// xs - 768 - sm - 970 - md - 1200 - lg
	//                            <------->
	@if $breakpoint == "lg" {
		@media only screen and (min-width: $screen-lg-min) {
			@content;
		}
	}
	
	// xs - 768 - sm - 970 - md - 1200 - lg
	// <------------->
	@if $breakpoint == "sm-down" {
		@media only screen and (max-width: $screen-sm-max) {
			@content;
		}
	}
	
	// xs - 768 - sm - 970 - md - 1200 - lg
	// <------------------------>
	@if $breakpoint == "md-down" {
		@media only screen and (max-width: $screen-md-max) {
			@content;
		}
	}
	
	// xs - 768 - sm - 970 - md - 1200 - lg
	//      <----------------------------->
	@if $breakpoint == "sm-up" {
		@media only screen and (min-width: $screen-sm-min) {
			@content;
		}
	}
	
	// xs - 768 - sm - 970 - md - 1200 - lg
	//                 <------------------>
	@if $breakpoint == "md-up" {
		@media only screen and (min-width: $screen-md-min) {
			@content;
		}
	}

	@if $breakpoint == "touch-hover" {
		@media only screen and (max-width: 1024px) {
			@content;
		}
	}

	@if $breakpoint == "mouse-hover" {
		@media only screen and (min-width: 1025px) {
			@content;
		}
	}

	// @if $breakpoint == "touch-hover" {
	// 	@media (width: 1366px) and (height:1024px), (width: 1024px) and (height:1366px), (max-width: 1024px) {
	// 		@content;
	// 	}
	// }

	// @if $breakpoint == "mouse-hover" {
	// 	@media not (min-width: 1025px), not #{$ipad-pro-portrait-breakpoint}, not #{$ipad-pro-landscape-breakpoint} {
	// 		@content;
	// 	}
	// }

	@if $breakpoint == "larger" {
		@media only screen and (min-width: 1281px) {
			@content;
		}
	}

	@if $breakpoint == "lg-down" {
		@media only screen and (max-width: 1450px) {
			@content;
		}
	}

	@if $breakpoint == "too-high" {
		@media only screen and (min-height: 900px) {
			@content;
		}
	}
}