// sections.jsx — All homepage sections
const { useState, useEffect, useRef } = React;

function useInView(threshold = 0.12) {
  const ref = useRef(null);
  const [visible, setVisible] = useState(false);
  useEffect(() => {
    const el = ref.current; if (!el) return;
    const obs = new IntersectionObserver(([e]) => {
      if (e.isIntersecting) { setVisible(true); obs.disconnect(); }
    }, { threshold });
    obs.observe(el);
    return () => obs.disconnect();
  }, []);
  return [ref, visible];
}

function useCountUp(target, duration = 1600, started = false) {
  const [val, setVal] = useState(0);
  useEffect(() => {
    if (!started) return;
    let start = null;
    const isNum = typeof target === 'number';
    if (!isNum) return;
    const step = (ts) => {
      if (!start) start = ts;
      const p = Math.min((ts - start) / duration, 1);
      const ease = 1 - Math.pow(1 - p, 3);
      setVal(Math.floor(ease * target));
      if (p < 1) requestAnimationFrame(step);
    };
    requestAnimationFrame(step);
  }, [started, target, duration]);
  return val;
}

function Eyebrow({ children, light }) {
  return (
    <div style={{
      fontFamily: 'var(--ff-mono)', fontSize: 11, letterSpacing: '0.12em',
      textTransform: 'uppercase', color: light ? 'rgba(255,255,255,0.35)' : 'var(--muted)',
      marginBottom: 20,
    }}>{children}</div>
  );
}

// ── Logo SVG ──────────────────────────────────────────────────────
// Tight 32×28 viewBox. Solid dot at left, then three concentric arcs.
// Each arc is the right-opening half-circle of its radius. Radii grow in
// arithmetic 5 → 8 → 11 so the stroke spacing stays visually even.
// Anchor x for each arc = (16 - r/2) so they share a center column near
// x=16 and read as one tightening wave. Endpoints (cx, cy±r) lie exactly
// on each circle so the arc geometry is mathematically clean.
function EchoLogo({ size = 28 }) {
  const w = size * (24 / 28);
  return (
    <svg width={w} height={size} viewBox="0 0 24 28" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
      <circle cx="5" cy="14" r="3.2" fill="#60A5FA"/>
      <path d="M10 9 A 5 5 0 0 1 10 19"  stroke="var(--ink)" strokeOpacity="0.96" strokeWidth="2.2" strokeLinecap="round" fill="none"/>
      <path d="M14 6 A 8 8 0 0 1 14 22"  stroke="var(--ink)" strokeOpacity="0.55" strokeWidth="2.2" strokeLinecap="round" fill="none"/>
      <path d="M18 3 A 11 11 0 0 1 18 25" stroke="var(--ink)" strokeOpacity="0.28" strokeWidth="2.2" strokeLinecap="round" fill="none"/>
    </svg>
  );
}

// (DemoSection removed — demo is now embedded inside the Agents section.)

// ── Problem ───────────────────────────────────────────────────────
function StatCard({ prefix = '', value, suffix = '', label, source, started }) {
  const count = useCountUp(typeof value === 'number' ? value : 0, 1800, started);
  const isNum = typeof value === 'number';
  const display = isNum ? `${prefix}${count.toLocaleString()}${suffix}` : value;

  return (
    <div style={{ background: 'var(--bg)', border: '1px solid var(--hairline)', borderRadius: 12, padding: '28px 24px', display: 'flex', flexDirection: 'column', gap: 12, transition: 'border-color 0.25s, transform 0.25s', cursor: 'default' }}
      onMouseEnter={e => { e.currentTarget.style.borderColor = 'var(--accent)'; e.currentTarget.style.transform = 'translateY(-2px)'; }}
      onMouseLeave={e => { e.currentTarget.style.borderColor = 'var(--hairline)'; e.currentTarget.style.transform = 'none'; }}
    >
      <div style={{ fontFamily: 'var(--ff-display)', fontSize: 'clamp(28px, 2.6vw, 40px)', fontWeight: 400, color: 'var(--ink)', lineHeight: 1, letterSpacing: '-0.025em', whiteSpace: 'nowrap' }}>{display}</div>
      <div style={{ fontSize: 13, color: 'var(--ink)', lineHeight: 1.55, fontWeight: 500 }}>{label}</div>
      <div style={{ fontFamily: 'var(--ff-mono)', fontSize: 10, letterSpacing: '0.08em', color: 'var(--muted)', marginTop: 'auto', textTransform: 'uppercase' }}>{source}</div>
    </div>
  );
}

