/*
 * dossier.css — a record to look things up in (a customer), under its head and facts
 * (document.css): its tabs, and beside them, only where there is room, what is open at a glance.
 *
 * <div class="app-dossier">
 *   <div class="app-dossier-main">[tabs]</div>
 *   <aside class="app-dossier-side" aria-label>[section: Offen]</aside>
 * </div>
 *
 * The side is not there by default: beside a list (a split view of 960 and more) and in a
 * region under 960 the dossier is its tabs alone, and what is open is a tab of its own. It comes back where the dossier stands alone in a region of 960: there
 * the region has twelve columns, and eight of them still hold the tab list of a customer
 * (about 800 wide at 1440 beside the rail). The region alone cannot tell: beside a 400 list at
 * 1440 the detail pane is already 972 wide, and a screen that full is what the side would crowd.
 *
 * The side's headings stand level with the tab list (both one control row), and their panels
 * level with the tab's panel, so the side's sections take the tabs' gap.
 */
@layer components {
    .app-dossier {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        column-gap: var(--app-space-gutter-wide);
        align-items: start;
    }

    .app-dossier-main {
        min-inline-size: 0;
    }

    .app-dossier-side {
        display: none;
        flex-direction: column;
        gap: var(--app-space-section);
        min-inline-size: 0;
    }

    .app-dossier-side > .app-section {
        gap: var(--app-space-tabs);
    }

    @container app-region (width >= 960px) {
        .app-dossier:has(> .app-dossier-side) {
            grid-template-columns: repeat(12, minmax(0, 1fr));
        }

        .app-dossier:has(> .app-dossier-side) > .app-dossier-main {
            grid-column: span 8;
        }

        .app-dossier-side {
            display: flex;
            grid-column: span 4;
        }
    }

    /* Beside its list, the dossier stays its tabs alone, whatever the pane's width. */
    @container app-split (width >= 960px) {
        [data-pane="detail"] .app-dossier:has(> .app-dossier-side) {
            grid-template-columns: minmax(0, 1fr);
        }

        [data-pane="detail"] .app-dossier:has(> .app-dossier-side) > .app-dossier-main {
            grid-column: auto;
        }

        [data-pane="detail"] .app-dossier-side {
            display: none;
        }
    }
}
