/* ============================================================
   Gaung AI — Home page sections (below hero)
   ============================================================ */

function OfficeSection() {
  const { lang } = React.useContext(LangCtx);
  return (
    <section className="section" id="office" style={{paddingBlock:'clamp(60px, 8vw, 120px)'}}>
      <div className="wrap">
        <div className="split-1-2" style={{marginBottom:56}}>
          <div>
            <div className="eyebrow mb-4">{t({id:'Di balik layar', en:'Behind the scenes'}, lang)}</div>
            <h2 className="h-section">
              {t({id:'Autonomous AI', en:'Autonomous AI'}, lang)}<br/>
              <span className="serif">{t({id:'Sales Orchestration', en:'Sales Orchestration'}, lang)}</span>
            </h2>
          </div>
          <p className="lead">
            {t({
              id:'Gaung AI bekerja 24/7 menjalankan agent-agent sales Anda. Lead Gen menyisir sumber data, Conversation Agent membalas leads di WhatsApp, Analytics menilai pipeline — semua dalam satu otak, semua terhubung.',
              en:'Gaung AI runs your sales agents 24/7. Lead Gen sweeps sources, Conversation Agent replies on WhatsApp, Analytics scores the pipeline — one brain, one system.'
            }, lang)}
          </p>
        </div>
        <OfficeScene/>
      </div>
    </section>
  );
}

function MarqueeStrip() {
  const { lang } = React.useContext(LangCtx);
  const items = [
    t({id:'Dipercaya oleh tim pertumbuhan di Indonesia',en:'Trusted by growth teams across Indonesia'}, lang),
    'PT Graha Merdeka',
    'Nusa Manufaktur',
    'Sekawan Logistik',
    'Bintang SaaS',
    'Arta Konstruksi',
    'Duta Pharma',
    'Harmoni FinTech',
    'Mitra Industri',
  ];
  const doubled = [...items, ...items];
  return (
    <div className="marquee">
      <div className="marquee-track">
        {doubled.map((x, i) => <span key={i} className="marquee-item">{x}</span>)}
      </div>
    </div>
  );
}

