/** Keyword routing for the landing chat welcome turn. */
export function detectLandingIntent(text: string): 'support' | 'console' | 'signup' | null {
  const t = text.trim().toLowerCase();
  if (!t) return null;
  if (
    /\b(sign\s*up|signup|register|request\s+access|new\s+account|join)\b/.test(t) ||
    t === 'access'
  ) {
    return 'signup';
  }
  // Console access is via the form on the right — never collect passwords in chat.
  if (
    /\b(sign\s*in|signin|log\s*in|login|password|console|credentials)\b/.test(t) ||
    t === 'login' ||
    t === 'sign in'
  ) {
    return 'console';
  }
  if (
    /\b(help|support|issue|problem|ticket|broken|error|how\s+do|need\s+help|question)\b/.test(t) ||
    t === 'help' ||
    t === 'support'
  ) {
    return 'support';
  }
  // Longer free text → treat as wanting support (demo-friendly).
  if (t.length >= 12) return 'support';
  return null;
}