function Problem() {
  const [ref, visible] = useInView(0.12);
  const stats = [
    { value: '30K+ / mo', label: 'PODs + BOLs still keyed by hand.', source: 'Regional LTL benchmark' },
    { value: '2 days', label: 'POD-to-invoice drag.', source: 'Industry · LTL automation 2025' },
    { value: '<50%', label: 'Of detention ever gets paid.', source: 'Industry · detention data' },
    { value: '10–15 min', label: 'Per booking re-keyed.', source: 'Carrier ops benchmark' },
  ];
  return (
    <section className="plate-section" style={{ padding: '40px 0' }}>
      <div ref={ref} className="glass-plate glass-plate--rounded plate-pad" style={{ maxWidth: 1240, margin: '0 auto', padding: '72px 56px' }}>
        <Eyebrow>The problem</Eyebrow>
        <div className="problem-header" style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 48, marginBottom: 56, alignItems: 'end' }}>
          <h2 style={{ fontFamily: 'var(--ff-display)', fontSize: 'clamp(32px, 3.6vw, 50px)', fontWeight: 400, lineHeight: 1.1, letterSpacing: '-0.02em' }}>
            Where time<br />
            <em style={{ fontStyle: 'italic', fontWeight: 300, color: 'var(--muted)' }}>and money leak.</em>
          </h2>
          <p style={{ fontSize: 15, color: 'var(--muted)', lineHeight: 1.7, maxWidth: 400 }}>
            High-margin operations still run on inbound email, phone calls, and manual TMS entry. Every handoff is a delay or an error.
          </p>
        </div>
        <div className="problem-stats" style={{ display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: 14 }}>
          {stats.map((s, i) => <StatCard key={i} {...s} started={visible} />)}
        </div>
      </div>
    </section>
  );
}

// ── Agent glyphs ──────────────────────────────────────────────────
const glyphs = {
  Otis: <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round"><rect x="3" y="3" width="18" height="13" rx="2"/><path d="M7 8h4M7 11h6"/><path d="M8 21h8M12 16v5"/></svg>,
  Dax:  <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round"><rect x="2" y="4" width="20" height="16" rx="2"/><polyline points="22,6 12,13 2,6"/></svg>,
  Ren:  <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round"><rect x="3" y="4" width="18" height="18" rx="2"/><line x1="16" y1="2" x2="16" y2="6"/><line x1="8" y1="2" x2="8" y2="6"/><line x1="3" y1="10" x2="21" y2="10"/></svg>,
  Mira: <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round"><line x1="12" y1="1" x2="12" y2="23"/><path d="M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"/></svg>,
};

function AgentCard({ num, name, domain, tagline, outcome, href, delay = 0 }) {
  const [hovered, setHovered] = useState(false);
  return (
    <a href={href} onMouseEnter={() => setHovered(true)} onMouseLeave={() => setHovered(false)} style={{
      background: 'var(--bg)', border: `1px solid ${hovered ? 'var(--accent)' : 'var(--hairline)'}`,
      borderRadius: 12, padding: '28px 24px', display: 'flex', flexDirection: 'column', gap: 16,
      cursor: 'pointer', textDecoration: 'none', color: 'inherit',
      transform: hovered ? 'translateY(-3px)' : 'none',
      boxShadow: hovered ? '0 12px 40px var(--accent-glow)' : 'none',
      transition: 'all 0.28s cubic-bezier(0.4,0,0.2,1)',
    }}>
      <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'flex-start' }}>
        <span style={{ fontFamily: 'var(--ff-mono)', fontSize: 10, letterSpacing: '0.1em', color: 'var(--muted)' }}>{num}</span>
        <span style={{ display: 'flex', alignItems: 'center', gap: 8, color: hovered ? 'var(--accent)' : 'var(--muted)', transition: 'color 0.28s' }}>
          {glyphs[name]}
          <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" style={{ transform: hovered ? 'translate(2px, -2px)' : 'none', transition: 'transform 0.28s' }}><path d="M7 17L17 7M7 7h10v10"/></svg>
        </span>
      </div>
      <div>
        <div style={{ fontFamily: 'var(--ff-mono)', fontSize: 10, letterSpacing: '0.1em', color: 'var(--muted)', textTransform: 'uppercase', marginBottom: 6 }}>{domain}</div>
        <div style={{ fontFamily: 'var(--ff-display)', fontSize: 34, fontWeight: 400, letterSpacing: '-0.02em', lineHeight: 1 }}>{name}</div>
      </div>
      <p style={{ fontSize: 13, color: 'var(--muted)', lineHeight: 1.6, margin: 0 }}>{tagline}</p>
      <div style={{ marginTop: 'auto', paddingTop: 14, borderTop: '1px solid var(--hairline)', display: 'flex', alignItems: 'flex-start', gap: 8 }}>
        <svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="var(--accent)" strokeWidth="2.2" strokeLinecap="round" strokeLinejoin="round" style={{ flexShrink: 0, marginTop: 2 }}><polyline points="9 18 15 12 9 6"/></svg>
        <span style={{ fontSize: 12, color: 'var(--ink)', fontWeight: 500, lineHeight: 1.5 }}>{outcome}</span>
      </div>
    </a>
  );
}

