// Shared site primitives: Icons, Button, Eyebrow, Nav, Footer

// === Icons (Lucide-style, 1.5px stroke) ===
const Icon = ({ children, size = 20, fill = "none" }) => (
  <svg width={size} height={size} viewBox="0 0 24 24" fill={fill} stroke="currentColor"
       strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round">{children}</svg>
);
const Icons = {
  arrowRight: ({ size } = {}) => <Icon size={size}><path d="M5 12h14"/><path d="M12 5l7 7-7 7"/></Icon>,
  arrowUpRight: ({ size } = {}) => <Icon size={size}><line x1="7" y1="17" x2="17" y2="7"/><polyline points="7 7 17 7 17 17"/></Icon>,
  mail: ({ size } = {}) => <Icon size={size}><rect x="3" y="5" width="18" height="14" rx="2"/><path d="M3 7l9 6 9-6"/></Icon>,
  zap: ({ size } = {}) => <Icon size={size}><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></Icon>,
  search: ({ size } = {}) => <Icon size={size}><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></Icon>,
  brain: ({ size } = {}) => <Icon size={size}><path d="M9.5 2A2.5 2.5 0 0 1 12 4.5v15a2.5 2.5 0 0 1-4.96.44 2.5 2.5 0 0 1-2.96-3.08 3 3 0 0 1-.34-5.58 2.5 2.5 0 0 1 1.32-4.24 2.5 2.5 0 0 1 4.94-.05Z"/><path d="M14.5 2A2.5 2.5 0 0 0 12 4.5v15a2.5 2.5 0 0 0 4.96.44 2.5 2.5 0 0 0 2.96-3.08 3 3 0 0 0 .34-5.58 2.5 2.5 0 0 0-1.32-4.24 2.5 2.5 0 0 0-4.94-.05Z"/></Icon>,
  workflow: ({ size } = {}) => <Icon size={size}><rect x="3" y="3" width="6" height="6" rx="1"/><rect x="15" y="15" width="6" height="6" rx="1"/><path d="M21 9V7a2 2 0 0 0-2-2h-6"/><path d="M3 15v2a2 2 0 0 0 2 2h6"/></Icon>,
  cpu: ({ size } = {}) => <Icon size={size}><rect x="4" y="4" width="16" height="16" rx="2"/><rect x="9" y="9" width="6" height="6"/><line x1="9" y1="1" x2="9" y2="4"/><line x1="15" y1="1" x2="15" y2="4"/><line x1="9" y1="20" x2="9" y2="23"/><line x1="15" y1="20" x2="15" y2="23"/><line x1="20" y1="9" x2="23" y2="9"/><line x1="20" y1="14" x2="23" y2="14"/><line x1="1" y1="9" x2="4" y2="9"/><line x1="1" y1="14" x2="4" y2="14"/></Icon>,
  users: ({ size } = {}) => <Icon size={size}><path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M23 21v-2a4 4 0 0 0-3-3.87"/><path d="M16 3.13a4 4 0 0 1 0 7.75"/></Icon>,
  dollar: ({ size } = {}) => <Icon size={size}><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"/></Icon>,
  megaphone: ({ size } = {}) => <Icon size={size}><path d="M3 11l18-5v12L3 14v-3z"/><path d="M11.6 16.8a3 3 0 1 1-5.8-1.6"/></Icon>,
  shield: ({ size } = {}) => <Icon size={size}><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/></Icon>,
  pen: ({ size } = {}) => <Icon size={size}><path d="M12 19l7-7 3 3-7 7-3-3z"/><path d="M18 13l-1.5-7.5L2 2l3.5 14.5L13 18l5-5z"/><path d="M2 2l7.586 7.586"/><circle cx="11" cy="11" r="2"/></Icon>,
  check: ({ size } = {}) => <Icon size={size}><polyline points="20 6 9 17 4 12"/></Icon>,
  checkCircle: ({ size } = {}) => <Icon size={size}><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/><polyline points="22 4 12 14.01 9 11.01"/></Icon>,
  alertCircle: ({ size } = {}) => <Icon size={size}><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/></Icon>,
  menu: ({ size } = {}) => <Icon size={size}><line x1="3" y1="6" x2="21" y2="6"/><line x1="3" y1="12" x2="21" y2="12"/><line x1="3" y1="18" x2="21" y2="18"/></Icon>,
  close: ({ size } = {}) => <Icon size={size}><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></Icon>,
  send: ({ size } = {}) => <Icon size={size}><line x1="22" y1="2" x2="11" y2="13"/><polygon points="22 2 15 22 11 13 2 9 22 2"/></Icon>,
  mapPin: ({ size } = {}) => <Icon size={size}><path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"/><circle cx="12" cy="10" r="3"/></Icon>,
  clock: ({ size } = {}) => <Icon size={size}><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></Icon>,
  inbox: ({ size } = {}) => <Icon size={size}><polyline points="22 12 16 12 14 15 10 15 8 12 2 12"/><path d="M5.45 5.11L2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"/></Icon>,
  database: ({ size } = {}) => <Icon size={size}><ellipse cx="12" cy="5" rx="9" ry="3"/><path d="M21 12c0 1.66-4 3-9 3s-9-1.34-9-3"/><path d="M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"/></Icon>,
  terminal: ({ size } = {}) => <Icon size={size}><polyline points="4 17 10 11 4 5"/><line x1="12" y1="19" x2="20" y2="19"/></Icon>,
  facebook: ({ size } = {}) => <Icon size={size} fill="currentColor"><path stroke="none" d="M24 12.07C24 5.4 18.63 0 12 0S0 5.4 0 12.07c0 6.02 4.39 11.01 10.13 11.93v-8.44H7.08v-3.49h3.05V9.41c0-3.02 1.79-4.69 4.53-4.69 1.31 0 2.69.24 2.69.24v2.97h-1.52c-1.49 0-1.96.93-1.96 1.89v2.25h3.33l-.53 3.49h-2.8v8.44C19.61 23.08 24 18.09 24 12.07z"/></Icon>,
  twitter: ({ size } = {}) => <Icon size={size} fill="currentColor"><path stroke="none" d="M22 5.8a8.5 8.5 0 0 1-2.36.64 4.13 4.13 0 0 0 1.81-2.27 8.21 8.21 0 0 1-2.6 1 4.1 4.1 0 0 0-7 3.74A11.64 11.64 0 0 1 3.39 4.62a4.16 4.16 0 0 0-.56 2.07A4.09 4.09 0 0 0 4.66 10.1a4.05 4.05 0 0 1-1.86-.51v.05a4.1 4.1 0 0 0 3.3 4 4.07 4.07 0 0 1-1.86.07 4.11 4.11 0 0 0 3.83 2.84A8.22 8.22 0 0 1 2 18.28a11.59 11.59 0 0 0 6.29 1.84c7.55 0 11.67-6.25 11.67-11.67v-.53A8.27 8.27 0 0 0 22 5.8z"/></Icon>,
  linkedin: ({ size } = {}) => <Icon size={size} fill="currentColor"><path stroke="none" d="M19 0H5a5 5 0 0 0-5 5v14a5 5 0 0 0 5 5h14a5 5 0 0 0 5-5V5a5 5 0 0 0-5-5zM8 19H5V8h3v11zM6.5 6.7a1.8 1.8 0 1 1 0-3.6 1.8 1.8 0 0 1 0 3.6zM20 19h-3v-5.6c0-3.37-4-3.11-4 0V19h-3V8h3v1.77c1.4-2.59 7-2.78 7 2.48V19z"/></Icon>,
  tiktok: ({ size } = {}) => <Icon size={size} fill="currentColor"><path stroke="none" d="M16.6 5.82A4.28 4.28 0 0 1 15.54 3h-3.09v12.4a2.59 2.59 0 0 1-2.59 2.5 2.59 2.59 0 0 1 0-5.18c.27 0 .52.04.76.12V9.69a5.7 5.7 0 0 0-.76-.05A5.68 5.68 0 1 0 15.54 15.3V9.01a7.3 7.3 0 0 0 4.27 1.37V7.29a4.28 4.28 0 0 1-3.21-1.47z"/></Icon>,
  github: ({ size } = {}) => <Icon size={size} fill="currentColor"><path stroke="none" d="M12 0a12 12 0 0 0-3.79 23.4c.6.1.82-.26.82-.58v-2.17c-3.34.73-4.04-1.42-4.04-1.42-.55-1.4-1.34-1.77-1.34-1.77-1.1-.75.08-.73.08-.73 1.2.08 1.83 1.23 1.83 1.23 1.07 1.84 2.8 1.31 3.49 1 .1-.78.42-1.31.76-1.6-2.66-.3-5.47-1.33-5.47-5.93 0-1.31.47-2.38 1.24-3.22-.13-.3-.54-1.52.11-3.18 0 0 1.01-.32 3.3 1.23a11.5 11.5 0 0 1 6 0c2.29-1.55 3.3-1.23 3.3-1.23.65 1.66.24 2.88.12 3.18.77.84 1.23 1.91 1.23 3.22 0 4.61-2.81 5.63-5.49 5.92.43.37.81 1.1.81 2.22v3.29c0 .32.22.7.83.58A12 12 0 0 0 12 0z"/></Icon>,
  tool: ({ size } = {}) => <Icon size={size}><path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"/></Icon>,
  layers: ({ size } = {}) => <Icon size={size}><polygon points="12 2 2 7 12 12 22 7 12 2"/><polyline points="2 17 12 22 22 17"/><polyline points="2 12 12 17 22 12"/></Icon>,
  gitBranch: ({ size } = {}) => <Icon size={size}><line x1="6" y1="3" x2="6" y2="15"/><circle cx="18" cy="6" r="3"/><circle cx="6" cy="18" r="3"/><path d="M18 9a9 9 0 0 1-9 9"/></Icon>,
};

