/*
* @Author: zhongjiahao
* @Date:   2016-08-03 15:31:16
* @Last Modified by:   zhongjiahao
* @Last Modified time: 2016-10-18 15:54:22
*/

@function strip-unit($num) {
  @return $num / ($num * 0 + 1);
}

@mixin rem($property, $values...) {
  $max: length($values);
  $pxValues: '';
  $remValues: '';
  @for $i from 1 through $max {
    $value: strip-unit(nth($values, $i));
    $pxValues: #{$pxValues + $value}px;
    @if $i < $max {
      $pxValues: #{$pxValues + " "};
    }
  }
  @for $i from 1 through $max {
    $value: strip-unit(nth($values, $i));
    $remValues: #{$remValues + $value/16}rem;
    @if $i < $max {
      $remValues: #{$remValues + " "};
    }
  }
  #{$property}: $pxValues;
  #{$property}: $remValues;
}


/*
  font-size: 34px;
*/

@mixin font-h1 {
  @include rem(font-size, 34);
  @include rem(line-height, 60);
  font-family: $font-family-h;
}


/*
  font-size: 24px;
*/

@mixin font-h2 {
  @include rem(font-size, 24);
  @include rem(line-height, 42);
  font-family: $font-family-h;
}


/*
  font-size: 20px;
*/

@mixin font-h3 {
  @include rem(font-size, 20);
  @include rem(line-height, 36);
  font-family: $font-family-h;
}


/*
  font-size: 16px;
*/

@mixin font-h4 {
  @include rem(font-size, 16);
  @include rem(line-height, 30);
  font-family: $font-family-h;
}


/*
  font-size: 14px;
*/

@mixin font-h5 {
  @include rem(font-size, 12);
  @include rem(line-height, 20);
  font-family: $font-family-h;
}

/*
  font-size: 12px;
*/

@mixin font-h6 {
  @include rem(font-size, 12);
  @include rem(line-height, 20);
  font-family: $font-family-h;
}


/*
  font-size: 14px;
*/

@mixin font-a1 {
  @include rem(font-size, 14);
  @include rem(line-height, 24);
  font-family: $font-family-a;
}


/*
  font-size: 12px;
*/

@mixin font-a2 {
  @include rem(font-size, 12);
  @include rem(line-height, 20);
  font-family: $font-family-a;
}
