// Welcome / pitch step — Ernesta × Malachyte
function StepWelcome({ onStart, state, setState }) {
  return (
    <div className="welcome-shell">
      <div className="welcome-logos">
        <img src="assets/ernesta-logo.png" alt="Ernesta" 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 · Best Sellers PLP · Search · PDP</div>
        <h1 className="welcome-title">Ernesta Personalization Demo</h1>
      </div>

      <div className="welcome-compare">
        <div className="compare-card compare-card--before">
          <div className="compare-icon"><img src="assets/ernesta-logo.png" alt="" /></div>
          <div>
            <h4>Ernesta today</h4>
            <p>
              74 best-selling rugs across wool, jute, performance and indoor/outdoor — shown in
              one fixed order, identical for every visitor. A coastal blue lover and a
              pet-household shopper see the exact same grid.
            </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>
              The same catalog, re-ranked per visitor vector — palette, material, room, durability,
              price tier and live behavior. Because the catalog is so diverse, every visitor gets a
              genuinely different first screen. On the PDP, recs shift from "more of the same" to
              rugs that actually pair across the home.
            </p>
          </div>
        </div>
      </div>

      <button className="btn btn-mal" onClick={onStart}>Open the Best Sellers 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 });
