/* frontend/src/theme/tokens.css */

/* ═══ Tier 1: Primitive tokens (internal only) ═══ */
:root {
  /* Spacing scale (4px base) */
  --z-space-1: 4px;  --z-space-2: 8px;  --z-space-3: 12px;
  --z-space-4: 16px; --z-space-5: 20px; --z-space-6: 24px;
  --z-space-8: 32px; --z-space-10: 40px; --z-space-12: 48px;

  /* Type scale */
  --z-font-xs: 10px; --z-font-sm: 12px; --z-font-md: 13px;
  --z-font-lg: 15px; --z-font-xl: 18px; --z-font-2xl: 22px;

  /* Radius scale */
  --z-radius-none: 0px; --z-radius-sm: 4px; --z-radius-md: 8px;
  --z-radius-lg: 12px;  --z-radius-xl: 16px; --z-radius-full: 9999px;

  /* Elevation */
  --z-shadow-none: none;
  --z-shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
  --z-shadow-md: 0 4px 12px rgba(0,0,0,0.15);
  --z-shadow-lg: 0 8px 32px rgba(0,0,0,0.25);

  /* Motion */
  --z-duration-fast: 0.1s;
  --z-duration-normal: 0.2s;
  --z-duration-slow: 0.3s;
  --z-ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ═══ Tier 2: Semantic tokens (component-facing) ═══ */
:root {
  /* Accent — set dynamically by applyTheme() */
  --z-accent: #a855f7;
  --z-accent-light: #c084fc;
  --z-accent-dim: rgba(168,85,247,0.10);
  --z-accent-border: rgba(168,85,247,0.3);
  --z-accent-text: #c084fc;

  /* Surfaces — dark defaults */
  --z-bg: #0a0a0a;
  --z-surface: #0d0d0d;
  --z-card-bg: rgba(255,255,255,0.015);
  --z-text: #e5e5e5;
  --z-muted: rgba(255,255,255,0.3);
  --z-border: rgba(255,255,255,0.06);
  --z-border-hover: rgba(255,255,255,0.1);

  /* Derived semantic — set by applyTheme() from app config */
  --z-radius: var(--z-radius-md);
  --z-radius-card: var(--z-radius);
  --z-radius-button: var(--z-radius);
  --z-radius-input: var(--z-radius);
  --z-radius-badge: var(--z-radius-full);

  --z-card-border: 1px solid var(--z-border);
  --z-card-shadow: var(--z-shadow-none);

  --z-content-width: 960px;
  --z-transition: var(--z-duration-normal) var(--z-ease);
  --z-density-padding: var(--z-space-3);
}

/* Light mode overrides */
html.light {
  --z-bg: #fafafa;
  --z-surface: #ffffff;
  --z-card-bg: rgba(0,0,0,0.02);
  --z-text: #18181b;
  --z-muted: rgba(0,0,0,0.4);
  --z-border: rgba(0,0,0,0.08);
  --z-border-hover: rgba(0,0,0,0.15);
}
