// About page — quiet, technical, declarative. Same voice as home.

function AboutHero() {
  return (
    <section className="flat" style={{ padding: '120px 0 80px' }}>
      <div className="container" style={{ maxWidth: 920 }}>
        <span className="eyebrow" style={{ alignSelf: 'flex-start', color: 'var(--accent)' }}>About</span>
        <h1 style={{
          fontSize: 'clamp(40px, 4.4vw, 64px)',
          lineHeight: 1.05,
          fontWeight: 700,
          letterSpacing: '-0.025em',
          color: 'var(--fg-1)',
          margin: '14px 0 0 0',
          maxWidth: 880,
        }}>
          Built by operators who scaled<br/>
          <span style={{ color: 'var(--accent)' }}>regulated technology.</span>
        </h1>
        <p style={{
          fontSize: 18, lineHeight: 1.6,
          color: 'var(--fg-2)', margin: '24px 0 0 0', maxWidth: 720,
        }}>
          EightbyZero is the intelligent data layer for group insurance —
          an agentic integration layer that connects employer data to
          carriers and TPAs. <BN/> is what carrier dataflows look like
          when they're adaptive and AI-ready.
        </p>
      </div>
    </section>
  );
}

// ---------- Vision / Mission ----------
function VisionMission() {
  return (
    <section className="flat" style={{ background: 'var(--bg-sunken)' }}>
      <div className="container">
        <div style={{ display: 'flex', flexDirection: 'column', gap: 14, marginBottom: 56, maxWidth: 820 }}>
          <span className="eyebrow" style={{ alignSelf: 'flex-start' }}>Vision &amp; Mission</span>
          <h2 style={{ fontSize: 'clamp(32px, 3.6vw, 48px)', fontWeight: 700, letterSpacing: '-0.02em', margin: 0, lineHeight: 1.1 }}>
            One agentic layer.<br/>
            <span style={{ color: 'var(--accent)' }}>Every leg of the stool.</span>
          </h2>
        </div>
        <div style={{ display: 'grid', gridTemplateColumns: 'repeat(2, 1fr)', gap: 24 }}>
          <div style={{
            padding: 32, border: '1px solid var(--border-1)', borderRadius: 4,
            background: 'var(--bg-elev-1)', display: 'flex', flexDirection: 'column', gap: 14,
            minHeight: 240,
          }}>
            <div className="eyebrow" style={{ color: 'var(--accent)', alignSelf: 'flex-start' }}>Vision</div>
            <h3 style={{ fontSize: 24, fontWeight: 700, letterSpacing: '-0.015em', margin: 0, lineHeight: 1.2 }}>
              A world where employer data moves at the speed of the work, not the speed of the integration.
            </h3>
            <p style={{ fontSize: 14.5, color: 'var(--fg-2)', lineHeight: 1.6, margin: 'auto 0 0' }}>
              Group insurance has been waiting for adaptive infrastructure
              for two decades. We're the team that builds it.
            </p>
          </div>
          <div style={{
            padding: 32, border: '1px solid var(--border-1)', borderRadius: 4,
            background: 'var(--bg-elev-1)', display: 'flex', flexDirection: 'column', gap: 14,
            minHeight: 240,
          }}>
            <div className="eyebrow" style={{ color: 'var(--accent)', alignSelf: 'flex-start' }}>Mission</div>
            <h3 style={{ fontSize: 24, fontWeight: 700, letterSpacing: '-0.015em', margin: 0, lineHeight: 1.2 }}>
              Make carrier, TPA, and employer dataflows adaptive and AI-ready — so every team they touch moves faster.
            </h3>
            <p style={{ fontSize: 14.5, color: 'var(--fg-2)', lineHeight: 1.6, margin: 'auto 0 0' }}>
              Pre-sales, implementation, claims, ops, audit — wherever data
              moves between systems, <BN/> turns the layer from a bottleneck
              into a lever.
            </p>
          </div>
        </div>
      </div>
    </section>
  );
}