function Agents() {
  const agents = [
    { num: '01 · DOCUMENTS · AR',           name: 'Otis', domain: 'Documents & AR',          tagline: 'Reads inbound PODs and BOLs, extracts the data, and posts to TruckMate AR instantly.',                              outcome: 'Every document processed the same shift.',  href: 'agents/otis.html' },
    { num: '02 · CUSTOMER SERVICE · INTAKE', name: 'Dax',  domain: 'Customer Service',        tagline: 'Triages inbound customer emails, pulls live rates from TruckMate, and sends quotes in minutes.',                  outcome: 'Rate quotes out in minutes. Inbox clear.',   href: 'agents/dax.html' },
    { num: '03 · SCHEDULING · DOCK OPS',     name: 'Ren',  domain: 'Scheduling & Dock Ops',   tagline: 'Takes dock booking requests from Teams or SMS and books them into TruckMate and OpenDock automatically.',         outcome: 'Every booking in OpenDock. Automatically.',  href: 'agents/ren.html' },
    { num: '04 · AR · ACCESSORIAL OPS',      name: 'Mira', domain: 'AR & Accessorial',        tagline: 'Pulls GPS and timestamp data to substantiate detention and accessorial charges, then submits the package.',       outcome: 'Every detention charge documented and billed.', href: 'agents/mira.html' },
  ];
  return (
    <section id="agents" style={{ padding: '100px 0' }}>
      <div style={{ maxWidth: 1160, margin: '0 auto', padding: '0 40px' }}>
        <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'flex-end', marginBottom: 48 }}>
          <div>
            <Eyebrow>Meet the agents</Eyebrow>
            <h2 style={{ fontFamily: 'var(--ff-display)', fontSize: 'clamp(32px, 3.6vw, 50px)', fontWeight: 400, letterSpacing: '-0.025em', lineHeight: 1.05 }}>
              Four agents.<br />One freight stack.
            </h2>
          </div>
          <a href="agents/otis.html" style={{ fontFamily: 'var(--ff-mono)', fontSize: 11, letterSpacing: '0.08em', color: 'var(--muted)', display: 'flex', alignItems: 'center', gap: 7, borderBottom: '1px solid var(--hairline)', paddingBottom: 2, textTransform: 'uppercase', transition: 'all 0.2s' }}
            onMouseEnter={e => { e.currentTarget.style.color = 'var(--ink)'; e.currentTarget.style.borderColor = 'var(--ink)'; }}
            onMouseLeave={e => { e.currentTarget.style.color = 'var(--muted)'; e.currentTarget.style.borderColor = 'var(--hairline)'; }}
          >
            All agents
            <svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round"><path d="M5 12h14M12 5l7 7-7 7"/></svg>
          </a>
        </div>
        <div style={{ display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: 14 }}>
          {agents.map((a, i) => <AgentCard key={a.name} {...a} delay={i * 70} />)}
        </div>
      </div>
    </section>
  );
}

