@keyframes background-fadeIn {
    from {background-color: transparent;}
    to {background-color: color-mix(in srgb, black 70%, transparent);}
}

@keyframes background-fadeOut {
    from {background-color: color-mix(in srgb, black 70%, transparent);}
    to {background-color: transparent;}
}

.ws-ressources-archive {
    display: flex;
    gap: 3.2rem;
}

.ws-ressources-archive__filters-slider {
    width: 28rem;
    flex-shrink: 0;

    @media (max-width: 1023px) {
        position: fixed;
        height: 100%;
        width: 38rem;
        top: 0;
        left: -40rem;
        padding: 2.4rem;
        z-index: 9999;
        background-color: white;
        transition: transform 0.3s ease-out;

        &::after {
            position: absolute;
            content: '';
            inset: 0;
            background-color: white;
            z-index: -1;
        }

        &.ws-shown {
            transform: translateX(40rem);

            &::before {
                position: fixed;
                content: '';
                inset: 0;
                width: calc(100vw + 40rem);
                z-index: -2;
                animation: background-fadeIn 0.3s forwards;
            }

            &.ws-closing::before {
                animation: background-fadeOut 0.3s forwards;
            }
        }

        &.ws-shown.ws-closing {
            transform: translateX(0);
        }

        & .ws-ressources-archive__filters-container {
            max-height: 100%;
        }
    }
}

.ws-ressources-archive__mobile-header {
    display: none;
    
    @media (max-width: 1023px) {
        display: block;
    }
}

.ws-ressources-archive__close-filter {
    position: absolute;
    top: 0;
    right: 0;
    cursor: pointer;
}

.ws-ressources-archive .ws-ressources-archive__mobile-title {
    width: 100%;
    font-size: 1.8rem;
    text-align: center;
    line-height: 1;
}

.ws-ressources-archive__filters-container {
    max-height: calc(100vh - 11rem);
    position: sticky;
    top: 10rem;
    display: flex;
    flex-direction: column;
    gap: 3.2rem;
}

.ws-ressources-archive__group {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;

    &.theme-group {
        min-height: 0;
    }
}

.ws-ressources-archive__group-title {
    font-size: 1.2rem;
    text-transform: uppercase;
    color: var(--sporsora-quinary-color);
}

.ws-ressources-archive__group-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    overflow-y: auto;

    &::-webkit-scrollbar {
        width: 0.7rem;
        background: transparent;
    }

    &::-webkit-scrollbar-track {
        background: transparent;
    }

    &::-webkit-scrollbar-thumb {
        border-radius: 5rem;
        background-color: gray;
    }

    &::-webkit-scrollbar-button {
        display: none;
        width: 0;
        height: 0;
    }

    /* Firefox only */
    @-moz-document url-prefix() {
        scrollbar-width: thin;
        scrollbar-color: gray transparent;
    }
}

.ws-ressources-archive .ws-ressources-archive__filter {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    color: var(--sporsora-text-color);
    background-color: transparent;
    border-radius: 0.8rem;
    padding: 0.8rem;
    cursor: pointer;

    &:hover {
        background-color: var(--sporsora-secondary-bg-color);
    }
}

.ws-ressources-archive__checkbox {
    flex-shrink: 0;
    appearance: none;
    -webkit-appearance: none;
    margin: 0;

    width: 1em;
    height: 1em;
    border: 1.5px solid var(--sporsora-primary-color);
    border-radius: 3px;
    background-color: #fff;

    display: inline-grid;
    place-content: center;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.ws-ressources-archive__checkbox:checked {
    background-color: var(--sporsora-primary-color);
    border-color: var(--sporsora-primary-color);
}

.ws-ressources-archive__checkbox::before {
    content: "";
    width: 0.55em;
    height: 0.55em;
    transform: scale(0);
    transition: transform 0.1s ease-in-out;
    box-shadow: inset 1em 1em white;
    clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}

.ws-ressources-archive__checkbox:checked::before {
    transform: scale(1);
}

.ws-ressources-archive__checkbox:focus-visible {
    outline: 2px solid var(--sporsora-primary-color);
    outline-offset: 2px;
}

.ws-ressources-archive__filter-name {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 1.4rem;
    font-weight: 500;
}

.ws-ressources-archive .ws-ressources-archive__filter-button {
    border-radius: 0.8rem;
}

.ws-ressources-archive .ws-ressources-archive__show-filters {
    display: none;
    gap: 0.8rem;
    color: var(--sporsora-text-color);
    background-color: white !important;
    border: 1px solid #e8e8e8;
    transition: border-color 0.15s ease;

    &:hover {
        border-color: var(--sporsora-quinary-color);
    }

    @media (max-width: 1023px) {
        display: flex;
        align-items: center;
    }
}



.ws-ressources-archive__content {
    display: flex;
    flex-direction: column;
    gap: 2.4rem;
}

.ws-ressources-archive .ws-ressources-archive__header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.2rem;

    & button {
        border-radius: 50rem;
        padding: 1rem 2.6rem;
    }
}

.ws-ressources-archive__search-form {
    position: relative;
    flex: 1;
}

.ws-ressources-archive__search-icon {
    position: absolute;
    top: 50%;
    left: 1.5rem;
    transform: translateY(-50%);
    font-size: 1.4rem;
    color: var(--sporsora-quinary-color);
}

.ws-ressources-archive__content .ws-ressources-archive__searchbar {
    min-width: 26rem;
    width: 100%;
    height: 4.4rem;
    font-weight: 500;
    border-radius: 5rem;
    padding: 1rem 4rem;
    background-color: white;
}

.ws-ressources-archive__searchbar::placeholder {
    color: var(--sporsora-quinary-color);
}

.ws-ressources-archive__orderby {
    width: fit-content;
    font-weight: 500;
    border-radius: 50rem;
    background-color: white;
    transition: border-color 0.15s ease;
    cursor: pointer;

    &:hover {
        border-color: var(--sporsora-quinary-color);
    }
}

.ws-ressources-archive__search-button {
    width: fit-content;
}

.ws-ressources-archive__item-count {
    font-weight: 500;
    color: var(--sporsora-quinary-color);
}

.ws-ressources-archive__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2.4rem;

    @media (max-width: 1279px) {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    
    @media (max-width: 639px) {
        grid-template-columns: 1fr;
    }
}