import { cva, type VariantProps } from 'class-variance-authority'

export function cn(...inputs: (string | undefined | null | false)[]): string {
  return inputs.filter(Boolean).join(' ')
}

/** Token-driven surface variants. Classes resolve via the ui-tokens v4 @theme adapter
 * (e.g. `bg-accent` → var(--mod-color-accent)). No raw color/length literals. */
export const surface = cva('', {
  variants: {
    tone: {
      fg: 'text-fg',
      'fg-muted': 'text-fg-muted',
      accent: 'bg-accent text-accent-fg',
      surface: 'bg-surface text-fg',
      danger: 'bg-danger text-accent-fg',
    },
    radius: {
      none: 'rounded-none',
      sm: 'rounded-sm',
      md: 'rounded-md',
      lg: 'rounded-lg',
      xl: 'rounded-xl',
      full: 'rounded-full',
    },
    size: {
      sm: 'text-sm',
      base: 'text-base',
      lg: 'text-lg',
    },
  },
  defaultVariants: { tone: 'surface', radius: 'md', size: 'base' },
})

export type SurfaceProps = VariantProps<typeof surface>
