/* ------------------------------------------------------------------------ *\
   mixins.util.size
\* ------------------------------------------------------------------------ */


/*
 * Size utility.
 *
 * Synopsis:
 *
 *   size: <width> <height> | <width & height>
 *
 * Examples:
 *
 *     size: 100% 30px
 *       yields:
 *         width: 100%
 *         height: 30px
 *
 *     size: 5px
 *       yields:
 *         width: 5px
 *         height: 5px
 *
 */

u-size()
  if length(arguments) == 1
    width: arguments[0]
    height: arguments[0]
  else
    width: arguments[0]
    height: arguments[1]


/// size--width ////////////////////////////


/**
 * [width description]
 * @param  {[type]} width =             100 [description]
 * @return {[type]}       [description]
 */
u-size--width(width = 100)
  if width == 100
    width: 100%

  else
    width: (100 / nix.grid.cols) * width * 1%


/**
 * [xxxl description]
 * @return {[type]} [description]
 */
u-size--width--xxxl()
  width: nix.sizes.xxxl


/**
 * [xxl description]
 * @return {[type]} [description]
 */
u-size--width--xxl()
  width: nix.sizes.xxl


/**
 * [xl description]
 * @return {[type]} [description]
 */
u-size--width--xl()
  width: nix.sizes.xl


/**
 * [lg description]
 * @return {[type]} [description]
 */
u-size--width--lg()
  width: nix.sizes.lg


/**
 * [md description]
 * @return {[type]} [description]
 */
u-size--width--md()
  width: nix.sizes.md


/**
 * [sm description]
 * @return {[type]} [description]
 */
u-size--width--sm()
  width: nix.sizes.sm


/**
 * [xs description]
 * @return {[type]} [description]
 */
u-size--width--xs()
  width: nix.sizes.xs


/**
 * [xxs description]
 * @return {[type]} [description]
 */
u-size--width--xxs()
  width: nix.sizes.xxs


/**
 * [xxxs description]
 * @return {[type]} [description]
 */
u-size--width--xxxs()
  width: nix.sizes.xxxs


/**
 * [description]
 * @return {[type]} [description]
 */
u-size--width--5()
  width: 5%


/**
 * [description]
 * @return {[type]} [description]
 */
u-size--width--10()
  width: 10%


/**
 * [description]
 * @return {[type]} [description]
 */
u-size--width--15()
  width: 15%


/**
 * [description]
 * @return {[type]} [description]
 */
u-size--width--15()
  width: 20%


/**
 * [description]
 * @return {[type]} [description]
 */
u-size--width--25()
  width: 25%


/**
 * [description]
 * @return {[type]} [description]
 */
u-size--width--25()
  width: 25%


/**
 * [description]
 * @return {[type]} [description]
 */
u-size--width--30()
  width: 30%


/**
 * [description]
 * @return {[type]} [description]
 */
u-size--width--33()
  width: 33.3333%


/**
 * [description]
 * @return {[type]} [description]
 */
u-size--width--35()
  width: 35%


/**
 * [description]
 * @return {[type]} [description]
 */
u-size--width--40()
  width: 40%


/**
 * [description]
 * @return {[type]} [description]
 */
u-size--width--45()
  width: 45%


/**
 * [description]
 * @return {[type]} [description]
 */
u-size--width--50()
  width: 50%


/**
 * [description]
 * @return {[type]} [description]
 */
u-size--width--55()
  width: 55%


/**
 * [description]
 * @return {[type]} [description]
 */
u-size--width--60()
  width: 60%


/**
 * [description]
 * @return {[type]} [description]
 */
u-size--width--65()
  width: 65%


/**
 * [description]
 * @return {[type]} [description]
 */
u-size--width--66()
  width: 66.6666%


/**
 * [description]
 * @return {[type]} [description]
 */
u-size--width--70()
  width: 70%


/**
 * [description]
 * @return {[type]} [description]
 */
u-size--width--75()
  width: 75%


/**
 * [description]
 * @return {[type]} [description]
 */
u-size--width--80()
  width: 80%


/**
 * [description]
 * @return {[type]} [description]
 */
u-size--width--85()
  width: 85%


