// rec_brand.jsx — marks, cursor, and tiny editor icons for the GIF-editor demo.

function ScreenSyncMark({ size = 22 }) {
  return <img src="assets/logo.svg" width={size} height={size} alt="" style={{ display: 'block' }} />;
}

function FigmaMark({ size = 18 }) {
  return (
    <svg width={size} height={size} viewBox="0 0 24 24" fill="none">
      <path d="M8.5 24a3.75 3.75 0 0 0 3.75-3.75V16.5H8.5a3.75 3.75 0 1 0 0 7.5Z" fill="#0ACF83"/>
      <path d="M4.75 12A3.75 3.75 0 0 1 8.5 8.25h3.75v7.5H8.5A3.75 3.75 0 0 1 4.75 12Z" fill="#A259FF"/>
      <path d="M4.75 3.75A3.75 3.75 0 0 1 8.5 0h3.75v7.5H8.5A3.75 3.75 0 0 1 4.75 3.75Z" fill="#F24E1E"/>
      <path d="M12.25 0H16a3.75 3.75 0 1 1 0 7.5h-3.75V0Z" fill="#FF7262"/>
      <path d="M19.75 12a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0Z" fill="#1ABCFE"/>
    </svg>
  );
}

// macOS-style pointer
function Cursor({ x, y, pressed = 0, opacity = 1, z = 60 }) {
  return (
    <div style={{ position: 'absolute', left: x, top: y, transform: `scale(${1 - pressed * 0.12})`, transformOrigin: 'top left', opacity, zIndex: z, pointerEvents: 'none', willChange: 'transform', filter: 'drop-shadow(0 2px 4px rgba(0,0,0,0.4))' }}>
      <svg width="26" height="28" viewBox="0 0 26 28" fill="none">
        <path d="M5 3l15 9.2-6.4 1.4-1.1.3.5 1 3 6.3-2.6 1.2-3-6.4-.5-1-0.8 0.8L5 21V3Z" fill="#fff" stroke="#1a1a1a" strokeWidth="1.4" strokeLinejoin="round"/>
      </svg>
    </div>
  );
}

// generic icon wrapper
function Icn({ size = 18, children }) {
  return <svg width={size} height={size} viewBox="0 0 24 24" fill="none">{children}</svg>;
}

const EdIcon = {
  select: (c) => <path d="M5 3l15 9-6.5 1.4 3 6.3-2.4 1-3-6.3L5 21V3Z" stroke={c} strokeWidth="1.6" fill="none" strokeLinejoin="round"/>,
  split: (c) => <g stroke={c} strokeWidth="1.6" fill="none"><rect x="4" y="5" width="6.5" height="14" rx="1.5"/><rect x="13.5" y="5" width="6.5" height="14" rx="1.5"/></g>,
  marker: (c) => <g stroke={c} strokeWidth="1.6" fill="none" strokeLinejoin="round" strokeLinecap="round"><path d="M14 4.5l5.5 5.5-8 8H6v-5.5l8-8Z"/><path d="M4 21h16"/></g>,
  undo: (c) => <path d="M9 7H5V3M5 7a8 8 0 1 1-2 5.3" stroke={c} strokeWidth="1.6" fill="none" strokeLinecap="round" strokeLinejoin="round"/>,
  redo: (c) => <path d="M15 7h4V3M19 7a8 8 0 1 0 2 5.3" stroke={c} strokeWidth="1.6" fill="none" strokeLinecap="round" strokeLinejoin="round"/>,
  reset: (c) => <path d="M4 12a8 8 0 1 1 2.3 5.6M4 17v-4h4" stroke={c} strokeWidth="1.6" fill="none" strokeLinecap="round" strokeLinejoin="round"/>,
  play: (c) => <path d="M7 4.5l12 7.5-12 7.5V4.5Z" fill={c}/>,
  expand: (c) => <path d="M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5" stroke={c} strokeWidth="1.6" fill="none" strokeLinecap="round" strokeLinejoin="round"/>,
  zoomOut: (c) => <g stroke={c} strokeWidth="1.7" fill="none" strokeLinecap="round"><circle cx="10.5" cy="10.5" r="6.5"/><path d="M20 20l-4.7-4.7M8 10.5h5"/></g>,
  zoomIn: (c) => <g stroke={c} strokeWidth="1.7" fill="none" strokeLinecap="round"><circle cx="10.5" cy="10.5" r="6.5"/><path d="M20 20l-4.7-4.7M10.5 8v5M8 10.5h5"/></g>,
  close: (c) => <path d="M6 6l12 12M18 6L6 18" stroke={c} strokeWidth="1.8" strokeLinecap="round"/>,
};

// Looping tap pulse: just an expanding blue ring at (x, y). No finger.
function FingerTap({ x = 0, y = 0, t = 0, period = 1.15, accent = '#0a84ff', opacity = 1, base = 40 }) {
  if (opacity <= 0.001) return null;
  const ph = (((t % period) + period) % period) / period;
  // two staggered ripples for a richer pulse
  const rings = [0, 0.5].map((off) => {
    const rp = ((ph + off) % 1);
    return rp;
  });
  return (
    <div style={{ position: 'absolute', left: x, top: y, zIndex: 7, pointerEvents: 'none', opacity, willChange: 'transform' }}>
      {/* solid core dot */}
      <div style={{ position: 'absolute', left: 0, top: 0, transform: 'translate(-50%,-50%)', width: base * 0.34, height: base * 0.34, borderRadius: '50%', background: accent, boxShadow: `0 0 ${base * 0.3}px ${accent}` }} />
      {/* expanding rings */}
      {rings.map((rp, i) => (
        <div key={i} style={{ position: 'absolute', left: 0, top: 0, transform: `translate(-50%,-50%) scale(${0.35 + rp * 1.65})`, width: base, height: base, borderRadius: '50%', border: `3px solid ${accent}`, opacity: 0.75 * (1 - rp) }} />
      ))}
    </div>
  );
}

Object.assign(window, { ScreenSyncMark, FigmaMark, Cursor, Icn, EdIcon, FingerTap });
