/* ==========================================================================
 * Mentra Theme Standard v1.0.0 — Mentra Core Design/Motion/Omni Bridge
 * Covers:
 * - 79 design-tokens.css variables (p0b/frontend/css/design-tokens.css)
 * - 14 motion-tokens.css variables (p0b/frontend/css/motion-tokens.css)
 * - 24 omni-beacon.css --omni-* variables (p0b/frontend/css/omni-beacon.css)
 * - Consumer aliases (--bg-app, --bg-base, --bg-primary, --accent-*, --mv-*, --status-*)
 * Policy: zero raw hex or color-space literals, zero priority bangs,
 *         zero pulse keyframes, zero global utility class selectors.
 * ========================================================================== */

@layer thm.aliases {
  :root:not([data-thm-app="office-acc"]):not([data-thm-clean="true"]) {
    /* 01. Core Surfaces (design-tokens.css:9-14 + consumer aliases) */
    --bg-obsidian: var(--thm-surface-canvas);
    --bg-main: var(--thm-surface-canvas);
    --bg-base: var(--thm-surface-canvas);
    --bg-app: var(--thm-surface-canvas);
    --bg-primary: var(--thm-surface-canvas);
    --bg-surface: var(--thm-surface-primary);
    --bg-surface-primary: var(--thm-surface-primary);
    --bg-card: var(--thm-surface-primary);
    --bg-surface-card: var(--thm-surface-elevated);
    --bg-surface-elevated: var(--thm-surface-elevated);
    --bg-elevated: var(--thm-surface-elevated);
    --bg-card-hover: var(--thm-surface-elevated);
    --bg-deep-blue: color-mix(in srgb, var(--thm-brand-accent) 26%, var(--thm-surface-canvas));

    /* 02. Core Palette, Radar & Status (design-tokens.css:17-33,89-94 + aliases) */
    --color-primary: var(--thm-brand-accent);
    --accent-primary: var(--thm-brand-accent);
    --accent-blue: var(--thm-brand-accent);
    --badge-running: var(--thm-brand-accent);
    --color-primary-hover: var(--thm-brand-accent-hover);
    --color-cyan: var(--thm-brand-accent-secondary);
    --color-cyan-radar: var(--thm-brand-accent-secondary);
    --color-violet: var(--thm-brand-accent-secondary);
    --color-learning: var(--thm-brand-accent-secondary);
    --color-pink: var(--thm-brand-accent-secondary);
    --badge-learning: var(--thm-brand-accent-secondary);
    --accent-secondary: var(--thm-brand-accent-secondary);
    --accent-cyan: var(--thm-brand-accent-secondary);
    --color-cyan-glow: color-mix(in srgb, var(--thm-brand-accent-secondary) 40%, transparent);
    --color-emerald: var(--thm-status-success);
    --color-success: var(--thm-status-success);
    --badge-completed: var(--thm-status-success);
    --accent-green: var(--thm-status-success);
    --status-success: var(--thm-status-success);
    --color-warning: var(--thm-status-warning);
    --badge-waiting: var(--thm-status-warning);
    --badge-need-owner: var(--thm-status-warning);
    --accent-amber: var(--thm-status-warning);
    --status-warning: var(--thm-status-warning);
    --color-danger: var(--thm-status-danger);
    --color-rose: var(--thm-status-danger);
    --badge-blocked: var(--thm-status-danger);
    --accent-red: var(--thm-status-danger);
    --status-danger: var(--thm-status-danger);
    --status-info: var(--thm-status-info);

    /* 03. Typography & Borders (design-tokens.css:36-41 + aliases) */
    --text-main: var(--thm-text-primary);
    --text-primary: var(--thm-text-primary);
    --text-secondary: var(--thm-text-secondary);
    --text-muted: var(--thm-text-muted);
    --text-dim: var(--thm-text-muted);
    --color-white: var(--thm-brand-on-accent);
    --border-color: var(--thm-border-default);
    --border-subtle: var(--thm-border-subtle);
    --font-family: var(--thm-font-sans);

    /* 04. Glassmorphism (design-tokens.css:44-54) */
    --glass-blur: blur(var(--thm-glass-blur, 12px));
    --bg-glass-card: var(--thm-glass-surface);
    --bg-glass-subtle: color-mix(in srgb, var(--thm-surface-subtle) 72%, transparent);
    --bg-glass-overlay: color-mix(in srgb, var(--thm-surface-canvas) 88%, transparent);
    --bg-glass-sheet: color-mix(in srgb, var(--thm-surface-elevated) 94%, transparent);
    --border-glass: var(--thm-glass-border);
    --border-glass-bright: color-mix(in srgb, var(--thm-brand-accent) 35%, transparent);
    --border-glass-cyan: color-mix(in srgb, var(--thm-brand-accent-secondary) 35%, transparent);
    --glass-highlight: var(--thm-glass-specular);
    --glass-shadow: var(--thm-elevation-popover);

    /* 05. Spacing, Radius, Z-Index & Canonical Viewport (design-tokens.css:57-71,97-110) */
    --space-2: 2px;
    --space-4: 4px;
    --space-8: 8px;
    --space-12: 12px;
    --space-16: 16px;
    --space-20: 20px;
    --space-24: 24px;
    --space-32: 32px;
    --radius-xs: 4px;
    --radius-sm: var(--thm-radius-sm);
    --radius-md: var(--thm-radius-md);
    --radius-lg: var(--thm-radius-lg);
    --radius-xl: 24px;
    --radius-pill: 9999px;
    --z-base: 1;
    --z-card: 2;
    --z-elevated: 10;
    --z-header: 20;
    --z-nav: 30;
    --z-sheet-backdrop: 90;
    --z-bottom-sheet: 100;
    --z-modal-backdrop: 190;
    --z-modal: 200;
    --z-toast: 300;
    --mobile-width: 390px;
    --mobile-height: 100dvh;

    /* 06. Glows & Shadows (design-tokens.css:74-86) */
    --shadow-card: var(--thm-elevation-card);
    --shadow-card-elevated: var(--thm-elevation-popover);
    --shadow-sheet: var(--thm-elevation-popover);
    --shadow-modal: var(--thm-elevation-popover);
    --glow-sm: 0 0 8px color-mix(in srgb, var(--thm-brand-accent-secondary) 25%, transparent);
    --glow-md: 0 0 16px color-mix(in srgb, var(--thm-brand-accent-secondary) 35%, transparent);
    --glow-lg: 0 0 24px color-mix(in srgb, var(--thm-brand-accent-secondary) 45%, transparent);
    --glow-primary: 0 4px 18px color-mix(in srgb, var(--thm-brand-accent) 40%, transparent);
    --glow-emerald: 0 0 16px color-mix(in srgb, var(--thm-status-success) 40%, transparent);
    --glow-green: 0 0 10px color-mix(in srgb, var(--thm-status-success) 40%, transparent);
    --glow-violet: 0 0 16px color-mix(in srgb, var(--thm-brand-accent-secondary) 40%, transparent);
    --glow-rose: 0 0 16px color-mix(in srgb, var(--thm-status-danger) 40%, transparent);

    /* 07. Motion Tokens (motion-tokens.css:9-24) */
    --duration-instant: calc(100ms * var(--thm-dur-scale, 1));
    --duration-fast: var(--thm-motion-duration-fast, 140ms);
    --duration-normal: var(--thm-motion-duration-normal, 220ms);
    --duration-sheet: var(--thm-dur-sheet, 280ms);
    --duration-slow: var(--thm-motion-duration-slow, 340ms);
    --duration-pulse: 2200ms;
    --duration-orbit-sweep: 6s;
    --duration-orbit-dashed: 24s;
    --ease-smooth: var(--thm-motion-spring-gentle, cubic-bezier(0.16, 1, 0.3, 1));
    --ease-spring: var(--thm-motion-spring-snappy, cubic-bezier(0.175, 0.885, 0.32, 1.15));
    --ease-out-quad: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
    --ease-decelerate: cubic-bezier(0, 0, 0.2, 1);
    --ease-accelerate: cubic-bezier(0.4, 0, 1, 1);

    /* 08. Omni-Beacon Tokens (omni-beacon.css:10-38 — all 24 + legacy --omni-bg) */
    --omni-bg: var(--thm-surface-canvas);
    --omni-bg-beacon: var(--thm-surface-canvas);
    --omni-bg-panel: var(--thm-surface-canvas);
    --omni-bg-surface: var(--thm-surface-primary);
    --omni-bg-card: var(--thm-surface-elevated);
    --omni-bg-card-hover: color-mix(in srgb, var(--thm-surface-elevated) 90%, var(--thm-brand-accent) 10%);
    --omni-border: var(--thm-border-default);
    --omni-border-highlight: var(--thm-border-strong);
    --omni-accent: var(--thm-brand-accent);
    --omni-accent-glow: color-mix(in srgb, var(--thm-brand-accent) 35%, transparent);
    --omni-healthy: var(--thm-status-success);
    --omni-working: var(--thm-status-info);
    --omni-blocked: var(--thm-status-danger);
    --omni-unknown: var(--thm-status-warning);
    --omni-offline: var(--thm-text-muted);
    --omni-text-main: var(--thm-text-primary);
    --omni-text-secondary: var(--thm-text-secondary);
    --omni-text-muted: var(--thm-text-muted);
    --omni-radius-beacon: 50%;
    --omni-radius-panel: var(--thm-radius-lg);
    --omni-radius-card: var(--thm-radius-md);
    --omni-radius-pill: 9999px;
    --omni-shadow-beacon: var(--thm-elevation-popover);
    --omni-shadow-panel: var(--thm-elevation-popover);
    --omni-snap-duration: var(--thm-dur-base);

    /* 09. Mentra Video & Tab-Mess Consumer Aliases (--mv-*) */
    --mv-bg: var(--thm-surface-canvas);
    --mv-surface: var(--thm-surface-primary);
    --mv-surface-strong: var(--thm-surface-elevated);
    --mv-text: var(--thm-text-primary);
    --mv-muted: var(--thm-text-muted);
    --mv-border: var(--thm-border-default);
    --mv-blue: var(--thm-brand-accent);
    --mv-cyan: var(--thm-brand-accent-secondary);
    --mv-green: var(--thm-status-success);
    --mv-amber: var(--thm-status-warning);
    --mv-danger: var(--thm-status-danger);
  }
}

