/* Magogi design tokens — kit entry point (mgf-brand-web 0.3.0)
 * ---------------------------------------------------------------------------
 * ONE TOKEN TRUTH (M1 Wave-2 P1.3). The canonical token layer is
 * ./global-tokens.css — a VERBATIM copy of the GENERATED
 * mgf-brand/brand/assets/system/global-tokens.css (single source:
 * design-tokens.json; regenerate/verify upstream with
 * `python3 brand/build/gen_tokens.py --check`). Never hand-edit the vendored
 * file — re-vendor it. The --mgf-* namespace is the only canonical spelling
 * of every token; it now includes the busy/derived functional hues (ratified
 * as canon by Decision 24, founder-enacted 2026-07-04).
 *
 * This file stays the kit's linked entry (`<link ... tokens.css>`) so
 * existing consumers keep working unchanged: it imports the canon layer,
 * then declares the DEPRECATED legacy aliases below.
 *
 * DEPRECATED ALIASES — removal target: 0.5.0 (retargeted from 0.4.0: the
 * P4.2 adoption wave still consumes aliases from the apps' remaining
 * domain CSS; removal follows their migration, deliberately, not silently
 * under them). Consume --mgf-* directly in
 * new code. Aliases are value-faithful: where a canon token carries the
 * exact same value (both themes) the alias points at it; the few legacy
 * values with NO canon equivalent keep their original recipes verbatim
 * (each is annotated with the nearest canon token — migrate deliberately,
 * because the nearest canon VALUE differs).
 */
@import url("global-tokens.css");

:root {
  /* -- pointing aliases: identical values in both themes, via canon ------ */
  --color-primary: var(--mgf-indigo);
  --color-link: var(--mgf-color-link);
  --color-link-hover: var(--mgf-color-link-hover);
  --color-accent: var(--mgf-gold);
  --color-success: var(--mgf-color-status-success-bg);
  --color-success-tint: var(--mgf-color-status-success-tint);
  --color-success-text: var(--mgf-color-status-success-strong);
  --color-warning-tint: var(--mgf-color-status-warning-tint);
  --color-warning-text: var(--mgf-color-status-warning-strong);
  --color-info-tint: var(--mgf-color-status-info-tint);
  --color-info-text: var(--mgf-color-status-info-strong);
  --color-error-tint: var(--mgf-color-status-error-tint);
  --color-error-text: var(--mgf-color-status-error-strong);
  --state-busy: var(--mgf-color-state-busy);
  --state-busy-tint: var(--mgf-color-state-busy-tint);
  --state-busy-text: var(--mgf-color-state-busy-strong);
  --state-derived: var(--mgf-color-state-derived);
  --state-derived-tint: var(--mgf-color-state-derived-tint);
  --state-derived-text: var(--mgf-color-state-derived-strong);
  --color-text: var(--mgf-color-text-primary);
  --color-text-muted: var(--mgf-color-text-secondary);
  --color-bg: var(--mgf-color-bg-canvas);
  --color-surface-raised: var(--mgf-color-bg-surface-raised);
  --color-border-strong: var(--mgf-color-border-strong);
  --font-sans: var(--mgf-font-body); /* rename resolved per canon: body */
  --font-display: var(--mgf-font-display);
  --font-mono: var(--mgf-font-mono);
  --shadow-sm: var(--mgf-shadow-sm);
  --shadow-md: var(--mgf-shadow-md);
  --motion-fast: var(--mgf-duration-fast);
  --ease-standard: var(--mgf-ease-standard);
  --radius-md: var(--mgf-radius-sm); /* legacy md was 8px = canon sm */
  --radius-lg: var(--mgf-radius-lg);
  --radius-pill: var(--mgf-radius-pill);
  /* contiguous canon spacing — also FIXES formerly-undefined gaps
   * (--space-5 was consumed by mgf-test-web but never defined pre-0.3) */
  --space-0: var(--mgf-space-0);
  --space-1: var(--mgf-space-1);
  --space-2: var(--mgf-space-2);
  --space-3: var(--mgf-space-3);
  --space-4: var(--mgf-space-4);
  --space-5: var(--mgf-space-5);
  --space-6: var(--mgf-space-6);
  --space-7: var(--mgf-space-7);
  --space-8: var(--mgf-space-8);
  --space-9: var(--mgf-space-9);
  --space-10: var(--mgf-space-10);
  --space-11: var(--mgf-space-11);
  --space-12: var(--mgf-space-12);
  --space-16: var(--mgf-space-16);
  --space-24: var(--mgf-space-24);

  /* -- legacy values with NO exact canon equivalent (recipes verbatim) --- */
  --color-primary-tint: color-mix(in srgb, var(--mgf-indigo) 10%, white);
  --color-primary-shade: color-mix(in srgb, var(--mgf-indigo) 80%, black);
  --color-accent-tint: color-mix(in srgb, var(--mgf-gold) 22%, white);
  --color-accent-strong: color-mix(in srgb, var(--mgf-gold) 55%, black);
  /* nearest canon: --mgf-color-bg-muted (full Mist — visibly darker) */
  --color-bg-soft: color-mix(in srgb, var(--mgf-mist) 55%, var(--mgf-paper));
  /* nearest canon: --mgf-color-border-subtle (same on light; dark differs) */
  --color-border: var(--mgf-mist);
  /* nearest canon: --mgf-radius-sm (8px per the Book) — NOTE the name trap:
   * legacy --radius-sm (4px) is NOT --mgf-radius-sm (8px) */
  --radius-sm: 0.25rem;
  /* nearest canon: --mgf-radius-tile (20px) */
  --radius-xl: 1.5rem;
  /* nearest canon: --mgf-duration-normal (180ms) */
  --motion-normal: 160ms;

  /* -- kit layout constants (kit-scope, not brand tokens) ---------------- */
  --content-max: 84rem;
  --content-prose: 42rem;
}

/* Dark values for the recipe-kept legacy aliases only (pointing aliases
 * flip by themselves through the canon layer). Declared on both theme
 * paths, mirroring the generated structure. */
[data-theme="dark"] {
  --color-primary-tint: color-mix(in srgb, var(--mgf-indigo) 32%, var(--mgf-ink));
  --color-primary-shade: color-mix(in srgb, var(--mgf-indigo) 35%, white);
  --color-accent-tint: color-mix(in srgb, var(--mgf-gold) 24%, var(--mgf-ink));
  --color-accent-strong: color-mix(in srgb, var(--mgf-gold) 82%, white);
  --color-bg-soft: color-mix(in srgb, white 6%, var(--mgf-ink));
  --color-border: color-mix(in srgb, var(--mgf-slate) 45%, var(--mgf-ink));
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-primary-tint: color-mix(in srgb, var(--mgf-indigo) 32%, var(--mgf-ink));
    --color-primary-shade: color-mix(in srgb, var(--mgf-indigo) 35%, white);
    --color-accent-tint: color-mix(in srgb, var(--mgf-gold) 24%, var(--mgf-ink));
    --color-accent-strong: color-mix(in srgb, var(--mgf-gold) 82%, white);
    --color-bg-soft: color-mix(in srgb, white 6%, var(--mgf-ink));
    --color-border: color-mix(in srgb, var(--mgf-slate) 45%, var(--mgf-ink));
  }
}
