// Ported version of flexboxgrid
// https://github.com/kristoferjoseph/flexboxgrid
//
// Copyright 2013 Kristofer Joseph
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

@import "variables.less";

.container-flex-fluid {
  margin-right: auto;
  margin-left: auto;
  padding-right: @outer-margin;
  padding-left: @outer-margin;
}

.flex-row {
  box-sizing: border-box;
  display: flex;
  flex: 0 1 auto;
  flex-direction: row;
  flex-wrap: wrap;
  margin-right: @gutter-compensation;
  margin-left: @gutter-compensation;
}

.flex-row.reverse {
  flex-direction: row-reverse;
}

.flex-col.reverse {
  flex-direction: column-reverse;
}

.flex-xs,
.flex-xs-1,
.flex-xs-2,
.flex-xs-3,
.flex-xs-4,
.flex-xs-5,
.flex-xs-6,
.flex-xs-7,
.flex-xs-8,
.flex-xs-9,
.flex-xs-10,
.flex-xs-11,
.flex-xs-12 {
  box-sizing: border-box;
  flex: 0 0 auto;
  padding-right: @half-gutter-width;
  padding-left: @half-gutter-width;
}

.flex-xs {
  flex-grow: 1;
  flex-basis: 0;
  max-width: 100%;
}

.flex-xs-1 {
  flex-basis: 8.333%;
  max-width: 8.333%;
}

.flex-xs-2 {
  flex-basis: 16.667%;
  max-width: 16.667%;
}

.flex-xs-3 {
  flex-basis: 25%;
  max-width: 25%;
}

.flex-xs-4 {
  flex-basis: 33.333%;
  max-width: 33.333%;
}

.flex-xs-5 {
  flex-basis: 41.667%;
  max-width: 41.667%;
}

.flex-xs-6 {
  flex-basis: 50%;
  max-width: 50%;
}

.flex-xs-7 {
  flex-basis: 58.333%;
  max-width: 58.333%;
}

.flex-xs-8 {
  flex-basis: 66.667%;
  max-width: 66.667%;
}

.flex-xs-9 {
  flex-basis: 75%;
  max-width: 75%;
}

.flex-xs-10 {
  flex-basis: 83.333%;
  max-width: 83.333%;
}

.flex-xs-11 {
  flex-basis: 91.667%;
  max-width: 91.667%;
}

.flex-xs-12 {
  flex-basis: 100%;
  max-width: 100%;
}

.flex-xs-offset-1 {
  margin-left: 8.333%;
}

.flex-xs-offset-2 {
  margin-left: 16.667%;
}

.flex-xs-offset-3 {
  margin-left: 25%;
}

.flex-xs-offset-4 {
  margin-left: 33.333%;
}

.flex-xs-offset-5 {
  margin-left: 41.667%;
}

.flex-xs-offset-6 {
  margin-left: 50%;
}

.flex-xs-offset-7 {
  margin-left: 58.333%;
}

.flex-xs-offset-8 {
  margin-left: 66.667%;
}

.flex-xs-offset-9 {
  margin-left: 75%;
}

.flex-xs-offset-10 {
  margin-left: 83.333%;
}

.flex-xs-offset-11 {
  margin-left: 91.667%;
}

.start-xs {
  justify-content: flex-start;
  text-align: start;
}

.center-xs {
  justify-content: center;
  text-align: center;
}

.end-xs {
  justify-content: flex-end;
  text-align: end;
}

.top-xs {
  align-items: flex-start;
}

.middle-xs {
  align-items: center;
}

.bottom-xs {
  align-items: flex-end;
}

.around-xs {
  justify-content: space-around;
}

.between-xs {
  justify-content: space-between;
}

.first-xs {
  order: -1;
}

.last-xs {
  order: 1;
}