// ── How It Works ──────────────────────────────────────────────────
function HowItWorks() {
  const steps = [
    {
      tag: 'Step 01 · Connect',
      title: 'Point Echo at your stack',
      body: 'Azure AD SSO and read-write TruckMate access, provisioned in your own tenant. Nothing leaves your infrastructure.',
      items: ['Azure AD / Entra SSO', 'TruckMate API access', 'Azure OpenAI (your tenant)', 'No data egress'],
    },
    {
      tag: 'Step 02 · Configure',
      title: 'Assign agents to channels',
      body: 'Each agent connects to its channel — Teams, SMS, or email. Set escalation rules, approval thresholds, and override controls.',
      items: ['Teams / SMS / Email', 'Escalation thresholds', 'Human-in-the-loop controls', 'Role-based overrides'],
    },
    {
      tag: 'Step 03 · Operate',
      title: 'Atlas keeps watch',
      body: 'Every agent action is logged and auditable. The Atlas dashboard shows what each agent did, why, and when.',
      items: ['Real-time audit log', 'Atlas dashboard', 'SLA tracking', '24/7 operation'],
    },
  ];
  return (
    <section id="how-it-works" className="plate-section" style={{ padding: '40px 0' }}>
      <div className="glass-plate glass-plate--rounded plate-pad" style={{ maxWidth: 1240, margin: '0 auto', padding: '72px 56px' }}>
        <Eyebrow>Deployment</Eyebrow>
        <h2 style={{ fontFamily: 'var(--ff-display)', fontSize: 'clamp(32px, 3.6vw, 50px)', fontWeight: 400, letterSpacing: '-0.02em', lineHeight: 1.1, marginBottom: 60, maxWidth: 480 }}>
          Operational in weeks,<br /><em style={{ fontStyle: 'italic', fontWeight: 300 }}>not months.</em>
        </h2>
        <div className="how-grid" style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', borderTop: '1px solid var(--hairline)' }}>
          {steps.map((s, i) => (
            <div key={i} className="how-step" style={{ padding: '36px', borderRight: i < 2 ? '1px solid var(--hairline)' : 'none' }}>
              <div style={{ fontFamily: 'var(--ff-mono)', fontSize: 10, letterSpacing: '0.1em', color: 'var(--accent)', textTransform: 'uppercase', marginBottom: 20 }}>{s.tag}</div>
              <h3 style={{ fontFamily: 'var(--ff-display)', fontSize: 22, fontWeight: 400, marginBottom: 12, letterSpacing: '-0.01em' }}>{s.title}</h3>
              <p style={{ fontSize: 13, color: 'var(--muted)', lineHeight: 1.7, marginBottom: 24 }}>{s.body}</p>
              <div style={{ display: 'flex', flexDirection: 'column', gap: 7 }}>
                {s.items.map(d => (
                  <div key={d} style={{ display: 'flex', alignItems: 'center', gap: 9 }}>
                    <div style={{ width: 4, height: 4, borderRadius: '50%', background: 'var(--accent)', flexShrink: 0 }}></div>
                    <span style={{ fontFamily: 'var(--ff-mono)', fontSize: 10, letterSpacing: '0.06em', color: 'var(--muted)', textTransform: 'uppercase' }}>{d}</span>
                  </div>
                ))}
              </div>
            </div>
          ))}
        </div>
      </div>
    </section>
  );
}

