
img.lazy-image{
    object-fit: cover;
    object-position: center;
    opacity: 0;
    border-radius: 15px;

    &.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: 20px;

    .filters-container{
        /* margin-top: calc(50px * var(--scale)); */
        display: flex;
        align-items: center;
        justify-content: center;
        flex-wrap: wrap;
        gap: 30px;

        .filter{
            padding: 5px 15px 5px 15px;
            border-radius: 50px;
            border: solid 3px #ff4387ff;
            background-color: transparent;
            color: white;
            font: calc(1.2rem * (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;

            &.enabled{
                background-color: #ff4387ff;
            }

            &:hover{
                border-color: rgb(255, 255, 255);

                &.enabled{
                    border-color: rgb(255, 146, 186);
                }
            }

            &:active{
                transform: scale(0.98);
            }
        }
    }

    .gallery-container{
        margin-top: 75px;
        width: calc(100% - 10px);
        display: grid;
        grid-template-columns: repeat(auto-fill, 250px);
        grid-auto-rows: 250px;
        gap: 15px;
        padding: 10px;
        margin-left: auto;
        margin-right: auto;
        justify-content: center;
        grid-auto-flow: dense;


        .gallery-item{
            background-color: transparent;
            border-radius: 15px;
            display: flex;
            justify-content: center;
            align-items: center;
            overflow: hidden;
            position: relative;

            .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: 15px;
                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,
        #ffffffe3 30%,
        #ffffff 38%,
        #ffffff 40%,
        #ffffffe3 50%
    );
    background-size: 200% 100%;
    background-position: 100% 0;
    animation: load 1.5s infinite;
    opacity: 0.3;
}

@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: 85%;
        height: 85%;
        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;

            .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: 767px){
    .gallery-block{
    
        .filters-container{
            gap: 15px;
            margin-left: 10px;
            margin-right: 10px;
            
            .filter{
                height: 30px;
                font: 0.8rem "Poppins", sans-serif;
                border-width: 2px;
                padding-top: 0;
                padding-bottom: 0;

                &:hover{
                    border-color: #ff4387ff;
    
                    &.enabled{
                        border-color: #ff4387ff;
                    }
                }
            }
        }
    
        .gallery-container{
            grid-template-columns: repeat(auto-fill, calc(50vw - 15px));
            grid-auto-rows: calc(50vw - 15px);
            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;

                .title-container{
                    margin-top: 15px;

                    h1{
                        font-size: 1rem;
                    }
                }

                .description-container{
    
                    &::-webkit-scrollbar {
                        width: 4px;
                        height: 4px;
                    }
    
                    &::-webkit-scrollbar-thumb {
                        border-radius: 10px;
                    }
                }
            }
        }
    }   
}