@d1-prefix: d1;
// mixins for grid system
// ------------------------

.loop-grid-columns(@index, @class) when (@index > 0) {
  .@{d1-prefix}-col@{class}-@{index} {
    display: block;
    flex: 0 0 percentage((@index / @grid-columns));
    max-width: percentage((@index / @grid-columns));
  }
  .@{d1-prefix}-col@{class}-push-@{index} {
    left: percentage((@index / @grid-columns));
  }
  .@{d1-prefix}-col@{class}-pull-@{index} {
    right: percentage((@index / @grid-columns));
  }
  .@{d1-prefix}-col@{class}-offset-@{index} {
    margin-left: percentage((@index / @grid-columns));
  }
  .@{d1-prefix}-col@{class}-order-@{index} {
    order: @index;
  }
  .loop-grid-columns((@index - 1), @class);
}

.loop-grid-columns(@index, @class) when (@index = 0) {
  .@{d1-prefix}-col@{class}-@{index} {
    display: none;
  }
  .@{d1-prefix}-col-push-@{index} {
    left: auto;
  }
  .@{d1-prefix}-col-pull-@{index} {
    right: auto;
  }
  .@{d1-prefix}-col@{class}-push-@{index} {
    left: auto;
  }
  .@{d1-prefix}-col@{class}-pull-@{index} {
    right: auto;
  }
  .@{d1-prefix}-col@{class}-offset-@{index} {
    margin-left: 0;
  }
  .@{d1-prefix}-col@{class}-order-@{index} {
    order: 0;
  }
}

.make-grid(@class: ~'') {
  .loop-grid-columns(@grid-columns, @class);
}