function HowItWorksSection() {
  const { lang } = React.useContext(LangCtx);

  const steps = [
    { n:'01', agent:'dna',
      title:{id:'Business DNA', en:'Business DNA'},
      desc:{id:'AI baca website Anda, ekstrak ICP, value prop, dan profil bisnis secara otomatis — tanpa form, tanpa brief manual.', en:'AI reads your website, extracts ICP, value props, and business profile automatically — no forms, no manual briefs.'} },
    { n:'02', agent:'lead',
      title:{id:'Lead Generation', en:'Lead Generation'},
      desc:{id:'Ratusan qualified leads dari berbagai sumber data — disaring berdasarkan intent signal dan kecocokan ICP.', en:'Hundreds of qualified leads sourced from multiple databases — filtered by intent signal and ICP fit.'} },
    { n:'03', agent:'outreach',
      title:{id:'Outreach', en:'Outreach'},
      desc:{id:'Pesan personalisasi terkirim sesuai profil dan industri masing-masing lead.', en:'Personalized messages sent tailored to each lead\'s profile and industry.'} },
    { n:'04', agent:'conversation',
      title:{id:'Conversation', en:'Conversation'},
      desc:{id:'AI agent membalas, menjawab pertanyaan, dan mendorong leads menuju meeting — 24/7 tanpa jeda.', en:'AI agent replies, answers questions, and moves leads toward meetings — 24/7 without pause.'} },
    { n:'05', agent:'nurture',
      title:{id:'Nurture', en:'Nurture'},
      desc:{id:'Leads yang belum konversi difollow-up otomatis: 7, 14, 30 hari. Tidak ada yang jatuh dari pipeline.', en:'Unconverted leads get automated follow-ups at 7, 14, 30 days. Nothing falls through the pipeline.'} },
    { n:'06', agent:'optimize',
      title:{id:'Optimize', en:'Optimize'},
      desc:{id:'Analytics evaluasi setiap langkah. Gaung AI perbarui strategi otomatis — tiap siklus makin tajam.', en:'Analytics evaluates every step. Gaung AI auto-updates strategy — each cycle gets sharper.'} },
  ];

  const colors = ['#ea008c','#ee1090','#f03080','#f55030','#ff7020','#ff8a10'];

  // Animated AI agent figures per step — robot body inlined per type to avoid Babel fragment-shorthand issues
  function AgentSVG({ type, color }) {
    const a = color;
    const Bot = () => (
      <g>
        <circle cx="20" cy="11" r="7" fill="none" stroke={a} strokeWidth="1.4" opacity="0.65"/>
        <circle cx="17.5" cy="10.5" r="1.1" fill={a} opacity="0.8"/>
        <circle cx="22.5" cy="10.5" r="1.1" fill={a} opacity="0.8"/>
        <rect x="14" y="19" width="12" height="11" rx="2.5" fill="none" stroke={a} strokeWidth="1.4" opacity="0.65"/>
        <line x1="14" y1="23" x2="7" y2="26" stroke={a} strokeWidth="1.4" strokeLinecap="round" opacity="0.65"/>
        <line x1="26" y1="23" x2="33" y2="26" stroke={a} strokeWidth="1.4" strokeLinecap="round" opacity="0.65"/>
        <line x1="17" y1="30" x2="15" y2="39" stroke={a} strokeWidth="1.4" strokeLinecap="round" opacity="0.65"/>
        <line x1="23" y1="30" x2="25" y2="39" stroke={a} strokeWidth="1.4" strokeLinecap="round" opacity="0.65"/>
      </g>
    );

    if (type === 'dna') return (
      <svg width="44" height="44" viewBox="0 0 44 44" fill="none" style={{animation:'hiw-float 3s ease-in-out infinite'}}>
        <Bot/>
        <rect x="3" y="17" width="7" height="10" rx="1" stroke={a} strokeWidth="1" opacity="0.5"/>
        <line x1="4.5" y1="19.5" x2="9" y2="19.5" stroke={a} strokeWidth="0.9" strokeLinecap="round" opacity="0.6" style={{animation:'hiw-scan-x 1.6s ease-in-out infinite'}}/>
        <line x1="4.5" y1="22" x2="8" y2="22" stroke={a} strokeWidth="0.9" strokeLinecap="round" opacity="0.6" style={{animation:'hiw-scan-x 1.6s ease-in-out infinite 0.3s'}}/>
        <line x1="4.5" y1="24.5" x2="9" y2="24.5" stroke={a} strokeWidth="0.9" strokeLinecap="round" opacity="0.6" style={{animation:'hiw-scan-x 1.6s ease-in-out infinite 0.6s'}}/>
      </svg>
    );
    if (type === 'lead') return (
      <svg width="44" height="44" viewBox="0 0 44 44" fill="none" style={{animation:'hiw-float 3s ease-in-out infinite 0.4s'}}>
        <Bot/>
        <g style={{animation:'hiw-mag 2.2s ease-in-out infinite', transformOrigin:'33px 23px'}}>
          <circle cx="34" cy="20" r="5" stroke={a} strokeWidth="1.4" opacity="0.75"/>
          <line x1="37.5" y1="23.5" x2="40.5" y2="26.5" stroke={a} strokeWidth="2" strokeLinecap="round" opacity="0.75"/>
        </g>
      </svg>
    );
    if (type === 'outreach') return (
      <svg width="44" height="44" viewBox="0 0 44 44" fill="none" style={{animation:'hiw-float 3s ease-in-out infinite 0.8s'}}>
        <Bot/>
        <g style={{animation:'hiw-fly 2.8s ease-in-out infinite', transformOrigin:'33px 22px'}}>
          <path d="M33 26 L41 20 L36 30 Z" fill={a} opacity="0.6"/>
          <line x1="33" y1="26" x2="36.5" y2="27.5" stroke={a} strokeWidth="0.8" opacity="0.4"/>
        </g>
      </svg>
    );
    if (type === 'conversation') return (
      <svg width="44" height="44" viewBox="0 0 44 44" fill="none" style={{animation:'hiw-float 3s ease-in-out infinite 1.2s'}}>
        <Bot/>
        <rect x="9" y="0" width="22" height="9" rx="3" stroke={a} strokeWidth="1" fill={a} opacity="0.12"/>
        <path d="M14 9 L12 13 L17 9" fill={a} opacity="0.12"/>
        <circle cx="15" cy="4.5" r="1.2" fill={a} opacity="0.7" style={{animation:'hiw-dot 1.5s ease-in-out infinite'}}/>
        <circle cx="20" cy="4.5" r="1.2" fill={a} opacity="0.7" style={{animation:'hiw-dot 1.5s ease-in-out infinite 0.3s'}}/>
        <circle cx="25" cy="4.5" r="1.2" fill={a} opacity="0.7" style={{animation:'hiw-dot 1.5s ease-in-out infinite 0.6s'}}/>
      </svg>
    );
    if (type === 'nurture') return (
      <svg width="44" height="44" viewBox="0 0 44 44" fill="none" style={{animation:'hiw-float 3s ease-in-out infinite 1.6s'}}>
        <Bot/>
        <line x1="5" y1="40" x2="5" y2="28" stroke={a} strokeWidth="1.2" strokeLinecap="round" opacity="0.6"/>
        <path d="M5 36 Q1 30 3 25" stroke={a} strokeWidth="1.2" fill="none" strokeLinecap="round" opacity="0.6" style={{animation:'hiw-grow 2.4s ease-in-out infinite', transformOrigin:'5px 36px'}}/>
        <path d="M5 32 Q9 27 7 22" stroke={a} strokeWidth="1.2" fill="none" strokeLinecap="round" opacity="0.6" style={{animation:'hiw-grow 2.4s ease-in-out infinite 0.6s', transformOrigin:'5px 32px'}}/>
      </svg>
    );
    if (type === 'optimize') return (
      <svg width="44" height="44" viewBox="0 0 44 44" fill="none" style={{animation:'hiw-float 3s ease-in-out infinite 2s'}}>
        <Bot/>
        <rect x="2" y="36" width="4" height="4" rx="0.5" fill={a} opacity="0.5" style={{animation:'hiw-bar-a 2s ease-in-out infinite', transformOrigin:'4px 40px'}}/>
        <rect x="8" y="33" width="4" height="7" rx="0.5" fill={a} opacity="0.5" style={{animation:'hiw-bar-b 2s ease-in-out infinite 0.3s', transformOrigin:'10px 40px'}}/>
        <rect x="14" y="30" width="4" height="10" rx="0.5" fill={a} opacity="0.5" style={{animation:'hiw-bar-c 2s ease-in-out infinite 0.6s', transformOrigin:'16px 40px'}}/>
        <line x1="1" y1="40.5" x2="19" y2="40.5" stroke={a} strokeWidth="0.8" opacity="0.4"/>
      </svg>
    );
    return null;
  }

  function StepCard({ step, color, extra }) {
    return (
      <div style={{
        background:'#fff', border:'1px solid var(--line)', borderRadius:18,
        padding:'24px 20px 56px', flex:1, minWidth:0,
        boxShadow:'0 4px 24px rgba(0,0,0,0.055)',
        position:'relative', overflow:'hidden',
      }}>
        <div style={{position:'absolute', top:0, right:0, width:120, height:120, background:`radial-gradient(circle at top right, ${color}1a, transparent 65%)`, pointerEvents:'none'}}/>
        {/* Step number — small label, NOT bigger than title */}
        <div style={{fontFamily:'var(--mono)', fontSize:10, fontWeight:700, color:color, letterSpacing:'.1em', textTransform:'uppercase', marginBottom:10}}>{step.n}</div>
        {/* Title — dominant visual element */}
        <h3 style={{fontSize:20, fontWeight:700, marginBottom:10, letterSpacing:'-0.02em', color:'var(--ink)', lineHeight:1.2}}>{t(step.title, lang)}</h3>
        <p style={{fontSize:13, color:'var(--ink-2)', lineHeight:1.65, margin:0}}>{t(step.desc, lang)}</p>
        {extra && <div style={{marginTop:12}}>{extra}</div>}
        {/* Animated agent — bottom right */}
        <div style={{position:'absolute', bottom:10, right:10, opacity:0.85, userSelect:'none', pointerEvents:'none'}}>
          <AgentSVG type={step.agent} color={color}/>
        </div>
      </div>
    );
  }

  function ArrowH({ dir, c1, c2 }) {
    const r = dir === 'right';
    return (
      <div style={{display:'flex', alignItems:'center', flexShrink:0, width:44, userSelect:'none'}}>
        <svg width="44" height="20" viewBox="0 0 44 20" fill="none">
          <line x1={r?2:42} y1="10" x2={r?34:10} y2="10" stroke={c1} strokeWidth="1.4" strokeDasharray="4 3" strokeLinecap="round"/>
          {r ? <path d="M34 4 L42 10 L34 16" stroke={c2} strokeWidth="1.4" strokeLinecap="round" strokeLinejoin="round"/>
             : <path d="M10 4 L2 10 L10 16" stroke={c2} strokeWidth="1.4" strokeLinecap="round" strokeLinejoin="round"/>}
        </svg>
      </div>
    );
  }

  // WhatsApp + Email badges for Outreach card
  const outreachExtra = (
    <div style={{display:'flex', gap:8, flexWrap:'wrap'}}>
      <div style={{display:'inline-flex', alignItems:'center', gap:6, fontSize:11.5, fontWeight:600, color:'#25D366', padding:'4px 10px', border:'1px solid #25D36640', borderRadius:99, background:'#25D36610'}}>
        <svg width="13" height="13" viewBox="0 0 24 24" fill="#25D366"><path d="M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413z"/></svg>
        WhatsApp
      </div>
      <div style={{display:'inline-flex', alignItems:'center', gap:6, fontSize:11.5, fontWeight:600, color:'#6366f1', padding:'4px 10px', border:'1px solid #6366f140', borderRadius:99, background:'#6366f110'}}>
        <svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="#6366f1" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><rect x="2" y="4" width="20" height="16" rx="2"/><path d="M2 8l10 6 10-6"/></svg>
        Email
      </div>
    </div>
  );

  const top = steps.slice(0, 3);
  const bot = [...steps.slice(3)].reverse(); // 06, 05, 04

  return (
    <section id="how-it-works" style={{background:'oklch(97.5% 0.005 70)', paddingBlock:'clamp(80px,10vw,120px)'}}>
      <div className="wrap">
        {/* Header — no subtitle */}
        <div style={{textAlign:'center', marginBottom:72}}>
          <div className="eyebrow mb-4">{t({id:'CARA KERJA', en:'HOW IT WORKS'}, lang)}</div>
          <h2 className="h-section">
            {t({id:'Loop agentic yang', en:'An agentic loop that'}, lang)}<br/>
            <span className="serif">{t({id:'tidak pernah berhenti.', en:'never stops.'}, lang)}</span>
          </h2>
        </div>

        {/* Row 1: 01 → 02 → 03 */}
        <div style={{display:'flex', alignItems:'stretch'}}>
          {top.map((s, i) => (
            <React.Fragment key={i}>
              <StepCard step={s} color={colors[i]} extra={i===2 ? outreachExtra : null}/>
              {i < 2 && <ArrowH dir="right" c1={colors[i]} c2={colors[i+1]}/>}
            </React.Fragment>
          ))}
        </div>

        {/* Turn gap: down on right, up-loop on left */}
        <div style={{display:'flex', alignItems:'center', height:52, userSelect:'none'}}>
          {/* Left: loop-return up arrow (06 → 01) */}
          <div style={{width:44, flexShrink:0, display:'flex', justifyContent:'center', alignItems:'center'}}>
            <svg width="24" height="52" viewBox="0 0 24 52" fill="none">
              <path d="M12 52 L12 10 M6 16 L12 8 L18 16" stroke={colors[5]} strokeWidth="1.4" strokeDasharray="4 3" strokeLinecap="round" strokeLinejoin="round"/>
            </svg>
          </div>
          <div style={{flex:1}}/>
          {/* Right: down arrow (03 → 04) */}
          <div style={{width:44, flexShrink:0, display:'flex', justifyContent:'center', alignItems:'center'}}>
            <svg width="24" height="52" viewBox="0 0 24 52" fill="none">
              <path d="M12 0 L12 42 M6 36 L12 44 L18 36" stroke={colors[2]} strokeWidth="1.4" strokeDasharray="4 3" strokeLinecap="round" strokeLinejoin="round"/>
            </svg>
          </div>
        </div>

        {/* Row 2: 06 ← 05 ← 04 */}
        <div style={{display:'flex', alignItems:'stretch'}}>
          {bot.map((s, i) => (
            <React.Fragment key={i}>
              <StepCard step={s} color={colors[5-i]}/>
              {i < 2 && <ArrowH dir="left" c1={colors[5-i]} c2={colors[4-i]}/>}
            </React.Fragment>
          ))}
        </div>

        {/* Loop badge */}
        <div style={{display:'flex', justifyContent:'center', marginTop:48}}>
          <div style={{display:'inline-flex', alignItems:'center', gap:12, fontSize:13.5, color:'var(--ink-2)', padding:'12px 28px', border:'1px solid var(--line)', borderRadius:99, background:'#fff', boxShadow:'0 2px 16px rgba(0,0,0,0.06)'}}>
            <span style={{fontSize:17, background:'var(--grad)', WebkitBackgroundClip:'text', WebkitTextFillColor:'transparent', backgroundClip:'text'}}>↻</span>
            {t({id:'Siklus berulang — tiap iterasi Gaung AI makin cerdas.', en:'Cycle repeats — each iteration Gaung AI gets smarter.'}, lang)}
          </div>
        </div>
      </div>
    </section>
  );
}