// === Button ===
const Button = ({ variant = "primary", size, icon, iconRight, children, onClick, href, type }) => {
  const cls = `btn btn-${variant} ${size === "lg" ? "btn-lg" : ""}`;
  const content = (
    <React.Fragment>
      {icon && <span style={{display: "inline-flex"}}>{icon}</span>}
      {children}
      {iconRight && <span style={{display: "inline-flex"}}>{iconRight}</span>}
    </React.Fragment>
  );
  if (href) return <a className={cls} href={href} onClick={onClick}>{content}</a>;
  return <button className={cls} type={type || "button"} onClick={onClick}>{content}</button>;
};

const Eyebrow = ({ onDark, children }) => (
  <span className={`eyebrow ${onDark ? "on-dark" : ""}`}>{children}</span>
);

// === Nav (full-length top header) ===
const Nav = ({ active, onDark, primaryCTA }) => {
  const [open, setOpen] = React.useState(false);
  const close = () => setOpen(false);
  return (
    <React.Fragment>
    <a className="skip-link" href="#main">Skip to content</a>
    <header className={`nav-wrap ${onDark ? "on-dark" : ""} ${open ? "menu-open" : ""}`}>
      <nav className={`nav ${onDark ? "on-dark" : ""}`}>
        <a className="nav-brand" href="index.html" onClick={close}>
          <img src="assets/logo-icon.png" alt="Zyniq Lab" />
          <div className="name">Zyniq Lab</div>
        </a>
        <div className="nav-menu">
          <div className="nav-links">
            <a href="index.html" className={active === "home" ? "active" : ""} onClick={close}>Home</a>
            <a href="services.html" className={active === "services" ? "active" : ""} onClick={close}>Services</a>
            <a href="build.html" className={active === "build" ? "active" : ""} onClick={close}>Build &amp; Sell</a>
            <a href="pricing.html" className={active === "pricing" ? "active" : ""} onClick={close}>Pricing</a>
            <a href="about.html" className={active === "about" ? "active" : ""} onClick={close}>About</a>
            <a href="contact.html" className={active === "contact" ? "active" : ""} onClick={close}>Contact</a>
          </div>
          <div className="nav-cta">
            <Button variant="primary" href="contact.html" onClick={close}>{primaryCTA || "Request a demo"}</Button>
          </div>
        </div>
        <button
          className="nav-toggle"
          aria-label="Toggle menu"
          aria-expanded={open}
          onClick={() => setOpen(o => !o)}>
          {open ? <Icons.close size={22}/> : <Icons.menu size={22}/>}
        </button>
      </nav>
    </header>
    </React.Fragment>
  );
};

