// Name:            Animation
// Description:     Provides a useful set of keyframe animations
//
// Component:       `uk-animation-*`
//
// Modifiers:       `uk-animation-fade`
//                  `uk-animation-scale-up`
//                  `uk-animation-scale-down`
//                  `uk-animation-slide-top`
//                  `uk-animation-slide-bottom`
//                  `uk-animation-slide-left`
//                  `uk-animation-slide-right`
//                  `uk-animation-scale`
//                  `uk-animation-shake`
//                  `uk-animation-reverse`
//                  `uk-animation-15`
//                  `uk-animation-top-left`
//                  `uk-animation-top-center`
//                  `uk-animation-top-right`
//                  `uk-animation-middle-left`
//                  `uk-animation-middle-right`
//                  `uk-animation-bottom-left`
//                  `uk-animation-bottom-center`
//                  `uk-animation-bottom-right`
//
// Sub-objects:     `uk-animation-hover`
//
// Uses:            Scrollspy
//
// Used by:         Dropdown
//                  Icon
//                  Search
//                  Datepicker
//                  Slideshow
//
// ========================================================================


/* ========================================================================
   Component: Animation
 ========================================================================== */

[class*='uk-animation-'] {
    -webkit-animation-duration: 0.5s;
    animation-duration: 0.5s;
    -webkit-animation-timing-function: ease-out;
    animation-timing-function: ease-out;
    -webkit-animation-fill-mode: both;
    animation-fill-mode: both;
}

/* Hide animated element if scrollspy is used */
@media screen {

    [data-uk-scrollspy*='uk-animation-']:not([data-uk-scrollspy*='target']) { opacity: 0; }

}

/*
 * Fade
 * Higher specificity (!important) needed because of reverse modifier
 */

.uk-animation-fade {
    -webkit-animation-name: uk-fade;
    animation-name: uk-fade;
    -webkit-animation-duration: 0.8s;
    animation-duration: 0.8s;
    -webkit-animation-timing-function: linear !important;
    animation-timing-function: linear !important;
}

/*
 * Fade with scale
 */

.uk-animation-scale-up {
    -webkit-animation-name: uk-fade-scale-02;
    animation-name: uk-fade-scale-02;
}

.uk-animation-scale-down {
    -webkit-animation-name: uk-fade-scale-18;
    animation-name: uk-fade-scale-18;
}

/*
 * Fade with slide
 */

.uk-animation-slide-top {
    -webkit-animation-name: uk-fade-top;
    animation-name: uk-fade-top;
}

.uk-animation-slide-bottom {
    -webkit-animation-name: uk-fade-bottom;
    animation-name: uk-fade-bottom;
}

.uk-animation-slide-left {
    -webkit-animation-name: uk-fade-left;
    animation-name: uk-fade-left;
}

.uk-animation-slide-right {
    -webkit-animation-name: uk-fade-right;
    animation-name: uk-fade-right;
}

/*
 * Scale
 */

.uk-animation-scale {
    -webkit-animation-name: uk-scale-12;
    animation-name: uk-scale-12;
}

/*
 * Shake
 */

.uk-animation-shake {
    -webkit-animation-name: uk-shake;
    animation-name: uk-shake;
}


/* Direction modifiers
 ========================================================================== */

.uk-animation-reverse {
    -webkit-animation-direction: reverse;
    animation-direction: reverse;
    -webkit-animation-timing-function: ease-in;
    animation-timing-function: ease-in;
}


/* Duration modifiers
========================================================================== */

.uk-animation-15 {
    -webkit-animation-duration: 15s;
    animation-duration: 15s;
}


/* Origin modifiers
========================================================================== */

.uk-animation-top-left {
     -webkit-transform-origin: 0 0;
     transform-origin: 0 0;
}

.uk-animation-top-center {
     -webkit-transform-origin: 50% 0;
     transform-origin: 50% 0;
}

.uk-animation-top-right {
     -webkit-transform-origin: 100% 0;
     transform-origin: 100% 0;
}