function EnginesSection() {
  const { lang } = React.useContext(LangCtx);
  const H = window.GAUNG_CONTENT.home;

  // Editorial layout: feature the 3 engines that map most directly to a CMO's
  // pain (sourcing, conversation, nurture) at full size, then list the rest as
  // a tight strip below. Breaks the symmetric 6-card grid that read as AI slop
  // and lets the page compress to 1-2-3 hierarchy instead of 1-1-1-1-1-1.
  const featured = [
    { n:'02', t:H.e2t, d:H.e2d, icon:'radar', stage:{ id:'Sourcing', en:'Sourcing'} },
    { n:'04', t:H.e4t, d:H.e4d, icon:'chat',  stage:{ id:'Conversation', en:'Conversation'} },
    { n:'05', t:H.e5t, d:H.e5d, icon:'seed',  stage:{ id:'Nurture', en:'Nurture'} },
  ];
  const rest = [
    { n:'01', t:H.e1t, stage:{ id:'Strategy', en:'Strategy'} },
    { n:'03', t:H.e3t, stage:{ id:'Outreach', en:'Outreach'} },
    { n:'06', t:H.e6t, stage:{ id:'Optimization', en:'Optimization'} },
  ];

  return (
    <section className="section" id="engines" style={{background:'var(--bg-2)'}}>
      <div className="wrap">
        <div style={{maxWidth:720,marginBottom:64}}>
          <div className="eyebrow mb-4">{t(H.enginesEyebrow, lang)}</div>
          <h2 className="h-section">
            {t(H.enginesH, lang).split(',')[0]},<br/>
            <span className="serif">{(t(H.enginesH, lang).split(',')[1] || '').trim()}</span>
          </h2>
          <p className="lead mt-6">{t(H.enginesLead, lang)}</p>
        </div>

        <div className="grid grid-3" style={{marginBottom:24}}>
          {featured.map((e, i) => (
            <div key={i} className="engine-card">
              <div style={{display:'flex',justifyContent:'space-between',alignItems:'center'}}>
                <EngineIcon type={e.icon}/>
                <span style={{fontFamily:'var(--mono)',fontSize:10,color:'var(--muted)',letterSpacing:'.08em',textTransform:'uppercase'}}>{e.n} · {t(e.stage, lang)}</span>
              </div>
              <div>
                <h3 className="engine-title">{t(e.t, lang)}</h3>
                <p className="body-s mt-4" style={{color:'var(--ink-2)',fontSize:14.5,lineHeight:1.6}}>{t(e.d, lang)}</p>
              </div>
            </div>
          ))}
        </div>

        <div style={{display:'flex',flexWrap:'wrap',gap:12,paddingTop:24,borderTop:'1px solid var(--line)'}}>
          <div style={{fontSize:12,color:'var(--muted)',marginRight:8,paddingTop:6}}>{t({ id:'+ agent pendukung:', en:'+ supporting agents:'}, lang)}</div>
          {rest.map((e, i) => (
            <div key={i} style={{display:'flex',alignItems:'baseline',gap:6,padding:'4px 12px',background:'var(--bg)',borderRadius:99,border:'1px solid var(--line)'}}>
              <span style={{fontFamily:'var(--mono)',fontSize:10,color:'var(--muted)'}}>{e.n}</span>
              <span style={{fontSize:13}}>{t(e.t, lang)}</span>
              <span style={{fontSize:10,color:'var(--muted)',textTransform:'uppercase',letterSpacing:'.06em'}}>{t(e.stage, lang)}</span>
            </div>
          ))}
        </div>
      </div>
    </section>
  );
}