/**
 * [description]
 * @return {[type]} [description]
 */
u-size--width--90()
  width: 90%


/**
 * [description]
 * @return {[type]} [description]
 */
u-size--width--95()
  width: 95%


/**
 * [description]
 * @return {[type]} [description]
 */
u-size--width--100()
  width: 100%


/// size--height ////////////////////////////


/**
 * [height description]
 * @param  {[type]} height =             100 [description]
 * @return {[type]}        [description]
 */
u-size--height(height = 100)
  if height == 100
    height: 100%

  else
    height: (100 / nix.grid.cols) * height * 1%


/**
 * [xxxl description]
 * @return {[type]} [description]
 */
u-size--height--xxxl()
  height: nix.sizes.xxxl


/**
 * [xxl description]
 * @return {[type]} [description]
 */
u-size--height--xxl()
  height: nix.sizes.xxl


/**
 * [xl description]
 * @return {[type]} [description]
 */
u-size--height--xl()
  height: nix.sizes.xl


/**
 * [lg description]
 * @return {[type]} [description]
 */
u-size--height--lg()
  height: nix.sizes.lg


/**
 * [md description]
 * @return {[type]} [description]
 */
u-size--height--md()
  height: nix.sizes.md


/**
 * [sm description]
 * @return {[type]} [description]
 */
u-size--height--sm()
  height: nix.sizes.sm


/**
 * [xs description]
 * @return {[type]} [description]
 */
u-size--height--xs()
  height: nix.sizes.xs


/**
 * [xxs description]
 * @return {[type]} [description]
 */
u-size--height--xxs()
  height: nix.sizes.xxs


/**
 * [xxxs description]
 * @return {[type]} [description]
 */
u-size--height--xxxs()
  height: nix.sizes.xxxs


/// size--all ////////////////////////////

/**
 * [all description]
 * @param  {[type]} width  =             null [description]
 * @param  {[type]} height =             null [description]
 * @return {[type]}        [description]
 */
u-size--all(width = null, height = null)
  u-size--width(width)
  u-size--height(height)


/**
 * [xxxl description]
 * @return {[type]} [description]
 */
u-size--all--xxxl()
  u-size--width--xxxl()
  u-size--height--xxxl()


/**
 * [xxl description]
 * @return {[type]} [description]
 */
u-size--all--xxl()
  u-size--width--xxl()
  u-size--height--xxl()


/**
 * [xl description]
 * @return {[type]} [description]
 */
u-size--all--xl()
  u-size--width--xl()
  u-size--height--xl()


/**
 * [lg description]
 * @return {[type]} [description]
 */
u-size--all--lg()
  u-size--width--lg()
  u-size--height--lg()


/**
 * [md description]
 * @return {[type]} [description]
 */
u-size--all--md()
  u-size--width--md()
  u-size--height--md()


/**
 * [sm description]
 * @return {[type]} [description]
 */
u-size--all--sm()
  u-size--width--sm()
  u-size--height--sm()


/**
 * [xs description]
 * @return {[type]} [description]
 */
u-size--all--xs()
  u-size--width--xs()
  u-size--height--xs()


/**
 * [xxs description]
 * @return {[type]} [description]
 */
u-size--all--xxs()
  u-size--width--xxs()
  u-size--height--xxs()


/**
 * [xxxs description]
 * @param  {[type]} breakpoint =             nix.mq.xxs [description]
 * @return {[type]}            [description]
 */
u-size--all--xxxs()
  u-size--width--xxxs()
  u-size--height--xxxs()


/**
 * [create description]
 * @param  {[type]} selector [description]
 * @return {[type]}          [description]
 */
u-size--width--create(selector)
  for breakpoint in nix.mq
    +above(nix.mq[breakpoint])
      [{selector}~=\"--33\\@{breakpoint}\"]
        width: 33%

      [{selector}~=\"--66\\@{breakpoint}\"]
        width: 66%

      for cols in 1..(nix.grid.cols / nix.grid.interval)
        cols = cols * nix.grid.interval
        [{selector}~=\"--{cols}\\@{breakpoint}\"]
          width: (100 / nix.grid.cols) * cols * 1%
