$font__rem-base: 16px;

/*---------------------------
		Foundation
---------------------------*/

// We use this to prevent styles from being loaded multiple times for compenents that rely on other components.
$modules: ();
@mixin exports($name) {
	// Import from global scope
	$modules: $modules;
	// Check if a module is already on the list
	$module_index: index($modules, $name);
	@if (($module_index == null) or ($module_index == false)) {
		$modules: append($modules, $name);
		@content;
	}
}

// RANGES
// We use these functions to define ranges for various things, like media queries.
@function lower-bound($range){
	@if length($range) <= 0 {
		@return 0;
	}
	@return nth($range,1);
}

@function upper-bound($range) {
	@if length($range) < 2 {
		@return 999999999999;
	}
	@return nth($range, 2);
}

/*---------------------------
		Rem Calc
---------------------------*/


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

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

@function rem-calc($values, $base-value: $font__rem-base) {
	$max: length($values);

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

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

