/*
 * filter-bar.css — the bar above a list: a search, quick filters, and the actions on them.
 *
 * <div class="app-filter-bar" role="group" aria-label="Filter">
 *   <div class="app-filter-bar-search">[search field]</div>
 *   <div class="app-filter-bar-filters">[toggle chips]</div>
 *   <div class="app-filter-bar-actions">[buttons]</div>
 * </div>
 *
 * Three tracks: the search takes up to 320, the filters the rest, the actions what they need.
 * All three sit on the line of the controls, at the bottom, so chips centre on the search
 * field and not on its label. Below a region of 560 the search and the actions share the
 * first row and the filters take the second, where they scroll sideways instead of wrapping:
 * one row of chips under the thumb, fading out at an edge with more behind it. In a page body
 * that row runs to the screen's edges (shell.css). Empty parts take no space.
 *
 * The search is known by its place, its kind and its placeholder (Suchen): its label is read
 * out, not shown, so the bar is one control high.
 */
@layer components {
    .app-filter-bar {
        display: grid;
        grid-template-columns: minmax(0, var(--app-filter-search-width)) minmax(0, 1fr) auto;
        align-items: end;
        gap: var(--app-space-field) var(--app-space-header-x);
    }

    .app-filter-bar-filters {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: var(--app-space-cluster);
        min-inline-size: 0;
        min-block-size: var(--app-control-height);
    }

    .app-filter-bar-actions {
        display: flex;
        align-items: center;
        gap: var(--app-space-actions);
    }

    .app-filter-bar-search .app-field:has(> .app-field-control[type="search"]) > .app-field-label {
        position: absolute;
        inline-size: var(--app-border-width);
        block-size: var(--app-border-width);
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }

    :is(.app-filter-bar-search, .app-filter-bar-filters, .app-filter-bar-actions):empty {
        display: none;
    }

    @container app-region (width < 560px) {
        .app-filter-bar {
            grid-template-columns: minmax(0, 1fr) auto;
        }

        .app-filter-bar-filters {
            flex-wrap: nowrap;
            grid-column: 1 / -1;
            grid-row: 2;
            overflow-x: auto;
            scrollbar-width: none;
            /* An edge with more chips behind it fades (layout.css). */
            animation-name: app-scroll-fade;
            animation-timing-function: linear;
            animation-fill-mode: both;
            animation-timeline: scroll(self inline);
        }
    }
}
