html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    color: #fff;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    overflow: hidden;
    /* Lock the page from any scrolling, rubber-band, pull-to-refresh,
     * pinch-zoom, or text-selection gestures on mobile. */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    -webkit-overflow-scrolling: auto;
    overscroll-behavior: none;
    -ms-touch-action: none;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

#apodStage {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    z-index: 1;
    overflow: hidden;
}

.apodLayer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    background-position: center center;
    background-repeat: no-repeat;
    background-size: cover;
    opacity: 0;
    -webkit-transition: opacity 1500ms ease-in-out;
    -moz-transition: opacity 1500ms ease-in-out;
    -o-transition: opacity 1500ms ease-in-out;
    transition: opacity 1500ms ease-in-out;
    -webkit-transform: scale(1.0);
    -moz-transform: scale(1.0);
    -ms-transform: scale(1.0);
    -o-transform: scale(1.0);
    transform: scale(1.0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.apodLayer.apodVisible {
    opacity: 1;
}

/* Ken Burns animation variants. Applied as a class so we can rotate
 * through them and keep adjacent slides feeling distinct.
 */
.apodKB1 {
    -webkit-animation: apodKenBurns1 18s ease-in-out forwards;
    -moz-animation: apodKenBurns1 18s ease-in-out forwards;
    -o-animation: apodKenBurns1 18s ease-in-out forwards;
    animation: apodKenBurns1 18s ease-in-out forwards;
}

.apodKB2 {
    -webkit-animation: apodKenBurns2 18s ease-in-out forwards;
    -moz-animation: apodKenBurns2 18s ease-in-out forwards;
    -o-animation: apodKenBurns2 18s ease-in-out forwards;
    animation: apodKenBurns2 18s ease-in-out forwards;
}

.apodKB3 {
    -webkit-animation: apodKenBurns3 18s ease-in-out forwards;
    -moz-animation: apodKenBurns3 18s ease-in-out forwards;
    -o-animation: apodKenBurns3 18s ease-in-out forwards;
    animation: apodKenBurns3 18s ease-in-out forwards;
}

.apodKB4 {
    -webkit-animation: apodKenBurns4 18s ease-in-out forwards;
    -moz-animation: apodKenBurns4 18s ease-in-out forwards;
    -o-animation: apodKenBurns4 18s ease-in-out forwards;
    animation: apodKenBurns4 18s ease-in-out forwards;
}

@-webkit-keyframes apodKenBurns1 {
    0% {
        -webkit-transform: scale(1.00) translate(0%, 0%);
    }

    100% {
        -webkit-transform: scale(1.18) translate(-3%, -2%);
    }
}

@keyframes apodKenBurns1 {
    0% {
        transform: scale(1.00) translate(0%, 0%);
    }

    100% {
        transform: scale(1.18) translate(-3%, -2%);
    }
}

@-webkit-keyframes apodKenBurns2 {
    0% {
        -webkit-transform: scale(1.18) translate(2%, 2%);
    }

    100% {
        -webkit-transform: scale(1.00) translate(0%, 0%);
    }
}

@keyframes apodKenBurns2 {
    0% {
        transform: scale(1.18) translate(2%, 2%);
    }

    100% {
        transform: scale(1.00) translate(0%, 0%);
    }
}

@-webkit-keyframes apodKenBurns3 {
    0% {
        -webkit-transform: scale(1.05) translate(-2%, 1%);
    }

    100% {
        -webkit-transform: scale(1.20) translate(2%, -1%);
    }
}

@keyframes apodKenBurns3 {
    0% {
        transform: scale(1.05) translate(-2%, 1%);
    }

    100% {
        transform: scale(1.20) translate(2%, -1%);
    }
}

@-webkit-keyframes apodKenBurns4 {
    0% {
        -webkit-transform: scale(1.20) translate(-2%, -2%);
    }

    100% {
        -webkit-transform: scale(1.04) translate(1%, 2%);
    }
}

@keyframes apodKenBurns4 {
    0% {
        transform: scale(1.20) translate(-2%, -2%);
    }

    100% {
        transform: scale(1.04) translate(1%, 2%);
    }
}

/* Invisible touch surface that catches swipes anywhere on the image.
 * Sits below the title bar / QR code / counter so those still receive
 * their own clicks, but above the image layers. */
#apodTouchSurface {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 4;
    background: transparent;
    -ms-touch-action: pan-y;
    touch-action: pan-y;
    cursor: pointer;
}

#apodVignette {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 2;
    background-image:
        -webkit-linear-gradient(top, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0) 25%, rgba(0, 0, 0, 0) 65%, rgba(0, 0, 0, 0.75) 100%);
    background-image:
        linear-gradient(to bottom, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0) 25%, rgba(0, 0, 0, 0) 65%, rgba(0, 0, 0, 0.75) 100%);
}

