
const Process = () => {
  const ref = React.useRef(null);
  const [visible, setVisible] = React.useState(false);
  React.useEffect(() => {
    const obs = new IntersectionObserver(([e]) => { if (e.isIntersecting) setVisible(true); }, { threshold: 0.1 });
    if (ref.current) obs.observe(ref.current);
    return () => obs.disconnect();
  }, []);

  const steps = [
    { num: '01', title: 'Discovery & Strategy', desc: 'We start by deeply understanding your business, goals, and constraints. Then we map out a clear technology strategy and project roadmap before writing a single line of code.', icon: <svg width="22" height="22" viewBox="0 0 22 22" fill="none"><circle cx="11" cy="11" r="7" stroke="currentColor" strokeWidth="1.6"/><circle cx="11" cy="11" r="2.5" fill="currentColor"/><path d="M11 4V2M11 20V18M4 11H2M20 11H18" stroke="currentColor" strokeWidth="1.4" strokeLinecap="round"/></svg> },
    { num: '02', title: 'Architecture & Design', desc: 'We design scalable system architecture and high-fidelity UI/UX prototypes. Every technical decision is justified — stack selection, data models, API design, cloud infrastructure.', icon: <svg width="22" height="22" viewBox="0 0 22 22" fill="none"><rect x="2" y="2" width="8" height="8" rx="1.5" stroke="currentColor" strokeWidth="1.6"/><rect x="12" y="2" width="8" height="8" rx="1.5" stroke="currentColor" strokeWidth="1.6"/><rect x="2" y="12" width="8" height="8" rx="1.5" stroke="currentColor" strokeWidth="1.6"/><path d="M12 16H20M16 12V20" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round"/></svg> },
    { num: '03', title: 'Agile Development', desc: 'We build in 2-week sprints with continuous delivery. You see working software early and often — not after 6 months. Every sprint ends with a demo, feedback, and iteration.', icon: <svg width="22" height="22" viewBox="0 0 22 22" fill="none"><path d="M4 11C4 7.13 7.13 4 11 4C13.5 4 15.7 5.3 17 7.3" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round"/><path d="M18 11C18 14.87 14.87 18 11 18C8.5 18 6.3 16.7 5 14.7" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round"/><path d="M17 4L17 7.5L20.5 7.5" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"/><path d="M5 18L5 14.5L1.5 14.5" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"/></svg> },
    { num: '04', title: 'QA & Testing', desc: 'Rigorous automated and manual testing — unit tests, integration tests, performance benchmarks, security audits, and UAT. We don\'t ship untested code.', icon: <svg width="22" height="22" viewBox="0 0 22 22" fill="none"><path d="M4 6H18M6 6V4C6 3.4 6.4 3 7 3H15C15.6 3 16 3.4 16 4V6M8 6V18C8 18.6 8.4 19 9 19H13C13.6 19 14 18.6 14 18V6" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round"/><path d="M10 10L12 12L10 14" stroke="currentColor" strokeWidth="1.4" strokeLinecap="round" strokeLinejoin="round"/></svg> },
    { num: '05', title: 'Deployment & Launch', desc: 'We handle CI/CD pipelines, cloud provisioning, domain setup, SSL, monitoring, and go-live. Your product launches smoothly with zero-downtime deployments.', icon: <svg width="22" height="22" viewBox="0 0 22 22" fill="none"><path d="M11 14V4M7 8L11 4L15 8" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round"/><path d="M4 14V17C4 17.6 4.4 18 5 18H17C17.6 18 18 17.6 18 17V14" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round"/></svg> },
    { num: '06', title: 'Support & Growth', desc: 'Post-launch, we provide ongoing support, performance monitoring, feature iteration, and scaling assistance. We\'re a long-term partner, not a one-off vendor.', icon: <svg width="22" height="22" viewBox="0 0 22 22" fill="none"><circle cx="11" cy="11" r="8" stroke="currentColor" strokeWidth="1.6"/><path d="M8 11C8 9.3 9.3 8 11 8C12.7 8 14 9.3 14 11C14 12.4 13.1 13.6 11.8 14" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round"/><circle cx="11" cy="16" r="1" fill="currentColor"/></svg> },
  ];

  return (
    <section id="process" data-screen-label="Process" ref={ref} style={{ padding: '100px 0', background: 'var(--bg, #e8edf5)' }}>
      <div className="inner-wrap" style={{ maxWidth: 1200, margin: '0 auto', padding: '0 32px' }}>
        <div style={{ textAlign: 'center', maxWidth: 560, margin: '0 auto 64px', opacity: visible ? 1 : 0, transform: visible ? 'translateY(0)' : 'translateY(24px)', transition: 'all 0.6s ease' }}>
          <div style={{ display: 'inline-flex', alignItems: 'center', gap: 7, padding: '5px 14px', borderRadius: 100, background: 'var(--accentbg, rgba(37,99,235,0.07))', border: '1px solid rgba(37,99,235,0.18)', marginBottom: 18 }}>
            <span style={{ fontFamily: "'DM Sans', sans-serif", fontSize: 12, fontWeight: 600, color: 'var(--accent, #1d4ed8)', letterSpacing: '0.07em' }}>HOW WE WORK</span>
          </div>
          <h2 style={{ fontFamily: "'Space Grotesk', sans-serif", fontSize: 'clamp(28px, 4vw, 46px)', fontWeight: 700, color: 'var(--text, #0f172a)', letterSpacing: '-0.03em', lineHeight: 1.1, margin: '0 0 14px' }}>
            A process built for clarity and speed
          </h2>
          <p style={{ fontFamily: "'DM Sans', sans-serif", fontSize: 16, color: 'var(--text2, #64748b)', lineHeight: 1.7, margin: 0 }}>
            Six proven phases that take your idea from concept to production — with full visibility at every stage.
          </p>
        </div>

        <div style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 20 }} className="process-grid">
          {steps.map((s, i) => (
            <div key={i} className="dm-card" style={{
              padding: '28px', borderRadius: 14, background: 'var(--bg3, #fff)',
              border: '1.5px solid var(--border, rgba(0,0,0,0.07))', boxShadow: 'var(--shadow)',
              opacity: visible ? 1 : 0, transform: visible ? 'translateY(0)' : 'translateY(24px)',
              transition: `all 0.6s ease ${i * 0.08}s`,
              position: 'relative', overflow: 'hidden',
            }}
            onMouseEnter={e => { e.currentTarget.style.borderColor = 'var(--accent2, #2563eb)'; e.currentTarget.style.boxShadow = '0 12px 36px rgba(29,78,216,0.1)'; e.currentTarget.style.transform = 'translateY(-3px)'; }}
            onMouseLeave={e => { e.currentTarget.style.borderColor = 'var(--border, rgba(0,0,0,0.07))'; e.currentTarget.style.boxShadow = 'var(--shadow)'; e.currentTarget.style.transform = 'translateY(0)'; }}>
              {/* Step number watermark */}
              <div style={{ position: 'absolute', top: 12, right: 16, fontFamily: "'Space Grotesk', sans-serif", fontSize: 40, fontWeight: 800, color: 'var(--accentbg, rgba(37,99,235,0.07))', lineHeight: 1, userSelect: 'none' }}>{s.num}</div>
              <div style={{ width: 44, height: 44, borderRadius: 11, background: 'var(--accentbg, rgba(37,99,235,0.08))', display: 'flex', alignItems: 'center', justifyContent: 'center', marginBottom: 16, color: 'var(--accent, #1d4ed8)' }}>
                {s.icon}
              </div>
              <h3 className="dm-h" style={{ fontFamily: "'Space Grotesk', sans-serif", fontSize: 16, fontWeight: 600, color: 'var(--text, #0f172a)', margin: '0 0 10px' }}>{s.title}</h3>
              <p className="dm-p" style={{ fontFamily: "'DM Sans', sans-serif", fontSize: 14, color: 'var(--text2, #64748b)', lineHeight: 1.65, margin: 0 }}>{s.desc}</p>
            </div>
          ))}
        </div>
      </div>
    </section>
  );
};

Object.assign(window, { Process });
