/*
 * notice.css — an inline message.
 *
 * <div class="app-notice" data-tone="info | success | warning | danger" role="status | alert">
 *   <span class="app-notice-icon" aria-hidden="true">[icon]</span>
 *   <div class="app-notice-content">
 *     <p class="app-notice-title">Titel</p>
 *     <p class="app-notice-text">Text</p>
 *     <p class="app-notice-reference">Fehler-ID <span class="app-code">4bf92f35…</span></p>   (optional)
 *     <div class="app-notice-actions">[compact buttons]</div>   (optional)
 *   </div>
 * </div>
 *
 * A resting surface: a soft tone, no border and no shadow.
 */
@layer components {
    .app-notice {
        display: flex;
        align-items: flex-start;
        gap: var(--app-space-inline);
        padding: var(--app-space-notice-y) var(--app-space-notice-x);
        border-radius: var(--app-radius-notice);
        background: var(--app-color-info-soft);
        color: var(--app-color-text);
        font-size: var(--app-text-body-size);
        line-height: var(--app-text-body-leading);
    }

    .app-notice-icon {
        display: inline-flex;
        flex: none;
        align-items: center;
        block-size: var(--app-text-body-leading);
        color: var(--app-color-info);
    }

    .app-notice-content {
        display: flex;
        flex-direction: column;
        gap: var(--app-space-notice-text);
        min-inline-size: 0;
    }

    .app-notice-title {
        font-weight: var(--app-text-strong-weight);
    }

    .app-notice-text {
        color: var(--app-color-text-muted);
    }

    .app-notice-title:empty,
    .app-notice-text:empty {
        display: none;
    }

    /* The trace ID support asks for: small, muted, selectable as one word. Its line is a text
       line, 20 tall, which the mono face sits inside; on a narrow screen the ID wraps
       anywhere rather than push the page sideways. */
    .app-notice-reference {
        color: var(--app-color-text-muted);
        font-size: var(--app-text-label-size);
        line-height: var(--app-text-body-leading);
    }

    .app-notice-reference > .app-code {
        white-space: normal;
        overflow-wrap: anywhere;
        user-select: all;
    }

    /* What a person can do about it, under the text; a gap more above, so they stand apart. */
    .app-notice-actions {
        display: flex;
        flex-wrap: wrap;
        gap: var(--app-space-actions);
        padding-block: var(--app-space-notice-text) 0;
    }

    .app-notice[data-tone="success"] {
        background: var(--app-color-success-soft);
    }

    .app-notice[data-tone="success"] .app-notice-icon {
        color: var(--app-color-success-text);
    }

    .app-notice[data-tone="warning"] {
        background: var(--app-color-warning-soft);
    }

    .app-notice[data-tone="warning"] .app-notice-icon {
        color: var(--app-color-warning-text);
    }

    .app-notice[data-tone="danger"] {
        background: var(--app-color-danger-soft);
    }

    .app-notice[data-tone="danger"] .app-notice-icon {
        color: var(--app-color-danger-text);
    }

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