/*
 * pagination.css — the pages of a long list.
 *
 * <nav class="app-pagination" aria-label="Seiten">
 *   <p class="app-pagination-status" aria-live="polite">26–50 von 312</p>
 *   <ul class="app-pagination-list" role="list">
 *     <li><button class="app-pagination-step" type="button">[icon]<span>Zurück</span></button></li>
 *     <li><button class="app-pagination-step" type="button" disabled><span>Weiter</span>[icon]</button></li>
 *   </ul>
 * </nav>
 *
 * The API pages its lists by cursor: a page knows the next and not page 37, so there are no page
 * numbers, only the step back, the step on and where the page stands in the whole ("von über
 * 10.000" when more match than the API counts). A step that leads nowhere is not shown: the
 * first page has only Weiter, the last only Zurück, and a list that fits on one page says
 * "Alle 23" and has no step at all. On a phone a list loads more at its end instead
 * (load-more.css); this stays for a table that pages.
 */
@layer components {
    .app-pagination {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: var(--app-space-header-row) var(--app-space-header-x);
    }

    .app-pagination-status {
        color: var(--app-color-text-muted);
        font-size: var(--app-text-body-size);
        font-variant-numeric: tabular-nums;
        line-height: var(--app-text-body-leading);
    }

    .app-pagination-list {
        display: flex;
        align-items: center;
        gap: var(--app-space-nav-items);
    }

    .app-pagination-list > li:has(> .app-pagination-step:disabled) {
        display: none;
    }

    .app-pagination-step {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: var(--app-space-inline);
        min-block-size: var(--app-control-height);
        padding: var(--app-space-control-y) var(--app-space-control-x);
        border: 0;
        border-radius: var(--app-radius-button);
        background: transparent;
        color: var(--app-color-text);
        font-family: var(--app-font-text);
        font-size: var(--app-text-control-size);
        font-weight: var(--app-text-tab-weight);
        line-height: var(--app-text-control-leading);
        cursor: pointer;
        transition:
            background-color var(--app-duration-hover) var(--app-easing),
            color var(--app-duration-hover) var(--app-easing);
    }

    @media (hover: hover) {
        .app-pagination-step:hover:not(:disabled) {
            background: var(--app-color-surface-hover);
        }
    }

    .app-pagination-step:focus-visible {
        outline: var(--app-focus-ring-width) solid var(--app-color-focus);
        outline-offset: calc(-1 * var(--app-focus-ring-width));
    }

    .app-pagination-step:disabled {
        color: var(--app-color-text-disabled);
        cursor: not-allowed;
    }

    @media (pointer: coarse) {
        .app-pagination-step {
            min-block-size: var(--app-touch-target);
        }
    }
}
