// Small screen / tablet
@screen-sm              : 768px;
@screen-sm-min          : @screen-sm;
@screen-sm-max          : (@screen-sm-min - 1);

// Medium screen / desktop
@screen-md              : 992px;
@screen-md-min          : @screen-md;
@screen-md-max          : (@screen-md-min - 1);

// Large screen / wide desktop
@screen-lg              : 1200px;
@screen-lg-min          : @screen-lg;
@screen-lg-max          : (@screen-lg-min - 1);

// Layout and Grid system
@grid-columns           : 24;
@grid-gutter-width      : 0;

// Container sizes
@container-sm           : (720px + @grid-gutter-width);
@container-md           : (940px + @grid-gutter-width);
@container-lg           : (1140px + @grid-gutter-width);

// mixins for grid system
// ------------------------
.container-fixed(@gutter: @grid-gutter-width) {
  margin-right: auto;
  margin-left: auto;
  padding-left:  (@gutter / 2);
  padding-right: (@gutter / 2);
  &:extend(.clearfix all);
}

.make-row(@gutter: @grid-gutter-width) {
  position: relative;
  width: 100%;
  margin-left: (@gutter / -2);
  margin-right: (@gutter / -2);
  height: auto;
  &:extend(.clearfix all);
}

.make-grid-columns() {
  .col(@index) {
    @item: ~".col-@{index}";
    .col((@index + 1), @item);
  }
  .col(@index, @list) when (@index =< @grid-columns) {
    @item: ~".col-@{index}";
    .col((@index + 1), ~"@{list}, @{item}");
  }
  .col(@index, @list) when (@index > @grid-columns) {
    @{list} {
      position: relative;
      display: block;
      float: left;
      flex: 0 0 auto;
      padding-left:  (@grid-gutter-width / 2);
      padding-right: (@grid-gutter-width / 2);
    }
  }
  .col(1);
}

.loop-grid-columns(@index) when (@index > 0) {
  .col-@{index} {
    width: percentage((@index / @grid-columns));
  }
  .col-push-@{index} {
    left: percentage((@index / @grid-columns));
  }
  .col-pull-@{index} {
    right: percentage((@index / @grid-columns));
  }
  .col-offset-@{index} {
    margin-left: percentage((@index / @grid-columns));
  }
  .col-order-@{index} {
    order: @index;
  }
  .loop-grid-columns((@index - 1));
}

.loop-grid-columns(@index) when (@index = 0) {
  .col-push-@{index} {
    left: auto;
  }
  .col-pull-@{index} {
    right: auto;
  }
}

.make-grid() {
  .loop-grid-columns(@grid-columns);
}