
img.lazy-image{
    object-fit: cover;
    object-position: center;
    opacity: 0;
    border-radius: 5px;

    &.loaded {
        opacity: 1;
        width: 100% !important;
        height: 100% !important;
        transition: all 0.2s ease-out;
    }

    &.no-transition{
        transition: none !important;
    }
}

.gallery-block{
    width: 100%;
    height: auto;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 0;
    flex: 1;
    display: flex;
    flex-direction: column;

    .filters-container{
        /* margin-top: calc(50px * var(--scale)); */
        display: flex;
        align-items: center;
        justify-content: center;
        flex-wrap: wrap;
        gap: 5px;
        z-index: 1;
        position: sticky;
        bottom: 10px;
        background-color: white;
        border-radius: 15px;
        padding: 5px;
        box-shadow: black;
        box-shadow: 0px 2px 20px #0000006e;
        width: fit-content;
        margin-inline: auto;
        margin-top: auto;
        margin-bottom: 10px;

        .filter{
            padding: 10px 15px 10px 15px;
            border: none;
            border-radius: 10px;
            background-color: transparent;
            color: #634cab;
            font: calc(1rem * (var(--scale) * 0.5 + 0.5)) "Poppins", sans-serif;
            font-weight: 500;
            cursor: pointer;
            transition: border 0.1s ease, transform 0.01s ease-out;
            -webkit-tap-highlight-color: transparent;

            &:hover{
                background-color: #ffe2ed7a;
            }

            &.enabled{
                background-color: #ff4387ff;
                color: white;
            }

            &:active{
                transform: scale(0.98);
            }
        }
    }

    .gallery-container{
        margin-top: 10px;
        width: calc(100% - 100px);
        display: grid;
        grid-template-columns: repeat(8, 1fr);
        grid-auto-rows: 1fr;
        gap: 20px;
        padding: 10px;
        margin-left: auto;
        margin-right: auto;
        justify-content: center;
        grid-auto-flow: dense;
        margin-bottom: 15px;

        .gallery-item{
            background-color: transparent;
            border-radius: 5px;
            display: flex;
            justify-content: center;
            align-items: center;
            overflow: hidden;
            position: relative;
            aspect-ratio: 1 / 1;

            .image-info-overlay{
                width: 100%;
                height: 100%;
                background-image: linear-gradient(0deg, rgba(0,0,0,0.5) 0%, rgba(211, 0, 0, 0) 60%);
                opacity: 0;
                position: absolute;
                transition: opacity ease-out 0.2s;
                border: solid rgb(255, 255, 255, 1) 4px;
                border-radius: 5px;
                p{
                    bottom: -10px;
                    left: 15px;
                    position: absolute;
                    transition: bottom ease-out 0.1s;
                }

                &:hover{
                    opacity: 1;
                    cursor: pointer;

                    p{
                        bottom: 10px;
                    }
                }
            }

            &.item-1x1{
                grid-column: span 1;
                grid-row: span 1;
            }

            &.item-2x2{
                grid-column: span 2;
                grid-row: span 2;
            }

            &.hidden{
                display: none;
            }

        }
    }
}

