/*
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;
*/
$contact-envelope-name: 'contact-envelope';
$contact-envelope-x: 0px;
$contact-envelope-y: 0px;
$contact-envelope-offset-x: 0px;
$contact-envelope-offset-y: 0px;
$contact-envelope-width: 64px;
$contact-envelope-height: 64px;
$contact-envelope-total-width: 128px;
$contact-envelope-total-height: 128px;
$contact-envelope-image: 'sprites/contact-icons.png';
$contact-envelope: (0px, 0px, 0px, 0px, 64px, 64px, 128px, 128px, 'sprites/contact-icons.png', 'contact-envelope', );
$contact-pin-name: 'contact-pin';
$contact-pin-x: 64px;
$contact-pin-y: 0px;
$contact-pin-offset-x: -64px;
$contact-pin-offset-y: 0px;
$contact-pin-width: 64px;
$contact-pin-height: 64px;
$contact-pin-total-width: 128px;
$contact-pin-total-height: 128px;
$contact-pin-image: 'sprites/contact-icons.png';
$contact-pin: (64px, 0px, -64px, 0px, 64px, 64px, 128px, 128px, 'sprites/contact-icons.png', 'contact-pin', );
$contact-telephone-name: 'contact-telephone';
$contact-telephone-x: 0px;
$contact-telephone-y: 64px;
$contact-telephone-offset-x: 0px;
$contact-telephone-offset-y: -64px;
$contact-telephone-width: 64px;
$contact-telephone-height: 64px;
$contact-telephone-total-width: 128px;
$contact-telephone-total-height: 128px;
$contact-telephone-image: 'sprites/contact-icons.png';
$contact-telephone: (0px, 64px, 0px, -64px, 64px, 64px, 128px, 128px, 'sprites/contact-icons.png', 'contact-telephone', );
$spritesheet-width: 128px;
$spritesheet-height: 128px;
$spritesheet-image: 'sprites/contact-icons.png';
$spritesheet-sprites: ($contact-envelope, $contact-pin, $contact-telephone, );
$spritesheet: (128px, 128px, 'sprites/contact-icons.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);
}
*/
@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: 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);
    }
  }
}
/*
Icon classes can be used entirely standalone. They are named after their original file names.

```html
<!-- `display: block` sprite -->
<div class="icon-home"></div>

<!-- `display: inline-block` sprite -->
<img class="icon-home" />
```
*/
.icon-contact-envelope {
  background-image: image-url('sprites/contact-icons.png');
  background-position: 0px 0px;
  width: 64px;
  height: 64px;
}
.icon-contact-pin {
  background-image: image-url('sprites/contact-icons.png');
  background-position: -64px 0px;
  width: 64px;
  height: 64px;
}
.icon-contact-telephone {
  background-image: image-url('sprites/contact-icons.png');
  background-position: 0px -64px;
  width: 64px;
  height: 64px;
}
