// SPACE


// Space
// .example_class {
//   @include space(margin, auto, horizontal);
// }
@mixin space($property, $value, $axis:default) {

  $value: size($value);

  // Default
  @if $axis == default {
    #{$property}: $value;
  }

  // Vertical
  @if $axis == vertical {
    #{$property}-top: $value;
    #{$property}-bottom: $value;
  }
  // Inner Vertical
  @if $axis == inner-vertical {
    #{$property}-top: $value/2;
    #{$property}-bottom: $value/2;
    &:first-child {
      #{$property}-top: 0;
    }
    &:last-child {
      #{$property}-bottom: 0;
    }
  }

  // Horizontal
  @if $axis == horizontal {
    #{$property}-left: $value;
    #{$property}-right: $value;
  }
  // Inner Horizontal
  @if $axis == inner-horizontal {
    #{$property}-left: $value/2;
    #{$property}-right: $value/2;
    &:first-child {
      #{$property}-left: 0;
    }
    &:last-child {
      #{$property}-right: 0;
    }
  }

  @if not $property == margin or not $property == padding {
    @error "`$property` is not valid. Used `margin` or `padding`.";
  }

}
