/**
 * Convert PX to EM
 *
 * @package  generator_css
 * @author   Martin Herweg <mherweg@zonedigital.com>
 */

/*
|--------------------------------------------------------------------------
| _tools.function.em_calc.scss
|--------------------------------------------------------------------------
*/

/* USAGE
 * RESULT
|--------------------------------------------------------------------------
| h1 { font-size: em-calc(20px); }
| h1 { font-size: 1em; }
|--------------------------------------------------------------------------
| h2 { font-size: em-calc(20px, 18px) } // modify the em base to calc from
| h2 { font-size: 1.11111em; }
|--------------------------------------------------------------------------
*/

$em-base: 16px !default;

/* stylelint-disable */

// CONVERT EM
@function em-calc($value, $base-value: $em-base) {
  $value: strip-unit($value) / strip-unit($base-value) * 1em;
  @if ($value == 0em) { $value: 0; } // Turn 0rem into 0
  @return $value;
}

/* stylelint-enable */