/* Opt-in Unlayered Override Mode: overrides p0b unlayered :root when Core sets data-thm-core-override="true" */
:root[data-thm-core-override="true"][data-thm-theme]:not([data-thm-app="office-acc"]):not([data-thm-clean="true"]) {
  --bg-obsidian: var(--thm-surface-canvas);
  --bg-main: var(--thm-surface-canvas);
  --bg-base: var(--thm-surface-canvas);
  --bg-app: var(--thm-surface-canvas);
  --bg-primary: var(--thm-surface-canvas);
  --bg-surface: var(--thm-surface-primary);
  --bg-surface-primary: var(--thm-surface-primary);
  --bg-card: var(--thm-surface-primary);
  --bg-surface-card: var(--thm-surface-elevated);
  --bg-surface-elevated: var(--thm-surface-elevated);
  --bg-elevated: var(--thm-surface-elevated);
  --bg-card-hover: var(--thm-surface-elevated);
  --bg-deep-blue: color-mix(in srgb, var(--thm-brand-accent) 26%, var(--thm-surface-canvas));

  --color-primary: var(--thm-brand-accent);
  --accent-primary: var(--thm-brand-accent);
  --accent-blue: var(--thm-brand-accent);
  --badge-running: var(--thm-brand-accent);
  --color-primary-hover: var(--thm-brand-accent-hover);
  --color-cyan: var(--thm-brand-accent-secondary);
  --color-cyan-radar: var(--thm-brand-accent-secondary);
  --color-violet: var(--thm-brand-accent-secondary);
  --color-learning: var(--thm-brand-accent-secondary);
  --color-pink: var(--thm-brand-accent-secondary);
  --badge-learning: var(--thm-brand-accent-secondary);
  --accent-secondary: var(--thm-brand-accent-secondary);
  --accent-cyan: var(--thm-brand-accent-secondary);
  --color-cyan-glow: color-mix(in srgb, var(--thm-brand-accent-secondary) 40%, transparent);
  --color-emerald: var(--thm-status-success);
  --color-success: var(--thm-status-success);
  --badge-completed: var(--thm-status-success);
  --accent-green: var(--thm-status-success);
  --status-success: var(--thm-status-success);
  --color-warning: var(--thm-status-warning);
  --badge-waiting: var(--thm-status-warning);
  --badge-need-owner: var(--thm-status-warning);
  --accent-amber: var(--thm-status-warning);
  --status-warning: var(--thm-status-warning);
  --color-danger: var(--thm-status-danger);
  --color-rose: var(--thm-status-danger);
  --badge-blocked: var(--thm-status-danger);
  --accent-red: var(--thm-status-danger);
  --status-danger: var(--thm-status-danger);
  --status-info: var(--thm-status-info);

  --text-main: var(--thm-text-primary);
  --text-primary: var(--thm-text-primary);
  --text-secondary: var(--thm-text-secondary);
  --text-muted: var(--thm-text-muted);
  --text-dim: var(--thm-text-muted);
  --color-white: var(--thm-brand-on-accent);
  --border-color: var(--thm-border-default);
  --border-subtle: var(--thm-border-subtle);
  --font-family: var(--thm-font-sans);

  --glass-blur: blur(var(--thm-glass-blur, 12px));
  --bg-glass-card: var(--thm-glass-surface);
  --bg-glass-subtle: color-mix(in srgb, var(--thm-surface-subtle) 72%, transparent);
  --bg-glass-overlay: color-mix(in srgb, var(--thm-surface-canvas) 88%, transparent);
  --bg-glass-sheet: color-mix(in srgb, var(--thm-surface-elevated) 94%, transparent);
  --border-glass: var(--thm-glass-border);
  --border-glass-bright: color-mix(in srgb, var(--thm-brand-accent) 35%, transparent);
  --border-glass-cyan: color-mix(in srgb, var(--thm-brand-accent-secondary) 35%, transparent);
  --glass-highlight: var(--thm-glass-specular);
  --glass-shadow: var(--thm-elevation-popover);

  --space-2: 2px;
  --space-4: 4px;
  --space-8: 8px;
  --space-12: 12px;
  --space-16: 16px;
  --space-20: 20px;
  --space-24: 24px;
  --space-32: 32px;
  --radius-xs: 4px;
  --radius-sm: var(--thm-radius-sm);
  --radius-md: var(--thm-radius-md);
  --radius-lg: var(--thm-radius-lg);
  --radius-xl: 24px;
  --radius-pill: 9999px;
  --z-base: 1;
  --z-card: 2;
  --z-elevated: 10;
  --z-header: 20;
  --z-nav: 30;
  --z-sheet-backdrop: 90;
  --z-bottom-sheet: 100;
  --z-modal-backdrop: 190;
  --z-modal: 200;
  --z-toast: 300;
  --mobile-width: 390px;
  --mobile-height: 100dvh;

  --shadow-card: var(--thm-elevation-card);
  --shadow-card-elevated: var(--thm-elevation-popover);
  --shadow-sheet: var(--thm-elevation-popover);
  --shadow-modal: var(--thm-elevation-popover);
  --glow-sm: 0 0 8px color-mix(in srgb, var(--thm-brand-accent-secondary) 25%, transparent);
  --glow-md: 0 0 16px color-mix(in srgb, var(--thm-brand-accent-secondary) 35%, transparent);
  --glow-lg: 0 0 24px color-mix(in srgb, var(--thm-brand-accent-secondary) 45%, transparent);
  --glow-primary: 0 4px 18px color-mix(in srgb, var(--thm-brand-accent) 40%, transparent);
  --glow-emerald: 0 0 16px color-mix(in srgb, var(--thm-status-success) 40%, transparent);
  --glow-green: 0 0 10px color-mix(in srgb, var(--thm-status-success) 40%, transparent);
  --glow-violet: 0 0 16px color-mix(in srgb, var(--thm-brand-accent-secondary) 40%, transparent);
  --glow-rose: 0 0 16px color-mix(in srgb, var(--thm-status-danger) 40%, transparent);

  --duration-instant: calc(100ms * var(--thm-dur-scale, 1));
  --duration-fast: var(--thm-motion-duration-fast, 140ms);
  --duration-normal: var(--thm-motion-duration-normal, 220ms);
  --duration-sheet: var(--thm-dur-sheet, 280ms);
  --duration-slow: var(--thm-motion-duration-slow, 340ms);
  --duration-pulse: 2200ms;
  --duration-orbit-sweep: 6s;
  --duration-orbit-dashed: 24s;
  --ease-smooth: var(--thm-motion-spring-gentle, cubic-bezier(0.16, 1, 0.3, 1));
  --ease-spring: var(--thm-motion-spring-snappy, cubic-bezier(0.175, 0.885, 0.32, 1.15));
  --ease-out-quad: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-decelerate: cubic-bezier(0, 0, 0.2, 1);
  --ease-accelerate: cubic-bezier(0.4, 0, 1, 1);

  --omni-bg: var(--thm-surface-canvas);
  --omni-bg-beacon: var(--thm-surface-canvas);
  --omni-bg-panel: var(--thm-surface-canvas);
  --omni-bg-surface: var(--thm-surface-primary);
  --omni-bg-card: var(--thm-surface-elevated);
  --omni-bg-card-hover: color-mix(in srgb, var(--thm-surface-elevated) 90%, var(--thm-brand-accent) 10%);
  --omni-border: var(--thm-border-default);
  --omni-border-highlight: var(--thm-border-strong);
  --omni-accent: var(--thm-brand-accent);
  --omni-accent-glow: color-mix(in srgb, var(--thm-brand-accent) 35%, transparent);
  --omni-healthy: var(--thm-status-success);
  --omni-working: var(--thm-status-info);
  --omni-blocked: var(--thm-status-danger);
  --omni-unknown: var(--thm-status-warning);
  --omni-offline: var(--thm-text-muted);
  --omni-text-main: var(--thm-text-primary);
  --omni-text-secondary: var(--thm-text-secondary);
  --omni-text-muted: var(--thm-text-muted);
  --omni-radius-beacon: 50%;
  --omni-radius-panel: var(--thm-radius-lg);
  --omni-radius-card: var(--thm-radius-md);
  --omni-radius-pill: 9999px;
  --omni-shadow-beacon: var(--thm-elevation-popover);
  --omni-shadow-panel: var(--thm-elevation-popover);
  --omni-snap-duration: var(--thm-dur-base);

  --mv-bg: var(--thm-surface-canvas);
  --mv-surface: var(--thm-surface-primary);
  --mv-surface-strong: var(--thm-surface-elevated);
  --mv-text: var(--thm-text-primary);
  --mv-muted: var(--thm-text-muted);
  --mv-border: var(--thm-border-default);
  --mv-blue: var(--thm-brand-accent);
  --mv-cyan: var(--thm-brand-accent-secondary);
  --mv-green: var(--thm-status-success);
  --mv-amber: var(--thm-status-warning);
  --mv-danger: var(--thm-status-danger);
}