function EngineIcon({ type }) {
  // Simple geometric glyphs — squares, circles, lines. No figurative SVG.
  const s = { width: 40, height: 40 };
  const stroke = 'var(--ink)';
  const common = { fill: 'none', stroke, strokeWidth: 1.4 };
  if (type === 'dna') return (
    <svg {...s} viewBox="0 0 40 40">
      <circle cx="12" cy="12" r="6" {...common}/>
      <circle cx="28" cy="28" r="6" {...common}/>
      <line x1="17" y1="17" x2="23" y2="23" {...common}/>
    </svg>
  );
  if (type === 'radar') return (
    <svg {...s} viewBox="0 0 40 40">
      <circle cx="20" cy="20" r="14" {...common}/>
      <circle cx="20" cy="20" r="8" {...common}/>
      <circle cx="20" cy="20" r="2.5" fill={stroke}/>
    </svg>
  );
  if (type === 'flow') return (
    <svg {...s} viewBox="0 0 40 40">
      <rect x="4" y="8" width="12" height="8" {...common}/>
      <rect x="24" y="8" width="12" height="8" {...common}/>
      <rect x="14" y="24" width="12" height="8" {...common}/>
      <path d="M10 16 L20 24 M30 16 L20 24" {...common}/>
    </svg>
  );
  if (type === 'chat') return (
    <svg {...s} viewBox="0 0 40 40">
      <rect x="5" y="8" width="22" height="16" rx="2" {...common}/>
      <rect x="13" y="18" width="22" height="14" rx="2" {...common}/>
    </svg>
  );
  if (type === 'seed') return (
    <svg {...s} viewBox="0 0 40 40">
      <path d="M20 6 L20 34" {...common}/>
      <path d="M20 18 Q10 14 8 22" {...common}/>
      <path d="M20 22 Q30 18 32 26" {...common}/>
    </svg>
  );
  if (type === 'bars') return (
    <svg {...s} viewBox="0 0 40 40">
      <line x1="8" y1="32" x2="8" y2="20" {...common}/>
      <line x1="16" y1="32" x2="16" y2="12" {...common}/>
      <line x1="24" y1="32" x2="24" y2="24" {...common}/>
      <line x1="32" y1="32" x2="32" y2="16" {...common}/>
    </svg>
  );
  return null;
}