.uk-animation-middle-left {
     -webkit-transform-origin: 0 50%;
     transform-origin: 0 50%;
}

.uk-animation-middle-right {
     -webkit-transform-origin: 100% 50%;
     transform-origin: 100% 50%;
}

.uk-animation-bottom-left {
     -webkit-transform-origin: 0 100%;
     transform-origin: 0 100%;
}

.uk-animation-bottom-center {
     -webkit-transform-origin: 50% 100%;
     transform-origin: 50% 100%;
}

.uk-animation-bottom-right {
     -webkit-transform-origin: 100% 100%;
     transform-origin: 100% 100%;
}


/* Sub-object: `uk-animation-hover`
========================================================================== */

/*
 * Enable animation only on hover
 * Note: Firefox also needs this because animations are not triggered when switching between display `hidden` and `block`
 */

.uk-animation-hover:not(:hover),
.uk-animation-hover:not(:hover) [class*='uk-animation-'],
.uk-touch .uk-animation-hover:not(.uk-hover),
.uk-touch .uk-animation-hover:not(.uk-hover) [class*='uk-animation-'] {
    -webkit-animation-name: none;
    animation-name: none;
}


/* Keyframes: Fade
 * Used by dropdown, datepicker and slideshow component
 ========================================================================== */

@-webkit-keyframes uk-fade {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes uk-fade {
    0% { opacity: 0; }
    100% { opacity: 1; }
}


/* Keyframes: Fade with slide
 ========================================================================== */

/*
 * Top
 */

@-webkit-keyframes uk-fade-top {
    0% {
        opacity: 0;
        -webkit-transform: translateY(-100%);
    }
    100% {
        opacity: 1;
        -webkit-transform: translateY(0);
    }
}

@keyframes uk-fade-top {
    0% {
        opacity: 0;
        transform: translateY(-100%);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/*
 * Bottom
 */

@-webkit-keyframes uk-fade-bottom {
    0% {
        opacity: 0;
        -webkit-transform: translateY(100%);
    }
    100% {
        opacity: 1;
        -webkit-transform: translateY(0);
    }
}

@keyframes uk-fade-bottom {
    0% {
        opacity: 0;
        transform: translateY(100%);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/*
 * Left
 */

@-webkit-keyframes uk-fade-left {
    0% {
        opacity: 0;
        -webkit-transform: translateX(-100%);
    }
    100% {
        opacity: 1;
        -webkit-transform: translateX(0);
    }
}

@keyframes uk-fade-left {
    0% {
        opacity: 0;
        transform: translateX(-100%);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

/*
 * Right
 */

@-webkit-keyframes uk-fade-right {
    0% {
        opacity: 0;
        -webkit-transform: translateX(100%);
    }
    100% {
        opacity: 1;
        -webkit-transform: translateX(0);
    }
}

@keyframes uk-fade-right {
    0% {
        opacity: 0;
        transform: translateX(100%);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}


/* Keyframes: Fade with scale
 ========================================================================== */

/*
 * Scale by 0.2
 */

@-webkit-keyframes uk-fade-scale-02 {
    0% {
        opacity: 0;
        -webkit-transform: scale(0.2);
    }
    100% {
        opacity: 1;
        -webkit-transform: scale(1);
    }
}

@keyframes uk-fade-scale-02 {
    0% {
        opacity: 0;
        transform: scale(0.2);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/*
 * Scale by 1.5
 * Used by slideshow component
 */

@-webkit-keyframes uk-fade-scale-15 {
    0% {
        opacity: 0;
        -webkit-transform: scale(1.5);
    }
    100% {
        opacity: 1;
        -webkit-transform: scale(1);
    }
}

@keyframes uk-fade-scale-15 {
    0% {
        opacity: 0;
        transform: scale(1.5);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/*
 * Scale by 1.8
 */

@-webkit-keyframes uk-fade-scale-18 {
    0% {
        opacity: 0;
        -webkit-transform: scale(1.8);
    }
    100% {
        opacity: 1;
        -webkit-transform: scale(1);
    }
}

@keyframes uk-fade-scale-18 {
    0% {
        opacity: 0;
        transform: scale(1.8);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}


/* Keyframes: Slide
 * Used by slideshow component
 ========================================================================== */

/*
 * Left
 */

@-webkit-keyframes uk-slide-left {
    0% { -webkit-transform: translateX(-100%); }
    100% { -webkit-transform: translateX(0); }
}

@keyframes uk-slide-left {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(0); }
}

/*
 * Right
 */

@-webkit-keyframes uk-slide-right {
    0% { -webkit-transform: translateX(100%); }
    100% { -webkit-transform: translateX(0); }
}

@keyframes uk-slide-right {
    0% { transform: translateX(100%); }
    100% { transform: translateX(0); }
}

/*
 * Left third
 */

@-webkit-keyframes uk-slide-left-33 {
    0% { -webkit-transform: translateX(33%); }
    100% { -webkit-transform: translateX(0); }
}

@keyframes uk-slide-left-33 {
    0% { transform: translateX(33%); }
    100% { transform: translateX(0); }
}

/*
 * Right third
 */

@-webkit-keyframes uk-slide-right-33 {
    0% { -webkit-transform: translateX(-33%); }
    100% { -webkit-transform: translateX(0); }
}

@keyframes uk-slide-right-33 {
    0% { transform: translateX(-33%); }
    100% { transform: translateX(0); }
}


/* Keyframes: Scale
 ========================================================================== */

@-webkit-keyframes uk-scale-12 {
    0% { -webkit-transform: scale(1.2); }
    100% { -webkit-transform: scale(1); }
}

@keyframes uk-scale-12 {
    0% { transform: scale(1.2); }
    100% { transform: scale(1); }
}


/* Keyframes: Rotate
 * Used by icon component
 ========================================================================== */

@-webkit-keyframes uk-rotate {
    0% { -webkit-transform: rotate(0deg); }
    100% { -webkit-transform: rotate(359deg); }
}

@keyframes uk-rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(359deg); }
}


/* Keyframes: Shake
 ========================================================================== */

@-webkit-keyframes uk-shake {
    0%, 100% { -webkit-transform: translateX(0); }
    10% { -webkit-transform: translateX(-9px); }
    20% { -webkit-transform: translateX(8px); }
    30% { -webkit-transform: translateX(-7px); }
    40% { -webkit-transform: translateX(6px); }
    50% { -webkit-transform: translateX(-5px); }
    60% { -webkit-transform: translateX(4px); }
    70% { -webkit-transform: translateX(-3px); }
    80% { -webkit-transform: translateX(2px); }
    90% { -webkit-transform: translateX(-1px); }
}

@keyframes uk-shake {
    0%, 100% { transform: translateX(0); }
    10% { transform: translateX(-9px); }
    20% { transform: translateX(8px); }
    30% { transform: translateX(-7px); }
    40% { transform: translateX(6px); }
    50% { transform: translateX(-5px); }
    60% { transform: translateX(4px); }
    70% { transform: translateX(-3px); }
    80% { transform: translateX(2px); }
    90% { transform: translateX(-1px); }
}


/* Keyframes: Fade with slide fixed
 * Used by dropdown and search component
 ========================================================================== */

/*
 * Top fixed
 */

@-webkit-keyframes uk-slide-top-fixed {
    0% {
        opacity: 0;
        -webkit-transform: translateY(-10px);
    }
    100% {
        opacity: 1;
        -webkit-transform: translateY(0);
    }
}

@keyframes uk-slide-top-fixed {
    0% {
        opacity: 0;
        transform: translateY(-10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/*
 * Bottom fixed
 */

@-webkit-keyframes uk-slide-bottom-fixed {
    0% {
        opacity: 0;
        -webkit-transform: translateY(10px);
    }
    100% {
        opacity: 1;
        -webkit-transform: translateY(0);
    }
}

@keyframes uk-slide-bottom-fixed {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}


// Hooks
// ========================================================================

@include hook-animation-misc();

// @mixin hook-animation-misc(){}
