// Responsive attributes
// ------------------------------

// hide means hide everywhere
/* Sizes:
  0    <= size <= 600  Phone
  600  <= size <= 960  Tablet
  960  <= size <= 1200 Tablet-Landscape
  1200 <= size         PC
*/

[layout] {
  box-sizing: border-box;
  display: flex;
}

[layout=column] {
  flex-direction: column;
}

[layout=row] {
  flex-direction: row;
}

[layout-padding], /* DEPRECATED */
[layout-padding] > [flex], /* DEPRECATED */
[layout-margin],
[layout-margin] > [flex] {
  margin: $layout-gutter-width / 2;
}

[layout-padding] + [layout-padding], /* DEPRECATED */
[layout-margin] + [layout-margin] {
  margin-top: -($layout-gutter-width / 2);
}

[layout-wrap] {
  flex-wrap: wrap;
}

[layout-fill] {
  margin: 0;
  min-height: 100%;
  width: 100%;
}

@mixin layout-for-name($name) {
  [layout-#{$name}] {
    box-sizing: border-box;
    display: flex;
  }
  [layout-#{$name}=column] {
    flex-direction: column;
  }
  [layout-#{$name}=row] {
    flex-direction: row;
  }
}

@mixin flex-properties-for-name($name: null) {
  $flexName: 'flex';
  @if $name != null {
    $flexName: 'flex-#{$name}';
  }

  [#{$flexName}] {
    flex: 1;
  }

  // (0-19) * 5 = 0-95%
  @for $i from 0 through 19 {
    [#{$flexName}="#{$i * 5}"] {
      flex: 0 0 #{$i * 5 + '%'};
      max-width: #{$i * 5 + '%'};
    }
  }

  [#{$flexName}="33"], [#{$flexName}="34"] {
    flex: 0 0 33.33%;
    max-width: 33.33%;
  }
  [#{$flexName}="66"], [#{$flexName}="67"] {
    flex: 0 0 66.66%;
    max-width: 66.66%;
  }

}

// Flex attributes for layout children
// ------------------------------

@include flex-properties-for-name();
[hide]:not([show]):not([show-sm]):not([show-md]):not([show-lg]):not([show-gt-sm]):not([show-gt-md]):not([show-gt-lg]) {
  display: none;
}

@media (max-width: $layout-breakpoint-sm) {
  [hide-sm]:not([show-sm]) {
    display: none;
  }

  @include layout-for-name(sm);
  @include flex-properties-for-name(sm);
}
@media (min-width: $layout-breakpoint-sm) {
  [hide-gt-sm]:not([show-gt-sm]):not([show-md]):not([show-gt-md]):not([show-lg]):not([show-gt-lg]) {
    display: none;
  }

  @include layout-for-name(gt-sm);
  @include flex-properties-for-name(gt-sm);
}

@media (min-width: $layout-breakpoint-sm) and (max-width: $layout-breakpoint-md) {
  [hide-md]:not([show-md]) {
    display: none;
  }

  @include layout-for-name(md);
  @include flex-properties-for-name(md);
}
@media (min-width: $layout-breakpoint-md) {
  [hide-gt-md]:not([show-gt-md]):not([show-lg]):not([show-gt-lg]) {
    display: none;
  }

  @include layout-for-name(gt-md);
  @include flex-properties-for-name(gt-md);
}

@media (min-width: $layout-breakpoint-md) and (max-width: $layout-breakpoint-lg) {
  [hide-lg]:not([show-lg]) {
    display: none;
  }

  @include layout-for-name(lg);
  @include flex-properties-for-name(lg);
}
@media (min-width: $layout-breakpoint-lg) {
  [hide-gt-lg]:not([show-gt-lg]) {
    display: none;
  }

  @include layout-for-name(gt-lg);
  @include flex-properties-for-name(gt-lg);
}



// Order attributes for layout children
// ------------------------------
[flex-order="0"] { order: 0; }
[flex-order="1"] { order: 1; }
[flex-order="2"] { order: 2; }
[flex-order="3"] { order: 3; }
[flex-order="4"] { order: 4; }
[flex-order="5"] { order: 5; }
[flex-order="6"] { order: 6; }
[flex-order="7"] { order: 7; }
[flex-order="8"] { order: 8; }
[flex-order="9"] { order: 9; }


// Alignment attributes for layout containers' children
// Arrange on the Main Axis
// center, start, end, space-between, space-around
// flex-start is the default for justify-content
// ------------------------------

// Main Axis Center
[layout-align="center"], //stretch
[layout-align="center center"],
[layout-align="center start"],
[layout-align="center end"] {
  justify-content: center;
}

// Main Axis End
[layout-align="end"], //stretch
[layout-align="end center"],
[layout-align="end start"],
[layout-align="end end"] {
  justify-content: flex-end;
}

// Main Axis Space Around
[layout-align="space-around"], //stretch
[layout-align="space-around center"],
[layout-align="space-around start"],
[layout-align="space-around end"] {
  justify-content: space-around;
}

// Main Axis Space Between
[layout-align="space-between"], //stretch
[layout-align="space-between center"],
[layout-align="space-between start"],
[layout-align="space-between end"] {
  justify-content: space-between;
}


// Arrange on the Cross Axis
// center, start, end
// stretch is the default for align-items
// ------------------------------

// Cross Axis Center
[layout-align="center center"],
[layout-align="start center"],
[layout-align="end center"],
[layout-align="space-between center"],
[layout-align="space-around center"] {
  align-items: center;
}

// Cross Axis Start
[layout-align="center start"],
[layout-align="start start"],
[layout-align="end start"],
[layout-align="space-between start"],
[layout-align="space-around start"] {
  align-items: flex-start;
}

// Cross Axis End
[layout-align="center end"],
[layout-align="start end"],
[layout-align="end end"],
[layout-align="space-between end"],
[layout-align="space-around end"] {
  align-items: flex-end;
}