// ── Comparison ────────────────────────────────────────────────────
function Comparison() {
  const [ref, visible] = useInView(0.08);
  const rows = [
    { workflow: 'POD intake',        today: 'CSR manually keys data from emailed PDF or fax',                     echo: 'Otis extracts and posts to TruckMate AR same shift' },
    { workflow: 'Rate quotes',       today: 'CSR pulls rate from TMS, emails back',                              echo: 'Dax responds in minutes with lane history' },
    { workflow: 'Dock scheduling',   today: 'Driver calls dispatcher; manual OpenDock entry',                     echo: 'Ren books from a Teams or SMS request' },
    { workflow: 'Detention claims',  today: 'Claims team reconstructs timelines after the fact',                  echo: 'Mira substantiates in real time and files' },
    { workflow: 'Accessorial billing', today: 'Inconsistent — depends which CSR caught it',                       echo: 'Every charge flagged, documented, billed' },
  ];
  return (
    <section className="plate-section" style={{ padding: '40px 0' }}>
      <div className="glass-plate glass-plate--rounded plate-pad" style={{ maxWidth: 1240, margin: '0 auto', padding: '72px 56px' }}>
        <Eyebrow>Today vs. Echo</Eyebrow>
        {/* (Pillar section is 04 · Why Echo) */}
        <h2 style={{ fontFamily: 'var(--ff-display)', fontSize: 'clamp(32px, 3.6vw, 50px)', fontWeight: 400, letterSpacing: '-0.02em', lineHeight: 1.1, marginBottom: 52, maxWidth: 480 }}>
          What changes when<br /><em style={{ fontStyle: 'italic', fontWeight: 300, color: 'var(--muted)' }}>agents go to work.</em>
        </h2>
        <div ref={ref} className="compare-table" style={{ border: '1px solid var(--hairline)', borderRadius: 12, overflow: 'hidden' }}>
          <div className="compare-header" style={{ display: 'grid', gridTemplateColumns: '180px 1fr 1fr', background: 'var(--surface)' }}>
            {[['WORKFLOW', false], ['TODAY', false], ['WITH ECHO', true]].map(([h, accent]) => (
              <div key={h} style={{ padding: '12px 18px', fontFamily: 'var(--ff-mono)', fontSize: 10, letterSpacing: '0.12em', color: accent ? 'var(--accent)' : 'var(--muted)', borderRight: h !== 'WITH ECHO' ? '1px solid var(--hairline)' : 'none', borderBottom: '1px solid var(--hairline)' }}>{h}</div>
            ))}
          </div>
          {rows.map((r, i) => (
            <div key={i} className="compare-row" style={{
              display: 'grid', gridTemplateColumns: '180px 1fr 1fr',
              borderBottom: i < rows.length - 1 ? '1px solid var(--hairline)' : 'none',
              opacity: visible ? 1 : 0,
              transform: visible ? 'none' : 'translateX(-10px)',
              transition: `opacity 0.5s cubic-bezier(0,0,0.2,1) ${i * 70}ms, transform 0.5s cubic-bezier(0,0,0.2,1) ${i * 70}ms`,
            }}>
              <div className="compare-cell compare-cell--label" style={{ padding: '16px 18px', borderRight: '1px solid var(--hairline)', fontFamily: 'var(--ff-mono)', fontSize: 10, letterSpacing: '0.07em', color: 'var(--muted)', textTransform: 'uppercase', display: 'flex', alignItems: 'center' }}>{r.workflow}</div>
              <div className="compare-cell compare-cell--today" data-mobile-label="TODAY" style={{ padding: '16px 18px', borderRight: '1px solid var(--hairline)', fontSize: 13, color: 'var(--muted)', lineHeight: 1.55, display: 'flex', alignItems: 'center' }}>{r.today}</div>
              <div className="compare-cell compare-cell--echo" data-mobile-label="WITH ECHO" style={{ padding: '16px 18px', fontSize: 13, color: 'var(--ink)', lineHeight: 1.55, display: 'flex', alignItems: 'center', gap: 10 }}>
                <span style={{ width: 5, height: 5, borderRadius: '50%', background: 'var(--accent)', flexShrink: 0 }}></span>
                {r.echo}
              </div>
            </div>
          ))}
        </div>
      </div>
    </section>
  );
}

