@charset "UTF-8";

///
/// Return a calulated column width that can then be passed in to a `calc()`.
///
/// @name flex-column-width
///
/// @param {Mixed} $columns - Number of columns either as integer or `x of y`
/// @param {Unit} $gutter - The width of the gutter in a css unit
/// @param {Integer} $su-grid-columns - The number of columns in the grid
///
/// @group mixin
@function flex-column-width($columns, $gutter: $su-gutter-xs, $grid-columns: $su-grid-columns) {
  $_column-ratio: flex-column-ratio($columns, $grid-columns);

  /// Make note here.
  $_total-columns: $grid-columns;
  @if length($columns) == 3 {
    $_total-columns: flex-parse-columns($columns);
  }

  @if $gutter == 0 {
    @return unquote("#{percentage($_column-ratio)}");
  }
  @else {
    $_gutter-affordance: (#{(1 - nth($columns, 1) / $_total-columns) * $gutter});
    @return unquote("#{percentage($_column-ratio)} - #{$_gutter-affordance}");
  }
}
