/*
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;
*/
$baidu-name: 'baidu';
$baidu-x: 0px;
$baidu-y: 0px;
$baidu-offset-x: 0px;
$baidu-offset-y: 0px;
$baidu-width: 540px;
$baidu-height: 258px;
$baidu-total-width: 1084px;
$baidu-total-height: 258px;
$baidu-image: '/static/images/index/sprite.png';
$baidu: 0px 0px 0px 0px 540px 258px 1084px 258px '/static/images/index/sprite.png' 'baidu';
$google-name: 'google';
$google-x: 540px;
$google-y: 0px;
$google-offset-x: -540px;
$google-offset-y: 0px;
$google-width: 544px;
$google-height: 184px;
$google-total-width: 1084px;
$google-total-height: 258px;
$google-image: '/static/images/index/sprite.png';
$google: 540px 0px -540px 0px 544px 184px 1084px 258px '/static/images/index/sprite.png' 'google';
$spritesheet-width: 1084px;
$spritesheet-height: 258px;
$spritesheet-image: '/static/images/index/sprite.png';
$spritesheet-sprites: $baidu $google;
$spritesheet: 1084px 258px '/static/images/index/sprite.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: 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);
    }
  }
}
