// theme.jsx — theme token sets + helper. Exported to window.
// Three themes for the visual-style comparison: apron (light, default),
// cockpit (dark instrument), hivis (safety high-contrast).

const THEMES = {
  airasia: {
    name: "AirAsia",
    bg: "#F3F4F6",            // clean light grey
    surface: "#FFFFFF",
    surface2: "#F4F5F7",
    line: "#E3E5EA",
    ink: "#16181D",           // near-black
    ink2: "#525B68",
    inkSoft: "#8B94A1",
    accent: "#ED1C24",        // AirAsia red
    accentInk: "#FFFFFF",     // white on red
    data: "#15489E",          // secondary info blue
    danger: "#E8590C",        // caution orange (kept distinct from the brand red)
    good: "#1F8A5B",
    chip: "#EEF0F3",
    onAccentNav: "#FFFFFF",
    glow: "rgba(237,28,36,0.0)",
    statusInk: "#16181D",
    isDark: false,
  },
  apron: {
    name: "Apron",
    bg: "#ECE9E2",            // paper / ramp concrete
    surface: "#FBFAF7",
    surface2: "#F2EFE8",
    line: "#D8D3C7",
    ink: "#1C2530",           // deep navy ink
    ink2: "#5A6573",
    inkSoft: "#8A93A0",
    accent: "#F2A41C",        // hi-vis aviation amber
    accentInk: "#241a05",
    data: "#0E7C86",          // cyan/teal data
    danger: "#D5452B",
    good: "#1F8A5B",
    chip: "#EDE9E0",
    onAccentNav: "#1C2530",
    glow: "rgba(242,164,28,0.0)",
    statusInk: "#1C2530",
    isDark: false,
  },
  cockpit: {
    name: "Cockpit",
    bg: "#0B0F14",
    surface: "#141A22",
    surface2: "#1B232E",
    line: "#26303C",
    ink: "#E7EDF3",
    ink2: "#9AA7B4",
    inkSoft: "#5E6C7A",
    accent: "#FFB020",
    accentInk: "#1a1203",
    data: "#36D6C3",          // instrument cyan-green glow
    danger: "#FF5B47",
    good: "#3FD980",
    chip: "#1B232E",
    onAccentNav: "#0B0F14",
    glow: "rgba(54,214,195,0.12)",
    statusInk: "#E7EDF3",
    isDark: true,
  },
  hivis: {
    name: "Hi-Vis",
    bg: "#F4F5F6",
    surface: "#FFFFFF",
    surface2: "#F0F1F3",
    line: "#D2D6DB",
    ink: "#101317",
    ink2: "#454B54",
    inkSoft: "#7A828C",
    accent: "#FF5A00",        // safety orange
    accentInk: "#1a0700",
    data: "#1742C4",          // strong blue
    danger: "#D60000",
    good: "#0A8A3C",
    chip: "#EBECEE",
    onAccentNav: "#FFFFFF",
    glow: "rgba(0,0,0,0)",
    statusInk: "#101317",
    isDark: false,
  },
};

function themeVars(key) {
  const t = THEMES[key] || THEMES.apron;
  return {
    "--bg": t.bg, "--surface": t.surface, "--surface2": t.surface2,
    "--line": t.line, "--ink": t.ink, "--ink2": t.ink2, "--ink-soft": t.inkSoft,
    "--accent": t.accent, "--accent-ink": t.accentInk, "--data": t.data,
    "--danger": t.danger, "--good": t.good, "--chip": t.chip,
    "--on-accent-nav": t.onAccentNav, "--glow": t.glow, "--status-ink": t.statusInk,
  };
}

Object.assign(window, { THEMES, themeVars });
