#projecten {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    width: 100%;
    gap: 1rem;

    @media screen and (max-width: 767px) {
        grid-template-columns: 1fr 1fr;
    }

    @media screen and (max-width: 512px) {
        grid-template-columns: 1fr;
    }

    .project {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 1rem;
        width: 100%;
        height: 25rem;
        color: var(--grey);

        img {
            width: 100%;
            border-radius: .625rem;
            aspect-ratio: 1/1;
            object-fit: cover;
            min-height: 0;
        }

        .name {
            font-size: 1rem;
            font-weight: 600;
            line-height: 1.1;
        }

        .location {
            font-size: .8rem;
            font-weight: 400;
            line-height: 1rem;
        }
    }
}

.filter {
    position: absolute;
    transform: translateY(-50%);
    inset: 50% max(7.5rem, calc(50% - calc(var(--max-content-width) / 2)));
    bottom: auto;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-auto-rows: 2.5rem;
    gap: .5rem;
    align-items: center;
    background-color: white;
    border-radius: 1.75rem;
    box-sizing: border-box;
    padding: .5rem;
    color: var(--grey);
    padding-right: 3rem;

    &[search-active] {
        .search {
            width: calc(100% - 1rem);

            .toggle {
                svg {
                    display: none;
    
                    &.close {
                        display: block;
                    }
                }
            }
        }

        .selects,
        label {
            opacity: 0;
            pointer-events: none;
        }
    }

    .selects {
        position: relative;
        display: flex;
        width: 100%;
        height: 100%;
        z-index: 0;
        opacity: 1;
        transition: opacity .3s ease;
        overflow: hidden;

        select {
            appearance: none;
            background: none;
            border: none;
            text-align: center;
            font-size: 1rem;
            transition: grid-column 1s ease;
            cursor: pointer;
            grid-row: 1;
            transition: color .3s ease;
            color: inherit;
            flex-shrink: 1;
            overflow: hidden;
            text-overflow: ellipsis;
            min-width: 0;
            width: 100%;
            outline: none;

            option {
                color: var(--grey);
            }

            &[selected] {
                color: white;
            }
        }

        .background {
            position: absolute;
            grid-column: 1;
            grid-row: 1;
            height: 100%;
            width: calc(100% / var(--select-count));
            background: var(--red);
            border-radius: 20rem;
            z-index: -1;
            left: calc(100% / var(--select-count) * var(--select-index));
            transition: background-color .3s ease, inset .3s ease;
        }
    }

    .search {
        position: absolute;
        display: flex;
        justify-content: right;
        align-items: center;
        height: 100%;
        background-color: white;
        border-radius: 5rem;
        z-index: 2;
        width: 2.5rem;
        justify-self: right;
        transition: width .3s ease;
        aspect-ratio: 1;
        height: 2.5rem;
        top: .5rem;
        right: .5rem;
        overflow: hidden;
        color: var(--grey);
        gap: 1rem;

        input {
            width: 100%;
            border: none;
            border-bottom: 1px solid var(--grey);
            padding: 1px 2px;
            margin: 0 2rem;
            outline: none;
            text-align: center;
            font-size: .875rem;
        }

        .toggle {
            box-sizing: border-box;
            padding: 0.47rem;
            aspect-ratio: 1;
            height: 100%;
            cursor: pointer;

            svg {
                pointer-events: none;
                &.close {
                    display: none;
                }
            }
        }
    }

    label {
        display: flex;
        align-items: center;
        gap: .5rem;
        color: white;
        background-color: var(--grey);
        border-radius: 5rem;
        height: 100%;
        padding: 0 1rem;
        cursor: pointer;
        user-select: none;
        white-space: nowrap;
        opacity: 1;
        transition: opacity .3s ease;

        &.first {
            margin-right: .5rem;
        }

        input {
            position: relative;
            appearance: none;
            width: 2.5rem;
            height: 1.2rem;
            background-color: #d3d3d3;
            border-radius: 5rem;
            transition: background-color .15s ease;
            transition-delay: .15s;
            pointer-events: none;
            margin-left: auto;

            &::before {
                position: absolute;
                content: '';
                height: calc(100% - 2px);
                top: 1px;
                width: calc(60% - 2px);
                left: 1px;
                background-color: var(--off-white);
                border-radius: 5rem;
                transform: translateX(0);
                transition: left .3s ease, transform .3s ease;
            }

            &:checked {
                background-color: var(--red);

                &::before {
                    left: calc(100% - 1px);
                    transform: translateX(-100%);
                }
            }
        }
    }

    .checkbox-group {
        display: flex;
        gap: .5rem;
        height: 100%;
        grid-column: span 2;
        justify-content: center;
    }

    @media screen and (max-width: 1000px) {
        & {
            display: grid;
            grid-template-columns: 1fr;
            grid-auto-rows: auto;
            padding: .75rem;
            width: 250px;
            left: 50%;
            transform: translate(-50%, -50%);

            .selects {
                display: grid;
                grid-template-columns: 1fr;
                grid-auto-rows: 2.5rem;

                select {
                    grid-row: auto;
                }

                .background {
                    height: 2.5rem;
                    width: 100%;
                    left: 0;
                    top: calc(100% / var(--select-count) * var(--select-index));
                }
            }

            .search {
                position: static;
                width: 100%;

                input {
                    width: 100%;
                }

                .toggle {
                    display: none;
                }
            }

            .checkbox-group {
                display: grid;
                grid-template-columns: 1fr;
                grid-auto-rows: 2.5rem;
                grid-column: span 1;
            }
        }
    }
}

.project-info {
    position: absolute;
    right: 5rem;
    bottom: 5rem;
    margin-bottom: var(--angled-padding-bottom);
    display: flex;
    flex-direction: column;
    text-align: right;
    align-items: center;

    .name {
        font-size: 2rem;
        line-height: 1;
    }

    .location {
        font-size: 1.2rem;
        line-height: 1;
    }

    a {
        margin-top: 1rem;
        font-size: .8rem;
        line-height: 1.2;
        color: white;
    }
}
