/*
 * Copyright 2015 Vivliostyle Inc.
 */

[data-vivliostyle-page-container] {
    position: relative;
    overflow: hidden;
}

[data-vivliostyle-bleed-box] {
    position: absolute;
    overflow: hidden;
    max-width: 100%;
    max-height: 100%;
}

@media print {
    [data-vivliostyle-outer-zoom-box], [data-vivliostyle-spread-container] {
        width: 100% !important;
        height: 100% !important;
    }

    [data-vivliostyle-spread-container] {
        -moz-transform: none !important;
        -ms-transform: none !important;
        -webkit-transform: none !important;
        transform: none !important;
    }

    [data-vivliostyle-page-container] {
        display: block !important;
        page-break-after: always;
        height: 100% !important;
        max-height: 100%;
    }
}

@media screen {
    [data-vivliostyle-viewer-viewport] {
        background: #AAAAAA;
    }

    [data-vivliostyle-page-container] {
        background: white;
    }

    [data-vivliostyle-viewer-viewport] {
        display: -webkit-flex;
        display: flex;
    }

    [data-vivliostyle-outer-zoom-box] {
        margin: auto;
        overflow: visible;
        -webkit-flex: none;
        flex: none;
    }

    [data-vivliostyle-viewer-viewport][data-vivliostyle-viewer-status=complete] [data-vivliostyle-spread-container] {
        display: -webkit-flex;
        display: flex;
        -webkit-flex: none;
        flex: none;
        -webkit-justify-content: center;
        justify-content: center;
        -moz-transform-origin: left top;
        -ms-transform-origin: left top;
        -webkit-transform-origin: left top;
        transform-origin: left top;
    }

    [data-vivliostyle-viewer-viewport][data-vivliostyle-page-progression=ltr] [data-vivliostyle-spread-container] {
        -webkit-flex-direction: row;
        flex-direction: row;
    }
    [data-vivliostyle-viewer-viewport][data-vivliostyle-page-progression=rtl] [data-vivliostyle-spread-container] {
        -webkit-flex-direction: row-reverse;
        flex-direction: row-reverse;
    }

    [data-vivliostyle-viewer-viewport] [data-vivliostyle-page-container] {
        margin: 0 auto;
        -webkit-flex: none;
        flex: none;
    }
    [data-vivliostyle-viewer-viewport][data-vivliostyle-spread-view=true] [data-vivliostyle-page-container][data-vivliostyle-page-side=left] {
        margin-right: 1px;
        transform-origin: right center;
    }
    [data-vivliostyle-viewer-viewport][data-vivliostyle-spread-view=true] [data-vivliostyle-page-container][data-vivliostyle-page-side=right] {
        margin-left: 1px;
        transform-origin: left center;
    }
    [data-vivliostyle-viewer-viewport][data-vivliostyle-spread-view=true] [data-vivliostyle-page-container][data-vivliostyle-unpaired-page=true] {
        margin-left: auto;
        margin-right: auto;
        transform-origin: center center;
    }
}
