
@mixin placeholder {
  $placeholders: ":-webkit-input" ":-moz" "-moz" "-ms-input";
  @each $placeholder in $placeholders {
    &:#{$placeholder}-placeholder {
      @content;
    }
  }
}

@mixin selection($current-selector: false) {
  @if $current-selector {
    &::-moz-selection {
      @content;
    }

    &::selection {
      @content;
    }
  } @else {
    ::-moz-selection {
      @content;
    }

    ::selection {
      @content;
    }
  }
}

@mixin resetA {
  &, &:link, &:hover, &:active, &:visited{
    @content;
  }
}

@mixin box-sizing($box-model) {
  box-sizing: $box-model;
}

@mixin border-box() {
  @include box-sizing(border-box);
}

@mixin scale($deg, $deg2: $deg) {
  transform: scale($deg, $deg2);
}

@mixin box-shadows($horizontal: 0px, $vertical: 1px, $blur: 2px, $spread: 0, $color: #000) {
  $spreadRadius: $blur * $spread / 100;
  $blurRadius: $blur - $spreadRadius;
  box-shadow: $horizontal $vertical $blurRadius #{$spreadRadius} $color;
}

@mixin drop-shadow($hor: 0px, $ver: 0px, $blur: 15px, $color: #000, $opacity: 1) {
  -webkit-filter: drop-shadow($hor $ver $blur rgba($color, $opacity));
  filter: url("data:image/svg+xml;utf8,<svg height='0' xmlns='http://www.w3.org/2000/svg'><filter id='drop-shadow'><feGaussianBlur in='SourceAlpha' stdDeviation='#{$blur}'/><feOffset dx='#{$hor}' dy='#{$ver}' result='offsetblur'/><feFlood flood-color='#{rgba($color, $opacity)}'/><feComposite in2='offsetblur' operator='in'/><feMerge><feMergeNode/><feMergeNode in='SourceGraphic'/></feMerge></filter></svg>#drop-shadow");
  filter: drop-shadow($hor $ver $blur rgba($color, $opacity));
  -ms-filter: "progid:DXImageTransform.Microsoft.Dropshadow(OffX=#{$hor}, OffY=#{$ver}, Color='#{$color}')";
  filter: "progid:DXImageTransform.Microsoft.Dropshadow(OffX=#{$hor}, OffY=#{$ver}, Color='#{$color}')";
}

@mixin letter-spacing($spacing) {
  letter-spacing: ($spacing / 1000) * 1em;
}

@mixin aspect-ratio($width, $height) {
  position: relative;

  &:before {
    display: block;
    content: "";
    width: 100%;
    padding-top: ($height / $width) * 100%;
  }

  > iframe {
    width: 100%;
    height: 100%;
  }

  > .content, > iframe {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
  }
}

@mixin ie {
  @media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
    @content;
  }
}

@mixin custom($type: 'checkbox', $color: 'null', $width: 18px, $height: $width, $border: 1px) {
  @if $color == 'null' {
    $color: #f83b6a;
  }

  display: flex;
  align-items: center;
  position: relative;
  cursor: pointer;
  user-select: none;
  max-width: 100%;

  input {
    cursor: pointer;
    position: absolute;
    opacity: 0;
    left: 0;
    top: 0;
    padding: 0;
    margin: 0;
    width: 100%;
    height: 100%;
    z-index: 4;
  }

  .checkmark {
    flex-shrink: 0;
    display: block;
    position: relative;
    border: $border solid $color;
    width: $width;
    height: $height;

    &:after {
      flex-shrink: 0;
      content: "";
      display: none;
    }
  }

  @if $type == 'checkbox' {
    .checkmark {
      border-radius: $width * ($width / $height * 1/6);

      &:after {
        position: absolute;
        left: $width / 3.3;
        top: $height * 0.0;
        width: $width / 3;
        height: $width / 3 * 2.4;
        border: solid $color;
        border-width: 0 ($border * 1.3) ($border * 1.3) 0;
        transform: rotate(45deg);
      }
    }
  } @else if $type == 'radio' {
    .checkmark {
      display: flex;
      align-items: center;
      justify-content: center;
      border-radius: 50%;

      &:after {
        border-radius: 50%;
        transform: translate(-50%, -50%);
        position: absolute;
        top: 50%;
        left: 50%;
        width: $width / 2;
        height: $height / 2;
        background-color: $color;
      }
    }
  } @else if $type == 'tab' {
    .checkmark {
      align-items: center;
      justify-content: center;

      &:after {
        width: $width;
        height: $height;
        background-color: $color;
      }
    }
  } @else if $type == 'file' {
    display: flex;
    align-items: center;
    justify-content: center;

    .checkmark {
      &:after {
        width: $width;
        height: $height;
        background-color: $color;
      }
    }
  }

  input:checked ~ .checkmark:after {
    display: block;
  }

  @content;
}