// ---------- Our story / origin ----------
function OurStory() {
  const beats = [
    {
      year: '2014–2024',
      title: 'A decade of scar tissue.',
      body: 'Sam and JP worked across insurtech and regulated infrastructure long enough to know exactly which integrations break, when, and why. Every employer onboarding looked like a fresh quarter of engineering. Every schema change looked like a fire drill.',
    },
    {
      year: 'Spring 2025',
      title: 'The wedge: flows that adapt.',
      body: 'Foundation models finally got good enough to read API specs, infer field mappings, and reason about policy. An early prototype absorbed Workday schema drift in hours instead of weeks. The premise had legs.',
    },
    {
      year: 'Q4 2025',
      title: 'EightbyZero, formed in Montréal.',
      body: 'Incubated out of the Diagram ecosystem. Three founders, a thesis, and the first carrier conversations. The layer would serve every side of the table, or it wouldn\'t serve at all.',
    },
    {
      year: '2026',
      title: 'In production, with paying customers.',
      body: 'First carriers and TPAs live. We\'re hiring the team that takes it from "live with the early few" to "the layer the industry runs on."',
    },
  ];
  return (
    <section id="story" className="flat">
      <div className="container">
        <div style={{ display: 'flex', flexDirection: 'column', gap: 14, marginBottom: 56, maxWidth: 820 }}>
          <span className="eyebrow" style={{ alignSelf: 'flex-start' }}>Our origin</span>
          <h2 style={{ fontSize: 'clamp(32px, 3.6vw, 48px)', fontWeight: 700, letterSpacing: '-0.02em', margin: 0, lineHeight: 1.1 }}>
            How we came about.
          </h2>
          <p style={{ fontSize: 16, color: 'var(--fg-2)', margin: '6px 0 0 0', lineHeight: 1.6, maxWidth: 720 }}>
            EightbyZero didn't start with a model. It started with three operators
            who'd spent a decade rebuilding the same integration, every quarter,
            for every new customer.
          </p>
        </div>
        <div style={{ borderTop: '1px solid var(--border-1)' }}>
          {beats.map(b => (
            <div key={b.year} style={{
              display: 'grid', gridTemplateColumns: '180px 1fr',
              gap: 32, padding: '28px 0',
              borderBottom: '1px solid var(--border-1)',
              alignItems: 'baseline',
            }}>
              <div style={{ fontFamily: 'var(--font-mono)', fontSize: 12.5, color: 'var(--accent)', letterSpacing: '0.14em', textTransform: 'uppercase' }}>{b.year}</div>
              <div>
                <div style={{ fontSize: 20, fontWeight: 700, color: 'var(--fg-1)', letterSpacing: '-0.01em', marginBottom: 8 }}>{b.title}</div>
                <p style={{ fontSize: 14.5, color: 'var(--fg-2)', lineHeight: 1.65, margin: 0, maxWidth: 760 }}>{b.body}</p>
              </div>
            </div>
          ))}
        </div>
      </div>
    </section>
  );
}

// ---------- Culture ----------
function Culture() {
  const beats = [
    { t: 'Montréal-based, distance-built.', b: 'HQ in downtown Montréal. Bilingual team. Hires across North America and EU. In-office is optional; deep-work hours are not.' },
    { t: 'AI-first, not AI-decorated.',      b: 'Every engineer builds agentic flows. LLMs design the workflows; humans approve them; runtime is deterministic. Every decision is observable, evaluable, and recoverable.' },
    { t: 'Product mindset, all functions.',  b: 'GTM, ops, eng: everyone reads the spec. Everyone sits in on customer calls. The shortest line between insight and ship is one person.' },
    { t: 'Senior team, every seat.',         b: 'We hire small and seasoned. No interns, no second-system-syndrome, no "we\'ll need a manager for that."' },
    { t: 'Customer access is a privilege.',  b: 'When a carrier or TPA becomes a customer, we owe them more than uptime. We owe them clarity. Earn the renewal.' },
  ];
  return (
    <section id="culture" className="flat" style={{ background: 'var(--bg-sunken)' }}>
      <div className="container">
        <div style={{ display: 'flex', flexDirection: 'column', gap: 14, marginBottom: 56, maxWidth: 820 }}>
          <span className="eyebrow" style={{ alignSelf: 'flex-start' }}>Culture</span>
          <h2 style={{ fontSize: 'clamp(32px, 3.6vw, 48px)', fontWeight: 700, letterSpacing: '-0.02em', margin: 0, lineHeight: 1.1 }}>
            How we work,<br/>
            <span style={{ color: 'var(--accent)' }}>so the layer works.</span>
          </h2>
        </div>
        <div style={{
          display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 0,
          borderTop: '1px solid var(--border-1)',
        }}>
          {beats.map((b, i) => (
            <div key={b.t} style={{
              padding: '32px 32px 32px 0',
              paddingLeft: i % 3 === 0 ? 0 : 32,
              borderLeft: i % 3 === 0 ? 'none' : '1px solid var(--border-1)',
              borderBottom: i < 3 ? '1px solid var(--border-1)' : 'none',
              display: 'flex', flexDirection: 'column', gap: 10,
              minHeight: 200,
            }}>
              <h3 style={{ fontSize: 20, fontWeight: 700, letterSpacing: '-0.012em', lineHeight: 1.2, margin: 0 }}>{b.t}</h3>
              <p style={{ fontSize: 14, color: 'var(--fg-2)', lineHeight: 1.6, margin: 0 }}>{b.b}</p>
            </div>
          ))}
        </div>
      </div>
    </section>
  );
}