// === Footer ===
const Footer = () => (
  <footer className="footer">
    <div className="container">
      <div className="footer-grid">
        <div className="footer-brand">
          <div className="lockup">
            <img src="assets/logo-icon.png" alt="" />
            <div className="name">Zyniq Lab</div>
          </div>
          <p>
            Practical agentic AI for small businesses and founders.
            We build it, we run it, you ship the work.
          </p>
          <div className="tagline">
            Automate<span className="dot">·</span>Innovate<span className="dot">·</span>Elevate
          </div>
        </div>
        <div className="footer-menu">
          <div className="footer-col">
            <h4>Site</h4>
            <div className="footer-links">
              <a href="index.html">Home</a>
              <a href="services.html">Services</a>
              <a href="build.html">Build &amp; Sell</a>
              <a href="pricing.html">Pricing</a>
              <a href="about.html">About</a>
              <a href="contact.html">Contact</a>
            </div>
          </div>
          <div className="footer-col">
            <h4>Services</h4>
            <div className="footer-links">
              <a href="services.html#it">IT AI Agent</a>
              <a href="services.html#marketing">Marketing AI Agent</a>
              <a href="services.html#hr">HR AI Agent</a>
              <a href="services.html#finance">Finance AI Agent</a>
            </div>
          </div>
          <div className="footer-col">
            <h4>Legal</h4>
            <div className="footer-links">
              <a href="privacy.html">Privacy</a>
            </div>
          </div>
        </div>
      </div>
      <div className="footer-bottom">
        <span>© Zyniq Lab, Inc. All rights reserved.</span>
        <div className="socials">
          <a href="https://www.facebook.com/profile.php?id=61590289291298" target="_blank" rel="noopener noreferrer" aria-label="Facebook"><Icons.facebook size={18} /></a>
          <a href="https://www.linkedin.com/company/118114048/" target="_blank" rel="noopener noreferrer" aria-label="LinkedIn"><Icons.linkedin size={18} /></a>
          <a href="https://www.tiktok.com/@zynip.lab" target="_blank" rel="noopener noreferrer" aria-label="TikTok"><Icons.tiktok size={18} /></a>
        </div>
      </div>
    </div>
  </footer>
);

Object.assign(window, { Icon, Icons, Button, Eyebrow, Nav, Footer });
