const NUA_PATHS = {
  heart: <path d="M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z"/>,
  lotus: <><path d="M12 20c-1.9-2-2.9-4.6-2.9-7.4 0-2.8 1.1-5.4 2.9-7.6 1.8 2.2 2.9 4.8 2.9 7.6 0 2.8-1 5.4-2.9 7.4Z"/><path d="M12 20c-2.7-.2-5.1-1.4-6.7-3.4-1.2-1.6-1.8-3.6-1.8-5.6 2.2 0 4.2.7 5.8 2"/><path d="M12 20c2.7-.2 5.1-1.4 6.7-3.4 1.2-1.6 1.8-3.6 1.8-5.6-2.2 0-4.2.7-5.8 2"/></>,
  family: <><circle cx="12" cy="6.5" r="2.4"/><circle cx="5" cy="8.5" r="1.9"/><circle cx="19" cy="8.5" r="1.9"/><path d="M8 19.5v-2a4 4 0 0 1 8 0v2"/><path d="M1.8 18v-1a3.3 3.3 0 0 1 5-2.8"/><path d="M22.2 18v-1a3.3 3.3 0 0 0-5-2.8"/></>,
  sun: <><circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41"/></>,
  arrow: <path d="M4 12h15M13 6l6 6-6 6"/>,
  chevL: <path d="M15 18l-6-6 6-6"/>,
  chevR: <path d="M9 18l6-6-6-6"/>,
  close: <path d="M18 6 6 18M6 6l12 12"/>,
  check: <path d="M20 6 9 17l-5-5"/>,
  menu: <path d="M4 7h16M4 12h16M4 17h16"/>,
  phone: <path d="M22 16.9v3a2 2 0 0 1-2.2 2 19.8 19.8 0 0 1-8.6-3.1 19.5 19.5 0 0 1-6-6A19.8 19.8 0 0 1 2.1 4.2 2 2 0 0 1 4.1 2h3a2 2 0 0 1 2 1.7c.1.9.4 1.8.7 2.7a2 2 0 0 1-.5 2.1L8 9.8a16 16 0 0 0 6 6l1.3-1.3a2 2 0 0 1 2.1-.4c.9.3 1.8.6 2.7.7a2 2 0 0 1 1.7 2Z"/>,
  video: <><path d="m22 8-6 4 6 4V8Z"/><rect x="2" y="6" width="14" height="12" rx="2"/></>,
  instagram: <><rect x="3" y="3" width="18" height="18" rx="5"/><circle cx="12" cy="12" r="4"/><path d="M17.5 6.5h.01"/></>,
  facebook: <path d="M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z"/>,
  mail: <><rect x="2" y="4" width="20" height="16" rx="2"/><path d="m22 7-10 6L2 7"/></>,
};

function NuaIcon({ name, size = 24, sw = 1.4, className }) {
  return <svg className={className} width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={sw} strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">{NUA_PATHS[name]}</svg>;
}

function NuaLeaf({ className }) {
  return <svg className={className} viewBox="0 0 40 40" fill="none" stroke="currentColor" strokeWidth="2.2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M10 32C11 19 21 8 36 3c-1 15-11 26-26 29Z"/><path d="M10 32C17 23 25 14 33 6"/><path d="M10 32l-4 5"/></svg>;
}

function NuaFlourish({ className }) {
  return <svg className={className} viewBox="0 0 150 16" fill="none" stroke="currentColor" strokeWidth="1.2" strokeLinecap="round" aria-hidden="true"><path d="M2 13C40 5 92 2 148 4"/></svg>;
}

function NuaLogo({ small, onClick }) {
  return (
    <div className={'logo' + (small ? ' sm' : '')} onClick={onClick} role="link" aria-label="Nüa Home — accueil">
      <span className="logo-word">N<span className="logo-u">ü<NuaLeaf className="logo-leaf" /></span>a</span>
      <span className="logo-home">HOME</span>
    </div>
  );
}

function NuaBtn({ variant = 'primary', small, arrow = true, children, className = '', ...rest }) {
  return (
    <button className={`btn btn-${variant}${small ? ' btn-sm' : ''} ${className}`} {...rest}>
      {children}{arrow && <NuaIcon name="arrow" size={15} sw={1.6} />}
    </button>
  );
}

Object.assign(window, { NuaIcon, NuaLeaf, NuaFlourish, NuaLogo, NuaBtn });