function Beliefs() {
  const beliefs = [
    {
      n: '01',
      title: 'Infrastructure should adapt.',
      body: 'The systems that move employer data should keep up when vendors change underneath. That\'s the layer\'s job.',
    },
    {
      n: '02',
      title: 'Carriers, TPAs, and employers all win on the same architecture.',
      body: 'One layer serves three sides of the table. No translation costs. No information asymmetry. No "let me get back to you next week."',
    },
    {
      n: '03',
      title: 'People remain the foundation.',
      body: 'Engineering teams build what the business needs. The layer extends their reach. It doesn\'t replace them. We work for sellers, implementers, and operators.',
    },
    {
      n: '04',
      title: 'We build the next standard.',
      body: 'Group insurance has been waiting for adaptive infrastructure. We\'re not iterating on what came before. We\'re building what carriers and TPAs would have specced if they could have.',
    },
  ];
  return (
    <section className="flat" style={{ background: 'var(--bg-sunken)' }}>
      <div className="container">
        <div style={{ display: 'flex', flexDirection: 'column', gap: 14, marginBottom: 64, maxWidth: 800 }}>
          <span className="eyebrow" style={{ alignSelf: 'flex-start' }}>What we believe</span>
          <h2 style={{
            fontSize: 'clamp(32px, 3.6vw, 48px)',
            fontWeight: 700, letterSpacing: '-0.02em', margin: 0, lineHeight: 1.1,
          }}>
            Four principles that<br/>shape the layer.
          </h2>
        </div>
        <div style={{
          display: 'grid', gridTemplateColumns: 'repeat(2, 1fr)', gap: 0,
          borderTop: '1px solid var(--border-1)',
        }}>
          {beliefs.map((b, i) => (
            <div key={b.n} style={{
              padding: '36px 32px 36px 0',
              paddingLeft: i % 2 === 0 ? 0 : 32,
              borderLeft: i % 2 === 0 ? 'none' : '1px solid var(--border-1)',
              borderBottom: i < 2 ? '1px solid var(--border-1)' : 'none',
              display: 'flex', flexDirection: 'column', gap: 14,
            }}>
              <div style={{
                fontFamily: 'var(--font-mono)', fontSize: 13,
                color: 'var(--accent)', letterSpacing: '0.16em',
              }}>{b.n}</div>
              <h3 style={{ fontSize: 22, fontWeight: 700, letterSpacing: '-0.015em', margin: 0 }}>{b.title}</h3>
              <p style={{ fontSize: 15, color: 'var(--fg-2)', lineHeight: 1.6, margin: 0 }}>{b.body}</p>
            </div>
          ))}
        </div>
      </div>
    </section>
  );
}

