@import "_variables.less";

/*Flex grid*/
.container{
  padding:@gutter/2;
}

.align-end{
  -webkit-align-self:flex-end;
      -ms-flex-item-align:end;
          align-self:flex-end;
}

.fullheight{
  min-height: calc(100vh ~"-" 75px);
}

.row{
  display:-webkit-box;
  display:-webkit-flex;
  display:-ms-flexbox;
  display:flex;
  -webkit-box-orient:horizontal;
  -webkit-box-direction:normal;
  -webkit-flex-direction:row;
      -ms-flex-direction:row;
          flex-direction:row;
  -webkit-flex-wrap:wrap;
      -ms-flex-wrap:wrap;
          flex-wrap:wrap;
  -webkit-box-pack:start;
  -webkit-justify-content:flex-start;
      -ms-flex-pack:start;
          justify-content:flex-start;
  -webkit-box-align: start;
  -webkit-align-items: flex-start;
      -ms-flex-align: start;
          align-items: flex-start;
  &.auto-fill{
    & > [class*="col-"]{
      -webkit-box-flex: 1;
      -webkit-flex-grow: 1;
          -ms-flex-positive: 1;
              flex-grow: 1;
    }
  }
}

.title{
    -webkit-flex-basis: 100%;
        -ms-flex-preferred-size: 100%;
            flex-basis: 100%;
    margin: @gutter 0;
}

.block{
  box-shadow: 0px 2px 10px -4px rgba(0, 0, 0, 0.3);
}

[class*="col-"]{
  
  -webkit-flex-basis:100%;
      -ms-flex-preferred-size:100%;
          flex-basis:100%;
  -webkit-box-ordinal-group:1000;
  -webkit-order:999;
  -ms-flex-order:999;
  order:999;
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
   -webkit-flex-wrap:wrap;
      -ms-flex-wrap:wrap;
          flex-wrap:wrap;
  -webkit-box-pack:start;
  -webkit-justify-content:flex-start;
      -ms-flex-pack:start;
          justify-content:flex-start;
  -webkit-box-align: start;
  -webkit-align-items: flex-start;
      -ms-flex-align: start;
          align-items: flex-start;
  -webkit-box-orient:vertical;
  -webkit-box-direction:normal;
  -webkit-flex-direction:row;
      -ms-flex-direction:row;
          flex-direction:row;

  -webkit-align-content: flex-start;
  -ms-flex-line-pack: start;
  align-content: flex-start;

  transition: flex-basis .1s ease;
  -webkit-transition: -webkit-flex-basis .1s ease;
  -ms-transition: -ms-flex-basis .1s ease;

  &.block{
    padding:@gutter;
    background:white;
    margin: @gutter/2;

    &.transparent{
      box-shadow: none;
    }
  }

   &.align-center{
    -webkit-box-pack: center;
    -webkit-justify-content: center;
        -ms-flex-pack: center;
            justify-content: center;
  }

  h1,h2{
    margin-top:0;
    margin-bottom:@gutter;
  }

  &.nested{
    padding: @gutter/2;
  }

  &:empty{
    min-height: 250px;
  }

  &.orderTop{
    -webkit-box-ordinal-group:2;
    -webkit-order:1;
    -ms-flex-order:1;
    order:1;
  }

  .align-bottom{
    margin-top:auto;
  }
  .align-right{
    margin-left: auto;
  }

  .title{
    margin-top:0;
  }

  [class*="col-"]{
    padding:@gutter/2;
  }
  
  &.nopadding{
    padding:0;
  }
}

.align-middle{
    -webkit-box-align: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
    align-items: center;
  }

.equal-height{
    -webkit-box-align:stretch;
    -webkit-align-items:stretch;
        -ms-flex-align:stretch;
            align-items:stretch;
  }
.align-center{
    -webkit-box-pack: center;
    -webkit-justify-content: center;
        -ms-flex-pack: center;
            justify-content: center;
  }
.align-end{
    -webkit-box-pack: end;
    -webkit-justify-content: flex-end;
        -ms-flex-pack: end;
            justify-content: flex-end;
  }
.column{
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -webkit-flex-direction: column;
  -ms-flex-direction: column;
  flex-direction: column;
}

.generate-columns(xs);

@media (min-width: @small) {
  .generate-columns(sm);
}
@media (min-width: @medium) {
  .generate-columns(md);
}
@media (min-width: @large) {
  .generate-columns(lg);
}


.generate-columns(@s,@n: 12,@i:1) when (@i =< @n){
  .col-@{s}-@{i}{
          -webkit-flex-basis: (@i * 100% / @n);
     -ms-flex-preferred-size: (@i * 100% / @n);
                  flex-basis: (@i * 100% / @n);
    &.block{
          -webkit-flex-basis: calc((@i * 100% / @n) ~"-" @gutter);
                  flex-basis: calc((@i * 100% / @n) ~"-" @gutter);
     -ms-flex-preferred-size: calc((@i * 100% / @n) ~"-" @gutter*3);
    }
  }
  .generate-columns(@s,@n,(@i + 1));
}