// theme.jsx — design tokens for the email client
// Brutalist / monospace. Flat, 1px borders, high-contrast type.

const MONO = '"JetBrains Mono", "IBM Plex Mono", "SF Mono", ui-monospace, Menlo, monospace';

// Build palette from dark flag. Keep warm neutrals in light, cool neutrals in dark.
function makeTheme(dark) {
  if (dark) {
    return {
      mono: MONO,
      bg:        '#0d0e10',    // app bg
      bg2:       '#141518',    // panel bg
      bg3:       '#1a1c20',    // hover / selected row
      bgInset:   '#08090a',    // reading pane bg (deepest)
      border:    '#222428',    // default 1px
      border2:   '#2d3036',    // slightly stronger
      text:      '#e6e4df',    // primary text
      textDim:   '#8b8a85',    // secondary text
      textFaint: '#55544f',    // metadata, hints
      textInv:   '#0d0e10',    // on accent
      accent:    'oklch(0.78 0.16 245)',     // electric blue
      accent2:   'oklch(0.82 0.16 80)',      // amber (unread/flagged)
      good:      'oklch(0.78 0.14 150)',     // green (sent)
      danger:    'oklch(0.70 0.18 25)',      // red (delete/urgent)
      caret:     '#e6e4df',
      shadow:    '0 16px 48px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,255,255,0.06)',
      label: {
        urgent:    'oklch(0.70 0.17 25)',
        invoice:   'oklch(0.72 0.16 290)',
        newsletter:'oklch(0.74 0.13 195)',
        personal:  'oklch(0.78 0.15 60)',
        client:    'oklch(0.74 0.14 245)',
        ops:       'oklch(0.76 0.13 150)',
      },
      dark: true,
    };
  }
  return {
    mono: MONO,
    bg:        '#f6f4ef',
    bg2:       '#eeece5',
    bg3:       '#e4e1d7',
    bgInset:   '#fbfaf6',
    border:    '#d4d0c4',
    border2:   '#b9b4a3',
    text:      '#1a1915',
    textDim:   '#6b6860',
    textFaint: '#a19e95',
    textInv:   '#f6f4ef',
    accent:    'oklch(0.52 0.16 245)',
    accent2:   'oklch(0.60 0.16 60)',
    good:      'oklch(0.55 0.14 150)',
    danger:    'oklch(0.52 0.18 25)',
    caret:     '#1a1915',
    shadow:    '0 16px 48px rgba(0,0,0,0.22), 0 0 0 1px rgba(0,0,0,0.08)',
    label: {
      urgent:    'oklch(0.50 0.17 25)',
      invoice:   'oklch(0.50 0.16 290)',
      newsletter:'oklch(0.52 0.14 195)',
      personal:  'oklch(0.55 0.15 60)',
      client:    'oklch(0.50 0.14 245)',
      ops:       'oklch(0.52 0.13 150)',
    },
    dark: false,
  };
}

// Density → row heights, paddings
const DENSITY = {
  compact:  { row: 44,  pad: 8,  gap: 2,  preview: 0 },
  comfortable: { row: 64,  pad: 12, gap: 4,  preview: 1 },
  cozy:     { row: 88,  pad: 16, gap: 6,  preview: 2 },
};

Object.assign(window, { makeTheme, DENSITY });