function Founders() {
  const founders = [
    {
      name: 'Sam Kasle',
      role: 'Co-Founder & CEO',
      bio: '20 years scaling tech startups in regulated industries.',
      photo: '../assets/team/sam.jpg',
      linkedin: 'https://www.linkedin.com/in/samkasle/',
    },
    {
      name: 'Jean-Philippe Carmona',
      role: 'Co-Founder & COO',
      bio: 'Operator turning product into commercial scale in insurtech.',
      photo: '../assets/team/jp.jpg',
      linkedin: 'https://www.linkedin.com/in/jpcarmona1/',
    },
    {
      name: 'Yan Avery',
      role: 'Co-Founder & CTO',
      bio: 'Engineering depth across regulated infrastructure and AI systems.',
      photo: '../assets/team/yan.jpg',
      linkedin: 'https://www.linkedin.com/in/yavery/',
    },
  ];
  // Leadership row no longer used — Yan now appears as a co-founder above.
  const leadership = [];
  const Card = ({ p, size = 'lg' }) => {
    const box = size === 'lg' ? 88 : 72;
    return (
      <div style={{
        padding: 28,
        border: '1px solid var(--border-1)',
        borderRadius: 4,
        background: 'var(--bg-elev-1)',
        display: 'flex', flexDirection: 'column', gap: 16,
        minHeight: size === 'lg' ? 280 : 240,
      }}>
        {p.photo ? (
          <img src={p.photo} alt={p.name + ' — headshot'} width={box} height={box}
            style={{
              width: box, height: box, borderRadius: 4,
              objectFit: 'cover',
              border: '1px solid var(--border-2)',
              filter: 'grayscale(1) contrast(1.05)',
              display: 'block',
            }}/>
        ) : (
          <div style={{
            width: box, height: box, borderRadius: 4,
            background: 'var(--bg-sunken)',
            border: '1px solid var(--border-2)',
            display: 'grid', placeItems: 'center',
            color: 'var(--fg-4)', fontSize: 10,
            fontFamily: 'var(--font-mono)', letterSpacing: '0.04em',
          }}>photo</div>
        )}
        <div>
          <div style={{ fontSize: size === 'lg' ? 20 : 18, fontWeight: 700, letterSpacing: '-0.01em' }}>{p.name}</div>
          <div className="eyebrow" style={{ color: 'var(--accent)', marginTop: 4, alignSelf: 'flex-start' }}>{p.role}</div>
        </div>
        <p style={{ fontSize: 14, color: 'var(--fg-2)', lineHeight: 1.55, margin: 0 }}>{p.bio}</p>
        {p.linkedin && (
          <a href={p.linkedin} target="_blank" rel="noopener" aria-label={`${p.name} on LinkedIn`}
            style={{
              marginTop: 'auto',
              display: 'inline-flex', alignItems: 'center', gap: 8,
              fontFamily: 'var(--font-mono)', fontSize: 12,
              color: 'var(--accent)', textDecoration: 'none',
              letterSpacing: '0.04em',
              paddingTop: 4,
              alignSelf: 'flex-start',
              borderBottom: '1px solid rgba(16, 200, 128, 0.45)',
              paddingBottom: 2,
            }}>
            <svg width="12" height="12" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
              <path d="M20.5 2h-17A1.5 1.5 0 002 3.5v17A1.5 1.5 0 003.5 22h17a1.5 1.5 0 001.5-1.5v-17A1.5 1.5 0 0020.5 2zM8 19H5v-9h3v9zM6.5 8.25A1.75 1.75 0 118.3 6.5a1.78 1.78 0 01-1.8 1.75zM19 19h-3v-4.74c0-1.42-.6-1.93-1.38-1.93A1.74 1.74 0 0013 14.19a.66.66 0 000 .14V19h-3v-9h2.9v1.3a3.11 3.11 0 012.7-1.4c1.55 0 3.36.86 3.36 3.66l.04 5.44z"/>
            </svg>
            LinkedIn →
          </a>
        )}
      </div>
    );
  };
  return (
    <section id="team" className="flat">
      <div className="container">
        <div style={{ display: 'flex', flexDirection: 'column', gap: 14, marginBottom: 56, maxWidth: 800 }}>
          <span className="eyebrow" style={{ alignSelf: 'flex-start' }}>Founders</span>
          <h2 style={{
            fontSize: 'clamp(32px, 3.6vw, 48px)',
            fontWeight: 700, letterSpacing: '-0.02em', margin: 0, lineHeight: 1.1,
          }}>
            Three operators.<br/>One shared problem.
          </h2>
        </div>
        <div style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 20 }}>
          {founders.map(p => <Card key={p.name} p={p} size="md"/>)}
        </div>

        {leadership.length > 0 && (
          <>
            <div style={{ display: 'flex', flexDirection: 'column', gap: 14, margin: '72px 0 32px', maxWidth: 800 }}>
              <span className="eyebrow" style={{ alignSelf: 'flex-start' }}>Leadership</span>
              <h2 style={{
                fontSize: 'clamp(24px, 2.8vw, 36px)',
                fontWeight: 700, letterSpacing: '-0.018em', margin: 0, lineHeight: 1.1,
              }}>
                The team building the layer.
              </h2>
            </div>
            <div style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 20 }}>
              {leadership.map(p => <Card key={p.name} p={p} size="md"/>)}
            </div>
          </>
        )}
      </div>
    </section>
  );
}

