/*
 * card.css — a surface that groups part of a page.
 *
 * <section class="app-card">
 *   <header class="app-card-header">
 *     <h2 class="app-card-title">Positionen</h2>
 *     <div class="app-card-actions">[badge, buttons]</div>
 *   </header>
 *   <div class="app-card-body">…</div>
 * </section>
 *
 * The header is written only when the card has a title; its first row is a control row, like
 * the page header's. The inset is the gutter of the region (16 narrow, 24 from 560), so what
 * sits in a card is inset by exactly one gutter. Its outline is a ring that takes no room.
 * A card is not a region: a select in it opens over the next card, not under it.
 *
 * A card alone in a column (layout.css) is as tall as its row, so cards side by side end on
 * one line.
 */
@layer components {
    .app-card {
        display: flex;
        flex-direction: column;
        gap: var(--app-space-field);
        min-inline-size: 0;
        padding: var(--app-space-gutter-narrow);
        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-column:has(> .app-card:only-child) {
        align-content: stretch;
    }

    .app-card-header {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: var(--app-space-header-row) var(--app-space-header-x);
        min-block-size: var(--app-control-height);
    }

    .app-card-title {
        min-inline-size: 0;
        color: var(--app-color-text);
        font-family: var(--app-font-display);
        font-size: var(--app-text-heading-size);
        font-weight: var(--app-text-heading-weight);
        line-height: var(--app-text-heading-leading);
    }

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

    .app-card-actions:empty {
        display: none;
    }

    .app-card-body {
        display: flex;
        flex-direction: column;
        gap: var(--app-space-field);
        min-inline-size: 0;
    }

    @container app-region (width >= 560px) {
        .app-card {
            padding: var(--app-space-gutter-wide);
        }
    }

    /* 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-card {
            outline: var(--app-border-width) solid var(--app-color-forced-line);
            outline-offset: calc(-1 * var(--app-border-width));
        }
    }
}
