/*
 * link-list.css — rows that lead on: the parts of an order, the rest of the navigation, the
 * categories of the settings, what needs attention.
 *
 * <ul class="app-link-list" role="list" aria-label>
 *   <li class="app-link-list-entry">
 *     <a class="app-link-list-item" href aria-current="page">   (a button type="button" when it opens a sheet)
 *       <svg class="app-icon" data-size="20">…</svg>   (optional)
 *       <span class="app-link-list-text">
 *         <span class="app-link-list-label">Material</span>
 *         <span class="app-link-list-detail">Kältemittel, Filter</span>   (optional)
 *       </span>
 *       <span class="app-link-list-value" data-tone="warning">fehlt</span>   (optional; tone only for a state that needs doing)
 *       <svg class="app-icon app-link-list-chevron" data-size="16">[chevron-right]</svg>
 *     </a>
 *   </li>
 * </ul>
 *
 * A row that only shows (AppLinkListItem Plain), in a list being filled on a page that must not
 * be left half done (the members a wizard adds): no link, no chevron, no hover.
 *   <li class="app-link-list-entry"><div class="app-link-list-item" data-kind="plain">[icon, text, value]</div></li>
 *
 * A row that is a switch (AppLinkListSwitch), for a setting that takes effect at once:
 *   <li class="app-link-list-entry">
 *     <label class="app-link-list-item" data-kind="switch">
 *       <span class="app-link-list-text">[label, detail]</span>
 *       <input class="app-switch-input" type="checkbox" role="switch" aria-labelledby aria-describedby>
 *       <span class="app-switch-track" aria-hidden="true"><span class="app-switch-thumb"></span></span>
 *     </label>
 *   </li>
 *
 * One panel with a line between the rows, like the agenda's days, so a list of parts reads as
 * one thing. A row is its label at 500, an optional muted detail under it, and at its end what
 * stands there now (1:23:05, 3 Positionen, Entwurf) and the chevron that says it leads on. A
 * value that asks for doing (fehlt) is the one coloured word, in the warning text. The current
 * row, in a split view, is marked like the current navigation item. On a touch screen a row is
 * 48 tall.
 */
@layer components {
    .app-link-list {
        display: flex;
        flex-direction: column;
        overflow: clip;
        border-radius: var(--app-radius-card);
        background: var(--app-color-surface);
        box-shadow: 0 0 0 var(--app-border-width) var(--app-color-line);
    }

    .app-link-list-entry {
        display: flex;
        flex-direction: column;
    }

    .app-link-list-entry + .app-link-list-entry {
        box-shadow: inset 0 var(--app-border-width) 0 var(--app-color-line);
    }

    .app-link-list-item {
        display: flex;
        align-items: center;
        gap: var(--app-space-inline);
        min-block-size: var(--app-link-list-row);
        padding: var(--app-space-link-list-y) var(--app-space-link-list-x);
        border: 0;
        background: transparent;
        color: var(--app-color-text);
        font: inherit;
        text-align: start;
        text-decoration: none;
        cursor: pointer;
        transition: background-color var(--app-duration-hover) var(--app-easing);
    }

    .app-link-list-item[data-kind="plain"] {
        cursor: default;
    }

    .app-link-list-text {
        display: flex;
        flex: 1 1 auto;
        flex-direction: column;
        min-inline-size: 0;
    }

    .app-link-list-label {
        font-weight: var(--app-text-value-weight);
        line-height: var(--app-text-body-leading);
        overflow-wrap: anywhere;
    }

    .app-link-list-detail {
        color: var(--app-color-text-muted);
        line-height: var(--app-text-body-leading);
        overflow-wrap: anywhere;
    }

    .app-link-list-value {
        flex: none;
        color: var(--app-color-text-muted);
        line-height: var(--app-text-body-leading);
        font-variant-numeric: tabular-nums;
    }

    .app-link-list-value[data-tone="warning"] {
        color: var(--app-color-warning-text);
        font-weight: var(--app-text-label-weight);
    }

    /* The switch row: the whole row is the switch's label, so the input covers it. */
    .app-link-list-item[data-kind="switch"] {
        position: relative;
    }

    .app-link-list-item[data-kind="switch"]:has(.app-switch-input:disabled) {
        color: var(--app-color-text-disabled);
        cursor: not-allowed;
    }

    .app-link-list-item > .app-icon {
        flex: none;
        color: var(--app-color-text-muted);
    }

    .app-link-list-item > .app-link-list-chevron {
        color: var(--app-color-text-subtle);
    }

    .app-link-list-item[aria-current="page"] {
        background: var(--app-color-nav-current);
    }

    .app-link-list-item[aria-current="page"] :is(.app-link-list-label, .app-icon) {
        color: var(--app-color-nav-current-text);
    }

    @media (hover: hover) {
        .app-link-list-item:hover:not([aria-current="page"], [data-kind="plain"]) {
            background: var(--app-color-row-hover);
        }

        .app-link-list-item[data-kind="switch"]:hover .app-switch-input:not(:disabled, :checked) + .app-switch-track {
            background: var(--app-color-line-hover);
        }

        .app-link-list-item[data-kind="switch"]:hover .app-switch-input:checked:not(:disabled) + .app-switch-track {
            background: var(--app-color-accent-hover);
        }
    }

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

    @media (pointer: coarse) {
        .app-link-list-item {
            min-block-size: var(--app-link-list-row-touch);
        }
    }

    /* Forced colours (a Windows contrast theme): shadows and backgrounds are gone, so frames
       are outlines and a chosen state is the system highlight. */
    @media (forced-colors: active) {
        .app-link-list {
            outline: var(--app-border-width) solid var(--app-color-forced-line);
            outline-offset: calc(-1 * var(--app-border-width));
        }

        .app-link-list-entry + .app-link-list-entry {
            border-block-start: var(--app-border-width) solid var(--app-color-forced-line);
        }

        .app-link-list-item[aria-current="page"] {
            forced-color-adjust: none;
            background: var(--app-color-forced-current);
            color: var(--app-color-forced-current-text);
        }
    }
}
