/* global React */
// Saloon — Icon set. Tiny inline SVGs, single-stroke, premium-neutral.
// Usage: <Icon name="search" size={18} />

const ICONS = {
  search: (s) => <><circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/></>,
  chevron_down: () => <path d="m6 9 6 6 6-6"/>,
  chevron_right: () => <path d="m9 6 6 6-6 6"/>,
  chevron_left: () => <path d="m15 6-6 6 6 6"/>,
  close: () => <><path d="M18 6 6 18"/><path d="m6 6 12 12"/></>,
  arrow_right: () => <><path d="M5 12h14"/><path d="m13 6 6 6-6 6"/></>,
  arrow_up_right: () => <><path d="M7 17 17 7"/><path d="M8 7h9v9"/></>,
  pin: () => <><path d="M12 22s-7-6.5-7-12a7 7 0 1 1 14 0c0 5.5-7 12-7 12Z"/><circle cx="12" cy="10" r="2.5"/></>,
  pin_filled: () => <><path d="M12 22s-7-6.5-7-12a7 7 0 1 1 14 0c0 5.5-7 12-7 12Z" fill="currentColor" stroke="none"/><circle cx="12" cy="10" r="2.2" fill="#fff" stroke="none"/></>,
  star: () => <path d="m12 3 2.6 5.6 6.1.6-4.6 4.2 1.3 6L12 16.8 6.6 19.4l1.3-6L3.3 9.2l6.1-.6L12 3Z" fill="currentColor" stroke="none"/>,
  heart: () => <path d="M20.8 6.6a5.4 5.4 0 0 0-7.7 0L12 7.7l-1.1-1.1a5.4 5.4 0 1 0-7.7 7.7L12 22.8l8.8-8.5a5.4 5.4 0 0 0 0-7.7Z"/>,
  filter: () => <><path d="M4 6h16"/><path d="M7 12h10"/><path d="M10 18h4"/></>,
  sliders: () => <><path d="M4 6h12"/><circle cx="18" cy="6" r="2"/><path d="M4 12h6"/><circle cx="12" cy="12" r="2"/><path d="M4 18h12"/><circle cx="18" cy="18" r="2"/></>,
  map: () => <><path d="m9 4 6 2 6-2v14l-6 2-6-2-6 2V6l6-2Z"/><path d="M9 4v16"/><path d="M15 6v16"/></>,
  list: () => <><path d="M8 6h12"/><path d="M8 12h12"/><path d="M8 18h12"/><circle cx="4" cy="6" r="1" fill="currentColor"/><circle cx="4" cy="12" r="1" fill="currentColor"/><circle cx="4" cy="18" r="1" fill="currentColor"/></>,
  globe: () => <><circle cx="12" cy="12" r="9"/><path d="M3 12h18"/><path d="M12 3a14 14 0 0 1 0 18M12 3a14 14 0 0 0 0 18"/></>,
  user: () => <><circle cx="12" cy="8" r="4"/><path d="M3 21a9 9 0 0 1 18 0"/></>,
  menu: () => <><path d="M4 7h16"/><path d="M4 17h16"/></>,
  bolt: () => <path d="M13 2 4 14h7l-1 8 9-12h-7l1-8Z" fill="currentColor" stroke="none"/>,
  calendar: () => <><rect x="3" y="5" width="18" height="16" rx="2"/><path d="M3 9h18"/><path d="M8 3v4"/><path d="M16 3v4"/></>,
  home: () => <><path d="m4 11 8-7 8 7"/><path d="M6 10v10h12V10"/></>,
  briefcase: () => <><rect x="3" y="7" width="18" height="13" rx="2"/><path d="M8 7V5a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/></>,
  clock: () => <><circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 2"/></>,
  check: () => <path d="m5 12 5 5 9-12"/>,
  check_circle: () => <><circle cx="12" cy="12" r="9"/><path d="m8 12 3 3 5-6"/></>,
  shield_check: () => <><path d="M12 3 4 6v6c0 5 3.5 8.5 8 9 4.5-.5 8-4 8-9V6l-8-3Z"/><path d="m9 12 2 2 4-4"/></>,
  message: () => <path d="M21 12a8 8 0 0 1-11.6 7.2L4 21l1.8-5.4A8 8 0 1 1 21 12Z"/>,
  scissors: () => <><circle cx="6" cy="6" r="3"/><circle cx="6" cy="18" r="3"/><path d="m20 4-12 8"/><path d="m20 20-12-8"/></>,
  sparkle: () => <><path d="M12 3v6"/><path d="M12 15v6"/><path d="M3 12h6"/><path d="M15 12h6"/><path d="m5.6 5.6 4.2 4.2"/><path d="m14.2 14.2 4.2 4.2"/><path d="m18.4 5.6-4.2 4.2"/><path d="M9.8 14.2 5.6 18.4"/></>,
  leaf: () => <><path d="M4 20s2-10 10-12c4-1 8 0 8 0s0 4-1 8c-2 8-12 10-12 10Z"/><path d="M4 20s6-6 14-8"/></>,
  car: () => <><path d="M5 17h14v-4l-2-5H7L5 13Z"/><circle cx="8" cy="17" r="2"/><circle cx="16" cy="17" r="2"/></>,
  walk: () => <><circle cx="13" cy="4" r="2"/><path d="m9 21 2-6 2 2 3 4"/><path d="m11 15-3-3 4-6 4 4"/></>,
  card: () => <><rect x="3" y="6" width="18" height="13" rx="2"/><path d="M3 11h18"/></>,
  phone: () => <path d="M5 4h3l2 5-2 1a11 11 0 0 0 5 5l1-2 5 2v3a2 2 0 0 1-2 2A16 16 0 0 1 3 6a2 2 0 0 1 2-2Z"/>,
  info: () => <><circle cx="12" cy="12" r="9"/><path d="M12 8h.01"/><path d="M11 12h1v4h1"/></>,
  plus: () => <><path d="M12 5v14"/><path d="M5 12h14"/></>,
  minus: () => <path d="M5 12h14"/>,
  receipt: () => <><path d="M5 3v18l2-2 2 2 2-2 2 2 2-2 2 2 2-2V3"/><path d="M9 8h6"/><path d="M9 12h6"/></>,
  bell: () => <><path d="M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"/><path d="M10 21a2 2 0 0 0 4 0"/></>,
  lock: () => <><rect x="4" y="11" width="16" height="10" rx="2"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></>,
  key: () => <><circle cx="8" cy="15" r="4"/><path d="m11 12 9-9"/><path d="m17 6 3 3"/><path d="m15 8 2 2"/></>,
  pencil: () => <><path d="M4 20h4l11-11-4-4L4 16Z"/><path d="m14 5 4 4"/></>,
  trash: () => <><path d="M4 7h16"/><path d="M10 7V4h4v3"/><path d="M6 7v13a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V7"/><path d="M10 11v7"/><path d="M14 11v7"/></>,
  copy: () => <><rect x="8" y="8" width="13" height="13" rx="2"/><path d="M5 16V5a2 2 0 0 1 2-2h10"/></>,
  download: () => <><path d="M12 4v12"/><path d="m7 11 5 5 5-5"/><path d="M4 19h16"/></>,
};

function Icon({ name, size = 18, stroke = 1.6, color = 'currentColor', className = '', style = {} }) {
  const draw = ICONS[name];
  if (!draw) return null;
  return (
    <svg
      width={size} height={size}
      viewBox="0 0 24 24"
      fill="none"
      stroke={color}
      strokeWidth={stroke}
      strokeLinecap="round"
      strokeLinejoin="round"
      className={className}
      style={{ flexShrink: 0, ...style }}
    >
      {draw()}
    </svg>
  );
}

// "Logo" — wordmark in the editorial serif italic
function Wordmark({ size = 22 }) {
  return (
    <span style={{ display: 'inline-flex', alignItems: 'center', gap: 8, fontSize: size }}>
      <span style={{ fontFamily: 'var(--font-serif)', fontStyle: 'italic', fontWeight: 500, letterSpacing: '-0.02em' }}>Saloon</span>
      <span style={{ width: 6, height: 6, borderRadius: 999, background: 'var(--gold)' }} />
    </span>
  );
}

Object.assign(window, { Icon, Wordmark });
