/*
 * entry.css — a screen before the app: the start, finding the company, signing in, signed out.
 *
 * <div class="app-entry">
 *   <div class="app-entry-brand">
 *     <div class="app-entry-mark">[the product's or the tenant's mark: text or an img]</div>
 *   </div>
 *   <div class="app-entry-panel">
 *     <div class="app-entry-body">
 *       <div class="app-entry-heading">
 *         <h1 class="app-entry-title">Anmelden</h1>
 *         <p class="app-entry-text">Geben Sie die Adresse Ihrer Firma ein.</p>
 *       </div>
 *       [a field, a notice or a state]
 *     </div>
 *     <div class="app-entry-actions">[a reason (sync.css), buttons: the main one first]</div>
 *     <div class="app-entry-settings">[the language's menu, light or dark (menu.css)]</div>   (optional)
 *   </div>
 * </div>
 *
 * The entry is the whole of the shell's main area (a shell with no navigation and no bar), not
 * a page in it: it is the one screen where the product, or the tenant, speaks first, so it
 * reaches every edge of the screen.
 *
 * Below a region of 560 the brand fills the screen and holds the mark in its middle; the panel
 * rises from the bottom as a sheet, as a dialog does on a phone (white, the card's corners at
 * the top), with the content and, at its foot, the buttons across its width, under the thumb
 * (48 high on touch, button.css). The sheet is as tall as its content, so the brand gives way
 * to a longer form and to the keyboard. From 560 the brand is the background of the screen,
 * and mark and panel stand in its middle as one column of at most 400, the panel a card.
 *
 * The brand is the accent with the mark in white (roles in semantic.css): a tenant theme that
 * brings its own accent brings its own entry. Elsewhere blue means "act here"; here it is the
 * surface of the screen, not a control, and nothing else on it competes.
 *
 * At the panel's foot, below a line, the language and light or dark, as the account menu has
 * them: a person who does not read the screen's language finds the switch before signing in.
 *
 * The buttons always take the panel's width, one under the other, the main one on top: a person
 * reads down to it. The mark is the product's or the tenant's; a theme or the screen can put
 * the tenant's logo there (an img with its alt).
 */
@layer components {
    .app-entry {
        display: grid;
        grid-template-rows: minmax(0, 1fr) auto;
        min-block-size: var(--app-page-height);
        background: var(--app-color-entry-brand);
        color: var(--app-color-text);
    }

    .app-entry-brand {
        display: flex;
        align-items: center;
        justify-content: center;
        padding-block: calc(var(--app-space-section) + var(--app-space-safe-top)) var(--app-space-section);
        padding-inline: calc(var(--app-space-gutter-narrow) + var(--app-space-safe-left)) calc(var(--app-space-gutter-narrow) + var(--app-space-safe-right));
    }

    .app-entry-mark {
        display: flex;
        align-items: center;
        min-block-size: var(--app-entry-mark-height);
        color: var(--app-color-entry-mark);
        font-family: var(--app-font-display);
        font-size: var(--app-text-display-size);
        font-weight: var(--app-text-display-weight);
        line-height: var(--app-text-display-leading);
        letter-spacing: var(--app-text-display-tracking);
    }

    .app-entry-mark img {
        display: block;
        inline-size: auto;
        max-inline-size: 100%;
        block-size: var(--app-entry-mark-height);
    }

    .app-entry-panel {
        display: flex;
        flex-direction: column;
        gap: var(--app-space-section);
        min-inline-size: 0;
        padding-block: var(--app-space-gutter-wide) calc(var(--app-space-gutter-narrow) + var(--app-space-safe-bottom));
        padding-inline: calc(var(--app-space-gutter-narrow) + var(--app-space-safe-left)) calc(var(--app-space-gutter-narrow) + var(--app-space-safe-right));
        border-start-start-radius: var(--app-radius-card);
        border-start-end-radius: var(--app-radius-card);
        background: var(--app-color-surface);
        box-shadow: 0 0 0 var(--app-border-width) var(--app-color-line);
    }

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

    .app-entry-heading {
        display: flex;
        flex-direction: column;
        gap: var(--app-space-label);
    }

    .app-entry-title {
        color: var(--app-color-text);
        font-family: var(--app-font-display);
        font-size: var(--app-text-display-size);
        font-weight: var(--app-text-display-weight);
        line-height: var(--app-text-display-leading);
        letter-spacing: var(--app-text-display-tracking);
    }

    .app-entry-text {
        color: var(--app-color-text-muted);
        font-size: var(--app-text-body-size);
        line-height: var(--app-text-body-leading);
    }

    .app-entry-actions {
        display: flex;
        flex-direction: column;
        gap: var(--app-space-actions);
    }

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

    .app-entry-actions > .app-reason {
        justify-content: center;
    }

    .app-entry-settings {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: var(--app-space-inline);
        padding-block: var(--app-space-field) 0;
        box-shadow: inset 0 var(--app-border-width) 0 var(--app-color-line);
    }

    /* Wide: the brand is the background, mark and panel one column in its middle. */
    @container app-region (width >= 560px) {
        .app-entry {
            grid-template-rows: auto auto;
            align-content: center;
            justify-items: center;
            gap: var(--app-space-section);
            padding: var(--app-space-section) var(--app-space-gutter-wide);
        }

        .app-entry-brand {
            padding: 0;
        }

        .app-entry-panel {
            inline-size: 100%;
            max-inline-size: var(--app-entry-width);
            padding: var(--app-space-gutter-wide);
            border-radius: var(--app-radius-card);
            box-shadow:
                0 0 0 var(--app-border-width) var(--app-color-line),
                var(--app-shadow-card);
        }
    }

    @media (forced-colors: active) {
        .app-entry-panel {
            outline: var(--app-border-width) solid var(--app-color-forced-line);
            outline-offset: calc(-1 * var(--app-border-width));
        }
    }
}
