@content-max-width: 1000px;
@global-gutter: 30px;

.container(@max-width: @content-max-width, @gutter: @global-gutter) {
  width: calc(~"100% - @{gutter}");
  max-width: @max-width;
  margin: 0 auto;
}

.grid(@direction: row, @count: 5, @gutter: @global-gutter) {
  display: flex;
  flex-wrap: wrap;
  flex-direction: @direction;
  justify-content: flex-start;
  
  > * {
    .cell(@gutter: @gutter, @count: @count);
  }
}

.cell(@count: 5, @gutter: @global-gutter) {
  flex: 0 0 auto;
  width: calc(100% / @count ~"-" ((@count - 1) * @gutter / @count));
  margin-right: @gutter;

  &:nth-child(@{count}n) {
    margin-right: 0;
    margin-left: auto;
  }
}

.simple-row() {
  display: flex;
  flex-wrap: wrap;
}

.simple-cell(@gutter: @global-gutter) {
  flex: 1 1 0px;
  margin-right: @gutter;
  &:last-child {
    margin-right: 0;
  }
}
