//**********************************************************
// Functions
//----------------------------------------------------------
//
//**********************************************************
@use "sass:math";
@use "sass:list";

// Grid
@function getGridCellWidth() {
    @return math.div($grid_width - ($grid_column - 1) * $grid_gap, $grid_column);
}

// Breakpoints
@function getListBreakpoints() {
    $list: [];
    $b: math.div(100, $layout_width) * $layout_gap * 2;
    $g: 100 - $b;

    @for $i from 1 through $grid_column {
        $w: $i * $grid_col_width;
        $s: math.div($w, $g) * $b;
        $d: math.round($w + $s - 1);
        $list: list.append($list, $d);
    }

    @return $list;
}

@function getBreakpoint($n: $grid_column) {
    @return list.nth($list_breakpoints, $n);
}

// Helpers
@function stripUnit($value) {
    @return math.div($value, ($value * 0 + 1));
}

@function pxToRem($value) {
    @return $px * stripUnit($value);
}