/* eslint-disable */
// Primitives — icons, logo, scroll reveal, screenshot wrapper

// ===== LOGO MARK =====
const SproutMark = ({ size = 28, color = "currentColor" }) => (
  <svg width={size} height={size} viewBox="0 0 732 718" aria-hidden="true">
    <g fill={color}>
      <path d="M 702 28 L 655 32 L 604 41 L 569 50 L 528 64 L 489 82 L 460 99 L 428 122 L 397 150 L 364 189 L 335 236 L 316 279 L 301 329 L 293 382 L 293 575 L 260 579 L 231 585 L 207 592 L 165 609 L 126 631 L 98 651 L 77 669 L 59 687 L 59 689 L 572 689 L 569 683 L 530 648 L 498 626 L 465 608 L 434 595 L 406 586 L 373 579 L 339 575 L 339 391 L 341 377 L 351 344 L 363 319 L 379 294 L 401 268 L 422 248 L 451 225 L 476 208 L 520 183 L 524 183 L 525 188 L 451 267 L 395 336 L 369 376 L 360 394 L 358 403 L 377 406 L 409 407 L 438 404 L 471 396 L 496 387 L 528 371 L 554 354 L 580 333 L 611 301 L 632 274 L 651 244 L 670 206 L 689 152 L 697 116 L 702 74 Z" />
      <path d="M 28 216 L 28 231 L 32 262 L 43 295 L 54 316 L 68 336 L 85 354 L 102 368 L 135 387 L 171 399 L 190 402 L 272 402 L 272 343 L 264 310 L 254 289 L 241 270 L 213 243 L 181 225 L 163 219 L 146 216 Z" />
    </g>
  </svg>
);

// ===== ICONS =====
const Ico = {
  bell: (p) => <svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round" {...p}><path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"/><path d="M13.73 21a2 2 0 0 1-3.46 0"/></svg>,
  mega: (p) => <svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round" {...p}><path d="M3 11l19-9-9 19-2-8-8-2z"/></svg>,
  umbrella: (p) => <svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round" {...p}><path d="M23 12a11.05 11.05 0 0 0-22 0zm-5 7a3 3 0 0 1-6 0v-7"/></svg>,
  star: (p) => <svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round" {...p}><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"/></svg>,
  rss: (p) => <svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round" {...p}><path d="M4 11a9 9 0 0 1 9 9"/><path d="M4 4a16 16 0 0 1 16 16"/><circle cx="5" cy="19" r="1"/></svg>,
  arrow: (p) => <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.2" strokeLinecap="round" strokeLinejoin="round" {...p}><path d="M5 12h14M13 5l7 7-7 7"/></svg>,
  check: (p) => <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.6" strokeLinecap="round" strokeLinejoin="round" {...p}><path d="M20 6L9 17l-5-5"/></svg>,
  squad: (p) => <svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round" {...p}><circle cx="9" cy="8" r="3.5"/><circle cx="17" cy="9" r="2.5"/><path d="M3 19c0-3 2.7-5 6-5s6 2 6 5"/><path d="M14.5 19c.1-1.6 1.1-3 3-3 2.2 0 3.5 1.6 3.5 3.5"/></svg>,
  cal: (p) => <svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round" {...p}><rect x="3" y="5" width="18" height="16" rx="2"/><path d="M3 10h18M8 3v4M16 3v4"/></svg>,
  whistle: (p) => <svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round" {...p}><path d="M14 11l7-3v6l-7-3z"/><circle cx="8" cy="13" r="5"/><path d="M5 9l-2-2"/></svg>,
  chat: (p) => <svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round" {...p}><path d="M21 12a8 8 0 1 1-3.2-6.4L21 4l-1.4 3.6A8 8 0 0 1 21 12z"/><path d="M8 12h.01M12 12h.01M16 12h.01"/></svg>,
  shield: (p) => <svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round" {...p}><path d="M12 3l8 3v6c0 4.5-3.4 8.5-8 9-4.6-.5-8-4.5-8-9V6l8-3z"/><path d="M9 12l2 2 4-4"/></svg>,
  card: (p) => <svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round" {...p}><rect x="3" y="6" width="18" height="13" rx="2"/><path d="M3 10h18M7 15h3"/></svg>,
  clipboard: (p) => <svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round" {...p}><rect x="6" y="4" width="12" height="17" rx="2"/><path d="M9 4h6v3H9z"/><path d="M9 12h6M9 16h4"/></svg>,
  formation: (p) => <svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round" {...p}><rect x="3" y="3" width="18" height="18" rx="2"/><path d="M3 12h18"/><circle cx="8" cy="8" r="1.2"/><circle cx="16" cy="8" r="1.2"/><circle cx="6" cy="16" r="1.2"/><circle cx="12" cy="16" r="1.2"/><circle cx="18" cy="16" r="1.2"/></svg>,
  phone: (p) => <svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round" {...p}><rect x="6" y="2" width="12" height="20" rx="2"/><path d="M11 18h2"/></svg>,
  stats: (p) => <svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round" {...p}><path d="M4 20V10M10 20V4M16 20v-7M22 20H2"/></svg>,
  scales: (p) => <svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round" {...p}><path d="M12 3v18M5 7h14M6 12l-3-5-3 5a3 3 0 0 0 6 0zM24 12l-3-5-3 5a3 3 0 0 0 6 0zM7 21h10"/></svg>,
  bolt: (p) => <svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round" {...p}><path d="M13 2L3 14h9l-1 8 10-12h-9l1-8z"/></svg>,
};

// ===== SCROLL REVEAL =====
// Adds .in class when the element enters the viewport. Children animate via CSS.
const Reveal = ({ as: Tag = "div", className = "", delay = 0, children, ...rest }) => {
  const ref = React.useRef(null);
  const [shown, setShown] = React.useState(false);

  React.useEffect(() => {
    const el = ref.current;
    if (!el) return;
    if (typeof IntersectionObserver === "undefined") { setShown(true); return; }
    const io = new IntersectionObserver(
      (entries) => {
        entries.forEach((e) => {
          if (e.isIntersecting) {
            setShown(true);
            io.unobserve(e.target);
          }
        });
      },
      { rootMargin: "0px 0px -12% 0px", threshold: 0.08 }
    );
    io.observe(el);
    return () => io.disconnect();
  }, []);

  return (
    <Tag
      ref={ref}
      className={`reveal ${shown ? "in" : ""} ${className}`}
      style={{ transitionDelay: shown ? `${delay}ms` : "0ms" }}
      {...rest}
    >
      {children}
    </Tag>
  );
};

// ===== SCREENSHOT — high-res, subtly breathing =====
const Screenshot = ({ src, alt = "", aspect, className = "", style = {}, frame = "dark" }) => {
  return (
    <div className={`shot shot-${frame} ${className}`} style={{ aspectRatio: aspect, ...style }}>
      <div className="shot-glow" aria-hidden="true"></div>
      <img src={src} alt={alt} loading="lazy" decoding="async" className="shot-img" />
    </div>
  );
};

// ===== PHONE — phone mock wrapper =====
const PhoneShot = ({ src, alt = "", className = "", style = {} }) => (
  <div className={`phone ${className}`} style={style}>
    <img src={src} alt={alt} loading="lazy" decoding="async" />
  </div>
);

Object.assign(window, { SproutMark, Ico, Reveal, Screenshot, PhoneShot });
