/*
 * The MIT License (MIT)
 *
 * Copyright (c) 2013 Adobe System Incorporated
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:

 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
 @mixin ui-asset($x, $y, $smooth: 'true'){
    background-image: url(../assets/images/ui.png);
    background-position: #{-$x}px #{-$y}px;
    background-repeat: no-repeat;

    @media (min--moz-device-pixel-ratio: 1.3),
         (-o-min-device-pixel-ratio: 2.6/2),
         (-webkit-min-device-pixel-ratio: 1.3),
         (min-device-pixel-ratio: 1.3),
         (min-resolution: 1.3dppx) {
        background-image: url(../assets/images/ui_x2.png);
        background-size: 225px 400px;
    }

    @if $smooth != 'true' {
        image-rendering: -webkit-optimize-contrast;
    }
}

@mixin mqWidth($minWidth: 0, $maxWidth: 900) {
    @media (min-width: #{$minWidth}px) and (max-width: #{$maxWidth}px) {
        @content;
    }
}

@mixin mqHeight($minHeight: 0, $maxHeight: 900) {
    @media (min-height: #{$minHeight}px) and (max-height: #{$maxHeight}px) {
        @content;
    }
}

@mixin offsetXY($x, $y, $fallbackPrefix: 'margin-') {

    html.csstransforms3d &{
        -webkit-transform: translate3d($x, $y, 0);
        -moz-transform: translate3d($x, $y, 0);
        -ms-transform: translate3d($x, $y, 0);
        -o-transform: translate3d($x, $y, 0);
        transform: translate3d($x, $y, 0);
    }

    html.no-csstransforms3d & {
        #{$fallbackPrefix}left: $x;
        #{$fallbackPrefix}top: $y;
    }
}

@mixin preserve3d {
    -webkit-transform-style: preserve-3d;
    -moz-transform-style: preserve-3d;
    -ms-transform-style: preserve-3d;
    transform-style: preserve-3d;
}

@mixin transform($transform) {
    -webkit-transform: $transform;
    -moz-transform: $transform;
    -ms-transform: $transform;
    -o-transform: $transform;
    transform: $transform;
}

@mixin transition($rest...) {
    -webkit-transition: $rest;
    -moz-transition: $rest;
    -ms-transition: $rest;
    -o-transition: $rest;
    transition: $rest;
}

@mixin transformTransition($rest...) {
    -webkit-transition: -webkit-transform $rest;
    -moz-transition: -moz-transform $rest;
    -ms-transition: -ms-transform $rest;
    -o-transition: -o-transform $rest;
    transition: transform $rest;
}

@mixin transformOrigin($x, $y) {
    -webkit-transform-origin: $x $y;
    -moz-transform-origin: $x $y;
    -ms-transform-origin: $x $y;
    -o-transform-origin: $x $y;
    transform-origin: $x $y;
}

@mixin perspective($rest) {
    -webkit-perspective: $rest;
    -moz-perspective: $rest;
    -ms-perspective: $rest;
    perspective: $rest;
}

@mixin cache {
    -webkit-transform: translateZ(0);
    -moz-transform: translateZ(0);
    -ms-transform: translateZ(0);
    -o-transform: translateZ(0);
    transform: translateZ(0);
}

@-webkit-keyframes simple-spin {
    from { -webkit-transform: rotate(0deg); }
    to { -webkit-transform: rotate(360deg); }
}
@-moz-keyframes simple-spin {
    from { -moz-transform: rotate(0deg); }
    to { -moz-transform: rotate(360deg); }
}
@-ms-keyframes simple-spin {
    from { -ms-transform: rotate(0deg); }
    to { -ms-transform: rotate(360deg); }
}
@-o-keyframes simple-spin {
    from { -o-transform: rotate(0deg); }
    to { -o-transform: rotate(360deg); }
}
@keyframes simple-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@mixin simple-spin($speed) {
    -webkit-animation: simple-spin $speed infinite linear;
    -moz-animation: simple-spin $speed infinite linear;
    -ms-animation: simple-spin $speed infinite linear;
    -o-animation: simple-spin $speed infinite linear;
    animation: simple-spin $speed infinite linear;
}


