/* atelier onboarding — question data, icons, shared atoms */

// ─── Quiz definition ───────────────────────────────────────
const QUESTIONS = [
  {
    id: 'style',
    type: 'multi',
    title: 'Which best describe your style?',
    sub: 'Pick as many as feel right.',
    options: ['Minimalist', 'Smart Casual', 'Streetwear', 'Classic', 'Sporty', 'Preppy', 'Formal', 'Outdoor'],
  },
  {
    id: 'fit',
    type: 'multi',
    title: 'How do you like things to fit?',
    sub: 'However you actually wear them.',
    options: ['Tailored', 'Relaxed', 'Oversized', 'Slim'],
  },
  {
    id: 'colors',
    type: 'color',
    title: 'What colours fill your closet?',
    sub: 'The shades you reach for most.',
    options: [
      { label: 'Black',  hex: '#15140F' },
      { label: 'White',  hex: '#F6F4EE' },
      { label: 'Navy',   hex: '#1F2A3C' },
      { label: 'Camel',  hex: '#C19A6B' },
      { label: 'Olive',  hex: '#5C5F3F' },
      { label: 'Brown',  hex: '#5A3D29' },
      { label: 'Grey',   hex: '#9A988F' },
      { label: 'Cream',  hex: '#E8DEC8' },
    ],
  },
  {
    id: 'painPoint',
    type: 'single',
    title: "What's the worst part of shopping online today?",
    sub: 'Be honest — this shapes what we build.',
    options: [
      { value: '20+ tabs open', glyph: '⌥' },
      { value: 'Screenshots everywhere', glyph: '◳' },
      { value: 'Wishlists scattered across sites', glyph: '⁂' },
      { value: "Never sure it'll go together", glyph: '?' },
    ],
  },
  {
    id: 'firstFeature',
    type: 'single',
    title: 'Which feature would you use first?',
    sub: 'Your vote moves it up our list.',
    options: [
      { value: 'Outfit builder', glyph: '▦' },
      { value: 'AI recommendations', glyph: '✦' },
      { value: 'Shop everything in one tap', glyph: '⊕' },
      { value: "Follow others' wardrobes", glyph: '◎' },
    ],
  },
];

const COLOR_MAP = QUESTIONS.find(q => q.id === 'colors')
  .options.reduce((m, o) => (m[o.label] = o.hex, m), {});

// ─── Icons ──────────────────────────────────────────────────
const Icon = {
  arrow: () => (
    <svg viewBox="0 0 24 24" fill="none"><path d="M5 12h13M13 6l6 6-6 6" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round"/></svg>
  ),
  back: () => (
    <svg viewBox="0 0 24 24" fill="none"><path d="M19 12H6M11 18l-6-6 6-6" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round"/></svg>
  ),
  close: () => (
    <svg viewBox="0 0 24 24" fill="none"><path d="M6 6l12 12M18 6L6 18" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round"/></svg>
  ),
  check: () => (
    <svg viewBox="0 0 24 24" fill="none"><path d="M5 12.5l4.5 4.5L19 6.5" stroke="currentColor" strokeWidth="2.2" strokeLinecap="round" strokeLinejoin="round"/></svg>
  ),
  tick: () => (
    <svg viewBox="0 0 24 24" fill="none"><path d="M5 12.5l4.5 4.5L19 6.5" stroke="currentColor" strokeWidth="2.4" strokeLinecap="round" strokeLinejoin="round"/></svg>
  ),
  copy: () => (
    <svg viewBox="0 0 24 24" fill="none"><rect x="9" y="9" width="11" height="11" rx="2.5" stroke="currentColor" strokeWidth="1.8"/><path d="M5 15V5a2 2 0 012-2h8" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round"/></svg>
  ),
  spark: () => (
    <svg viewBox="0 0 24 24" fill="none"><path d="M12 2.5l2.2 7.3 7.3 2.2-7.3 2.2L12 21.5l-2.2-7.3L2.5 12l7.3-2.2z" fill="currentColor"/></svg>
  ),
  google: () => (
    <svg viewBox="0 0 24 24"><path fill="#4285F4" d="M22.5 12.27c0-.79-.07-1.54-.2-2.27H12v4.29h5.9a5.05 5.05 0 01-2.19 3.31v2.75h3.54c2.07-1.9 3.25-4.71 3.25-8.08z"/><path fill="#34A853" d="M12 23c2.97 0 5.46-.98 7.28-2.65l-3.54-2.75c-.98.66-2.24 1.05-3.74 1.05-2.87 0-5.3-1.94-6.17-4.55H2.18v2.84A11 11 0 0012 23z"/><path fill="#FBBC05" d="M5.83 14.1a6.6 6.6 0 010-4.2V7.06H2.18a11 11 0 000 9.88z"/><path fill="#EA4335" d="M12 4.75c1.62 0 3.07.56 4.21 1.65l3.15-3.15A10.6 10.6 0 0012 1 11 11 0 002.18 7.06l3.65 2.84C6.7 6.69 9.13 4.75 12 4.75z"/></svg>
  ),
  apple: () => (
    <svg viewBox="0 0 24 24" fill="#0E0E0C"><path d="M17.05 12.54c-.02-2.13 1.74-3.15 1.82-3.2-.99-1.45-2.53-1.65-3.08-1.67-1.31-.13-2.56.77-3.22.77-.66 0-1.69-.75-2.78-.73-1.43.02-2.75.83-3.48 2.11-1.49 2.58-.38 6.39 1.06 8.48.7 1.02 1.54 2.17 2.63 2.13 1.06-.04 1.46-.68 2.74-.68 1.28 0 1.64.68 2.76.66 1.14-.02 1.86-1.04 2.56-2.07.81-1.19 1.14-2.34 1.16-2.4-.03-.01-2.22-.85-2.25-3.38zM14.94 5.7c.58-.71.98-1.69.87-2.67-.84.03-1.86.56-2.46 1.27-.54.62-1.01 1.62-.88 2.58.94.07 1.89-.48 2.47-1.18z"/></svg>
  ),
};

// ─── Small atoms ───────────────────────────────────────────
function Mark() {
  return (
    <span className="mark">
      <span className="mark-square">a<span className="dot">.</span></span>
      <span className="mark-word">atelier<span className="dot">.</span></span>
    </span>
  );
}

function PrimaryButton({ children, onClick, disabled, type = 'button' }) {
  return (
    <button className="pill block" onClick={onClick} disabled={disabled} type={type}>
      <span>{children}</span>
      <span className="knob"><Icon.arrow /></span>
    </button>
  );
}

Object.assign(window, { QUESTIONS, COLOR_MAP, Icon, Mark, PrimaryButton });
