@mixin gradientGenerate($arg, $degree: 45deg) {

  background: map-get($arg, "start");
  background: -moz-linear-gradient($degree, map-get($arg, "start") 0%, map-get($arg, "finish") 80%);
  background: -webkit-linear-gradient($degree, map-get($arg, "start") 0%, map-get($arg, "finish") 80%);
  background: linear-gradient($degree, map-get($arg, "start") 0%, map-get($arg, "finish") 80%);
  filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#{map-get($arg, "start")}', endColorstr='#{map-get($arg, "finish")}', GradientType=1);
}

@mixin repeatingGridTemplate() {
  $repeatValue: 1fr;

  @for $i from 1 through 6 {
    &c-#{$i} {
      $repeatedValue: '';

      @for $r from 1 through $i {
        $repeatedValue: $repeatedValue + " "+ $repeatValue;
      }

      grid-template-columns: unquote($repeatedValue);
    }

    &c-#{$i}-auto {
      $repeatedValue: '';

      @for $r from 1 through $i {
        $repeatedValue: $repeatedValue + " "+ "auto";
      }

      grid-template-columns: unquote($repeatedValue);
    }

    &r-#{$i} {
      $repeatedValue: '';

      @for $r from 1 through $i {
        $repeatedValue: $repeatedValue + " "+ $repeatValue;
      }

      grid-template-rows: unquote($repeatedValue);
    }


    // I have seen the behavior that when grid template is defined whit 1fr but without grid-template-area,
    // it will always be one column/row.
    // If grid template is defined with auto and without grid-template-area,
    // it will respect the grid-template-column/row.
    &r-#{$i}-auto {
      $repeatedValue: '';

      @for $r from 1 through $i {
        $repeatedValue: $repeatedValue + " "+ "auto";
      }

      grid-template-rows: unquote($repeatedValue);
    }
  }

  @each $name,
  $value in $grid-breakpoints {
    @media (min-width:$value) {
      @for $i from 1 through 6 {
        &c-#{$name}-#{$i} {
          $repeatedValue: '';

          @for $r from 1 through $i {
            $repeatedValue: $repeatedValue + " "+ $repeatValue;
          }

          grid-template-columns: unquote($repeatedValue);
        }

        &c-#{$name}-#{$i}-auto {
          $repeatedValue: '';

          @for $r from 1 through $i {
            $repeatedValue: $repeatedValue + " "+ "auto";
          }

          grid-template-columns: unquote($repeatedValue);
        }

        &r-#{$name}-#{$i} {
          $repeatedValue: '';

          @for $r from 1 through $i {
            $repeatedValue: $repeatedValue + " "+ $repeatValue;
          }

          grid-template-rows: unquote($repeatedValue);
        }

        &r-#{$name}-#{$i}-auto {
          $repeatedValue: '';

          @for $r from 1 through $i {
            $repeatedValue: $repeatedValue + " "+ "auto";
          }

          grid-template-rows: unquote($repeatedValue);
        }
      }
    }
  }

}

@mixin gridSpaceBetween() {

  @each $name,
  $value in $spacers {
    &c-gap#{$name} {
      column-gap: $value;
    }

    &r-gap#{$name} {
      row-gap: $value;
    }
  }
}

// @ Position per media query mixins

@mixin positions() {

  @each $name,
  $value in $grid-breakpoints {

    &-top {
      top: 0;
    }

    &-right {
      right: 0;
    }

    &-bottom {
      bottom: 0;
    }

    &-left {
      left: 0;
    }

    @media (min-width:$value) {
      &-#{$name}-top {
        top: 0;
      }

      &-#{$name}-right {
        right: 0;
      }

      &-#{$name}-bottom {
        bottom: 0;
      }

      &-#{$name}-left {
        left: 0;
      }

      @each $position in $positions {
        &-#{$name}-#{$position} {
          position: $position !important;
        }
      }
    }
  }

}
