// Welcome / pitch step
function StepWelcome({ onStart, state, setState }) {
  const personas = window.PERSONAS;
  const setPersona = (id) => setState(s => ({ ...s, persona: id, favorites: [] }));

  return (
    <div className="welcome-shell">
      <div className="welcome-logos">
        <img src="assets/wiha-logo.png" alt="Wiha" className="logo-wiha" />
        <span className="sep" />
        <img src="assets/malachyte-logo-gradient.png" alt="Malachyte" className="logo-mal" />
      </div>

      <div style={{ textAlign: 'center', display: 'flex', flexDirection: 'column', gap: 12, alignItems: 'center' }}>
        <div className="welcome-eye">Phase 1 POC · New Tools PLP</div>
        <h1 className="welcome-title">Wiha Tools Demo</h1>
      </div>

      <div className="welcome-compare">
        <div className="compare-card compare-card--before">
          <div className="compare-icon"><img src="assets/wiha-logo.png" alt="" /></div>
          <div>
            <h4>Wiha today</h4>
            <p>
              24 new SKUs, one fixed order, identical for every visitor. The torque wrench
              tops the grid because it's the most expensive new item — not because it's the
              best match for who's shopping.
            </p>
          </div>
        </div>
        <div className="compare-card compare-card--after">
          <div className="compare-icon"><img src="assets/malachyte-symbol-gradient.png" alt="" /></div>
          <div>
            <h4>With Malachyte</h4>
            <p>
              Same 24 SKUs, re‑ordered by visitor vector — trade · use case · price tier · prior
              behavior. The PokitPak leads for the EDC maker; the VDE torque wrench leads for
              the electrician; the impact bit set leads for the mechanic.
            </p>
          </div>
        </div>
      </div>

      <button className="btn btn-mal" onClick={onStart}>Open the New Tools PLP →</button>
    </div>
  );
}

// Shared: circular portrait with 4 signal pills floating at the corners.
function PortraitWithSignals({ persona }) {
  const anchors = ['wp-sig--tl', 'wp-sig--tr', 'wp-sig--bl', 'wp-sig--br'];
  return (
    <div className="wp-portrait-wrap">
      <div className="wp-portrait">
        <img src={persona.img} alt={persona.name} />
      </div>
      {(persona.signals || []).slice(0, 4).map((s, i) => (
        <span key={i} className={`wp-sig ${anchors[i]} wp-sig--${s.tone || 'amber'}`}>
          {s.label}
        </span>
      ))}
    </div>
  );
}

Object.assign(window, { StepWelcome, PortraitWithSignals });
