// SASS variables are information about icon's compiled state, stored under its original file name
//
// .icon-home
//   width: $icon-home-width
//
// The large array-like variables contain all information about a single icon
// $icon-home: x y offset_x offset_y width height total_width total_height image_path
//
// At the bottom of this section, we provide information about the spritesheet itself
// $spritesheet: width height image $spritesheet-sprites
$sprite-dash-case-name: 'sprite-dash-case'
$sprite-dash-case-x: 0px
$sprite-dash-case-y: 0px
$sprite-dash-case-offset-x: 0px
$sprite-dash-case-offset-y: 0px
$sprite-dash-case-width: 10px
$sprite-dash-case-height: 20px
$sprite-dash-case-total-width: 80px
$sprite-dash-case-total-height: 100px
$sprite-dash-case-image: 'nested/dir/spritesheet.png'
$sprite-dash-case: (0px, 0px, 0px, 0px, 10px, 20px, 80px, 100px, 'nested/dir/spritesheet.png', 'sprite-dash-case', )
$sprite-snake-case-name: 'sprite_snake_case'
$sprite-snake-case-x: 10px
$sprite-snake-case-y: 20px
$sprite-snake-case-offset-x: -10px
$sprite-snake-case-offset-y: -20px
$sprite-snake-case-width: 20px
$sprite-snake-case-height: 30px
$sprite-snake-case-total-width: 80px
$sprite-snake-case-total-height: 100px
$sprite-snake-case-image: 'nested/dir/spritesheet.png'
$sprite-snake-case: (10px, 20px, -10px, -20px, 20px, 30px, 80px, 100px, 'nested/dir/spritesheet.png', 'sprite_snake_case', )
$sprite-camel-case-name: 'spriteCamelCase'
$sprite-camel-case-x: 30px
$sprite-camel-case-y: 50px
$sprite-camel-case-offset-x: -30px
$sprite-camel-case-offset-y: -50px
$sprite-camel-case-width: 50px
$sprite-camel-case-height: 50px
$sprite-camel-case-total-width: 80px
$sprite-camel-case-total-height: 100px
$sprite-camel-case-image: 'nested/dir/spritesheet.png'
$sprite-camel-case: (30px, 50px, -30px, -50px, 50px, 50px, 80px, 100px, 'nested/dir/spritesheet.png', 'spriteCamelCase', )
$spritesheet-width: 80px
$spritesheet-height: 100px
$spritesheet-image: 'nested/dir/spritesheet.png'
$spritesheet-sprites: ($sprite-dash-case, $sprite-snake-case, $sprite-camel-case, )
$spritesheet: (80px, 100px, 'nested/dir/spritesheet.png', $spritesheet-sprites, )

// The provided mixins are intended to be used with the array-like variables
//
// .icon-home
//   @include sprite-width($icon-home)
//
// .icon-email
//   @include sprite($icon-email)
//
// Example usage in HTML:
//   `display: block` sprite:
//   <div class="icon-home"></div>
//
// To change `display` (e.g. `display: inline-block;`), we suggest using a common CSS class:
//   // CSS
//   .icon {
//     display: inline-block;
//   }
//
//   // HTML
//   <i class="icon icon-home"></i>
@mixin sprite-width($sprite)
  width: nth($sprite, 5)

@mixin sprite-height($sprite)
  height: nth($sprite, 6)

@mixin sprite-position($sprite)
  $sprite-offset-x: nth($sprite, 3)
  $sprite-offset-y: nth($sprite, 4)
  background-position: $sprite-offset-x  $sprite-offset-y

@mixin sprite-image($sprite)
  $sprite-image: nth($sprite, 9)
  background-image: url(#{$sprite-image})

@mixin sprite($sprite)
  @include sprite-image($sprite)
  @include sprite-position($sprite)
  @include sprite-width($sprite)
  @include sprite-height($sprite)

// The `sprites` mixin generates identical output to the CSS template
//   but can be overridden inside of SASS
//
// @include sprites($spritesheet-sprites)
@mixin sprites($sprites)
  @each $sprite in $sprites
    $sprite-name: nth($sprite, 10)
    .#{$sprite-name}
      @include sprite($sprite)
