/* =============================================================================
   Notices: <twig:Warp:Notice>, information, a warning or an error on the
   page that stays, without a close button. The colours are Warp:Flash's.
   ============================================================================= */

.warp-notice {
    display: flex;
    align-items: flex-start;
    gap: var(--warp-spacing-2);
    width: fit-content;
    max-width: 100%;
    padding: var(--warp-spacing-2) var(--warp-spacing-3);
    border: 1px solid;
    border-radius: var(--warp-radius-md);
    font-size: var(--warp-font-size-sm);
    line-height: var(--warp-line-height-normal);

    &[hidden] {
        display: none;
    }

    /* The icon on the text's first line. */
    & > .warp-icon {
        flex-shrink: 0;
        width: 1em;
        height: 1lh;
    }

    & a {
        color: inherit;
        text-decoration: underline;
    }
}

.warp-notice--info {
    background-color: var(--warp-color-info-50);
    color: var(--warp-color-info-600);
    border-color: var(--warp-color-info-100);
}

.warp-notice--warning {
    background-color: var(--warp-color-warning-50);
    color: var(--warp-color-warning-700);
    border-color: var(--warp-color-warning-200);
}

.warp-notice--error {
    background-color: var(--warp-color-danger-50);
    color: var(--warp-color-danger-700);
    border-color: var(--warp-color-danger-200);
}

.warp-notice-text {
    min-width: 0;
    overflow-wrap: anywhere;
}

/* At a field: under the message line, as wide as the field's column. */
.warp-field > .warp-notice {
    grid-column: 2;
    width: auto;
    margin-top: var(--warp-spacing-1);
}

.warp-field--above > .warp-notice {
    grid-column: 1;
}

/* First in a section or the page's content: before what it concerns. */
:is(.warp-section, .warp-content, section) > .warp-notice:not(:last-child) {
    margin-bottom: var(--warp-spacing-4);
}

/* Smaller, no wider than its text, one line for a short text: the shortcut notice. */
.warp-notice--compact {
    padding: var(--warp-spacing-1) var(--warp-spacing-2);
    font-size: var(--warp-font-size-xs);
}

/* The shortcut notice, <twig:Warp:ShortcutNotice>: over the content right under
   the toolbar, on the left of the content's column, following the sticky
   toolbar; nothing on the page moves when it shows. */
.warp-shortcut-notice {
    position: sticky;
    top: var(--warp-header-height);
    z-index: calc(var(--warp-z-sticky) + 1);
    height: 0;
    padding-inline: var(--warp-spacing-4);
    pointer-events: none;

    & > .warp-notice {
        margin-top: var(--warp-spacing-1);
        box-shadow: var(--warp-shadow-md);
        pointer-events: auto;
    }
}

.warp-app-content:has(> .warp-app-bar--compact) > .warp-shortcut-notice {
    top: var(--warp-header-height-compact);
}

/* The portal's header scrolls away: the notice stays at the window's top. */
.warp-portal > .warp-shortcut-notice {
    top: 0;
    max-width: var(--warp-content-max-width);
    margin-inline: auto;
}

/* Several messages in one notice, as a page's errors. */
.warp-notice-list {
    margin: 0;
    padding-left: var(--warp-spacing-4);
}
