#filters-wrapper {
    display: flex;
    flex-direction: column;
    --width: 130px;
}

#filters-button {
    font-size: 1em;
    font-family: sans-serif-font, sans-serif;
    border: 1px solid var(--color);
    height: 40px;
    width: var(--width);
    border-radius: var(--br);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    flex-shrink: 0;
    position: relative;
    z-index: 10;
    cursor: pointer;
    transition: background 0.2s linear, outline-offset 0.15s ease, border-radius 0.2s ease;
    outline-offset: -3px;
    outline: 3px solid transparent;
    border-radius: var(--br) var(--br) 0 0;
}

#filters-button.closed {
    border-radius: var(--br);
}

#filters-button:hover {
    background: var(--color-bg-1);
}

#filters-button:active {
    background: var(--color-bg-1);
}

#filters {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: start;
    height: 42px;
    cursor: pointer;
    outline-offset: -3px;
    transition: background 0.1s linear, outline-offset 0.2s ease, border-radius 0.1s 0.075s ease, clip-path 0.6s var(--bounce);
    height: 450px;
    background: var(--color-bg);
    clip-path: inset(0 0 0 0);
    font-family: sans-serif-font, sans-serif;
    border-radius: 0 0 var(--br) var(--br);
    border: 1px solid var(--color);
    border-top: none;
    width: var(--width);
    flex-shrink: 0;
}

#filters.closed:not(:focus-within) {
    clip-path: inset(0 0 100% 0);
}

#filters > hr, #inverted-filters > hr {
    height: 1px;
    background: var(--color);
}

#inverted-filters > hr {
    background: transparent;
}

#filters > span, #inverted-filters > span {
    display: block;
    width: 100%;
    text-align: left;
    font-size: 0.875em;
    padding: 5px 10px;
    cursor: default;
    border-top: 1px solid var(--color);
    background: var(--color-bg);
    z-index: 3;
}

#inverted-filters > span {
    opacity: 0;
}

#filters label {
    background: transparent;
    outline: none;
    padding: 5px 10px;
    cursor: pointer;
    transition: background 0.1s linear, outline-offset 0.2s ease, color 0.1s linear;
    outline-offset: -2px;
    color: var(--color);
    flex-shrink: 0;
    height: 38px;
    margin: 2px;
    position: relative;
    width: calc(100% - 4px);
    border-radius: calc(var(--br) - 2px);
    display: flex;
    justify-content: start;
    align-items: center;
}

#inverted-filters label {
    color: var(--color-bg);
    justify-content: space-between;

}

#filters label > input {
    appearance: none;
    height: 38px;
    width: 0;
}

::checkmark {
    content: "";
    mask-image: url("/images/check_mark.png");
    mask-size: 100%;
    background: currentColor;
    height: 1.25em;
    width: 1.25em;
    margin-left: auto;
}

.filter-group {
    position: relative;
    --top: -40px;
    overflow: hidden;
    transition: outline-offset 0.15s ease;
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
    border-radius: var(--br);
}

#inverted-filters .filter-group {
    clip-path: inset(-40px 0 100% 0 round calc(var(--br) - 2px));
}

.filter-group:has(:focus-visible) {
    outline: 2px solid var(--color-accent);
    outline-offset: -2px;
}

.filter-group::after {
    content: "";
    position: absolute;
    top: var(--top);
    background: var(--color-bg);
    height: 38px;
    aspect-ratio: 1;
    right: 7px;
    pointer-events: none;
    transition: top 0.3s ease;
    mask-image: url("/images/check_mark.png");
    mask-size: 1.25rem;
    mask-position: center;
    mask-repeat: no-repeat;
    z-index: 3;
}

#filters label:not(:has(input:checked)):hover {
    background: var(--color-bg-1);
}

#filters label:not(:has(input:checked)):active {
    background: var(--color-bg-2);
}

::-webkit-search-cancel-button {
    display: none;
}

#inverted-filters {
    position: absolute;
    z-index: 2;
    inset: 0;
    pointer-events: none;
    color: var(--color-bg);
}

#inverted-filters .filter-group {
    transition: clip-path 0.3s ease;
    background: var(--color-accent);
}
