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


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

[class*='wk-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-wk-scrollspy*='wk-animation-']:not([data-wk-scrollspy*='target']) { opacity: 0; }

}

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

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

/*
 * Fade with scale
 */

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

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

/*
 * Fade with slide
 */

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

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

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

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

/*
 * Scale
 */

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

/*
 * Shake
 */

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


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

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


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

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


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

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

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

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

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

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

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

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

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


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

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

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


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

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

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


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

/*
 * Top
 */

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

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

/*
 * Bottom
 */

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

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

/*
 * Left
 */

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

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

/*
 * Right
 */

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

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


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

/*
 * Scale by 0.2
 */

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

@keyframes wk-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 wk-fade-scale-15 {
    0% {
        opacity: 0;
        -webkit-transform: scale(1.5);
    }
    100% {
        opacity: 1;
        -webkit-transform: scale(1);
    }
}

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

/*
 * Scale by 1.8
 */

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

@keyframes wk-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 wk-slide-left {
    0% { -webkit-transform: translateX(-100%); }
    100% { -webkit-transform: translateX(0); }
}

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

/*
 * Right
 */

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

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

/*
 * Left third
 */

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

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

/*
 * Right third
 */

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

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


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

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

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


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

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

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


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

@-webkit-keyframes wk-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 wk-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 wk-slide-top-fixed {
    0% {
        opacity: 0;
        -webkit-transform: translateY(-10px);
    }
    100% {
        opacity: 1;
        -webkit-transform: translateY(0);
    }
}

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

/*
 * Bottom fixed
 */

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

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


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

.hook-animation-misc;

.hook-animation-misc() {}
