$typography-condensed: em(640px);

$font-family-data: (
  base: #{-apple-system,
  'BlinkMacSystemFont',
  'San Francisco',
  'Roboto',
  'Segoe UI',
  'Helvetica Neue',
  sans-serif},
  monospace: #{Monaco,
  Consolas,
  'Lucida Console',
  monospace},
);

$line-height-data: (
  caption: (
    base: rem(20px),
    large-screen: rem(16px),
  ),
  heading: (
    base: rem(24px),
  ),
  subheading: (
    base: rem(16px),
  ),
  input: (
    base: rem(24px),
  ),
  body: (
    base: rem(20px),
  ),
  button: (
    base: rem(16px),
  ),
  button-large: (
    base: rem(20px),
  ),
  display-x-large: (
    base: rem(36px),
    large-screen: rem(44px),
  ),
  display-large: (
    base: rem(28px),
    large-screen: rem(32px),
  ),
  display-medium: (
    base: rem(28px),
    large-screen: rem(32px),
  ),
  display-small: (
    base: rem(24px),
    large-screen: rem(28px),
  ),
);

$font-size-data: (
  caption: (
    base: rem(13px),
    large-screen: rem(12px),
  ),
  heading: (
    base: rem(17px),
    large-screen: rem(16px),
  ),
  subheading: (
    base: rem(13px),
    large-screen: rem(12px),
  ),
  input: (
    base: rem(16px),
    large-screen: rem(14px),
  ),
  body: (
    base: rem(15px),
    large-screen: rem(14px),
  ),
  button: (
    base: rem(15px),
    large-screen: rem(14px),
  ),
  button-large: (
    base: rem(17px),
    large-screen: rem(16px),
  ),
  display-x-large: (
    base: rem(27px),
    large-screen: rem(42px),
  ),
  display-large: (
    base: rem(24px),
    large-screen: rem(28px),
  ),
  display-medium: (
    base: rem(21px),
    large-screen: rem(26px),
  ),
  display-small: (
    base: rem(16px),
    large-screen: rem(20px),
  ),
);

/// Returns the font stack for a given family.
///
/// @param {String} $family - The key for the given family.
/// @return {Number} The font stack for the family.

@function font-family($family: base) {
  $fetched-value: map-get($font-family-data, $family);

  @if $fetched-value != null {
    @return $fetched-value;
  } @else {
    @error 'Font family `#{$family}` not found. Available font families: #{available-names($font-family-data)}';
  }
}

/// Returns the line height for a given text style and variant.
///
/// @param {String} $style - The font style.
/// @param {String} $variant [base] - The variant on the font-size.
/// @return {Number} The line-height for the text-style.

@function line-height($style, $variant: base) {
  $fetched-line-height: map-get(map-get($line-height-data, $style), $variant);

  @if type-of($fetched-line-height) != null {
    @return $fetched-line-height;
  } @else {
    @error 'Line height `#{$style} - #{$variant}` not found. Available line heights: #{available-names($line-height-data)}';
  }
}

/// Returns the font size for a given text style and variant.
///
/// @param {String} $style - The font style.
/// @param {String} $variant [base] - The variant on the font-size.
/// @return {Number} The font-size for the text-style.

@function font-size($style, $variant: base) {
  $fetched-font-size: map-get(map-get($font-size-data, $style), $variant);

  @if type-of($fetched-font-size) != null {
    @return $fetched-font-size;
  } @else {
    @error 'Font size `#{$style} - #{$variant}` not found. Available font sizes: #{available-names($line-height-data)}';
  }
}
