﻿/* Auto-generated from mockups/05-service-tiers.html */
(function(){

const { useState, useEffect, useRef } = React;

    /* WhatsApp deep link — number is placeholder per brief §F.1 */
    const WA_BASE = 'https://wa.me/972000000000';
    const waLink = (msg) => `${WA_BASE}?text=${encodeURIComponent(msg)}`;

    /* ── Icons ── */
    const Icon = ({ size = 16, children, style }) => (
      <svg viewBox="0 0 24 24" width={size} height={size} fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" style={{ flex:'none', ...style }}>{children}</svg>
    );
    const Check = (p) => <Icon {...p}><path d="M20 6L9 17l-5-5"/></Icon>;
    const WA = ({ size = 18 }) => (
      <svg viewBox="0 0 24 24" width={size} height={size} fill="currentColor" style={{ flex:'none' }}>
        <path d="M17.5 14.4c-.3-.1-1.7-.9-2-1-.3-.1-.5-.1-.7.1-.2.3-.8 1-1 1.2-.2.2-.4.2-.7.1-.3-.1-1.3-.5-2.4-1.5-.9-.8-1.5-1.8-1.7-2.1-.2-.3 0-.5.1-.6l.5-.5c.2-.2.2-.3.3-.5 0-.2 0-.4 0-.5 0-.1-.7-1.6-.9-2.2-.2-.6-.5-.5-.7-.5h-.6c-.2 0-.5.1-.8.4-.3.3-1 1-1 2.4 0 1.4 1 2.8 1.2 3 .1.2 2 3 4.7 4.2 1.7.7 2.3.8 3.1.7.5-.1 1.7-.7 1.9-1.4.2-.7.2-1.3.2-1.4-.1-.1-.3-.2-.5-.2zM12 2C6.5 2 2 6.5 2 12c0 1.9.5 3.7 1.5 5.3L2 22l4.8-1.5c1.5.8 3.3 1.3 5.2 1.3 5.5 0 10-4.5 10-10S17.5 2 12 2z"/>
      </svg>
    );
    const SalesIcon = (p) => <Icon {...p}><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></Icon>;
    const SupportIcon = (p) => <Icon {...p}><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/></Icon>;
    const OrganizerIcon = (p) => <Icon {...p}><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"/></Icon>;

    /* ── Button (lifted from hero — identical signature) ── */
    function Button({ size = 'lg', glow = false, children, onClick, fullWidth = false }) {
      const [hover, setHover] = useState(false);
      const base = {
        display: 'inline-flex', alignItems: 'center', justifyContent: 'center', gap: 10,
        fontFamily: 'var(--font-display)', fontWeight: 600,
        borderRadius: 10, border: '1px solid transparent', cursor: 'pointer',
        letterSpacing: '-0.005em', whiteSpace: 'nowrap',
        transition: 'all 180ms var(--ease-out)',
        background: hover ? '#0035cc' : '#0047ff', color: '#fff',
        boxShadow: glow ? (hover ? '0 0 40px rgba(0,71,255,0.65)' : '0 0 24px rgba(0,71,255,0.45)') : 'none',
        width: fullWidth ? '100%' : 'auto',
      };
      const sizes = {
        sm: { height: 36, padding: '0 16px', fontSize: 13 },
        lg: { height: 54, padding: '0 32px', fontSize: 15 },
      };
      return (
        <button onClick={onClick}
          onMouseEnter={() => setHover(true)} onMouseLeave={() => setHover(false)}
          style={{ ...base, ...sizes[size] }}>
          {children}
        </button>
      );
    }

    /* ── Reveal hook ── */
    function useReveal(threshold = 0.15) {
      const ref = useRef(null);
      useEffect(() => {
        if (!ref.current) return;
        const el = ref.current;
        const r = el.getBoundingClientRect();
        if (r.top < window.innerHeight * 0.92 && r.bottom > 0) { el.classList.add('in'); return; }
        const io = new IntersectionObserver(([e]) => {
          if (e.isIntersecting) { el.classList.add('in'); io.disconnect(); }
        }, { threshold });
        io.observe(el);
        return () => io.disconnect();
      }, [threshold]);
      return ref;
    }

    /* ── Section header (eyebrow + h2 opener) ── */
    function SectionHead({ eyebrow, title, accentDot = '#0047ff' }) {
      const ref = useReveal();
      return (
        <div ref={ref} className="reveal" style={{ marginBottom: 40, maxWidth: 880 }}>
          <div style={{
            display: 'inline-flex', alignItems: 'center', gap: 10,
            fontFamily: 'var(--font-mono)', fontSize: 14, color: 'var(--text-dim)',
            letterSpacing: '0.16em', textTransform: 'uppercase', marginBottom: 22,
          }}>
            <span style={{ width: 6, height: 6, borderRadius: 9999, background: accentDot, boxShadow: `0 0 8px ${accentDot}` }}/>
            {eyebrow}
          </div>
          <h2 className="section-h2" style={{
            margin: 0,
            fontFamily: 'var(--font-display)', fontWeight: 600,
            fontSize: 44, lineHeight: 1.1, letterSpacing: '-0.035em',
            color: 'var(--text-primary)', textWrap: 'balance',
          }}>
            {title}
          </h2>
        </div>
      );
    }

    /* ── Top-of-card tag (full label) ── */
    function CardTag({ children }) {
      return (
        <div style={{
          display: 'inline-flex', alignItems: 'center', gap: 8,
          padding: '7px 13px', borderRadius: 9999,
          background: 'rgba(0,71,255,0.10)', border: '1px solid rgba(0,71,255,0.30)',
          fontFamily: 'var(--font-display)', fontSize: 14, fontWeight: 600,
          letterSpacing: '0.12em', textTransform: 'uppercase', color: '#9fb8ff',
        }}>
          <span style={{ width: 6, height: 6, borderRadius: 9999, background: '#0047ff', boxShadow: '0 0 8px #0047ff' }}/>
          {children}
        </div>
      );
    }

    /* ────────────────────────────────────────────────────────────────────
       SECTION 5 · TIER 1 — Marketing Funnel & Systems
       ──────────────────────────────────────────────────────────────────── */
    function Tier1Card() {
      const ref = useReveal(0.1);
      const t = window.useCopy();
      const { lang } = window.useLang();
      const waMsg = "Hi BoldBrandz, I'd like to learn more about the Marketing Funnel tier";

      return (
        <div ref={ref} className="reveal svc-card tier-card" style={{
          position: 'relative',
          background: 'var(--bg-card)',
          border: '1px solid var(--border-subtle)',
          borderRadius: 20,
          padding: '44px 48px 40px',
          boxShadow: '0 18px 48px -16px rgba(0,0,0,0.55)',
          overflow: 'hidden',
        }}>
          {/* Tier 1 accent: solid blue stripe — engine, foundational */}
          <div style={{
            position: 'absolute', top: 0, left: 24, right: 24, height: 2,
            background: '#0047ff',
            boxShadow: '0 0 14px rgba(0,71,255,0.55)',
          }}/>

          {/* Header row: tag + Arabic name */}
          <div style={{
            display: 'flex', alignItems: 'flex-start', justifyContent: 'space-between',
            gap: 24, marginBottom: 26, flexWrap: 'wrap',
          }}>
            <div>
              <div style={{ marginBottom: 14 }}>
                <CardTag>{t.t1.pill}</CardTag>
              </div>
              {lang === 'ar' && (
              <div style={{
                fontFamily: 'var(--font-arabic)', fontWeight: 500,
                fontSize: 22, lineHeight: 1.3, color: 'var(--text-muted)',
                direction: 'rtl', textAlign: 'left',
              }}>
                {t.t1.ar_sub}
              </div>
              )}
            </div>
          </div>

          {/* Tagline — large, prominent */}
          <h3 style={{
            margin: '0 0 36px',
            fontFamily: 'var(--font-display)', fontWeight: 600,
            fontSize: 38, lineHeight: 1.15, letterSpacing: '-0.03em',
            color: 'var(--text-primary)', textWrap: 'balance', maxWidth: 720,
          }}>
            {t.t1.title}
          </h3>

          {/* Section divider */}
          <div style={{
            display: 'flex', alignItems: 'center', gap: 12,
            marginBottom: 22,
          }}>
            <div style={{
              fontFamily: 'var(--font-mono)', fontSize: 13, color: 'var(--text-dim)',
              letterSpacing: '0.16em', textTransform: 'uppercase',
            }}>{t.t1.features_label}</div>
            <div style={{ flex: 1, height: 1, background: 'var(--border-subtle)' }}/>
          </div>

          {/* Two-column inclusions checklist */}
          <ul style={{
            listStyle: 'none', margin: 0, padding: 0,
            display: 'grid', gridTemplateColumns: 'repeat(2, 1fr)', gap: '14px 32px',
          }}>
            {t.t1.features.map((line, i) => (
              <li key={i} style={{
                display: 'flex', alignItems: 'flex-start', gap: 12,
                fontFamily: 'var(--font-display)', fontSize: 18, fontWeight: 400,
                lineHeight: 1.5, color: 'var(--text-secondary)',
              }}>
                <span style={{
                  flex: 'none', width: 22, height: 22, borderRadius: 9999,
                  background: 'rgba(34,197,94,0.12)',
                  display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
                  color: '#22c55e', marginTop: 1,
                }}>
                  <Check size={13}/>
                </span>
                <span>{line}</span>
              </li>
            ))}
          </ul>

          {/* Price + CTA footer */}
          <div style={{
            marginTop: 40, paddingTop: 32, borderTop: '1px solid var(--border-subtle)',
            display: 'flex', alignItems: 'center', justifyContent: 'space-between',
            gap: 32, flexWrap: 'wrap',
          }}>
            <div>
              <div style={{
                fontFamily: 'var(--font-mono)', fontSize: 13, color: 'var(--text-dim)',
                letterSpacing: '0.16em', textTransform: 'uppercase', marginBottom: 8,
              }}>{t.t1.price.label}</div>
              <div style={{
                fontFamily: 'var(--font-display)', fontSize: 20, fontWeight: 500,
                color: 'var(--text-muted)', lineHeight: 1.4,
              }}>
                <span style={{ color: 'var(--text-muted)' }}>{t.t1.price.prefix} </span>
                <span style={{
                  fontFamily: 'var(--font-display)', fontWeight: 700,
                  color: '#0047ff', fontSize: 32, letterSpacing: '-0.025em',
                  fontVariantNumeric: 'tabular-nums',
                  textShadow: '0 0 18px var(--accent-primary-glow)',
                  direction: 'ltr', unicodeBidi: 'isolate', display: 'inline-block',
                }}>4,000 ₪</span>
                <span style={{ color: 'var(--text-muted)' }}> {t.t1.price.suffix}</span>
                <div style={{ color: 'var(--text-muted)', fontSize: 19, marginTop: 4 }}>{t.t1.price.retainer}</div>
              </div>
            </div>
            <Button glow onClick={() => window.open(waLink(waMsg), '_blank')}>
              <WA size={16}/> {t.t1.cta}
            </Button>
          </div>
        </div>
      );
    }

    /* ────────────────────────────────────────────────────────────────────
       SECTION 6 · TIER 2 — AI Agents
       ──────────────────────────────────────────────────────────────────── */
    function Tier2Card() {
      const ref = useReveal(0.1);
      const t = window.useCopy();
      const { lang } = window.useLang();
      const cardInView = useInViewBoolean(ref, 0.15);
      const agentIcons = [SalesIcon, SupportIcon, OrganizerIcon];
      const waMsg = "Hi BoldBrandz, I'd like to build my AI agent (Tier 2)";

      return (
        <div ref={ref} className="reveal svc-card tier-card" style={{
          position: 'relative',
          background: 'var(--bg-card)',
          border: '1px solid var(--border-subtle)',
          borderRadius: 20,
          padding: '44px 48px 40px',
          boxShadow: '0 18px 48px -16px rgba(0,0,0,0.55)',
          overflow: 'hidden',
        }}>
          {/* Tier 2 accent: blue → transparent gradient stripe — workforce, in motion */}
          <div style={{
            position: 'absolute', top: 0, left: 24, right: 24, height: 2,
            background: 'linear-gradient(90deg, #0047ff 0%, #0047ff 40%, rgba(0,71,255,0) 100%)',
            boxShadow: '0 0 14px rgba(0,71,255,0.45)',
          }}/>

          {/* Header row: tag (with online pulse dot to distinguish from Tier 1) + Arabic */}
          <div style={{
            display: 'flex', alignItems: 'flex-start', justifyContent: 'space-between',
            gap: 24, marginBottom: 26, flexWrap: 'wrap',
          }}>
            <div>
              <div style={{ marginBottom: 14, display: 'flex', alignItems: 'center', gap: 10, flexWrap: 'wrap' }}>
                <CardTag>{t.t2.pill}</CardTag>
                <div style={{
                  display: 'inline-flex', alignItems: 'center', gap: 7,
                  padding: '5px 11px', borderRadius: 9999,
                  background: 'rgba(34,197,94,0.10)', border: '1px solid rgba(34,197,94,0.30)',
                  fontFamily: 'var(--font-mono)', fontSize: 13, fontWeight: 600,
                  letterSpacing: '0.16em', textTransform: 'uppercase', color: '#86efac',
                }}>
                  <span className="pulse-dot" style={{ width: 6, height: 6, borderRadius: 9999, background: '#22c55e' }}/>
                  {t.t2.live}
                </div>
              </div>
              {lang === 'ar' && (
              <div style={{
                fontFamily: 'var(--font-arabic)', fontWeight: 500,
                fontSize: 22, lineHeight: 1.3, color: 'var(--text-muted)',
                direction: 'rtl', textAlign: 'left',
              }}>
                {t.t2.ar_sub}
              </div>
              )}
            </div>
          </div>

          {/* Tagline — first sentence emphasised */}
          <h3 style={{
            margin: '0 0 14px',
            fontFamily: 'var(--font-display)', fontWeight: 600,
            fontSize: 32, lineHeight: 1.2, letterSpacing: '-0.025em',
            color: 'var(--text-primary)', textWrap: 'balance', maxWidth: 760,
          }}>
            {t.t2.title}
          </h3>
          <div style={{
            fontFamily: 'var(--font-display)', fontSize: 18, fontWeight: 500,
            color: 'var(--text-dim)', marginBottom: 34, lineHeight: 1.5,
          }}>
            {t.t2.title_tag_pre} <span style={{ color: 'var(--text-secondary)' }}>{t.t2.title_tag_bold}</span>
          </div>

          {/* Section divider */}
          <div style={{
            display: 'flex', alignItems: 'center', gap: 12, marginBottom: 18,
          }}>
            <div style={{
              fontFamily: 'var(--font-mono)', fontSize: 13, color: 'var(--text-dim)',
              letterSpacing: '0.16em', textTransform: 'uppercase',
            }}>{t.t2.features_label}</div>
            <div style={{ flex: 1, height: 1, background: 'var(--border-subtle)' }}/>
          </div>

          {/* Three agent sub-cards — stagger 80ms left→right when card enters view */}
          <div className="agent-grid" style={{
            display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 14,
          }}>
            {t.t2.features.map((agent, i) => (
              <div key={i}
                className="agent-card"
                style={{
                  background: 'var(--bg-elevated)',
                  border: '1px solid var(--border-subtle)',
                  borderRadius: 14,
                  padding: '20px 18px',
                  display: 'flex', flexDirection: 'column', gap: 12,
                  opacity: cardInView ? 1 : 0,
                  transform: cardInView ? 'translateY(0)' : 'translateY(12px)',
                  transition: `opacity 600ms var(--ease-out) ${i * 80}ms, transform 600ms var(--ease-out) ${i * 80}ms, border-color 200ms var(--ease-out), background 200ms var(--ease-out)`,
                }}>
                <span style={{
                  width: 34, height: 34, borderRadius: 9,
                  background: 'rgba(0,71,255,0.10)',
                  border: '1px solid rgba(0,71,255,0.20)',
                  display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
                  color: '#9fb8ff',
                }}>
                  {React.createElement(agentIcons[i], { size: 16 })}
                </span>
                <div style={{
                  fontFamily: 'var(--font-display)', fontWeight: 600,
                  fontSize: 16, color: '#0047ff', letterSpacing: '0.04em',
                  textTransform: 'uppercase',
                }}>{agent.title}</div>
                <div style={{
                  fontFamily: 'var(--font-display)', fontWeight: 400,
                  fontSize: 15, color: 'var(--text-secondary)', lineHeight: 1.5,
                }}>{agent.body}</div>
              </div>
            ))}
          </div>

          {/* Channels row — inline bullets */}
          <div style={{
            marginTop: 22,
            display: 'flex', flexWrap: 'wrap', alignItems: 'center', gap: 8,
            fontFamily: 'var(--font-display)', fontSize: 15, fontWeight: 500,
            color: 'var(--text-muted)',
          }}>
            <span>{t.t2.channels_pre}</span>
            {t.t2.channels_list.map((ch, i) => (
              <React.Fragment key={i}>
                <span style={{ color: 'var(--text-primary)', fontWeight: 600 }}>{ch}</span>
                {i < t.t2.channels_list.length - 1 && <span style={{ color: 'var(--text-faint)' }}>·</span>}
              </React.Fragment>
            ))}
            <span style={{ color: 'var(--text-faint)', margin: '0 4px' }}>—</span>
            <span>{t.t2.channels_post}</span>
          </div>

          {/* Price + CTA footer */}
          <div style={{
            marginTop: 36, paddingTop: 32, borderTop: '1px solid var(--border-subtle)',
            display: 'flex', alignItems: 'center', justifyContent: 'space-between',
            gap: 32, flexWrap: 'wrap',
          }}>
            <div>
              <div style={{
                fontFamily: 'var(--font-mono)', fontSize: 13, color: 'var(--text-dim)',
                letterSpacing: '0.16em', textTransform: 'uppercase', marginBottom: 8,
              }}>{t.tiers.investment}</div>
              <div style={{
                fontFamily: 'var(--font-display)', fontSize: 20, fontWeight: 500,
                color: 'var(--text-muted)', lineHeight: 1.4,
              }}>
                <span style={{ color: 'var(--text-muted)' }}>{t.t2.price.prefix} </span>
                <span style={{
                  fontFamily: 'var(--font-display)', fontWeight: 700,
                  color: '#0047ff', fontSize: 32, letterSpacing: '-0.025em',
                  fontVariantNumeric: 'tabular-nums',
                  textShadow: '0 0 18px var(--accent-primary-glow)',
                  direction: 'ltr', unicodeBidi: 'isolate', display: 'inline-block',
                }}>8,000 ₪</span>
                <span style={{ color: 'var(--text-muted)' }}> {t.t2.price.suffix}</span>
                <div style={{
                  color: 'var(--text-muted)', fontSize: 19, marginTop: 4,
                  direction: 'ltr', unicodeBidi: 'isolate',
                }}>
                  {t.t2.price.monthly}
                </div>
              </div>
            </div>
            <Button glow onClick={() => window.open(waLink(waMsg), '_blank')}>
              <WA size={16}/> {t.t2.cta}
            </Button>
          </div>
        </div>
      );
    }

    /* useInViewBoolean — for Tier 2 sub-card stagger trigger */
    function useInViewBoolean(ref, threshold = 0.15) {
      const [inView, setInView] = useState(false);
      useEffect(() => {
        if (!ref.current) return;
        const r = ref.current.getBoundingClientRect();
        if (r.top < window.innerHeight * 0.92 && r.bottom > 0) { setInView(true); return; }
        const io = new IntersectionObserver(([e]) => {
          if (e.isIntersecting) { setInView(true); io.disconnect(); }
        }, { threshold });
        io.observe(ref.current);
        return () => io.disconnect();
      }, [ref, threshold]);
      return inView;
    }

    /* ────────────────────────────────────────────────────────────────────
       PAGE — back-to-back sections, max-w-5xl per brief
       ──────────────────────────────────────────────────────────────────── */
    function ServiceTiers() {
      const t = window.useCopy();
      return (
        <>
          {/* SECTION 5 */}
          <section style={{
            position: 'relative', background: 'var(--bg-base)',
            padding: '120px 48px 64px', overflow: 'hidden',
          }}>
            {/* horizon streak — subtle */}
            <div style={{
              position: 'absolute', left: 0, right: 0, top: '60%',
              height: 200, pointerEvents: 'none',
              background: 'linear-gradient(180deg, transparent, rgba(0,71,255,0.05), transparent)',
            }}/>
            <div style={{ maxWidth: 1024, margin: '0 auto', position: 'relative' }}>
              <SectionHead
                eyebrow={t.t1.section_badge}
                title={t.t1.section_h1}
              />
              <Tier1Card/>
            </div>
          </section>

          {/* SECTION 6 */}
          <section style={{
            position: 'relative', background: 'var(--bg-base)',
            padding: '64px 48px 120px', overflow: 'hidden',
          }}>
            <div style={{ maxWidth: 1024, margin: '0 auto', position: 'relative' }}>
              <SectionHead
                eyebrow={t.t2.section_badge}
                title={
                  <>{t.t2.section_h1_pre}{' '}<span style={{ color: '#22c55e', direction: 'ltr', unicodeBidi: 'isolate', display: 'inline-block' }}>{t.t2.section_h1_metric}</span>{' '}{t.t2.section_h1_post}</>
                }
                accentDot="#22c55e"
              />
              <Tier2Card/>
            </div>
          </section>
        </>
      );
    }

    /* ── Mockup chrome wrapper ── */

window.Tier12Section = ServiceTiers;
})();