function NumbersSection() {
  const { lang } = React.useContext(LangCtx);
  const H = window.GAUNG_CONTENT.home;
  const nums = [
    { v: H.n1, l: H.n1l },
    { v: H.n2, l: H.n2l },
    { v: H.n3, l: H.n3l },
    { v: H.n4, l: H.n4l },
  ];
  return (
    <section className="section">
      <div className="wrap">
        <div style={{maxWidth:640, marginBottom: 56}}>
          <div className="eyebrow mb-4">{t(H.numEyebrow, lang)}</div>
          <h2 className="h-section">
            {t(H.numH, lang).split(',')[0]},<br/>
            <span className="serif">{(t(H.numH, lang).split(',')[1] || '').trim()}</span>
          </h2>
        </div>
        <div className="kpi-4" style={{background:'var(--line)',border:'1px solid var(--line)',borderRadius:14,overflow:'hidden'}}>
          {nums.map((n, i) => (
            <div key={i} style={{background:'var(--bg)',padding:'36px 32px',minHeight:200,display:'flex',flexDirection:'column',justifyContent:'space-between'}}>
              <div className="stat-n">{t(n.v, lang)}</div>
              <div style={{color:'var(--muted)',fontSize:13,marginTop:24,maxWidth:180}}>{t(n.l, lang)}</div>
            </div>
          ))}
        </div>
      </div>
    </section>
  );
}

