/* Avis — modèle canonique ; son emploi : canon_notice.md. */

@layer components {
    .notice {
        --notice-glass-start: color-mix(in oklab, var(--notice-state-surface, var(--notice-surface, var(--canon-theme-neutral-surface))) 20%, var(--canon-theme-raised));
        --notice-glass-end: var(--notice-gradient, color-mix(in oklab, var(--notice-state-surface, var(--notice-surface, var(--canon-theme-neutral-surface))) 50%, color-mix(in oklab, var(--notice-state-color, var(--notice-color, var(--canon-theme-neutral))) 7%, var(--canon-theme-raised))));
        --notice-edge: var(--notice-state-color, var(--notice-color, var(--canon-theme-neutral)));
    }

    .notice {
        display: flex;
        flex-direction: column;
        gap: var(--canon-space-1);
        padding: var(--notice-padding, var(--canon-space-3) var(--canon-space-4));
    }

    .notice {
        border: var(--notice-line-width, var(--canon-line-width)) solid transparent;
        border-radius: var(--notice-radius, calc(2 * var(--canon-radius-control)));
        background-image: linear-gradient(160deg, var(--notice-glass-start), var(--notice-glass-end)), linear-gradient(160deg, color-mix(in oklab, var(--notice-edge) 62%, transparent), color-mix(in oklab, var(--notice-edge) 16%, transparent));
        background-origin: border-box;
        background-clip: padding-box, border-box;
        box-shadow: var(--notice-shadow, 0 6px 18px -10px color-mix(in oklab, var(--notice-edge) 45%, transparent));
    }

    .notice {
        font-size: var(--canon-size-control);
        color: var(--notice-ink, var(--canon-theme-ink));
    }
    .notice :where(p) {
        color: inherit;
    }
    .notice-title {
        font-weight: var(--notice-title-weight, var(--canon-weight-label));
        color: var(--notice-state-color, var(--notice-color, var(--canon-theme-neutral)));
    }
}

@layer components {
    .notice--position-floating {
        --notice-glass-start: var(--notice-state-color, var(--notice-color, var(--canon-theme-neutral)));
        --notice-glass-end: color-mix(in oklab, var(--notice-state-color, var(--notice-color, var(--canon-theme-neutral))) 76%, var(--canon-theme-ink));
        --notice-edge: color-mix(in oklab, var(--canon-theme-on-action) 55%, var(--notice-state-color, var(--notice-color, var(--canon-theme-neutral))));
    }

    .notice--position-floating {
        position: fixed;
        inset-block-end: var(--canon-space-edge);
        inset-inline-end: var(--canon-space-edge);
        z-index: var(--canon-plane-notice);
        max-width: calc(100% - 2 * var(--canon-space-edge));
    }

    .notice--position-floating {
        background-color: var(--notice-floating-surface, var(--canon-theme-raised));
        box-shadow: var(--notice-floating-shadow, var(--canon-shadow-overlay, 0 0 #0000), 0 12px 32px -12px color-mix(in oklab, var(--notice-state-color, var(--notice-color, var(--canon-theme-neutral))) 60%, transparent));
    }

    .notice--position-floating,
    .notice--position-floating .notice-title {
        color: var(--notice-floating-ink, var(--canon-theme-on-action));
    }
}

@layer components {
    .notice--style-text {
        padding: 0;
    }
    .notice--style-text {
        border-width: 0;
        border-radius: 0;
        background: none;
        box-shadow: none;
    }

    .notice--style-text {
        color: var(--notice-state-color, var(--notice-ink, var(--canon-theme-ink)));
    }
}

@layer components {
    .notice--color-danger {
        --notice-state-color: var(--canon-theme-danger);
        --notice-state-surface: var(--canon-theme-danger-surface);
    }
    .notice--color-warning {
        --notice-state-color: var(--canon-theme-warning);
        --notice-state-surface: var(--canon-theme-warning-surface);
    }
    .notice--color-success {
        --notice-state-color: var(--canon-theme-success);
        --notice-state-surface: var(--canon-theme-success-surface);
    }
    .notice--color-info {
        --notice-state-color: var(--canon-theme-info);
        --notice-state-surface: var(--canon-theme-info-surface);
    }
    .notice--color-neutral {
        --notice-state-color: var(--canon-theme-neutral);
        --notice-state-surface: var(--canon-theme-neutral-surface);
    }
}

/* Part locale — les réglages que l'app pose sur cet objet, contexte par contexte. */

@layer components {
    /* Les avis d'Exavoris : le retour du configurateur et la mise à jour d'un moteur sur un aplat
       léger, sans cadre. L'échec d'un chargement, `error`, est un avis au danger ; sa forme en texte
       seul est demandée au registre. */
    .configurator-message,
    .engine-update {
        --notice-line-width: 0px;
    }
    .configurator-message[data-configurator-message="error"] {
        --notice-ink: var(--canon-theme-danger);
    }
    .configurator-message[data-configurator-message="error"] {
        --notice-surface: var(--canon-theme-danger-surface);
    }
    .configurator-message[data-configurator-message="success"] {
        --notice-surface: var(--canon-theme-success-surface);
        --notice-ink: var(--canon-theme-success);
    }
    .configurator-message {
        --notice-padding: 8px 10px;
    }
    .engine-update {
        --notice-padding: 6px 10px;
        --notice-color: var(--canon-theme-action);
        --notice-surface: var(--local-color-decor-update-surface);
        --notice-ink: var(--canon-theme-action);
    }
}
