* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    line-height: 1.4;
    font-family: 'Roboto', sans-serif;
    color: #fff;
    background-color: #111;
    scroll-snap-type: both mandatory;
}

body {
    scroll-snap-type: both mandatory;
}

body.home {
    padding: 3rem;
}

@media (max-width: 990px) {
    body {
        scroll-snap-type: none;
    }

    body.home {
        padding: 1rem;
    }
}

a {
    color: inherit;
    text-decoration: none;
}


/*
 * Loading
 */
.loading {
    left: 50%;
    top: 50%;
    width: 4rem;
    height: 4rem;
    margin: -2rem 0 0 -2rem;
    border-radius: 50%;
    opacity: 0;
    background-color: rgba(0, 0, 0, .5);
    pointer-events: none;
    position: absolute;
}

.loading.is-active {
    opacity: 1;
}

.loading:before,
.loading:after {
    content: '';
    left: 50%;
    top: 50%;
    width: 2rem;
    height: 2rem;
    margin: -1rem 0 0 -1rem;
    border-radius: 50%;
    background-color: #fff;
    position: absolute;
    animation: loading 2s infinite;
}

.loading:after {
    animation: loading 2s infinite .5s;
}

@keyframes loading {
    0% { opacity: 0; transform: scale(0); }
    50% { opacity: .7; transform: scale(.5); }
    100% { opacity: 0; transform: scale(1); }
}

/* GALLERY LIST */
.gallery-list {
    width: 100%;
    margin-bottom: 2rem;
}

.gallery-list__heading {
    width: 100%;
    font-size: 3.4rem;
    line-height: 1;
    margin-bottom: .5rem;
    color: #333;
    font-weight: 800;
}

@media (max-width: 990px) {
    .gallery-list__heading {
        font-size: 2.4rem;
    }
}

.gallery-list__items {
    display: flex;
    flex-wrap: wrap;
}

.gallery-list__item {
    width: calc(20% - 2rem);
    margin: 0 0 2rem 2rem;
    background-color: #222;
    position: relative;
    overflow: hidden;
}

.gallery-list__item-wrapper {
    height: 0;
    width: 100%;
    padding-top: 100%;
}

.gallery-list__item:nth-child(5n+1) {
    margin-left: 0;
}

.gallery-list__item-image {
    width: 100%;
    transition: .25s;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    object-fit: cover;
    height: auto;
    vertical-align: top;
    position: absolute;
}

.gallery-list__item-content {
    left: 1rem;
    bottom: 1rem;
    width: calc(100% - 2rem);
    padding: .2rem .5rem;
    line-height: 1.2;
    overflow: hidden;
    position: absolute;
    text-transform: uppercase;
    mix-blend-mode: difference;
    transition: .25s;
}

.gallery-list__item-title {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
}

@media (max-width: 990px) {

    .gallery-list__item-title {
        font-size: 1.15rem;
    }

}

@media (min-width: 990px) {

    .gallery-list__item:hover .gallery-list__item-image {
        mix-blend-mode: difference;
    }

}

@media (max-width: 1900px) {

    .gallery-list__item,
    .gallery-list__item:nth-child(5n+1) {
        margin-left: 0;
        width: calc(25% - 1.5rem);
        margin: 0 0 2rem 2rem;
    }

    .gallery-list__item:nth-child(4n+1) {
        margin-left: 0;
    }

}

@media (max-width: 1440px) {

    .gallery-list__item,
    .gallery-list__item:nth-child(5n+1),
    .gallery-list__item:nth-child(4n+1) {
        width: calc(33.3% - 1rem);
        margin: 0 0 2rem 1.5rem;
    }

    .gallery-list__item:nth-child(3n+1) {
        margin-left: 0;
    }

}

@media (max-width: 800px) {

    .gallery-list__item,
    .gallery-list__item:nth-child(5n+1),
    .gallery-list__item:nth-child(4n+1),
    .gallery-list__item:nth-child(3n+1) {
        width: calc(50% - .5rem);
        margin: 0 0 1rem 1rem;
    }
    
    .gallery-list__item:nth-child(2n+1) {
        margin-left: 0;
    }

}

@media (max-width: 560px) {

    .gallery-list__item,
    .gallery-list__item:nth-child(5n+1),
    .gallery-list__item:nth-child(4n+1),
    .gallery-list__item:nth-child(3n+1),
    .gallery-list__item:nth-child(2n+1) {
        width: 100%;
        margin: 0 0 1rem 0;
    }

}

/*
 * Gallery header
 */
.gallery-header {
    left: 0;
    top: 0;
    z-index: 20;
    padding: 0 3rem;
    height: 4rem;
    width: 100%;
    display: flex;
    align-items: center;
    position: fixed;
    background-color: #111;
}

.gallery-header__heading {
    padding: 0 6rem;
    width: 100%;
    font-size: 1.6rem;
    margin: 0;
    text-align: center;
}

