function TeamCard({ m }) {
  const [hover, setHover] = React.useState(false);
  return (
    <a href={m.linkedin} target="_blank" rel="noopener noreferrer"
       onMouseEnter={()=>setHover(true)} onMouseLeave={()=>setHover(false)}
       style={{
         display:'block', textDecoration:'none',
         background:'#F9FAFB',
         border: `1px solid ${hover ? 'rgba(247,63,52,0.45)' : 'rgba(55,60,66,0.15)'}`,
         position:'relative',
         transform: hover ? 'translateY(-4px)' : 'translateY(0)',
         transition:'transform 380ms cubic-bezier(.22,1,.36,1), border-color 320ms ease',
         overflow:'hidden', cursor:'pointer'
       }}>
      <span style={{
        position:'absolute', left:0, top:-1, height:2,
        background:'#f73f34',
        width: hover ? '100%' : '0%',
        transition:'width 420ms cubic-bezier(.22,1,.36,1)', zIndex:2
      }}/>
      <div style={{ width:'100%', aspectRatio:'4 / 3.6', overflow:'hidden', borderBottom:'1px solid rgba(55,60,66,0.10)' }}>
        <img src={m.portrait} alt={m.name} style={{
          width:'100%', height:'100%', objectFit:'cover',
          transform: hover ? 'scale(1.04)' : 'scale(1)',
          transition:'transform 500ms cubic-bezier(.22,1,.36,1)'
        }}/>
      </div>
      <div style={{ padding:'28px 32px 36px' }}>
        <div style={{ font:'400 13px/1 var(--rz-font-mono)', color:'#5D656E', marginBottom:16 }}>{m.role.toUpperCase()}</div>
        <div style={{ font:'700 28px/1.1 var(--rz-font-display)', color:'#25282C' }}>{m.name}</div>
        <div style={{ height:16 }}/>
        <div style={{ font:'400 14px/1.55 var(--rz-font-mono)', color:'#5D656E' }}>{m.bio}</div>
      </div>
    </a>
  );
}

function ContactEmail() {
  const [hover, setHover] = React.useState(false);
  return (
    <a href="mailto:hello@rayzorice.com"
       onMouseEnter={()=>setHover(true)} onMouseLeave={()=>setHover(false)}
       style={{
         font:'400 24px/1 var(--rz-font-mono)',
         color: hover ? '#f73f34' : '#25282C',
         textAlign:'right', textDecoration:'none',
         transition:'color 280ms cubic-bezier(.22,1,.36,1)',
         position:'relative', display:'inline-block', paddingBottom:4
       }}>
      hello@rayzorice.com
      <span style={{
        position:'absolute', left:0, right:0, bottom:0, height:2,
        background:'#f73f34',
        transform: hover ? 'scaleX(1)' : 'scaleX(0)',
        transformOrigin:'left center',
        transition:'transform 320ms cubic-bezier(.22,1,.36,1)'
      }}/>
    </a>
  );
}

function ProofBlock() {
  const points = [
    'Customer discovery with rink owners and operators',
    'Testing environments in progress',
    'Prototype under development',
    'Non-dilutive funding support',
    'Focus on real rink scheduling and resurfacing constraints',
  ];
  return (
    <div>
      <div style={{ font:'400 12px/1 var(--rz-font-mono)', color:'#5D656E', letterSpacing:'0.16em', marginBottom:18 }}>
        <span className="rz-accent-dot"/>VALIDATION
      </div>
      <div className="rz-proof-heading" style={{ font:'700 40px/1.05 var(--rz-font-display)', color:'#25282C', letterSpacing:'-0.01em', marginBottom:32 }}>
        Built with real rink feedback.
      </div>
      <div className="rz-proof-grid" style={{ display:'grid', gridTemplateColumns:'repeat(2, 1fr)', columnGap:48, rowGap:0 }}>
        {points.map((p, i) => (
          <ProofPoint key={p} text={p} index={i}/>
        ))}
      </div>
    </div>
  );
}

