// SCSS 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;
$facebook-name: 'facebook';
$facebook-x: 0px;
$facebook-y: 0px;
$facebook-offset-x: 0px;
$facebook-offset-y: 0px;
$facebook-width: 64px;
$facebook-height: 64px;
$facebook-total-width: 224px;
$facebook-total-height: 144px;
$facebook-image: '../sprites/sprites.png';
$facebook: (0px, 0px, 0px, 0px, 64px, 64px, 224px, 144px, '../sprites/sprites.png', 'facebook', );
$html5-name: 'html5';
$html5-x: 80px;
$html5-y: 0px;
$html5-offset-x: -80px;
$html5-offset-y: 0px;
$html5-width: 64px;
$html5-height: 64px;
$html5-total-width: 224px;
$html5-total-height: 144px;
$html5-image: '../sprites/sprites.png';
$html5: (80px, 0px, -80px, 0px, 64px, 64px, 224px, 144px, '../sprites/sprites.png', 'html5', );
$instagram-name: 'instagram';
$instagram-x: 0px;
$instagram-y: 80px;
$instagram-offset-x: 0px;
$instagram-offset-y: -80px;
$instagram-width: 64px;
$instagram-height: 64px;
$instagram-total-width: 224px;
$instagram-total-height: 144px;
$instagram-image: '../sprites/sprites.png';
$instagram: (0px, 80px, 0px, -80px, 64px, 64px, 224px, 144px, '../sprites/sprites.png', 'instagram', );
$twitter-name: 'twitter';
$twitter-x: 80px;
$twitter-y: 80px;
$twitter-offset-x: -80px;
$twitter-offset-y: -80px;
$twitter-width: 64px;
$twitter-height: 64px;
$twitter-total-width: 224px;
$twitter-total-height: 144px;
$twitter-image: '../sprites/sprites.png';
$twitter: (80px, 80px, -80px, -80px, 64px, 64px, 224px, 144px, '../sprites/sprites.png', 'twitter', );
$youtube-name: 'youtube';
$youtube-x: 160px;
$youtube-y: 0px;
$youtube-offset-x: -160px;
$youtube-offset-y: 0px;
$youtube-width: 64px;
$youtube-height: 64px;
$youtube-total-width: 224px;
$youtube-total-height: 144px;
$youtube-image: '../sprites/sprites.png';
$youtube: (160px, 0px, -160px, 0px, 64px, 64px, 224px, 144px, '../sprites/sprites.png', 'youtube', );
$spritesheet-width: 224px;
$spritesheet-height: 144px;
$spritesheet-image: '../sprites/sprites.png';
$spritesheet-sprites: ($facebook, $html5, $instagram, $twitter, $youtube, );
$spritesheet: (224px, 144px, '../sprites/sprites.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 SCSS
//
// @include sprites($spritesheet-sprites);
@mixin sprites($sprites) {
  @each $sprite in $sprites {
    $sprite-name: nth($sprite, 10);
    .#{$sprite-name} {
      @include sprite($sprite);
    }
  }
}
