@import "vars";
/* Functions
******************************************************************************/
@function columns-width($num-columns, $total-width, $total-columns: 12, $gutter: $gutter) {
	$column-width: ( $total-width - ( $gutter *  2 * $total-columns ) ) / $total-columns;
	@return ($column-width * $num-columns) + (($gutter * 2) * ($num-columns - 1));
}


@mixin multiline-ellipsis($font-size, $line-height, $lines-to-show){
	display: block;
	display: -webkit-box;
	display: -moz-box;
	display: -ms-flexbox;
	height: auto;
	margin: 0 auto;
	font-size: $font-size;
	line-height: $line-height;
	-webkit-line-clamp: $lines-to-show;
	-webkit-box-orient: vertical;
	overflow: hidden;
	text-overflow: ellipsis;
}

// Mixin for subtotal inside button
@mixin button-with-subtotal() {
	.subtotal {
		position: absolute;
		top: 7px;
		right: $gutter;
		background-color: $action-color-contrast-dark;
		padding: 2px 8px;
	}

	&.disabled {
		.subtotal {
			background-color: $disabled-color-darker;
		}
	}
}

/**
	 * Set button background color
	 * default, on hover, and on click
	 */
@mixin button-states($color, $hover, $click) {
	background-color: $color;

	&:hover,&:focus {
		background-color: $hover;
	}

	&:active {
		background-color: $click;
	}
}

@mixin icon-element {
	font-family: 'dcom-ico-font';
	speak: none;
	font-style: normal;
	font-weight: normal;
	font-variant: normal;
	text-transform: none;
	line-height: 1;

	/* Better Font Rendering =========== */
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

@mixin clear-fix {
	&:after {
		content: '';
		clear: both;
		display: block;
	}
}

@mixin clearfix {
	overflow: hidden
}

@mixin pie-clearfix {
	&:after {
		content: '';
		clear: both;
		display: table;
	}
}

@mixin display-flex {
	display: -webkit-box;
	display: -ms-flexbox;
	display: -webkit-flex;
	display: flex;
}

@mixin flex-direction($direction: row) {
	@if $direction == row-reverse {
		-webkit-box-direction: reverse;
		-webkit-box-orient: horizontal;
	}
	@else if $direction == column {
		-webkit-box-direction: normal;
		-webkit-box-orient: vertical;
	}
	@else if $direction == column-reverse {
		-webkit-box-direction: reverse;
		-webkit-box-orient: vertical;
	}
	@else {
		-webkit-box-direction: normal;
		-webkit-box-orient: horizontal;
	}
	-webkit-flex-direction: $direction;
	-ms-flex-direction: $direction;
	flex-direction: $direction;
}

@mixin flex($grow: 1, $shrink: 1, $basis: auto) {
	-webkit-box-flex: $grow;
	-webkit-flex: $grow $shrink $basis;
	-ms-flex: $grow $shrink $basis;
	flex: $grow $shrink $basis;
}

@mixin required-message {
	background-color: $yellow-transparent;
	padding: 2px 10px;
	border-radius: 2px;
}

@mixin cuisines-items($classname) {
	$base-item-height: 100px;
	$item-diff-height: 40px;

	@for $i from 1 through 10 {
		$item-height: $base-item-height + ($item-diff-height * $i);
		@if $classname =='all-cuisines' {
			$item-height: $item-height - 100px;
		}
		.#{$classname}-len-#{$i} {
			height: $item-height;
		}
	}
}

@mixin center-vertical() {
	position: absolute;
	top: 50%;
	transform: translate(0, -50%);
}

@mixin center-center() {
	position: absolute;
	top: 50%;
	left: 50%;
	margin-right: -50%;
	transform: translate(-50%, -50%);
}

@mixin header-image($group) {

	background: url(https://res.cloudinary.com/delivery-com/image/fetch/w_320,h_160,c_fill/https://s3.amazonaws.com/s3.delivery.com/banners/2016/banners-#{$group}.jpg) no-repeat center center;
	background-size: cover;

	// Target pixel ratio 1 up to 1.49
	@media (min-width: $site-width-mobile) {
		background-image: url(https://res.cloudinary.com/delivery-com/image/fetch/w_320,h_160,c_fill/https://s3.amazonaws.com/s3.delivery.com/banners/2016/banners-#{$group}.jpg);
	}
	@media (min-width: $site-width-mobile-large) {
		background-image: url(https://res.cloudinary.com/delivery-com/image/fetch/w_768,h_160,c_fill/https://s3.amazonaws.com/s3.delivery.com/banners/2016/banners-#{$group}.jpg);
	}

	// Desktop
	@include desktop {
		background-image: url(https://res.cloudinary.com/delivery-com/image/fetch/w_1024,h_160,c_fill/https://s3.amazonaws.com/s3.delivery.com/banners/2016/banners-#{$group}.jpg);
		background-position: center bottom;
	}
	@media (min-width: $site-width-large) {
		background-image: url(https://res.cloudinary.com/delivery-com/image/fetch/w_1920,h_300,c_fill/https://s3.amazonaws.com/s3.delivery.com/banners/2016/banners-#{$group}.jpg);
		background-position: center bottom;
	}

	// Target pixel ratio >= 1.5 and < 2.5 (i.e close to 2)
	@media (-webkit-min-device-pixel-ratio: 1.5), (min-device-pixel-ratio: 1.5), (min-resolution: 1.5dppx) {
		@media (min-width: $site-width-mobile) {
			background-image: url(https://res.cloudinary.com/delivery-com/image/fetch/w_640,h_320,c_fill/https://s3.amazonaws.com/s3.delivery.com/banners/2016/banners-#{$group}.jpg);
		}
		@media (min-width:  $site-width-mobile-large) {
			background-image: url(https://res.cloudinary.com/delivery-com/image/fetch/w_1536,h_320,c_fill/https://s3.amazonaws.com/s3.delivery.com/banners/2016/banners-#{$group}.jpg);
		}
		@include desktop {
			background-position: center bottom;
		}
	}

	// Target pixel ratio 2.5 and above (i.e close to 3)
	@media (-webkit-min-device-pixel-ratio: 2.5), (min-device-pixel-ratio: 2.5), (min-resolution: 2.5dppx) {
		background-image: url(https://res.cloudinary.com/delivery-com/image/fetch/w_1080,h_480,c_fill/https://s3.amazonaws.com/s3.delivery.com/banners/2016/banners-#{$group}.jpg);
	}
}


@mixin disable-links {
	pointer-events: none;
	cursor: default;

}

@mixin multiline-format {
	white-space: pre-wrap;
}

@mixin match-media($size) {
	display: none;
	@media (min-width: $size) {
		display: block;
	}
}

@mixin primary-text {
	color: $primary-text-color;
	font-size: $font-size-main;
	line-height: $primary-line-height;
}
@mixin secondary-text {
	color: $secondary-text-color;
	font-size: $secondary-font-size;
	line-height: $secondary-line-height;
}
@mixin legal-text {
	color: $legal-text-color;
	font-size: $legal-font-size;
	line-height: $legal-line-height;
}

@mixin ellipsis{
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

@mixin icon {
	/* use !important to prevent issues with browser extensions that change fonts */
	font-family: 'dcom-ico-font' !important;
	speak: none;
	font-style: normal;
	font-weight: normal;
	font-variant: normal;
	text-transform: none;
	line-height: 1;

	/* Better Font Rendering =========== */
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}