@media only screen and (min-width: @screen-sm-min) {
  .container {
    width: @container-sm;
  }

  .flex-sm,
  .flex-sm-1,
  .flex-sm-2,
  .flex-sm-3,
  .flex-sm-4,
  .flex-sm-5,
  .flex-sm-6,
  .flex-sm-7,
  .flex-sm-8,
  .flex-sm-9,
  .flex-sm-10,
  .flex-sm-11,
  .flex-sm-12 {
    box-sizing: border-box;
    flex: 0 0 auto;
    padding-right: @half-gutter-width;
    padding-left: @half-gutter-width;
  }

  .flex-sm {
    flex-grow: 1;
    flex-basis: 0;
    max-width: 100%;
  }

  .flex-sm-1 {
    flex-basis: 8.333%;
    max-width: 8.333%;
  }

  .flex-sm-2 {
    flex-basis: 16.667%;
    max-width: 16.667%;
  }

  .flex-sm-3 {
    flex-basis: 25%;
    max-width: 25%;
  }

  .flex-sm-4 {
    flex-basis: 33.333%;
    max-width: 33.333%;
  }

  .flex-sm-5 {
    flex-basis: 41.667%;
    max-width: 41.667%;
  }

  .flex-sm-6 {
    flex-basis: 50%;
    max-width: 50%;
  }

  .flex-sm-7 {
    flex-basis: 58.333%;
    max-width: 58.333%;
  }

  .flex-sm-8 {
    flex-basis: 66.667%;
    max-width: 66.667%;
  }

  .flex-sm-9 {
    flex-basis: 75%;
    max-width: 75%;
  }

  .flex-sm-10 {
    flex-basis: 83.333%;
    max-width: 83.333%;
  }

  .flex-sm-11 {
    flex-basis: 91.667%;
    max-width: 91.667%;
  }

  .flex-sm-12 {
    flex-basis: 100%;
    max-width: 100%;
  }

  .flex-sm-offset-1 {
    margin-left: 8.333%;
  }

  .flex-sm-offset-2 {
    margin-left: 16.667%;
  }

  .flex-sm-offset-3 {
    margin-left: 25%;
  }

  .flex-sm-offset-4 {
    margin-left: 33.333%;
  }

  .flex-sm-offset-5 {
    margin-left: 41.667%;
  }

  .flex-sm-offset-6 {
    margin-left: 50%;
  }

  .flex-sm-offset-7 {
    margin-left: 58.333%;
  }

  .flex-sm-offset-8 {
    margin-left: 66.667%;
  }

  .flex-sm-offset-9 {
    margin-left: 75%;
  }

  .flex-sm-offset-10 {
    margin-left: 83.333%;
  }

  .flex-sm-offset-11 {
    margin-left: 91.667%;
  }

  .start-sm {
    justify-content: flex-start;
    text-align: start;
  }

  .center-sm {
    justify-content: center;
    text-align: center;
  }

  .end-sm {
    justify-content: flex-end;
    text-align: end;
  }

  .top-sm {
    align-items: flex-start;
  }

  .middle-sm {
    align-items: center;
  }

  .bottom-sm {
    align-items: flex-end;
  }

  .around-sm {
    justify-content: space-around;
  }

  .between-sm {
    justify-content: space-between;
  }

  .first-sm {
    order: -1;
  }

  .last-sm {
    order: 1;
  }
}

@media only screen and (min-width: @screen-md-min) {
  .container {
    width: @container-md;
  }

  .flex-md,
  .flex-md-1,
  .flex-md-2,
  .flex-md-3,
  .flex-md-4,
  .flex-md-5,
  .flex-md-6,
  .flex-md-7,
  .flex-md-8,
  .flex-md-9,
  .flex-md-10,
  .flex-md-11,
  .flex-md-12 {
    box-sizing: border-box;
    flex: 0 0 auto;
    padding-right: @half-gutter-width;
    padding-left: @half-gutter-width;
  }

  .flex-md {
    flex-grow: 1;
    flex-basis: 0;
    max-width: 100%;
  }

  .flex-md-1 {
    flex-basis: 8.333%;
    max-width: 8.333%;
  }

  .flex-md-2 {
    flex-basis: 16.667%;
    max-width: 16.667%;
  }

  .flex-md-3 {
    flex-basis: 25%;
    max-width: 25%;
  }

  .flex-md-4 {
    flex-basis: 33.333%;
    max-width: 33.333%;
  }

  .flex-md-5 {
    flex-basis: 41.667%;
    max-width: 41.667%;
  }

  .flex-md-6 {
    flex-basis: 50%;
    max-width: 50%;
  }

  .flex-md-7 {
    flex-basis: 58.333%;
    max-width: 58.333%;
  }

  .flex-md-8 {
    flex-basis: 66.667%;
    max-width: 66.667%;
  }

  .flex-md-9 {
    flex-basis: 75%;
    max-width: 75%;
  }

  .flex-md-10 {
    flex-basis: 83.333%;
    max-width: 83.333%;
  }

  .flex-md-11 {
    flex-basis: 91.667%;
    max-width: 91.667%;
  }

  .flex-md-12 {
    flex-basis: 100%;
    max-width: 100%;
  }

  .flex-md-offset-1 {
    margin-left: 8.333%;
  }

  .flex-md-offset-2 {
    margin-left: 16.667%;
  }

  .flex-md-offset-3 {
    margin-left: 25%;
  }

  .flex-md-offset-4 {
    margin-left: 33.333%;
  }

  .flex-md-offset-5 {
    margin-left: 41.667%;
  }

  .flex-md-offset-6 {
    margin-left: 50%;
  }

  .flex-md-offset-7 {
    margin-left: 58.333%;
  }

  .flex-md-offset-8 {
    margin-left: 66.667%;
  }

  .flex-md-offset-9 {
    margin-left: 75%;
  }

  .flex-md-offset-10 {
    margin-left: 83.333%;
  }

  .flex-md-offset-11 {
    margin-left: 91.667%;
  }

  .start-md {
    justify-content: flex-start;
    text-align: start;
  }

  .center-md {
    justify-content: center;
    text-align: center;
  }

  .end-md {
    justify-content: flex-end;
    text-align: end;
  }

  .top-md {
    align-items: flex-start;
  }

  .middle-md {
    align-items: center;
  }

  .bottom-md {
    align-items: flex-end;
  }

  .around-md {
    justify-content: space-around;
  }

  .between-md {
    justify-content: space-between;
  }

  .first-md {
    order: -1;
  }

  .last-md {
    order: 1;
  }
}

