@import '../../../styles/grid';
@import '../../../styles/definitions/breakpoints';

.grid {
    &_row {
        display: flex;
        flex-flow: row wrap;
        justify-content: flex-start;
        @include grid-row();

        &--gutter-width {
            &-small {
                @include grid-row($grid-gutter-width-small);
            }
        }
    }
    &_item {
        flex-grow: 1;
        -ms-flex: auto;
        @include grid-item();
        margin-bottom: $grid-gutter-height;
        width: 100%;

        @for $i from 1 through 8 {
            &--#{$i} {
                @include column-width($i);
            }
        }

        &--stretch#{&--2},
        &--stretch#{&--3},
        &--stretch#{&--4},
        &--stretch#{&--5} {
            width: auto;
            max-width: unset;
        }

        &--gutter-width {
            &-small {
                @include grid-item($grid-gutter-width-small);
            }
        }

        &--gutter-height {
            &-large {
                margin-bottom: $grid-gutter-height-large;
            }
        }
    }

    // remove extra margin-bottom when grid inside other grid
    &_item--1 &_item:last-of-type,
    &_item:not(&_item--1) &_item:not(&_item--1) {
        margin-bottom: 0;
    }
}