function Investors() {
  const logos = [
    { name: 'Diagram',   src: '../assets/investors/diagram.png',   height: 40, alt: 'Diagram',   role: 'Investor' },
    { name: 'Munich RE', src: '../assets/investors/munich-re.png', height: 50, alt: 'Munich Re', role: 'Partner' },
  ];
  return (
    <section id="investors" className="flat" style={{ background: 'var(--bg-sunken)' }}>
      <div className="container">
        <div style={{ display: 'flex', flexDirection: 'column', gap: 14, marginBottom: 48, maxWidth: 800 }}>
          <span className="eyebrow" style={{ alignSelf: 'flex-start' }}>Investors &amp; Partners</span>
          <h2 style={{
            fontSize: 'clamp(32px, 3.6vw, 48px)',
            fontWeight: 700, letterSpacing: '-0.02em', margin: 0, lineHeight: 1.1,
          }}>
            Backed by operators<br/>
            <span style={{ color: 'var(--accent)' }}>who shipped at scale.</span>
          </h2>
          <p style={{ fontSize: 15, color: 'var(--fg-2)', margin: '4px 0 0 0', lineHeight: 1.6, maxWidth: 680 }}>
            Backed by investors with depth in insurtech, infrastructure, and
            regulated industries — and partnered with the institutions shaping
            group insurance.
          </p>
        </div>

        <div style={{
          display: 'flex',
          alignItems: 'flex-end',
          gap: 56,
          flexWrap: 'wrap',
          padding: '32px 0',
          borderTop: '1px solid var(--border-1)',
          borderBottom: '1px solid var(--border-1)',
        }}>
          {logos.map(l => (
            <div key={l.name} style={{ display: 'flex', flexDirection: 'column', alignItems: 'flex-start', gap: 12 }}>
              <img
                src={l.src}
                alt={l.alt}
                style={{ height: l.height, width: 'auto', display: 'block', opacity: 0.85 }}
              />
              <span style={{ fontFamily: 'var(--font-mono)', fontSize: 11, letterSpacing: '0.1em', textTransform: 'uppercase', color: 'var(--fg-4)' }}>{l.role}</span>
            </div>
          ))}
        </div>

        <p style={{ fontSize: 12, color: 'var(--fg-4)', marginTop: 20, fontStyle: 'italic' }}>
          Additional names disclosed at close. Investor &amp; partnership inquiries: connect@eightbyzero.com.
        </p>
      </div>
    </section>
  );
}