.loading{
    background: linear-gradient(120deg, #ffffff82 30%, #ffffff 38%, #ffffff 40%, #ffffff82 50%);
    background-size: 200% 100%;
    background-position: 100% 0;
    animation: load 1.5s infinite;
    opacity: 0.8;
}

@keyframes load{
    100%{
        background-position: -100% 0;
    }
}

.gallery-viewer-container{
    position: fixed;
    width: 100%;
    height: 100%;
    align-items: center;
    top: 0;
    z-index: 5;
    pointer-events: none;
    backdrop-filter: contrast(0.5) brightness(0.2) saturate(1.5);

    .viewer-group{
        width: 95%;
        height: 95%;
        margin: auto;
        display: flex;
        align-items: center;
        pointer-events: none;

        .image-group{
            width: 70%;
            height: 100%;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            pointer-events: none;
            left: 0;
            position: relative;

            .images-container{
                width: 100%;
                height: 100%;
                display: flex;
                flex-direction: row;
                overflow: hidden;
                gap: 10px;

                div{
                    width: 100%;
                    height: 100%;
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    flex-shrink: 0;

                    .image-slot{
                        height: 500px;
                        width: 500px;
                        border-radius: 15px;
                        pointer-events: auto;
                        overflow: hidden;
                        display: flex;
                        align-items: center;
                        justify-content: center;
                        margin: auto;
                        flex-shrink: 0;
            
                        &.loading{
                            opacity: 0.5;
                        }
    
                        img.lazy-image{
                            width: 80%;
                            height: 80%;
                        }
                    }
                }
            }

            .arrow{
                background-color: rgba(255, 255, 255, 0.3);
                height: 35px;
                width: 35px;
                border-radius: 50%;
                position: absolute;
                pointer-events: auto;
                cursor: pointer;
                color: white;
                text-align: center;
                align-content: center;
                -webkit-user-select: none;
                user-select: none;

                &.left{
                    left: 20px;
                }

                &.right{
                    right: 20px;
                }

                &:hover{
                    background-color: rgba(255, 255, 255, 0.5);
                }

                &::after{
                    content: '';
                    display: block;
                    width: 70px;
                    height: 70px;
                    border-radius: 50%;
                    background-color: transparent;
                    position: absolute;
                    top: -17.5px;
                    left: -17.5px;
                }

                &.hidden{
                    display: none !important;
                }
            }

            .nav-items-container{
                display: flex;
                width: auto;
                padding: 20px;
                justify-content: center;
                align-items: center;
                pointer-events: auto;
                height: 50px;

                .nav-item{
                    width: 20px;
                    height: 20px;
                    pointer-events: auto;
                    cursor: pointer;
                    display: flex;
                    align-items: center;
                    justify-content: center;


                    &::after{
                        content: '';
                        display: block;
                        width: 10px;
                        height: 10px;
                        border-radius: 50%;
                        background-color: rgba(255, 255, 255, 0.4);
                        transition: background 0.1s ease;
                    }

                    &:hover::after{
                        background-color: rgba(255, 255, 255, 0.7);
                    }
                    
                    &.active::after {
                        background-color: rgb(255, 255, 255);
                    }
                }
            }
        }

        .side-group{
            width: 30%;
            height: 60%;
            margin-left: 50px;
            left: 0;
            display: flex;
            flex-direction: column;

            .contact-btn{
                pointer-events: auto;
                position: absolute;
                top: 0;
                right: 0;
                margin: 50px;
            }

            .title-container{

                h1{
                    margin-bottom: 20px;
                    color: #ff4387ff;
                    -moz-hyphens: auto;
                    -ms-hyphens: auto;
                    hyphens: auto;
                    word-wrap: break-word;
                    overflow-x: hidden;
                    width: fit-content;
                    pointer-events: auto;
                }
            }

            .description-container{
                height: auto;
                width: 100%;
                overflow-y: auto;
                pointer-events: auto;
                overscroll-behavior: contain;
                padding-right: 10px;

                p{
/*                     -moz-hyphens: auto;
                    -ms-hyphens: auto;
                    hyphens: auto; */
                    word-wrap: break-word;
                    overflow-x: hidden;
                    width: fit-content;
                }

                &::-webkit-scrollbar-track {
                    background: rgba(0, 0, 0, 0);
                }

                &::-webkit-scrollbar {
                    width: 8px;
                    height: 8px;
                }

                &::-webkit-scrollbar-thumb {
                    border-radius: 10px;
                }
            }
        }
    }
}

@media (max-width: 1200px){
    .gallery-block{   
        .gallery-container{
            grid-template-columns: repeat(6, 1fr);
            width: calc(100% - 40px);
        }
    }
}

@media (max-width: 767px){
    .gallery-block{
        margin-bottom: 0;

        .filters-container{
            gap: 0;
            width: 100%;
            bottom: 0;
            overflow-x: auto;
            overflow-y: hidden;
            display: flex;
            border-radius: 0;
            pointer-events: all;
            padding-inline: 10px;
            justify-content: space-evenly;
            -ms-overflow-style: none;
            scrollbar-width: none;
            flex-wrap: nowrap;
            margin-bottom: 0;
            box-shadow: 0 -2px 30px #0000001f;
            
            .filter{
                padding: 5px 15px 5px 15px;
                height: 45px;
                font: 0.8rem "Poppins", sans-serif;
                border-width: 2px;
                padding-top: 0;
                padding-bottom: 0;
                white-space: nowrap;

                &:hover{
                    border-color: #ff4387ff;
    
                    &.enabled{
                        border-color: #ff4387ff;
                    }
                }
            }

            &::-webkit-scrollbar {
                display: none;
            }
        }
    
        .gallery-container{
            grid-template-columns: repeat(4, 1fr);
            margin-left: 0;
            margin-right: 0;
            margin-top: 10px;
            width: 100%;
            gap: 10px;

            .gallery-item{
    
                .image-info-overlay{
                    border: none;

                    p{
                        display: none;
                    }
                }
            }
        }
    }

    .gallery-viewer-container{   
        .viewer-group{
            flex-direction: column;
            width: calc(100vw - 25px);
            height: calc(100% - 30px);
            margin-bottom: 25px;

            .image-group{    
                width: 100%;
                max-height: calc(100% - 180px);
                margin: auto;

                .nav-items-container{
                    padding: 0;
                    padding-top: 10px;
                    height: auto;
    
                    .nav-item{
                        width: 10px;
                        height: 10px;
                        pointer-events: none;
                        cursor: auto;
                    }
    
                    .nav-item::after{
                        width: 5px;
                        height: 5px;
                    }
                }

                .arrow{
                    display: none;
                }
            }

            .side-group{
                width: 93%;
                height: auto;
                max-height: 170px;
                margin-left: 0;

                .contact-btn{
                    margin: 15px;
                }

                .title-container{
                    margin-top: 15px;

                    h1{
                        font-size: 1rem;
                    }
                }

                .description-container{
    
                    &::-webkit-scrollbar {
                        width: 4px;
                        height: 4px;
                    }
    
                    &::-webkit-scrollbar-thumb {
                        border-radius: 10px;
                    }
                }
            }
        }
    }   
}