// =============================================================================
// TOOLS / #TYPOGRAPHY
// =============================================================================

// Functions
// ==============================================

// font-size()
// ------------------------------------

// Function to get font-size from `$text` instead of using `map-get`.
// See `docs/` for usage.
@function font-size($key, $variant:large) {
  @return map-get-deep($text, $key, $variant, font-size);
}

// line-height()
// ------------------------------------

// Function to get line-height from `$text` instead of using `map-get`.
// See `docs/` for usage.
@function line-height($key, $variant:large) {
  @return map-get-deep($text, $key, $variant, line-height);
}

// Mixins
// ==============================================

// @include font()
// ------------------------------------

// Create a fully formed type style (sizing and line-height) by passing in a
// single value.
// See `docs/` for usage.
@mixin font($key, $variant:large) {
  $font-size: font-size($key, $variant);

  @include rem($font-size);
  line-height: line-height($key, $variant);
}

// @include rem()
// ------------------------------------

// Generates a rem-based font-size with its pixel fallback e.g:
// See `docs/` for usage.
@mixin rem($value) {
  @if unit($value) != "px" {
    @warn "Value must by a px unit";
  }
  font-size: $value;
  font-size: ($value / $global-font-size) * 1rem;
}