function Press() {
  // Press releases come from /news/releases.jsx, the list /news renders too.
  const releases = window.NEWS_RELEASES || [];
  const published = releases.filter(r => r.live);

  return (
    <section id="press" className="flat">
      <div className="container">
        <div style={{ display: 'flex', flexDirection: 'column', gap: 14, marginBottom: 40, maxWidth: 800 }}>
          <span className="eyebrow" style={{ alignSelf: 'flex-start' }}>Press</span>
          <h2 style={{
            fontSize: 'clamp(32px, 3.6vw, 48px)',
            fontWeight: 700, letterSpacing: '-0.02em', margin: 0, lineHeight: 1.1,
          }}>
            {published.length ? 'In the news.' : 'Media inquiries.'}
          </h2>
        </div>

        {/* Release list — only rendered when there's at least one live release */}
        {published.length > 0 && (
          <div style={{ borderTop: '1px solid var(--border-1)', marginBottom: 40 }}>
            {published.map(r => (
              <a key={r.href} href={r.href} style={{
                display: 'grid', gridTemplateColumns: '180px 1fr auto',
                gap: 24, padding: '24px 0', alignItems: 'baseline',
                borderBottom: '1px solid var(--border-1)',
                textDecoration: 'none', color: 'inherit',
              }}>
                <div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
                  <span style={{ fontFamily: 'var(--font-mono)', fontSize: 12.5, color: 'var(--accent)', letterSpacing: '0.1em', textTransform: 'uppercase' }}>{r.date}</span>
                  <span className="eyebrow" style={{ alignSelf: 'flex-start', color: 'var(--fg-3)' }}>{r.tag}</span>
                </div>
                <div style={{ fontSize: 19, fontWeight: 600, color: 'var(--fg-1)', letterSpacing: '-0.015em', lineHeight: 1.3 }}>{r.title}</div>
                <span style={{ fontFamily: 'var(--font-mono)', fontSize: 13, color: 'var(--accent)', whiteSpace: 'nowrap' }}>Read →</span>
              </a>
            ))}
          </div>
        )}

        {/* Media-inquiries card — always shown */}
        <div style={{
          padding: 32,
          border: '1px solid var(--border-1)',
          borderRadius: 4,
          background: 'var(--bg-elev-1)',
          display: 'flex', justifyContent: 'space-between', alignItems: 'center',
          flexWrap: 'wrap', gap: 20,
        }}>
          <div style={{ display: 'flex', flexDirection: 'column', gap: 6 }}>
            <div style={{ fontSize: 18, fontWeight: 600, color: 'var(--fg-1)' }}>For press, briefings, or quotes:</div>
            <div style={{ fontSize: 14, color: 'var(--fg-3)' }}>Same address, just say "press" in the subject.</div>
          </div>
          <a href="mailto:connect@eightbyzero.com?subject=Press" style={{
            fontSize: 16, color: 'var(--accent)',
            textDecoration: 'none',
            fontFamily: 'var(--font-mono)',
            padding: '4px 0',
            borderBottom: '1px solid rgba(16, 200, 128, 0.45)',
          }}>connect@eightbyzero.com</a>
        </div>
      </div>
    </section>
  );
}

function Contact() {
  return (
    <section id="contact" className="flat" style={{ background: 'var(--bg-sunken)', textAlign: 'center' }}>
      <div className="container" style={{ maxWidth: 800, margin: '0 auto', display: 'flex', flexDirection: 'column', gap: 24, alignItems: 'center' }}>
        <img src="../assets/logo-mark.svg" width="56" height="56" alt="" style={{ opacity: 0.9 }}/>
        <h2 style={{
          fontSize: 'clamp(32px, 3.6vw, 48px)',
          fontWeight: 700, letterSpacing: '-0.025em',
          margin: 0, lineHeight: 1.1, color: 'var(--fg-1)',
        }}>
          Talk to us.
        </h2>
        <p style={{ fontSize: 16, color: 'var(--fg-3)', margin: 0, lineHeight: 1.55, fontStyle: 'italic' }}>
          Infinite connectivity, zero friction.<sup style={{ fontSize: 9, marginLeft: 1, fontStyle: 'normal' }}>™</sup>
        </p>
        <a href="mailto:connect@eightbyzero.com" style={{
          fontSize: 18, color: 'var(--accent)', textDecoration: 'none', fontWeight: 500,
          padding: '4px 0',
          borderBottom: '1px solid rgba(16, 200, 128, 0.45)',
          fontFamily: 'var(--font-mono)',
        }}>connect@eightbyzero.com</a>
      </div>
    </section>
  );
}

Object.assign(window, { AboutHero, VisionMission, OurStory, Beliefs, Culture, Founders, Investors, Press, Contact });
