/*
*
* Grid modules
*/


// Custom Grid
//
// Change $enable-grid-classes-custom: true
// that would generate custom grid (example: 10 columns)

$enable-grid-classes-custom: false;

@mixin make-grid-columns-custom($columns: $grid-columns, $gutter: $grid-gutter-width, $breakpoints: $grid-breakpoints) {
	@each $breakpoint in map-keys($breakpoints) {
		$infix: breakpoint-infix($breakpoint, $breakpoints);

		@include media-breakpoint-up($breakpoint, $breakpoints) {
			@for $i from 1 through $columns {
				.col#{$infix}-#{$i} {
					@include make-col($i, $columns);
				}
			}
		}
	}
}

@if $enable-grid-classes-custom {
	.row-ten {
		@include make-grid-columns-custom(10);
	}

	.row-xl-ten {
		@include make-grid-columns-custom(10, 30px, (xl: map-get($grid-breakpoints, xl), xlg: map-get($grid-breakpoints, xlg), xxl: map-get($grid-breakpoints, xxl)));
	}
}


//
// Range Grid System
//
.range {
	display: flex;
	flex-wrap: wrap;
}

.cell-inner {
	width: 100%;
	padding-right: 15px;
	padding-left: 15px;
}

.range > [class*='cell'] {
	position: relative;
	width: 100%;
	min-height: 1px;

	& > .row { 
		margin: 0; 
	}
	
	&.container {
		padding: 0;
	}
}

.range > [class*='col'] { padding: 0; }

@mixin cell($breakpoint, $columns) {
	flex: 0 0 #{grid-parameter($breakpoint, $columns)};
	max-width: #{grid-parameter($breakpoint, $columns)};
} 

@mixin cell-inner($breakpoint, $columns) {
	 max-width: map-get($container-max-widths, $breakpoint) / 12 * $columns;
}

@include media-breakpoint-up(sm) {
	.cell-sm-6 {
		@include cell(sm, 6);

		.cell-inner {
			@include cell-inner(sm, 6);
		}
	}

	.range > [class*='cell-sm']:nth-child(odd) {
		.cell-inner { margin-left: auto; }
	}

	.range.flex-sm-row-reverse {
		> [class*='cell-sm'] {
			&:nth-child(odd) .cell-inner { margin-left: 0; }
			&:nth-child(even) .cell-inner { margin-left: auto; }
		}
	}

	.range > [class*='cell-sm'].container {
		margin: 0;
	}
}

@include media-breakpoint-up(md) {
	.range > [class*='cell-md']:nth-child(odd) {
		.cell-inner { margin-left: auto; }
	}

	.range.flex-md-row-reverse {
		> [class*='cell-md'] {
			&:nth-child(odd) .cell-inner { margin-left: 0; }
			&:nth-child(even) .cell-inner { margin-left: auto; }
		}
	}

	.range > [class*='cell-md'].container {
		margin: 0;
	}
}

@include media-breakpoint-up(lg) {
	[class*='cell-lg'] > .row > [class*='col'] {
		flex-basis: 100%;
	}

	.cell-lg-5 {
		@include cell(lg, 5);

		.cell-inner {
			@include cell-inner(lg, 5);
		}
	}

	.cell-lg-6 {
		@include cell(lg, 6);

		.cell-inner {
			@include cell-inner(lg, 6);
		}
	}

	.range > [class*='cell-lg']:nth-child(odd) {
		.cell-inner { margin-left: auto; }
	}

	.range.flex-lg-row-reverse {
		> [class*='cell-lg'] {
			&:nth-child(odd) .cell-inner { margin-left: 0; }
			&:nth-child(even) .cell-inner { margin-left: auto; }
		}
	}

	.range > [class*='cell-lg'].container {
		margin: 0;
	}
}

@include media-breakpoint-up(xl) {
	.range > [class*='cell-xl'].container {
		margin: 0;
	}
	
	.range > [class*='cell-xl']:nth-child(odd) {
		.cell-inner { margin-left: auto; }
	}

	.range {
		.cell-inner {
			flex-basis: 100%;
		}
	}

	.cell-xl-7 {
		@include cell(xl, 7);

		.cell-inner {
			@include cell-inner(xl, 7);
		}
	}

	.cell-lg-6,
	.cell-xl-6 {
		@include cell(xl, 6);

		.cell-inner {
			@include cell-inner(xl, 6);
		}
	}

	.cell-xl-5 {
		@include cell(xl, 5);

		.cell-inner {
			@include cell-inner(xl, 5);
		}
	}

	.cell-xl-4 {
		@include cell(xl, 4);

		.cell-inner {
			@include cell-inner(xl, 4);
		}
	}
}

@include media-breakpoint-up(xxl) {
  .cell-xxl-6 {
		@include cell(xl, 6); 

		.cell-inner {
			@include cell-inner(xl, 6);
		}
	} 
} 
