@use "sass:list";
/*#############################################################################
# FUNCTIONS
#############################################################################*/


// ===========================================================================

// This is the default html and body font-size for the base rem value.
$rem-base: 16px !default;

// STRIP UNIT
// It strips the unit of measure and returns it
@function strip-unit($num) {
  @return calc($num / ($num * 0 + 1px));
}

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

// REM CALC
@function rem-calc($values, $base-value: $rem-base) {
  $max: list.length($values);

  @if $max == 1 { @return convert-to-rem(list.nth($values, 1), $base-value); }

  $remValues: ();
  @for $i from 1 through $max {
    $remValues: list.append($remValues, convert-to-rem(list.nth($values, $i), $base-value));
  }
  @return $remValues;
}

// ===========================================================================