#apodTitleBar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 32px 56px 40px 56px;
    z-index: 5;
    color: #fff;
    text-shadow: 0 2px 8px #000, 0 0 18px rgba(0, 0, 0, 0.7);
    -webkit-transition: opacity 800ms ease;
    transition: opacity 800ms ease;
    pointer-events: none;
}

#apodTitle {
    font-size: 44px;
    font-weight: 300;
    letter-spacing: 0.5px;
    line-height: 1.15;
    margin-bottom: 10px;
    max-width: 1400px;
}

#apodMeta {
    font-size: 18px;
    color: #ddd;
    font-weight: 300;
    letter-spacing: 1px;
    text-transform: uppercase;
}

#apodDate {
    color: #6cf;
    margin-right: 16px;
}

#apodCopyright {
    color: #aaa;
    font-style: italic;
    text-transform: none;
    letter-spacing: 0;
}

#apodCounter {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 6;
    color: #6cf;
    font-size: 16px;
    font-weight: 300;
    letter-spacing: 3px;
    text-shadow: 0 1px 4px #000;
    background-color: rgba(0, 0, 0, 0.45);
    padding: 6px 12px;
    border-radius: 4px;
    pointer-events: none;
}

#apodQrCode {
    display: block;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 6;
    width: 112px;
    height: 112px;
    padding: 8px;
    box-sizing: content-box;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
    opacity: 0.92;
    text-align: center;
    line-height: 0;
    font-size: 0;
}

#apodQrCode img,
#apodQrCode canvas,
#apodQrCode table {
    display: block;
    margin: 0 auto;
    width: 112px;
    height: 112px;
}

#apodHelp {
    position: fixed;
    top: 148px;
    left: 16px;
    z-index: 6;
    color: #ddd;
    font-size: 13px;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 6px 10px;
    border-radius: 4px;
    max-width: 220px;
    text-shadow: 0 1px 2px #000;
    pointer-events: none;
}

#apodStatus {
    position: fixed;
    bottom: 4px;
    right: 8px;
    z-index: 7;
    color: #555;
    font-size: 11px;
    text-shadow: 0 1px 2px #000;
    pointer-events: none;
}

/* Loading shimmer for the title before the slideshow starts */
.apodLoading #apodTitle {
    color: #6cf;
    font-style: italic;
}

/* Portrait tablet / small viewer adjustments */
@media (max-width: 960px) {
    #apodTitle {
        font-size: 28px;
    }

    #apodMeta {
        font-size: 14px;
    }

    #apodTitleBar {
        padding: 20px 24px 28px 24px;
    }

    #apodQrCode {
        width: 88px;
        height: 88px;
        padding: 6px;
    }

    #apodQrCode img,
    #apodQrCode canvas,
    #apodQrCode table {
        width: 88px;
        height: 88px;
    }

    #apodHelp {
        display: none;
    }
}

@media (max-width: 540px) {
    #apodTitle {
        font-size: 20px;
        margin-bottom: 6px;
    }

    #apodMeta {
        font-size: 11px;
    }

    #apodTitleBar {
        padding: 16px 16px 18px 16px;
    }

    #apodCounter {
        top: 10px;
        right: 10px;
        font-size: 13px;
        letter-spacing: 2px;
        padding: 5px 9px;
    }

    #apodQrCode {
        width: 64px;
        height: 64px;
        padding: 5px;
        top: 10px;
        left: 10px;
        border-radius: 6px;
    }

    #apodQrCode img,
    #apodQrCode canvas,
    #apodQrCode table {
        width: 64px;
        height: 64px;
    }

    #apodHelp {
        display: none;
    }
}

/* Portrait phones — keep the title bar compact and the corner badges small,
 * since the image is tall and the title is the only thing competing with it. */
@media (orientation: portrait) and (max-width: 720px) {
    #apodTitleBar {
        padding: 14px 14px 16px 14px;
    }

    #apodTitle {
        font-size: 18px;
        line-height: 1.2;
    }

    #apodMeta {
        font-size: 10px;
        letter-spacing: 1px;
    }

    #apodDate {
        margin-right: 10px;
    }
}

/* Very short viewports (landscape phones) — pull title in tight so it
 * never overlaps the bottom of the image. */
@media (max-height: 500px) {
    #apodTitleBar {
        padding: 10px 16px 12px 16px;
    }

    #apodTitle {
        font-size: 16px;
        margin-bottom: 4px;
    }

    #apodMeta {
        font-size: 10px;
    }

    #apodQrCode {
        width: 56px;
        height: 56px;
        padding: 4px;
    }

    #apodQrCode img,
    #apodQrCode canvas,
    #apodQrCode table {
        width: 56px;
        height: 56px;
    }
}