/*
 * AIOS design tokens.
 *
 * Lives in the `tokens` layer, which sits before `legacy` in the order declared
 * by aios-layers.css. Anything here is a floor: legacy CSS can still override a
 * token, and that is deliberate while legacy is being drained.
 *
 * This file holds scales that are canonical by construction — values that exist
 * only as tokens and have no literal form anywhere in the codebase. Colour,
 * spacing and radius tokens still live in aios-design-system.css, which
 * test:css-tokens guards; they are not moved here yet, because most of their
 * repeat definitions are legitimate scoped overrides (.dark-mode, component
 * scopes, media queries), not duplicates.
 */

@layer tokens {
  :root {
    /* ---------------------------------------------------------------------
     * Stacking scale.
     *
     * Replaces 140 literal z-index values spread over 15 stylesheets, which
     * ranged from -1 to 2147483000 with no shared meaning. Every literal was
     * mapped onto this scale by a strictly order-preserving substitution, so
     * no two elements changed their relative stacking order.
     *
     * Tiers are 100 apart. Use a tier directly; use calc(var(--z-tier) + n)
     * only to separate siblings inside one tier, and keep n small. If you need
     * a value larger than --z-top, the answer is a different stacking context,
     * not a bigger number.
     * ------------------------------------------------------------------- */
    --z-behind: -1;   /* decorative pseudo-elements painted under their box */
    --z-base: 0;      /* the normal flow */
    --z-raised: 1;    /* content lifted above a sibling background or overlay */
    --z-shell: 100;   /* app chrome: topbar, composer, tabbar, inline popovers */
    --z-drawer: 200;  /* sidebars and their backdrops */
    --z-float: 300;   /* detached surfaces above the shell */
    --z-modal: 400;   /* modal root, backdrops, fullscreen chat */
    --z-top: 500;     /* keyboard-pinned bars, mobile menu sheet, status badge */
  }
}
