// ----
// Typography
// ----

//- Mixin: Inline List
///
/// For when you need your list to be horizontal.
///
/// @param {variable} $spacing [20px] - Amount of spacing between elements -
/// can be whatever unit you like.
///
/// @group typography
/// @example
///   ul {
///     @include inline-list();
///   }

@mixin inline-list($spacing: 20px) {
  @include clearfix();
  margin: 0;
  padding: 0;

  li {
    float: left;
    list-style-type: none;
    margin-right: $spacing;
  }

  li:last-child {
    margin-right: 0;
  }
}

//- Mixin: Inline List
///
/// We tend to spend a great deal of time resetting all of the properties for
/// lists. This puts them back to roughly the same state as browser defaults.
/// You can pass it any option that [list-style-type]
/// (http://www.w3schools.com/cssref/pr_list-style-type.asp) would normally
/// take.
///
/// @param {variable} $style [disc] - Amount of spacing between elements.
/// can be whatever unit you like.
///
/// @group typography
/// @example
///   ul {
///     @include text-list();
///   }
///   ul {
///     @include text-list('disc');
///   }

@mixin text-list($style: 'disc') {
  margin: .32rem .94rem;
  padding-left: 1rem;

  li {
    list-style-type: unquote($style);
    padding: .125rem 0;
  }
}

//- Mixin: Reset List
///
///  Resets the margins padding, and styles to list.
///
/// @group typography
/// @example
///   ul {
///     @include reset-list();
///   }

@mixin reset-list() {
  margin: 0;
  padding: 0;

  li {
    float: none;
    list-style-type: none;
    margin: 0;
    padding: 0;
  }
}


//- Mixin: Ellipsis
///
/// Truncate text to the width of its container...
///
/// @param {variable} $width [100%] - Width of the container
/// can be whatever unit you like.
///
/// @group typography
/// @example
///   h3 {
///     @include ellipsis();
///   }

@mixin ellipsis($width: 100%) {
  white-space: nowrap;
  display: inline-block;
  max-width: $width;
  overflow: hidden;
  text-overflow: ellipsis;
  word-wrap: normal;
}


//- Mixin: Fluid Type
///
/// Magic calc + vh combo to allow text to be fluid between minimum
/// and maximum breakpoints.
///
/// @group typography
/// @param {variable} $min-font-size [12px] - Minimum font size
/// @param {variable} $max-font-size [24px] - Maximum font size
/// @param {variable} $lower-range [420px] - Stop scaling font smaller at this screen resolution
/// @param {variable} $upper-range [900px] - Stop scaling font larger at this screen resolution
/// @example
///   h1 {
///     @include fluid-type(20px, 48px);
///   }
/// @link http://codepen.io/dbox/pen/meaMba

@mixin fluid-type($min-font-size: 12px, $max-font-size: 21px, $lower-range: 420px, $upper-range: 900px) {
  font-size: calc(#{$min-font-size} + #{(($max-font-size / ($max-font-size * 0 + 1)) - ($min-font-size / ($min-font-size * 0 + 1)))} * ((100vw - #{$lower-range}) / #{(($upper-range / ($upper-range * 0 + 1)) - ($lower-range / ($lower-range * 0 + 1)))}));

  @media screen and (max-width: $lower-range) {
    font-size: $min-font-size;
  }

  @media screen and (min-width: $upper-range){
    font-size: $max-font-size;
  }
}
