/**
 * Built-in theme definitions.
 *
 * The default palettes follow the Singularity Engine design system:
 * Scandinavian x IBM Carbon, ember-40 accent, warm gray/stone neutrals,
 * paper/ink semantics, hard hairlines, and restrained status color.
 */

import type { ThemeJson } from "./theme.js";

const dark: ThemeJson = {
	name: "dark",
	vars: {
		ember40: "#ff8838",
		paper: "#f7f5f1",
		paper2: "#efece6",
		stone1: "#d4cfc3",
		stone2: "#8d877a",
		stone3: "#6b6659",
		ink1: "#1a1916",
		ink2: "#2c2a26",
		ink3: "#3d3b36",
		green: "#24a148",
		red: "#da1e28",
		blue: "#4589ff",
		yellow: "#f1c21b",
		mutedBg: "#22201d",
		selectedBg: "#2c2a26",
		userMsgBg: "#1a1916",
		toolPendingBg: "#1a1916",
		toolSuccessBg: "#172018",
		toolErrorBg: "#261717",
		customMsgBg: "#22201d",
	},
	colors: {
		accent: "ember40",
		border: "stone3",
		borderAccent: "ember40",
		borderMuted: "ink3",
		success: "green",
		error: "red",
		warning: "ember40",
		muted: "stone2",
		dim: "stone3",
		text: "paper",
		thinkingText: "stone2",

		selectedBg: "selectedBg",
		userMessageBg: "userMsgBg",
		userMessageText: "paper",
		customMessageBg: "customMsgBg",
		customMessageText: "paper",
		customMessageLabel: "ember40",
		toolPendingBg: "toolPendingBg",
		toolSuccessBg: "toolSuccessBg",
		toolErrorBg: "toolErrorBg",
		toolTitle: "ember40",
		toolOutput: "stone2",

		mdHeading: "paper",
		mdLink: "ember40",
		mdLinkUrl: "stone2",
		mdCode: "ember40",
		mdCodeBlock: "paper2",
		mdCodeBlockBorder: "stone3",
		mdQuote: "stone1",
		mdQuoteBorder: "ember40",
		mdHr: "stone3",
		mdListBullet: "ember40",

		toolDiffAdded: "green",
		toolDiffRemoved: "red",
		toolDiffContext: "stone2",

		syntaxComment: "stone2",
		syntaxKeyword: "ember40",
		syntaxFunction: "paper",
		syntaxVariable: "paper2",
		syntaxString: "#ffb27a",
		syntaxNumber: "#f1c21b",
		syntaxType: "#33b1ff",
		syntaxOperator: "stone1",
		syntaxPunctuation: "stone2",

		thinkingOff: "ink3",
		thinkingMinimal: "stone3",
		thinkingLow: "stone2",
		thinkingMedium: "ember40",
		thinkingHigh: "#ffb27a",
		thinkingXhigh: "#fff1e6",

		bashMode: "green",
	},
	export: {
		pageBg: "#1a1916",
		cardBg: "#22201d",
		infoBg: "#2c2a26",
	},
};

const light: ThemeJson = {
	name: "light",
	vars: {
		ember40: "#ff8838",
		paper: "#f7f5f1",
		paper2: "#efece6",
		paper3: "#e6e2da",
		stone1: "#d4cfc3",
		stone2: "#8d877a",
		stone3: "#6b6659",
		ink1: "#1a1916",
		ink2: "#3d3b36",
		green: "#24a148",
		red: "#da1e28",
		blue: "#4589ff",
		yellow: "#f1c21b",
		selectedBg: "#efece6",
		userMsgBg: "#ffffff",
		toolPendingBg: "#ffffff",
		toolSuccessBg: "#f0f6ef",
		toolErrorBg: "#fff1ee",
		customMsgBg: "#efece6",
	},
	colors: {
		accent: "ember40",
		border: "stone3",
		borderAccent: "ember40",
		borderMuted: "stone1",
		success: "green",
		error: "red",
		warning: "ember40",
		muted: "stone3",
		dim: "stone2",
		text: "ink1",
		thinkingText: "stone3",

		selectedBg: "selectedBg",
		userMessageBg: "userMsgBg",
		userMessageText: "ink1",
		customMessageBg: "customMsgBg",
		customMessageText: "ink1",
		customMessageLabel: "ember40",
		toolPendingBg: "toolPendingBg",
		toolSuccessBg: "toolSuccessBg",
		toolErrorBg: "toolErrorBg",
		toolTitle: "ember40",
		toolOutput: "stone3",

		mdHeading: "ink1",
		mdLink: "ember40",
		mdLinkUrl: "stone3",
		mdCode: "ember40",
		mdCodeBlock: "ink2",
		mdCodeBlockBorder: "stone1",
		mdQuote: "stone3",
		mdQuoteBorder: "ember40",
		mdHr: "stone1",
		mdListBullet: "ember40",

		toolDiffAdded: "green",
		toolDiffRemoved: "red",
		toolDiffContext: "stone3",

		syntaxComment: "stone3",
		syntaxKeyword: "#b5500f",
		syntaxFunction: "ink1",
		syntaxVariable: "ink2",
		syntaxString: "#8a3d0a",
		syntaxNumber: "#87620a",
		syntaxType: "#3a5c8c",
		syntaxOperator: "ink2",
		syntaxPunctuation: "stone3",

		thinkingOff: "stone1",
		thinkingMinimal: "stone2",
		thinkingLow: "stone3",
		thinkingMedium: "ember40",
		thinkingHigh: "#e56a1a",
		thinkingXhigh: "#8a3d0a",

		bashMode: "green",
	},
	export: {
		pageBg: "#f7f5f1",
		cardBg: "#ffffff",
		infoBg: "#efece6",
	},
};

export const builtinThemes: Record<string, ThemeJson> = { dark, light };
