/*
 *  Tools: Functions
 *  ---
 *  Functions that you can use during the theming process.
 */

/**
 * Convert any px value into its rem equivalent.
 *
 * Usage: rem(number);
 */
@function rem($number) {
  @return $number / $global-font-size * 1rem;
}

/**
 * Math functions. Very usefull to stay on baseline grid
 */
@function quarter($number) {
  @return round($number / 4);
}

@function halve($number) {
  @return round($number / 2);
}

@function double($number) {
  @return round($number * 2);
}

@function quadruple($number) {
  @return round($number * 4);
}

/**
 * The palette function works with a base color and a tint.
 * Reads from '_settings.colors.scss'
 *
 * Usage: palette(color-alpha,base)
 */
@function palette($palette, $tone: 'base') {
  @return map-get(map-get($palettes, $palette), $tone);
}

/**
 * The index function returns a z-index value based on your
 * $z-indexes map.
 *
 * Usage: z-index: index(key);
 */
@function index($index: 'alpha') {
  @return map-get($z-indexes, $index);
}