@mixin no-decoration {
  text-decoration: none;

  &:focus,
  &:hover {
    text-decoration: none;
  }
}

// set link state color
@mixin set-link-state-color($link, $visited: null, $hover: null, $active: null) {
  &,
  &:link {
    color: $link;
  }

  &:visited {
    color: if($visited, $visited, $link);
  }

  &:hover,
  &:focus {
    color: if($hover, $hover, $link);
  }

  &:active {
    color: if($active, $active, $link);
  }
}

// clearfix
@mixin clearfix {
  &::after {
    display: block;
    clear: both;
    content: '';
  }
}

// debug outline
@mixin debug {
  * {
    $_outline-color: rgba(#f00, .5);
    outline: 1px solid $_outline-color;
  }
}

// All headings, h1-h6.
@mixin headings {
  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    @content;
  }
}

// Utility generator
// Used to generate utilities & print utilities
// @link https://github.com/twbs/bootstrap/blob/master/scss/mixins/_utilities.scss
@mixin generate-utility($utility, $infix) {
  $values: map-get($utility, values);

  // If the values are a list or string, convert it into a map
  @if type-of($values) == 'string' or type-of(nth($values, 1)) != 'list' {
    $values: zip($values, $values);
  }

  @each $key, $value in $values {
    $properties: map-get($utility, property);

    // Multiple properties are possible, for example with vertical or horizontal margins or paddings
    @if type-of($properties) == 'string' {
      $properties: append((), $properties);
    }

    // Use custom class if present
    $property-class: if(map-has-key($utility, class), map-get($utility, class), nth($properties, 1));
    $property-class: if($property-class == null, '', $property-class);

    $infix: if($property-class == '' and str-slice($infix, 1, 1) == '-', str-slice($infix, 2), $infix);

    // Don't prefix if value key is null (eg. with shadow class)
    $property-class-modifier: if($key, if($property-class == '' and $infix == '', '', '-') + $key, '');

    .#{$property-class + $infix + $property-class-modifier} {
      @each $property in $properties {
        #{$property}: $value !important;
      }
    }
  }
}
