@mixin flex-align($align-items, $justify-content) {
  display: flex;
  align-items: $align-items;
  justify-content: $justify-content;
}

@mixin flex-direction($flex-direction) {
  display: flex;
  flex-direction: $flex-direction;
}

@mixin overflow($overflow-type, $overflow-value, $scrolling) {
  #{$overflow-type}: $overflow-value;
  -webkit-overflow-scrolling: $scrolling; // Autoprefixer doesn't add
}

@mixin text-background($bgcolor, $text-color) {
  background: $bgcolor;
  border-radius: 100px;
  color: $text-color;
  font-weight: 700;
  @include flex-align(center, center);
  padding: 0 2rem;
}

@mixin link-color($color) {
  color: $color;

  &:hover {
    color: $color;
  }
}

// Using em because I want images in content to inherit size based on parent element (not root)
@mixin content-img-float($direction) {
  float: $direction;
  @if $direction == right {
    margin: var(--img-float-direction-right, 0 0 2.4rem 4.8rem);
  } @else if $direction == left {
    margin: var(--img-float-direction-left, 0 4.8rem 2.4rem 0);
  } @else {
    margin: 0 1em 1em 0;
  }
}

@mixin content-img-align($direction: center, $spacing: var(--content-img-spacing, 1em)) {
  display: block;
  @if $direction == right {
    margin: $spacing 0 $spacing auto;
  } @else if $direction == left {
    margin: $spacing auto $spacing 0;
  } @else {
    margin: $spacing auto;
  }
}

@mixin section-arrow-down($color, $width, $height) {
  position: relative;
  &:after {
    top: 100%;
    left: 50%;
    border: solid transparent;
    content: '';
    height: 0;
    width: 0;
    position: absolute;
    pointer-events: none;
    border-color: rgba(0, 0, 0, 0);
    border-top: $height solid $color;
    border-right: calc($width / 2) solid transparent;
    border-left: calc($width / 2) solid transparent;
    margin-left: -calc($width / 2);
  }
}

@mixin gradientBtn($color1, $color2, $color3) {
  background: linear-gradient(to bottom, $color1 0, $color2 14%, $color3 61%);
  &:hover {
    background: linear-gradient(to bottom, $color1 0, $color2 14%, $color3 61%);
  }
}

@mixin sportBtn($color1, $color2) {
  background: linear-gradient(to bottom, $color1 0, $color2 100%);
  &:hover {
    background: linear-gradient(to bottom, $color2 0, $color1 100%);
  }
}

@mixin star($border-color: #ffb400, $fill-color: #ffb400, $width: 16px, $line-height: 2rem) {
  line-height: $line-height;
  width: $width;
  font-weight: normal;
  display: inline-block;
  color: $fill-color;
  font-size: 15px;
  position: relative;
  text-shadow: -1px 0 $border-color, 0 1px $border-color, 1px 0 $border-color, 0 -1px $border-color;

  &:last-child {
    margin-right: 0;
  }
  &:before {
    content: '\2605';
  }
}

@mixin half-star($border-color: #ffb400, $half-empty-color: #ffb400, $half-full-color: white) {
  line-height: 2rem;
  width: 16px;
  font-weight: normal;
  display: inline-block;
  color: $half-full-color;
  font-size: 15px;
  position: relative;
  &:before {
    content: '\2605';
  }
  text-shadow: -1px 0 $border-color, 0 1px $border-color, 1px 0 $border-color, 0 -1px $border-color;
  &:after {
    content: '\2605';
    color: $half-empty-color;
    position: absolute;
    width: 7px;
    overflow: hidden;
    bottom: 0;
    left: 0;
  }
}

@mixin border-gradient($color-1, $color-2, $bgcolor, $radius: 0.8rem) {
  background: $bgcolor;
  &:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: $radius;
    border: 2px solid transparent;
    background: $color-1, $color-2 border-box;
    -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: destination-out;
    mask-composite: exclude;
  }
}

@mixin buttonsColor($color1, $color2, $color3, $textColor: 'white') {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background-color: $color1;
  color: $textColor;
  padding: 0.9rem 3rem;
  font-weight: 700;
  font-size: 1.8rem;
  border-radius: var(--border-radius);

  > svg {
    flex: none;
    margin-left: 0.8rem;
  }

  &:hover {
    background-color: $color2;
    color: $textColor;
  }

  &:active {
    background-color: $color3;
    color: $textColor;
  }
}