@media only screen and (min-width: @screen-lg-min) {
  .container {
    width: @container-lg;
  }

  .flex-lg,
  .flex-lg-1,
  .flex-lg-2,
  .flex-lg-3,
  .flex-lg-4,
  .flex-lg-5,
  .flex-lg-6,
  .flex-lg-7,
  .flex-lg-8,
  .flex-lg-9,
  .flex-lg-10,
  .flex-lg-11,
  .flex-lg-12 {
    box-sizing: border-box;
    flex: 0 0 auto;
    padding-right: @half-gutter-width;
    padding-left: @half-gutter-width;
  }

  .flex-lg {
    flex-grow: 1;
    flex-basis: 0;
    max-width: 100%;
  }

  .flex-lg-1 {
    flex-basis: 8.333%;
    max-width: 8.333%;
  }

  .flex-lg-2 {
    flex-basis: 16.667%;
    max-width: 16.667%;
  }

  .flex-lg-3 {
    flex-basis: 25%;
    max-width: 25%;
  }

  .flex-lg-4 {
    flex-basis: 33.333%;
    max-width: 33.333%;
  }

  .flex-lg-5 {
    flex-basis: 41.667%;
    max-width: 41.667%;
  }

  .flex-lg-6 {
    flex-basis: 50%;
    max-width: 50%;
  }

  .flex-lg-7 {
    flex-basis: 58.333%;
    max-width: 58.333%;
  }

  .flex-lg-8 {
    flex-basis: 66.667%;
    max-width: 66.667%;
  }

  .flex-lg-9 {
    flex-basis: 75%;
    max-width: 75%;
  }

  .flex-lg-10 {
    flex-basis: 83.333%;
    max-width: 83.333%;
  }

  .flex-lg-11 {
    flex-basis: 91.667%;
    max-width: 91.667%;
  }

  .flex-lg-12 {
    flex-basis: 100%;
    max-width: 100%;
  }

  .flex-lg-offset-1 {
    margin-left: 8.333%;
  }

  .flex-lg-offset-2 {
    margin-left: 16.667%;
  }

  .flex-lg-offset-3 {
    margin-left: 25%;
  }

  .flex-lg-offset-4 {
    margin-left: 33.333%;
  }

  .flex-lg-offset-5 {
    margin-left: 41.667%;
  }

  .flex-lg-offset-6 {
    margin-left: 50%;
  }

  .flex-lg-offset-7 {
    margin-left: 58.333%;
  }

  .flex-lg-offset-8 {
    margin-left: 66.667%;
  }

  .flex-lg-offset-9 {
    margin-left: 75%;
  }

  .flex-lg-offset-10 {
    margin-left: 83.333%;
  }

  .flex-lg-offset-11 {
    margin-left: 91.667%;
  }

  .start-lg {
    justify-content: flex-start;
    text-align: start;
  }

  .center-lg {
    justify-content: center;
    text-align: center;
  }

  .end-lg {
    justify-content: flex-end;
    text-align: end;
  }

  .top-lg {
    align-items: flex-start;
  }

  .middle-lg {
    align-items: center;
  }

  .bottom-lg {
    align-items: flex-end;
  }

  .around-lg {
    justify-content: space-around;
  }

  .between-lg {
    justify-content: space-between;
  }

  .first-lg {
    order: -1;
  }

  .last-lg {
    order: 1;
  }
}