function FinalCTA({ setRoute }) {
  const { lang } = React.useContext(LangCtx);
  const H = window.GAUNG_CONTENT.home;
  return (
    <section className="section">
      <div className="wrap">
        <div style={{
          background:'var(--dark)',
          borderRadius: 20,
          padding: 'clamp(40px, 6vw, 80px)',
          color: 'var(--dark-ink)',
          position:'relative',
          overflow:'hidden',
        }}>
          <div style={{position:'absolute',inset:0,background:'radial-gradient(ellipse at 80% 20%, rgba(234,0,140,0.25), transparent 55%), radial-gradient(ellipse at 20% 90%, rgba(255,138,16,0.2), transparent 55%)',pointerEvents:'none'}}/>
          <div style={{position:'relative',maxWidth:720}}>
            <div className="eyebrow mb-4" style={{color:'oklch(70% 0.008 70)'}}>{t(H.ctaEyebrow, lang)}</div>
            <h2 className="h-section" style={{color:'#fff'}}>
              {t(H.ctaH, lang).split(' dengan').length > 1
                ? <>{t(H.ctaH, lang).split(' dengan')[0]} <span className="serif">dengan{t(H.ctaH, lang).split(' dengan')[1]}</span></>
                : t(H.ctaH, lang).split(' on ').length > 1
                  ? <>{t(H.ctaH, lang).split(' on ')[0]} <span className="serif">on{t(H.ctaH, lang).split(' on ')[1]}</span></>
                  : t(H.ctaH, lang)}
            </h2>
            <p className="lead mt-6" style={{color:'oklch(75% 0.008 70)'}}>{t(H.ctaD, lang)}</p>
            <div style={{marginTop:32, maxWidth:560}}>
              <WizardInput setRoute={setRoute}/>
            </div>
            <div style={{marginTop:14}}>
              <a href="#pricing" style={{color:'oklch(75% 0.008 70)',fontSize:13,borderBottom:'1px solid oklch(35% 0.008 70)',paddingBottom:1}} onClick={(e)=>{e.preventDefault();setRoute('pricing')}}>
                {t({id:'Atau lihat paket dan harga →',en:'Or see plans and pricing →'}, lang)}
              </a>
            </div>
          </div>
        </div>
      </div>
    </section>
  );
}

// ---- HOW IT WORKS page ----
Object.assign(window, { OfficeSection, MarqueeStrip, HowItWorksSection, EnginesSection, NumbersSection, FinalCTA, EngineIcon });
