*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #d8d2ca;
    overflow-x: hidden;
    overflow-y: scroll;
}

header .nav {
    height: 60px;
}

.container.nav.hidden {
    display: none;
}

main.container {
    padding: 0;
}

.gallery {
    position: relative;
    width: 100%;
    display: grid;
    justify-content: space-between;
    justify-items: center;
    align-items: center;
    --left: 0;
    --top: 0;
    --zoom: 1;
    --trans-dur: .8s;
    transition-property: --left, --top, --zoom;
    transition-duration: var(--trans-dur), var(--trans-dur), calc(.75 * var(--trans-dur));
    transition-delay: 0s, 0s, calc(.25 * var(--trans-dur));
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transform: translate(var(--left), var(--top)) scale(var(--zoom));
}

.gallery-container {
    padding-top: 60px;
    padding-bottom: 60px;
    transition: padding-top 0.8s;
}

.gallery-container.zoomed-in {
    padding: 0;
}

.gallery-container.zoomed-in>.gallery {
    transition-duration: var(--trans-dur), var(--trans-dur), calc(.6 * var(--trans-dur));
    transition-delay: 0s;
}

@keyframes zoom-in {
    to {
        --left-cur: var(--left);
        --top-cur: var(--top);
    }
}

.gallery-item {
    position: relative;
    grid-column-end: span 2;
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    justify-content: flex-end;
}

.gallery-item-perspective,
.gallery-item-strings-perspective {
    perspective: 800px;
}

.gallery-item-perspective {
    position: relative;
    z-index: 1;
    display: block;
    text-decoration: none;
    outline: none;
}

.gallery-item-card {
    opacity: 0;
    height: 24px;
    width: 38px;
    position: fixed;
    background-color: white;
    transform: translate(50px, 0px);
    border: 1px solid rgba(199, 199, 199, 0.7);
    box-shadow: 4px 6px 6px rgba(0, 0, 0, 0.7);
    transition: opacity 0.8s ease-in-out;
    cursor: zoom-in;
}

.gallery-item-card-title {
    font-size: 3px;
    margin: 3px;
}

.gallery-item-card-content {
    font-size: 2px;
    margin: 3px;
}

.gallery-item-body {
    opacity: 0;
    font-size: 8px;
    width: 100%;
    height: 100%;
    position: absolute;
    left: 0;
    top: 0;
    background-color: rgba(255, 255, 255, 0.797);
    transition: opacity 0.8s ease-in-out;
}

.gallery-item-body-title {
    font-size: 15px;
    font-weight: bold;
    margin: 5px;
    color: #333333;
}

.gallery-item-body-time {
    margin: 5px;
    color: #666666;
}

.gallery-item-body-content {
    margin: 5px;
    color: #555555;
}

.gallery-item-body-more {
    margin: 5px;
    color: #777777;
    position: absolute;
    bottom: 0;
    right: 0;
}

.gallery-container:not(.zoomed-in) .gallery-item-perspective:hover+.gallery-item-strings-perspective .gallery-item-strings,
.gallery-container:not(.zoomed-in) .gallery-item-perspective:hover .gallery-item-wrap {
    animation: wobble 0.9s ease-in-out;
}

.gallery-container:not(.zoomed-in) .gallery-item-perspective:focus-visible+.gallery-item-strings-perspective .gallery-item-strings,
.gallery-container:not(.zoomed-in) .gallery-item-perspective:focus-visible .gallery-item-wrap {
    animation: wobble 0.9s ease-in-out;
}

@keyframes wobble {
    15% {
        transform: rotateY(10deg);
    }

    40% {
        transform: rotateY(-7deg);
    }

    60% {
        transform: rotateY(4deg);
    }

    78% {
        transform: rotateY(-2deg);
    }

    89% {
        transform: rotateY(1deg);
    }

    100% {
        transform: none;
    }
}

.gallery-item-wrap {
    padding: 12px;
    background: var(--frame);
    cursor: pointer;
    box-shadow: 4px 6px 6px rgba(0, 0, 0, 0.7);
    transition: 0.25s;
    z-index: 1;
}

.gallery-item-strings-perspective {
    position: absolute;
    z-index: -1;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    display: flex;
}

.gallery-item-strings {
    flex: auto;
}

.gallery-item-strings::before,
.gallery-item-strings::after {
    content: "";
    position: absolute;
    bottom: 50%;
    width: 1px;
    background: #f6ede4;
    box-shadow: 4px 0 3px rgba(0, 0, 0, 0.4);
    pointer-events: none;
}

.gallery-item-strings::before {
    left: 7%;
}

.gallery-item-strings::after {
    right: 7%;
}

.gallery-item-overlay {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.25);
    transition: opacity var(--trans-dur);
}

.gallery-item.current .gallery-item-overlay {
    opacity: 0;
    transition-duration: 0.8s;
}

.gallery-img {
    display: block;
    max-width: 100%;
}

@media (max-width: 899px) {
    .gallery {
        grid-template-columns: repeat(4, 1fr);
        gap: 13vw;
        padding: 8% 8%;
    }

    .gallery-item:nth-child(3n+3) {
        grid-column-start: 2;
    }

    .gallery-item .gallery-item-strings::before,
    .gallery-item .gallery-item-strings::after {
        height: 40vw;
    }

    .gallery-item:nth-child(3n+1) .gallery-item-strings::before,
    .gallery-item:nth-child(3n+2) .gallery-item-strings::after {
        height: 100vw;
    }

    .gallery-item-card {
        transform: translate(0px, 36px);
    }

    .gallery-item-body {
        font-size: 5px;
    }

    .gallery-item-body-title {
        font-size: 10px;
    }
}

@media (min-width: 900px) {
    .gallery {
        grid-template-columns: repeat(6, 1fr);
        gap: 9vw;
        padding: 7% 18%;
    }

    .gallery-item:nth-child(5n+4) {
        grid-column-start: 2;
    }

    .gallery-item .gallery-item-strings::before,
    .gallery-item .gallery-item-strings::after {
        height: 20vw;
    }

    .gallery-item:nth-child(5n+1) .gallery-item-strings::before,
    .gallery-item:nth-child(5n+3) .gallery-item-strings::after {
        height: 63vw;
    }
}

.link-to-page-cont {
    position: fixed;
    right: 10px;
    bottom: 10px;
    animation: fade-in 0.7s 5s backwards;
}

@keyframes fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.link-to-page {
    display: block;
    padding: 0.4em 0.8em;
    background: #d8d2ca;
    border: 1px solid;
    border-radius: 3px;
    color: #bf8040;
    font-size: 1rem;
    text-decoration: none;
    transition: 0.25s;
}

.link-to-page:hover,
.link-to-page:focus {
    color: #bf5540;
}

.toggle-fullscreen-btn {
    z-index: 2;
    opacity: 0.5;
}