// ── Footer ────────────────────────────────────────────────────────
function Footer({ theme, setTheme }) {
  const links = {
    Product: ['Agents', 'How It Works', 'Changelog'],
    Company: ['About', 'Contact', 'Privacy', 'Terms'],
  };
  return (
    <footer className="plate-section" style={{ padding: '40px 0 60px' }}>
      <div className="glass-plate glass-plate--rounded plate-pad-footer" style={{ maxWidth: 1240, margin: '0 auto', padding: '56px 56px 36px' }}>
        <div className="footer-grid" style={{ display: 'grid', gridTemplateColumns: '2fr 1fr 1fr 1fr', gap: 40, marginBottom: 56 }}>
          <div>
            <div style={{ display: 'flex', alignItems: 'center', gap: 8, marginBottom: 16 }}>
              <EchoLogo size={26} />
              <span style={{ fontFamily: 'var(--ff-mono)', fontSize: 13, fontWeight: 500, letterSpacing: '0.05em' }}>Echo</span>
            </div>
            <p style={{ fontFamily: 'var(--ff-display)', fontSize: 16, color: 'var(--ink)', lineHeight: 1.5, maxWidth: 280, marginBottom: 14, fontWeight: 400, letterSpacing: '-0.01em' }}>
              AI agents for regional carriers.<br/>
              <span style={{ color: 'var(--muted)', fontStyle: 'italic', fontWeight: 300 }}>Built on TruckMate. Owned by you.</span>
            </p>
            <a href="#" className="echo-cta echo-cta--primary echo-cta--sm" style={{
              fontFamily: 'var(--ff-mono)', fontSize: 10.5, letterSpacing: '0.12em', textTransform: 'uppercase',
              color: '#F4F0E8',
              background: 'linear-gradient(180deg, #3B82F6 0%, #2563EB 100%)',
              padding: '8px 14px', borderRadius: 7,
              display: 'inline-flex', alignItems: 'center', gap: 7,
              fontWeight: 600,
              boxShadow: '0 4px 14px rgba(37,99,235,0.3)',
              border: '1px solid rgba(96,165,250,0.5)',
              marginBottom: 14,
            }}>
              <span style={{ width: 5, height: 5, borderRadius: '50%', background: '#7DC9A8', boxShadow: '0 0 6px rgba(125,201,168,0.85)' }}></span>
              Get a demo
              <svg width="9" height="9" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round"><path d="M5 12h14M12 5l7 7-7 7"/></svg>
            </a>
            <div style={{ fontFamily: 'var(--ff-mono)', fontSize: 9.5, letterSpacing: '0.1em', color: 'var(--muted)', textTransform: 'uppercase' }}>A vertical of Echo Agents</div>
          </div>
          {Object.entries(links).map(([section, items]) => (
            <div key={section}>
              <div style={{ fontFamily: 'var(--ff-mono)', fontSize: 10, letterSpacing: '0.12em', textTransform: 'uppercase', color: 'var(--muted)', marginBottom: 14 }}>{section}</div>
              <div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}>
                {items.map(item => (
                  <a key={item} href="#" style={{ fontSize: 13, color: 'var(--muted)', transition: 'color 0.2s' }}
                    onMouseEnter={e => e.target.style.color = 'var(--ink)'}
                    onMouseLeave={e => e.target.style.color = 'var(--muted)'}
                  >{item}</a>
                ))}
              </div>
            </div>
          ))}
          <div>
            <div style={{ fontFamily: 'var(--ff-mono)', fontSize: 10, letterSpacing: '0.12em', textTransform: 'uppercase', color: 'var(--muted)', marginBottom: 14 }}>Display</div>
            <button onClick={() => setTheme(t => t === 'light' ? 'dark' : 'light')} style={{ display: 'flex', alignItems: 'center', gap: 8, padding: '7px 12px', borderRadius: 7, border: '1px solid var(--hairline)', background: 'var(--surface)', color: 'var(--ink)', cursor: 'pointer', fontSize: 11, fontFamily: 'var(--ff-mono)', letterSpacing: '0.06em', transition: 'border-color 0.2s' }}
              onMouseEnter={e => e.currentTarget.style.borderColor = 'var(--ink)'}
              onMouseLeave={e => e.currentTarget.style.borderColor = 'var(--hairline)'}
            >
              {theme === 'light'
                ? <svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/></svg>
                : <svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round"><circle cx="12" cy="12" r="5"/><path d="M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42"/></svg>
              }
              {theme === 'light' ? 'Dark mode' : 'Light mode'}
            </button>
          </div>
        </div>
        <div style={{ borderTop: '1px solid var(--hairline)', paddingTop: 24, display: 'flex', justifyContent: 'space-between', alignItems: 'center', flexWrap: 'wrap', gap: 14 }}>
          <span style={{ fontFamily: 'var(--ff-mono)', fontSize: 10, color: 'var(--muted)', letterSpacing: '0.07em' }}>© 2026 ECHO AGENTS INC.</span>
          <div style={{ display: 'flex', alignItems: 'center', gap: 14, flexWrap: 'wrap' }}>
            <span style={{ display: 'inline-flex', alignItems: 'center', gap: 7, fontFamily: 'var(--ff-mono)', fontSize: 10, color: 'var(--muted)', letterSpacing: '0.07em' }}>
              <span style={{ width: 6, height: 6, borderRadius: '50%', background: '#7DC9A8', boxShadow: '0 0 6px rgba(125,201,168,0.6)', animation: 'pulse 2.4s ease-in-out infinite' }} />
              All systems operational
            </span>
            <span style={{ fontFamily: 'var(--ff-mono)', fontSize: 10, color: 'var(--muted)', letterSpacing: '0.07em' }}>v2.4 · deployed today</span>
            <span style={{ fontFamily: 'var(--ff-mono)', fontSize: 10, color: 'var(--muted)', letterSpacing: '0.07em' }}>SOC 2 · TRUCKMATE · AZURE</span>
          </div>
        </div>
      </div>
    </footer>
  );
}

Object.assign(window, { EchoLogo, Problem, Agents, HowItWorks, Comparison, Footer });