.gallery-header__actions {
    z-index: 2;
    height: 100%;
    top: 0;
    position: absolute;
    display: flex;
}

.gallery-header__actions--left {
    left: 0;
}

.gallery-header__actions--right {
    right: 0;
}

.gallery-header__actions-link {
    width: 3rem;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-header__actions-link-icon {
    fill: #fff;
    width: 50%;
}

.gallery-header__actions-link--previous .gallery-header__actions-link-icon {
    transform: rotate(90deg);
}

@media (max-width: 990px) {

    .gallery-header {
        padding: 0 2rem;
        height: auto;
        position: relative;
    }

    .gallery-header__heading {
        padding: 1rem;
        font-size: 1rem;
        line-height: 1.2;
    }

    .gallery-header__actions-link {
        width: 2rem;
    }

}


/*
 * Gallery preview
 */
.gallery-preview {
    padding: 0 3rem;
    width: 100vw;
    height: 100vh;
    overflow: auto;
    scroll-snap-type: both mandatory;
    scrollbar-width: thin;
    scrollbar-color: #fff #111;
}

.gallery-preview::-webkit-scrollbar {
    width: .75rem;
}

.gallery-preview::-webkit-scrollbar-track {
    background: #111;
}

.gallery-preview::-webkit-scrollbar-thumb {
    background-color: #fff;
    border-radius: 0;
    border: 3px solid #111;
}

@media (max-width: 990px) {

    .gallery-preview {
        padding: 0 1rem;
        scroll-snap-type: none;
    }

}

.gallery-preview__items {
    height: 100%;
    display: flex;
}

.gallery-preview__item {
    width: 100%;
    max-height: 100vh;
    padding: 4rem 0 3rem 0;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
}

[data-gallery-preview^="list"] .gallery-preview__item {
    scroll-snap-align: center;
}

.gallery-preview__item:last-child {
    margin-bottom: 0;
}

.gallery-preview__description {
    text-align: initial;
    display: block;
    max-width: 50rem;
}

.gallery-preview__description > *:first-child {
    margin-top: 0;
}

.gallery-preview__description > *:last-child {
    margin-bottom: 0;
}

.gallery-preview--masonry .gallery-preview__description {
    margin: 5rem auto 3rem auto;
}

/* Gallery preview list vertical */
.gallery-preview--list-vertical .gallery-preview__items {
    flex-direction: column;
    align-items: center;
}

.gallery-preview--list-vertical .gallery-preview__item {
    margin-bottom: 3rem;
    flex: 0 0 100%;
}

.gallery-preview--list-vertical .gallery-preview__item--description {
    padding: 6rem 0 0 0;
    margin-bottom: 0;
}

.gallery-preview--list-vertical .gallery-preview__item--description {
    max-width: 50rem;
}

/* Gallery preview list horizontal */
.gallery-preview--list-horizontal .gallery-preview__items:after {
    content: '';
    height: 100%;
    flex: 0 0 1px;
    display: block;
}

.gallery-preview--list-horizontal .gallery-preview__item {
    margin-right: 3rem;
    flex: 0 0 100%;
}

.gallery-preview--list-horizontal .gallery-preview__item--description {
    max-width: 50rem;
    margin-left: calc(50% - 25rem);
}

/* Gallery preview masonry */
.gallery-preview--masonry .gallery-preview__item {
    padding: 0;
}

@media (max-width: 990px) {

    .gallery-preview--list-horizontal .gallery-preview__items {
        flex-direction: column;
        align-items: center;
    }

    .gallery-preview__item {
        margin-bottom: 1rem;
        padding: 0;
    }

    .gallery-preview--list-vertical .gallery-preview__item,
    .gallery-preview--list-horizontal .gallery-preview__item {
        padding: 0;
        margin-bottom: 1rem;
        max-height: 100vh;
        flex: 0 0 auto;
        margin-right: 0;
    }

    .gallery-preview--list-horizontal .gallery-preview__item--description {
        margin-left: 0;
        max-width: 100%;
    }

    .gallery-preview__description,
    .gallery-preview--masonry .gallery-preview__description {
        margin: 1rem 0;
        font-size: .9rem;
    }

}

.gallery-preview__item-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    position: relative;
}

.gallery-preview__item-filler {
    max-width: 100%;
    max-height: 80vh;
    width: 100%;
    height: 0;
}

.gallery-preview--masonry .gallery-preview__item-image {
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    position: absolute;
}

.gallery-preview--default .gallery-preview__item.is-active .gallery-preview__item-filler {
    display: none;
}

.gallery-preview--default .gallery-preview__item-image {
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    position: absolute;
}

.gallery-preview--default .gallery-preview__item.is-active .gallery-preview__item-image {
    left: auto;
    top: auto;
    transform: none;
    position: relative;
}

/* Masonry: start the grid below the fixed gallery header (it is in normal flow below 991px). */
@media (min-width: 991px) {
    .gallery-preview--masonry .gallery-preview__items {
        margin-top: 4rem;
    }
}
