@charset "UTF-8";

@mixin except($params...) {
  @if length($params) == 0 {
    @error "Please pass an argument. The argument must be either a negative or positive number or list of numbers. Or pass one of the following predefined string values: 'first', 'last', 'odd', 'even'.";
  } @else if length($params) == 1 {
    $value: nth($params, 1);
    @if type-of($value) == "number" {
      @if $value < 0 {
        &:not(:nth-last-of-type(#{$value * -1})) {
          @content;
        }
      } @else {
        &:not(:nth-of-type(#{$value})) {
          @content;
        }
      }
    } @else if type-of($value) == "string" {
      @if $value == "odd" {
        &:not(:nth-of-type(odd)) {
          @content;
        }
      } @else if $value == "even" {
        &:not(:nth-of-type(even)) {
          @content;
        }
      } @else if $value == "first" {
        &:not(:first-of-type) {
          @content;
        }
      } @else if $value == "last" {
        &:not(:last-of-type) {
          @content;
        }
      } @else {
        &:not(#{$value}) {
          @content;
        }
      }
    }
  } @else if length($params) > 1 {
    $items: "";
    @for $i from 1 through length($params) {
      $items: $items + if(nth($params, $i) < 0, unquote(":not(:nth-last-of-type(#{nth($params, $i) * -1}))"), unquote(":not(:nth-of-type(#{nth($params, $i)}))"));
    }
    &#{$items} {
      @content;
    }
  }
}