function ProofPoint({ text, index }) {
  const [hover, setHover] = React.useState(false);
  return (
    <div onMouseEnter={()=>setHover(true)} onMouseLeave={()=>setHover(false)}
         style={{
           display:'flex', alignItems:'flex-start', gap:14,
           padding:'18px 0',
           borderTop:'1px solid rgba(55,60,66,0.15)',
           position:'relative', cursor:'default',
           transform: hover ? 'translateX(4px)' : 'translateX(0)',
           transition:'transform 320ms cubic-bezier(.22,1,.36,1)'
         }}>
      <span style={{
        flexShrink:0, marginTop:8, width:6, height:6,
        background: hover ? '#f73f34' : '#25282C',
        transition:'background 280ms ease'
      }}/>
      <span style={{
        font:'400 16px/1.5 var(--rz-font-mono)',
        color:'#25282C'
      }}>{text}</span>
    </div>
  );
}

function Testimonial() {
  return (
    <div style={{
      borderLeft:'2px solid #f73f34', paddingLeft:24, maxWidth:780
    }}>
      <div style={{ font:'400 22px/1.4 var(--rz-font-display)', color:'#25282C', fontStyle:'italic' }}>
        "This idea has the potential to become a game-changer in high-volume rinks."
      </div>
      <div style={{ height:12 }}/>
      <div style={{ font:'400 13px/1 var(--rz-font-mono)', color:'#5D656E', letterSpacing:'0.08em', textTransform:'uppercase' }}>
        Facility supervisor
      </div>
    </div>
  );
}

function TractionStat({ k, v, isFirst, isLast }) {
  const [hover, setHover] = React.useState(false);
  const padLeft = isFirst ? 0 : 24;
  return (
    <div className="rz-traction-stat-cell" onMouseEnter={()=>setHover(true)} onMouseLeave={()=>setHover(false)}
         style={{
           padding:`28px 24px 28px ${padLeft}px`,
           borderRight: !isLast ? '1px solid rgba(55,60,66,0.20)' : 'none',
           position:'relative', cursor:'default'
         }}>
      <div style={{
        font:'700 40px/1 var(--rz-font-display)', color:'#25282C',
        transform: hover ? 'translateY(-2px)' : 'translateY(0)',
        transition:'transform 320ms cubic-bezier(.22,1,.36,1)'
      }}>{k}</div>
      <div style={{ height:10 }}/>
      <div style={{ font:'400 13px/1.4 var(--rz-font-mono)', color:'#5D656E' }}>{v}</div>
      <span style={{
        position:'absolute', left:padLeft, right:24, bottom:-1, height:2,
        background:'#f73f34',
        transform: hover ? 'scaleX(1)' : 'scaleX(0)',
        transformOrigin:'left center',
        transition:'transform 380ms cubic-bezier(.22,1,.36,1)'
      }}/>
    </div>
  );
}

function BackerName({ name, href }) {
  const [hover, setHover] = React.useState(false);
  return (
    <a href={href} target="_blank" rel="noopener noreferrer"
       onMouseEnter={()=>setHover(true)} onMouseLeave={()=>setHover(false)}
       style={{ position:'relative', cursor:'pointer', display:'inline-block', paddingBottom:6, textDecoration:'none', color:'inherit' }}>
      {name}
      <span style={{
        position:'absolute', left:0, right:0, bottom:0, height:2,
        background:'#f73f34',
        transform: hover ? 'scaleX(1)' : 'scaleX(0)',
        transformOrigin:'left center',
        transition:'transform 320ms cubic-bezier(.22,1,.36,1)'
      }}/>
    </a>
  );
}

