@import '../../config/variables.css';

.proportional-resize {
    max-width: 100%;
    height: auto;
    width: auto;
}
/*
How this works: the image needs a max-height to fit inside the viewport. max-height and max-width is set inline
on the element, but max-height is overridden here up to 1800px (device-height) with an !important declaration.
We scale off 40 extra pixels to accommodate for browser chrome.

Why all this repetition instead of `calc(100vh - 40px)`? Because Chrome on Android (and possibly other browsers),
when the page is scrolled and the browser chrome disappears, will recalculate `vh` which might lead to a jump.
*/
@media (device-height <= 1800px) {
    .gallery-image { max-height: 1660px !important; }
}
@media (device-height <= 1700px) {
    .gallery-image { max-height: 1560px !important; }
}
@media (device-height <= 1600px) {
    .gallery-image { max-height: 1460px !important; }
}
@media (device-height <= 1500px) {
    .gallery-image { max-height: 1360px !important; }
}
@media (device-height <= 1400px) {
    .gallery-image { max-height: 1260px !important; }
}
@media (device-height <= 1300px) {
    .gallery-image { max-height: 1160px !important; }
}
@media (device-height <= 1200px) {
    .gallery-image { max-height: 1060px !important; }
}
@media (device-height <= 1100px) {
    .gallery-image { max-height: 960px !important; }
}
@media (device-height <= 1000px) {
    .gallery-image { max-height: 860px !important; }
}
@media (device-height <= 900px) {
    .gallery-image { max-height: 760px !important; }
}
@media (device-height <= 800px) {
    .gallery-image { max-height: 660px !important; }
}
@media (device-height <= 700px) {
    .gallery-image { max-height: 560px !important; }
}
@media (device-height <= 600px) {
    .gallery-image { max-height: 460px !important; }
}
@media (device-height <= 500px) {
    .gallery-image { max-height: 360px !important; }
}
@media (device-height <= 400px) {
    .gallery-image { max-height: 260px !important; }
}
@media (device-height <= 300px) {
    .gallery-image { max-height: 160px !important; }
}
/* iOS does not change device-width on rotation, so special-case for known Apple device screen dimensions */
/* TODO: IE has the same behavior as iOS? */
/* iPad */
@media (device-width: 768px) and (device-height: 1024px) and (orientation: portrait) {
    .gallery-image { max-height: 984px !important; }
}
@media (device-width: 768px) and (device-height: 1024px) and (orientation: landscape) {
    .gallery-image { max-height: 728px !important; }
}
/* iPhone 6 Plus */
@media (device-width: 414px) and (device-height: 736px) and (orientation: portrait) {
    .gallery-image { max-height: 374px !important; }
}
@media (device-width: 414px) and (device-height: 736px) and (orientation: landscape) {
    .gallery-image { max-height: 696px !important; }
}
/* iPhone 6 */
@media (device-width: 375px) and (device-height: 667px) and (orientation: portrait) {
    .gallery-image { max-height: 627px !important; }
}
@media (device-width: 375px) and (device-height: 667px) and (orientation: landscape) {
    .gallery-image { max-height: 335px !important; }
}
/* iPhone 5 */
@media (device-width: 320px) and (device-height: 568px) and (orientation: portrait) {
    .gallery-image { max-height: 528px !important; }
}
@media (device-width: 320px) and (device-height: 568px) and (orientation: landscape) {
    .gallery-image { max-height: 280px !important; }
}
/* iPhone 4 */
@media (device-width: 320px) and (device-height: 480px) and (orientation: portrait) {
    .gallery-image { max-height: 440px !important; }
}
@media (device-width: 320px) and (device-height: 480px) and (orientation: landscape) {
    .gallery-image { max-height: 280px !important; }
}

.centered-element {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    margin: auto;
}

.lightbox {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
    background: #000000;
    background: rgba(0, 0, 0, .9);
}

.lightbox-content {
    display: -ms-flexbox;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.lightbox-body {
    flex: 1 0 auto;
    position: relative;
}

.lightbox-image-currentimage {
    max-width: 100%;
    max-height: 100%;
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    margin: auto;
}

.lightbox-image-wrapper {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    margin: auto;
    width: 100%; /* This is needed to center the image in IE 11, because we set max-width */
    height: 100%;
}

.lightbox-imagecounter {
    width: 60%;
    padding-left: 40%;
    text-align: center;
}

.lightbox-buttons {
    width: 40%;
    text-align: right;
}

@media (max-width: 640px) {
    .lightbox-imagecounter {
        padding-left: 20px;
        width: 30%;
        text-align: left;
    }

    .lightbox-buttons { width: 70%; }
}

.lightbox-left,
.lightbox-right {
    position: absolute;
    top: 50%;
    top: calc(50% - 22px);
    opacity: .5;
}

.lightbox-left { left: 20px; }

.lightbox-right { right: 20px; }
.lightbox-left:hover,
.lightbox-right:hover { opacity: 1; }

.lightbox-thumbs-wrapper {
    display: -ms-flexbox;
    display: flex;
    -ms-flex-pack: center;
    justify-content: center;
    -ms-flex-align: center;
    align-items: center;
    flex-direction: column;
    flex: 1 0 0%;
    overflow-y: auto; /* Needed for Firefox */
}

.lightbox-thumbs {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    /* IE bug: https://github.com/philipwalton/flexbugs#2-column-flex-items-set-to-align-itemscenter-overflow-their-container */
    max-width: 100%;
}

.lightbox-thumbs-image {
    display: inline-block;
    line-height: 100%;
    padding: 2px 3px;
}
/* stuff for thumbs on object page */
.more-images {
    position: absolute;
    bottom: 0;
    right: 0;
    text-shadow: 0 1px 1px rgba(0,0,0,.3);
    background-color: rgba(0,0,0,.65);
}

.thumbs-slider {
    margin-top: 5px;
    padding-left: 5px;
    height: 69px;
    white-space: nowrap;
    overflow-y: hidden;
    overflow-x: scroll;
    -webkit-overflow-scrolling: touch;
    font-size: 0;
}

.thumb {
    max-width: 84px;
    max-height: 84px;
    margin: 0 5px 0 0;
    border: solid 2px transparent;
}

.activethumb { border: solid 2px var(--secondary-blue); }
