/* === Pages === */

// Pages animations
@pageDuration: 400ms;

.pages {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
}
.page {
    box-sizing: border-box;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: #efeff4;
    .translate3d(0,0,0);
    &.cached {
        display: none;
    }
}
.page-on-left {
    opacity: 0.9;
    .translate3d(-20%);
}
.page-on-center {
    .swipeback-page-shadow {
        opacity: 1;
    }
}
.page-on-right {
    .translate3d(100%);
    .swipeback-page-shadow {
        opacity: 0;
    }
}
.page-content {
    .scrollable();
    box-sizing: border-box;
    height: 100%;
    position: relative;
    z-index: 1;
}

// Page Shadow
.page-fake-shadow() {
    position: absolute;
    right: 100%;
    top: 0;
    width: 16px;
    height: 100%;
    background: -webkit-linear-gradient(left, rgba(0,0,0,0) 0%, rgba(0,0,0,0) 10%, rgba(0,0,0,0.01) 50%, rgba(0,0,0,0.2) 100%);
    background: linear-gradient(to right, rgba(0,0,0,0) 0%, rgba(0,0,0,0) 10%, rgba(0,0,0,0.01) 50%, rgba(0,0,0,0.2) 100%);
    z-index: -1;
    content: '';
    html.android & {
        display: none;
        .animation(none);
    }
}
.swipeback-page-shadow {
    .page-fake-shadow();
}


//Class that will trigger transition during page custom transitions (like swipe-back)
.page-transitioning {
    &, .swipeback-page-shadow {
        .transition(@pageDuration);
    }
}
.page-from-right-to-center, .page-from-center-to-right {
    &:before {
        .page-fake-shadow();
    }
}
// From/to Right To/from Center animations
.page-from-right-to-center {
    &:before {
        .animation(pageFromRightToCenterShadow @pageDuration forwards);
    }
    .animation(pageFromRightToCenter @pageDuration forwards);
}
.page-from-center-to-right {
    &:before {
        .animation(pageFromCenterToRightShadow @pageDuration forwards);
    }
    .animation(pageFromCenterToRight @pageDuration forwards);
}
@-webkit-keyframes pageFromRightToCenter {
    from {
        -webkit-transform: translate3d(100%,0,0);
    }
    to {
        -webkit-transform: translate3d(0,0,0);
    }
}
@keyframes pageFromRightToCenter {
    from {
        transform: translate3d(100%,0,0);
    }
    to {
        transform: translate3d(0,0,0);
    }
}
@-webkit-keyframes pageFromRightToCenterShadow {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}
@keyframes pageFromRightToCenterShadow {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}
@-webkit-keyframes pageFromCenterToRight {
    from {
        -webkit-transform: translate3d(0,0,0);
    }
    to {
        -webkit-transform: translate3d(100%,0,0);
    }
}
@keyframes pageFromCenterToRight {
    from {
        transform: translate3d(0,0,0);
    }
    to {
        transform: translate3d(100%,0,0);
    }
}
@-webkit-keyframes pageFromCenterToRightShadow {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}
@keyframes pageFromCenterToRightShadow {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}


// From/to Center To/from Left animations
.page-from-center-to-left {
    .animation(pageFromCenterToLeft @pageDuration forwards);
}
.page-from-left-to-center {
    .animation(pageFromLeftToCenter @pageDuration forwards);
}

@-webkit-keyframes pageFromCenterToLeft {
    from {
        opacity: 1;
        -webkit-transform: translate3d(0,0,0);
    }
    to {
        opacity: 0.9;
        -webkit-transform: translate3d(-20%,0,0);
    }
}
@keyframes pageFromCenterToLeft {
    from {
        transform: translate3d(0,0,0);
    }
    to {
        opacity: 0.9;
        transform: translate3d(-20%,0,0);
    }
}
@-webkit-keyframes pageFromLeftToCenter {
    from {
        opacity: 0.9;
        -webkit-transform: translate3d(-20%,0,0);
    }
    to {
        opacity: 1;
        -webkit-transform: translate3d(0,0,0);
    }
}
@keyframes pageFromLeftToCenter {
    from {
        transform: translate3d(-20%,0,0);
    }
    to {
        opacity: 1;
        transform: translate3d(0,0,0);
    }
}