@function calculateRem($size) {
  $remSize: $size / 18;
  @return #{$remSize}rem;
}

@function setHeaderFontWeight($font) {
  @if ($font == "Bitter") {
    @return 400;
  } @else {
    @return 700;
  }
}

@function setH3FontWeight($font) {
  @if ($font == "Bitter" or $font == "Montserrat") {
    @return 400;
  } @else {
    @return 700;
  }
}

@function setLetterSpacing($font) {
  @if ($font == "Merriweather") {
    @return 1px;
  } @else {
    @return 0;
  }
}

@function setTextColor($color) {
  @if (lightness($color) > 50) {
    @return $dark; // Lighter background, return dark color
  } @else {
    @return $light; // Darker background, return light color
  }
}

@function setLinkColor($color) {
  @if (lightness($color) > 50) {
    @if (lightness($primary-color) < 50) {
      @return $primary-color;
    }
    @else {
      $darker-primary-color: hsl(hue($primary-color), saturation($primary-color), 49);
      @return $darker-primary-color;
    }
  } @else {
    @if (lightness($primary-color) > 50) {
      @return $primary-color;
    }
    @else {
      $lighter-primary-color: hsl(hue($primary-color), saturation($primary-color), 51);
      @return $lighter-primary-color;
    }
  }
}

@function setLinkHoverColor($color) {
  @if ($color == $light) {
    @return $primary-color;
  }
  @elseif (lightness($color) > 50) {
    @return darken($color, 5%);
  }
  @else {
    @return lighten($color, 5%);
  }
}

@function setTextShadow($color) {
  @if ($color == $light) {
    @return 0 2px 4px rgba(0,0,0,0.50);
  }
  @else {
    @return none;
  }
}

@function setGray($color) {
  @if (lightness($color) < 50) {
    @return $dark-gray;
  }
  @else {
    @return $light-gray;
  }
}

@function setContrastGray($color) {
  @if (lightness($color) > 50) {
    @return $dark-gray;
  }
  @else {
    @return $light-gray;
  }
}