function TractionSection() {
  return (
    <section style={{ background:'#cbcbcb', padding:'140px 56px 70px', minHeight:'90vh' }}>
      <Reveal>
        <div style={{ font:'400 14px/1 var(--rz-font-mono)', color:'#25282C', marginBottom:24 }}><span className="rz-accent-dot"/>TRACTION</div>
        <div className="rz-traction-heading" style={{ font:'700 64px/1.05 var(--rz-font-display)', color:'#25282C', maxWidth:980 }}>
          $50,000 raised. First prototype in build.
        </div>
        <div style={{ height:32 }}/>
        <div style={{ font:'400 16px/1.7 var(--rz-font-mono)', color:'#373C42', maxWidth:680 }}>
          Non-dilutive funding secured. Over fifty rink operator interviews completed. Backed by Mitacs, SICIEEIL, and Next Canada.
        </div>
      </Reveal>
      <div style={{ height:64 }}/>
      <Reveal delay={100}>
        <Testimonial/>
      </Reveal>
      <div style={{ height:80 }}/>
      <Reveal delay={110}>
        <ProofBlock/>
      </Reveal>
      <div style={{ height:80 }}/>
      <Reveal delay={120}>
        <div className="rz-traction-stats" style={{ display:'grid', gridTemplateColumns:'repeat(3, 1fr)', gap:0, borderTop:'1px solid rgba(55,60,66,0.20)' }}>
          {[
            ['$50K', 'Non-dilutive raised'],
            ['50+', 'Rink operator interviews'],
            ['Q4/2026', 'Prototype build'],
          ].map(([k,v], i, arr) => (
            <TractionStat key={k} k={k} v={v} isFirst={i === 0} isLast={i === arr.length - 1}/>
          ))}
        </div>
      </Reveal>
      <div style={{ height:60 }}/>
      <Reveal delay={200}>
        <div style={{ font:'400 14px/1 var(--rz-font-mono)', color:'#5D656E', marginBottom:18 }}>BACKED BY</div>
        <div style={{ display:'flex', gap:48, flexWrap:'wrap', alignItems:'center', font:'700 28px/1 var(--rz-font-display)', color:'#25282C' }}>
          <BackerName name="Mitacs"      href="https://www.mitacs.ca/"/><span>·</span>
          <BackerName name="SICIEEIL"    href="https://www.utsc.utoronto.ca/sicieeil/"/><span>·</span>
          <BackerName name="Next Canada" href="https://www.nextcanada.com/next-36/"/>
        </div>
      </Reveal>
    </section>
  );
}

function TeamSection() {
  const team = [
    { name:'Samuel Medina', role:'Chief Executive Officer', bio:'Business, University of Toronto.',          portrait:'assets/renders/samuel portrait shot.jpg.jpeg', linkedin:'https://www.linkedin.com/in/samuel-andres-medina/' },
    { name:'Ali Macias',    role:'Chief Technology Officer', bio:'M.A.Sc. Aerospace & Robotics, University of Toronto.', portrait:'assets/renders/Ali Portrait.jpeg',                    linkedin:'https://www.linkedin.com/in/ali-macias' },
    { name:'Zane Yacoub',   role:'Chief Financial Officer', bio:'Finance, University of Texas.',             portrait:'assets/renders/zane portrait (1).png',            linkedin:'https://www.linkedin.com/in/zaneyacoub/' },
  ];
  return (
    <section style={{ background:'#cbcbcb', padding:'40px 56px 140px' }}>
      <Reveal>
        <div style={{ font:'400 14px/1 var(--rz-font-mono)', color:'#25282C', marginBottom:24 }}><span className="rz-accent-dot"/>TEAM</div>
        <div className="rz-team-heading" style={{ font:'700 56px/1.05 var(--rz-font-display)', color:'#25282C', maxWidth:780 }}>
          The Team
        </div>
      </Reveal>
      <div style={{ height:64 }}/>
      <div className="rz-team-grid" style={{ display:'grid', gridTemplateColumns:'repeat(3, 1fr)', gap:24 }}>
        {team.map((m,i) => (
          <Reveal key={m.name} delay={i*100}>
            <TeamCard m={m}/>
          </Reveal>
        ))}
      </div>
    </section>
  );
}

function ContactStrip() {
  return (
    <section style={{ background:'#cbcbcb', padding:'80px 56px', borderTop:'1px solid rgba(55,60,66,0.20)' }}>
      <div className="rz-contact-grid" style={{ display:'grid', gridTemplateColumns:'1.4fr 1fr', alignItems:'center', gap:32 }}>
        <div>
          <div className="rz-contact-heading" style={{ font:'700 36px/1.05 var(--rz-font-display)', color:'#25282C', letterSpacing:'-0.01em' }}>
            Partner With Rayzor.
          </div>
          <div style={{ height:8 }}/>
          <div style={{ font:'400 16px/1.5 var(--rz-font-mono)', color:'#5D656E' }}>
            Join our pilot program — early rinks shape the product.
          </div>
        </div>
        <div style={{ textAlign:'right' }}>
          <ContactEmail/>
        </div>
      </div>
    </section>
  );
}
window.TractionSection = TractionSection;
window.TeamSection = TeamSection;
window.ContactStrip = ContactStrip;
