/**
 * Nebula Core default theme tokens.
 * @type {{
 *   colors: Record<string, string>,
 *   spacing: Record<string, number>,
 *   radius: Record<string, number>,
 *   typography: Record<string, number>,
 *   motion: Record<string, number>
 * }}
 */
export const baseTheme = {
  colors: {
    background: "#0b0d12",
    surface: "#161a22",
    accent: "#5b7cff",
    text: "#f5f7ff",
    textMuted: "#b7c0d8",
    focus: "#8ddcff",
    danger: "#ff6363"
  },
  spacing: {
    xs: 4,
    sm: 8,
    md: 16,
    lg: 24,
    xl: 32,
    xxl: 48
  },
  radius: {
    sm: 6,
    md: 10,
    lg: 16,
    pill: 999
  },
  typography: {
    caption: 12,
    body: 16,
    title: 22,
    display: 32
  },
  motion: {
    fast: 120,
    base: 200,
    slow: 320
  }
};

/**
 * Merge theme overrides with the Nebula base tokens.
 * @param {Partial<typeof baseTheme>} overrides
 * @returns {typeof baseTheme}
 */
export function createTheme(overrides = {}) {
  return {
    colors: { ...baseTheme.colors, ...overrides.colors },
    spacing: { ...baseTheme.spacing, ...overrides.spacing },
    radius: { ...baseTheme.radius, ...overrides.radius },
    typography: { ...baseTheme.typography, ...overrides.typography },
    motion: { ...baseTheme.motion, ...overrides.motion }
  };
}
