<?php
require_once __DIR__ . '/includes/functions.php';
require_once __DIR__ . '/includes/blog_posts.php';
startSecureSession();
$plans = getPlans();

// ---- Social proof stats (all-time) ----
$allUsers  = readJson(USERS_FILE);
$allOrders = readJson(ORDERS_FILE);
$receivedByUser = [];
$statsOrders = 0; $statsAmount = 0.0;
foreach ($allOrders as $o) {
    if (($o['status'] ?? '') !== 'success') continue;
    $statsOrders++; $statsAmount += floatval($o['amount'] ?? 0);
    $uid = $o['user_id'] ?? '';
    if ($uid !== '') $receivedByUser[$uid] = ($receivedByUser[$uid] ?? 0) + floatval($o['amount'] ?? 0);
}
$usersById = [];
foreach ($allUsers as $u) $usersById[$u['id']] = migrateUserSchema($u);
arsort($receivedByUser);
$topLeaderboard = [];
$rank = 0;
foreach ($receivedByUser as $uid => $amt) {
    if ($amt <= 0 || !isset($usersById[$uid])) continue;
    $rank++;
    $topLeaderboard[] = ['rank' => $rank, 'name' => $usersById[$uid]['name'], 'avatar' => $usersById[$uid]['avatar'], 'amount' => $amt];
    if ($rank >= 3) break;
}
$demoAmount = (int) (getAdminSettings()['demo_amount'] ?? 1);
$statsUsers = count($allUsers);

$pageTitle = 'FamAPI - FamPay UPI Payment API Gateway | AdityaHost';
$navActive = 'index';
$faqSchema = '
<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "FAQPage",
  "mainEntity": [
    {"@type":"Question","name":"What is the FamAPI by AdityaHost?","acceptedAnswer":{"@type":"Answer","text":"FamAPI is a payment verification API that plugs into your FamPay account. It generates UPI QRs, detects payment confirmation emails, and tells your app when money has arrived - with just 2 API calls."}},
    {"@type":"Question","name":"Do I need a business account or KYC?","acceptedAnswer":{"@type":"Answer","text":"No. If you have a FamPay account you can start today. No business PAN, no GST, no merchant onboarding."}},
    {"@type":"Question","name":"Does the customer paying me need FamPay?","acceptedAnswer":{"@type":"Answer","text":"No. Anyone with any UPI app (GPay, PhonePe, Paytm, BHIM) can pay you. Only you need the FamPay account connected to the API."}},
    {"@type":"Question","name":"How much commission does AdityaHost take?","acceptedAnswer":{"@type":"Answer","text":"Zero percent. FamAPI works on flat-rate access plans starting at ₹5. The full payment amount goes straight to your own FamPay account."}},
    {"@type":"Question","name":"Is my Gmail password safe?","acceptedAnswer":{"@type":"Answer","text":"Yes. You use a Gmail App Password (not your real password), and it is AES-256 encrypted before being stored. It is never shown again after setup."}},
    {"@type":"Question","name":"How fast is payment verification?","acceptedAnswer":{"@type":"Answer","text":"Usually within 5 to 15 seconds of the customer paying. Your app checks the order status and delivers the product as soon as it reads success."}}
  ]
}
</script>';

include __DIR__ . '/includes/public_header.php';
?>

<!-- ================= HERO ================= -->
<section class="hero">
  <div class="hero-grid-bg" aria-hidden="true"></div>
  <div class="wrap hero-inner">
    <div class="reveal">
      <span class="hero-badge"><span class="dot"></span> FamPay UPI Payment API &mdash; Made in India</span>
      <h1>Accept UPI payments with a <span class="accent">2-call API</span>. No business account, no commission.</h1>
      <p class="hero-sub">Connect your FamPay Gmail once. Generate UPI QRs, get instant payment confirmations in your bot, website or app — and keep 100% of the money. No KYC queues, no middlemen.</p>
      <div class="hero-ctas">
        <a href="register.php" class="btn btn-light btn-lg">Grab API Free <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12h14M13 6l6 6-6 6"/></svg></a>
        <a href="demo.php?quick=1" class="btn btn-outline-light btn-lg">Try Live Demo</a>
      </div>
      <div class="hero-pills">
        <span class="hero-pill">Instant verification</span>
        <span class="hero-pill">AES-256 encrypted</span>
        <span class="hero-pill">0% commission</span>
        <span class="hero-pill">24/7 support</span>
      </div>
    </div>

    <div class="mock reveal" data-d="2" aria-hidden="true">
      <div class="mock-window">
        <div class="mock-top"><i></i><i></i><i></i><span>dashboard.adityahost.in</span></div>
        <div class="mock-body">
          <div class="mock-row">
            <span class="mock-ico"><svg viewBox="0 0 24 24" fill="none" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><path d="m5 12 5 5 9-10"/></svg></span>
            <span class="mock-main"><b>Payment verified</b><small>Order FAMPAY…2X7K · ₹50.00</small></span>
            <span class="mock-val green">SUCCESS</span>
          </div>
          <div class="mock-row">
            <span class="mock-ico"><svg viewBox="0 0 24 24" fill="none" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12a9 9 0 1 1-9-9M21 3l-9 9M15 3h6v6"/></svg></span>
            <span class="mock-main"><b>QR created</b><small>Amount ₹199 · expires in 10 min</small></span>
            <span class="mock-val">LIVE</span>
          </div>
          <div class="mock-row">
            <span class="mock-ico green"><svg viewBox="0 0 24 24" fill="none" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><path d="M12 2v20M17 7H9.5a2.5 2.5 0 0 0 0 5h5a2.5 2.5 0 0 1 0 5H6"/></svg></span>
            <span class="mock-main"><b>₹2,480.00 settled</b><small>Straight to your FamPay</small></span>
            <span class="mock-val green">+100%</span>
          </div>
        </div>
      </div>
      <div class="mock-float mock-a">
        <div class="f-head"><b>Today&rsquo;s revenue</b><span>● live</span></div>
        <div class="f-val">₹2,480.00</div>
        <svg class="spark" viewBox="0 0 200 44" fill="none" stroke="#3ce090" stroke-width="2.5" stroke-linecap="round"><polyline points="2,34 28,26 52,30 80,16 108,22 134,10 162,14 198,4"/><polyline points="2,34 28,26 52,30 80,16 108,22 134,10 162,14 198,4" stroke="#0a4bff" stroke-width="7" opacity="0.25"/></svg>
      </div>
      <div class="mock-float mock-b">
        <div class="f-head"><b>Payment success rate</b><span class="f-val" style="font-size:13px"><small>▲</small> 100%</span></div>
        <div class="spark" style="background:linear-gradient(90deg,#0ac66b,#0a4bff);height:6px;border-radius:99px;width:100%"></div>
      </div>
    </div>
  </div>
</section>

<!-- ================= SOCIAL STRIP ================= -->
<div class="logostrip">
  <div class="wrap">
    <p>Built for teams that trust UPI everywhere</p>
    <div class="logo-grid">
      <span><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20V2H6.5A2.5 2.5 0 0 0 4 4.5v15Z"/></svg> ScriptBots</span>
      <span><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 2 2 7l10 5 10-5-10-5ZM2 17l10 5 10-5M2 12l10 5 10-5"/></svg> MC Servers</span>
      <span><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M2 12h20M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/></svg> Creator Shops</span>
      <span><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m22 2-11 11M22 2 15 22l-4-9-9-4Z"/></svg> Dev Click</span>
      <span><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2"/><circle cx="8.5" cy="8.5" r="1.5"/><path d="m21 15-5-5-9 9"/></svg> SnapModule</span>
    </div>
  </div>
</div>

<!-- ================= FEATURES ================= -->
<section class="section" id="features">
  <div class="wrap">
    <div class="center reveal">
      <span class="eyebrow">Why FamAPI</span>
      <h2 class="section-title">A payment gateway built for India&rsquo;s creators</h2>
      <p class="section-sub">Connect your FamPay account once and start collecting verified payments everywhere — bots, websites, apps and stores.</p>
    </div>
    <div class="feature-grid reveal">
      <div class="feature-card">
        <div class="feature-ico"><svg viewBox="0 0 24 24" fill="none" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="m22 2-11 11M22 2 15 22l-4-9-9-4Z"/></svg></div>
        <h3>Instant verification</h3>
        <p>Your connected Gmail is checked automatically. Payment is confirmed the moment FamPay sends its email — no manual checking, ever.</p>
      </div>
      <div class="feature-card">
        <div class="feature-ico"><svg viewBox="0 0 24 24" fill="none" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><rect x="4" y="11" width="16" height="10" rx="2"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg></div>
        <h3>Secure &amp; encrypted</h3>
        <p>Gmail app passwords and UPI IDs are AES-256 encrypted before they touch disk. API keys stay private to your dashboard.</p>
      </div>
      <div class="feature-card">
        <div class="feature-ico"><svg viewBox="0 0 24 24" fill="none" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M13 2 3 14h8l-1 8 10-12h-8l1-8z"/></svg></div>
        <h3>Zero commission</h3>
        <p>Flat-rate plans, no percentage cuts. The full payment lands in your own FamPay account — the money is always yours.</p>
      </div>
      <div class="feature-card">
        <div class="feature-ico"><svg viewBox="0 0 24 24" fill="none" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20V2H6.5A2.5 2.5 0 0 0 4 4.5v15Z"/><path d="M4 19.5A2.5 2.5 0 0 0 6.5 22H20v-5"/></svg></div>
        <h3>Simple 2-call API</h3>
        <p>Create a QR, then verify it. Drop-in documentation with copy-paste examples for PHP, Python, Node.js and more.</p>
      </div>
      <div class="feature-card">
        <div class="feature-ico"><svg viewBox="0 0 24 24" fill="none" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M10 14a5 5 0 0 0 7.07 0l2.83-2.83a5 5 0 0 0-7.07-7.07L11.6 5.34"/><path d="M14 10a5 5 0 0 0-7.07 0L4.1 12.83a5 5 0 0 0 7.07 7.07L12.4 18.66"/></svg></div>
        <h3>Payment links &amp; checkout</h3>
        <p>Hosted checkout pages and short payment links for WhatsApp, Discord and email — with auto-expiring order IDs.</p>
      </div>
      <div class="feature-card">
        <div class="feature-ico"><svg viewBox="0 0 24 24" fill="none" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/><path d="m9 12 2 2 4-4"/></svg></div>
        <h3>Bots-first design</h3>
        <p>Built for Telegram, WhatsApp and Discord bot sellers: rank sales, access keys and premium unlocks with auto-delivery.</p>
      </div>
    </div>
  </div>
</section>

<!-- ================= HOW IT WORKS ================= -->
<section class="section section-soft" id="how">
  <div class="wrap">
    <div class="center reveal">
      <span class="eyebrow">How it works</span>
      <h2 class="section-title">Live in three simple steps</h2>
      <p class="section-sub">From zero to accepting payments faster than your chai cools down.</p>
    </div>
    <div class="steps reveal">
      <div class="step">
        <div class="step-dot">1</div>
        <h3>Create your free account</h3>
        <p>Sign up in seconds and grab your private API key from the dashboard. Free trial access included on signup.</p>
      </div>
      <div class="step">
        <div class="step-dot">2</div>
        <h3>Connect your FamPay Gmail</h3>
        <p>Add the Gmail linked to your FamPay account + a 16-character App Password. Encrypted instantly, validated live.</p>
      </div>
      <div class="step">
        <div class="step-dot">3</div>
        <h3>Start collecting payments</h3>
        <p>Drop the 2-call API into your bot or site. Customers scan the QR, you get verified success responses. Done.</p>
      </div>
    </div>
    <div class="code-box reveal">
      <div class="code-head">
        <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><polyline points="16 18 22 12 16 6"/><polyline points="8 6 2 12 8 18"/></svg>
        payment.php — complete integration
      </div>
      <pre><code><span class="c-com">// 1) Create a payment order → get QR for your customer</span>
<span class="c-key">$order</span> = api(<span class="c-str">"https://adityahost.in/api/qr.php"</span>, [
  <span class="c-str">"key"</span>      =&gt; <span class="c-str">"sk_live_xxxx"</span>,
  <span class="c-str">"amount"</span>   =&gt; <span class="c-num">199</span>,                       <span class="c-com">// ₹199</span>
  <span class="c-str">"order_id"</span> =&gt; <span class="c-str">"order_<span class="c-num">0001</span>"</span>,
]);

<span class="c-com">// 2) When the user says "paid", verify instantly</span>
<span class="c-key">$check</span> = api(<span class="c-str">"https://adityahost.in/api/verify_order.php"</span>, [
  <span class="c-str">"key"</span>      =&gt; <span class="c-str">"sk_live_xxxx"</span>,
  <span class="c-str">"order_id"</span> =&gt; <span class="c-str">"order_0001"</span>,
]);

<span class="c-key">if</span> ($check[<span class="c-str">"status"</span>] === <span class="c-str">"success"</span>) {
    <span class="c-com">// ✅ Money credited — deliver the product, rank or access</span>
    unlockUserPremium($check[<span class="c-str">"order_id"</span>], $check[<span class="c-str">"amount"</span>]);
}</code></pre>
    </div>
  </div>
</section>

<!-- ================= PRICING ================= -->
<section class="section" id="pricing">
  <div class="wrap">
    <div class="center reveal">
      <span class="eyebrow">Pricing</span>
      <h2 class="section-title">Simple plans. Zero commission, always.</h2>
      <p class="section-sub">Start with free trial access on signup. Upgrade anytime — plan payments are verified automatically via QR.</p>
    </div>
    <div class="pricing-grid reveal">
      <?php foreach ($plans as $i => $plan): ?>
        <div class="pricing-card <?= $plan['offer'] ? 'featured' : '' ?>">
          <?php if ($plan['offer']): ?><div class="pricing-ribbon">Best value</div><?php endif; ?>
          <div class="pricing-name"><?= htmlspecialchars($plan['label']) ?> Plan</div>
          <div class="pricing-price">₹<?= (int)$plan['price'] ?><small>.00</small>
            <?php if (!empty($plan['original_price'])): ?><span class="pricing-orig">₹<?= $plan['original_price'] ?></span><?php endif; ?>
          </div>
          <div class="pricing-desc"><?= $plan['days'] >= 365 ? 'Full year of API access' : 'API access for ' . $plan['days'] . ' days' ?></div>
          <ul class="pricing-feats">
            <li><span class="tick"><svg viewBox="0 0 24 24" fill="none" stroke-width="3"><path d="m5 12 5 5 9-10"/></svg></span><?= htmlspecialchars($plan['label']) ?> of API access</li>
            <li><span class="tick"><svg viewBox="0 0 24 24" fill="none" stroke-width="3"><path d="m5 12 5 5 9-10"/></svg></span>Unlimited QR orders</li>
            <li><span class="tick"><svg viewBox="0 0 24 24" fill="none" stroke-width="3"><path d="m5 12 5 5 9-10"/></svg></span>Auto payment verification</li>
            <li><span class="tick"><svg viewBox="0 0 24 24" fill="none" stroke-width="3"><path d="m5 12 5 5 9-10"/></svg></span>1 API key included</li>
            <li><span class="tick"><svg viewBox="0 0 24 24" fill="none" stroke-width="3"><path d="m5 12 5 5 9-10"/></svg></span>Hosted checkout &amp; links</li>
          </ul>
          <a href="register.php" class="btn <?= $plan['offer'] ? 'btn-primary' : 'btn-outline' ?> btn-block"><?= $plan['offer'] ? 'Grab the deal' : 'Get API' ?></a>
        </div>
      <?php endforeach; ?>
    </div>
  </div>
</section>

<!-- ================= STATS + LEADERBOARD ================= -->
<section class="section section-dark">
  <div class="wrap">
    <div class="stats-band reveal">
      <div class="stat-block">
        <div class="stat-num" data-count="<?= $statsUsers ?>">0</div>
        <div class="stat-label">API accounts</div>
      </div>
      <div class="stat-block">
        <div class="stat-num" data-count="<?= $statsOrders ?>">0</div>
        <div class="stat-label">Payments verified</div>
      </div>
      <div class="stat-block">
        <div class="stat-num" data-count="<?= number_format($statsAmount, 2, '.', '') ?>" data-decimals="2" data-prefix="₹">₹0.00</div>
        <div class="stat-label">Collected all-time</div>
      </div>
    </div>
    <?php if (!empty($topLeaderboard)): ?>
    <div class="center reveal">
      <span class="eyebrow">Community</span>
      <h2 class="section-title">Top earners this month</h2>
    </div>
    <div class="testi-grid reveal" style="margin-top:28px">
      <?php
      $rankMeta = [1 => ['#1', '#0ac66b'], 2 => ['#2', '#8ab0ff'], 3 => ['#3', '#ffb020']];
      foreach ($topLeaderboard as $entry):
          [$lbl, $color] = $rankMeta[$entry['rank']] ?? ['#' . $entry['rank'], '#0a4bff'];
      ?>
      <div class="testi">
        <div style="display:flex;justify-content:space-between;align-items:center">
          <div class="av" style="background:<?= $color ?>">
            <?php if (!empty($entry['avatar'])): ?><img src="<?= htmlspecialchars($entry['avatar']) ?>" alt="" style="width:42px;height:42px;border-radius:50%"><?php else: ?><?= htmlspecialchars(strtoupper(substr($entry['name'], 0, 1))) ?><?php endif; ?>
          </div>
          <span style="font-size:12px;font-weight:800;color:<?= $color ?>"><?= $lbl ?> EARNER</span>
        </div>
        <h3 style="font-size:17px;font-weight:700;color:var(--ink)"><?= htmlspecialchars($entry['name']) ?></h3>
        <p style="font-size:24px;font-weight:800;color:var(--ink);font-family:var(--mono);letter-spacing:-1px">₹<?= number_format($entry['amount'], 2) ?></p>
        <small style="color:var(--muted)">Total verified &amp; received via FamAPI</small>
      </div>
      <?php endforeach; ?>
    </div>
    <?php endif; ?>
  </div>
</section>

<!-- ================= TESTIMONIALS ================= -->
<section class="section section-soft">
  <div class="wrap">
    <div class="center reveal">
      <span class="eyebrow">Loved by builders</span>
      <h2 class="section-title">What our users say</h2>
    </div>
    <div class="testi-grid reveal">
      <div class="testi">
        <div class="stars">
          <svg viewBox="0 0 24 24"><path d="M12 2l2.9 6.3 6.9.8-5.1 4.7 1.4 6.8L12 17.2 5.9 20.6l1.4-6.8L2.2 9.1l6.9-.8z"/></svg><svg viewBox="0 0 24 24"><path d="M12 2l2.9 6.3 6.9.8-5.1 4.7 1.4 6.8L12 17.2 5.9 20.6l1.4-6.8L2.2 9.1l6.9-.8z"/></svg><svg viewBox="0 0 24 24"><path d="M12 2l2.9 6.3 6.9.8-5.1 4.7 1.4 6.8L12 17.2 5.9 20.6l1.4-6.8L2.2 9.1l6.9-.8z"/></svg><svg viewBox="0 0 24 24"><path d="M12 2l2.9 6.3 6.9.8-5.1 4.7 1.4 6.8L12 17.2 5.9 20.6l1.4-6.8L2.2 9.1l6.9-.8z"/></svg><svg viewBox="0 0 24 24"><path d="M12 2l2.9 6.3 6.9.8-5.1 4.7 1.4 6.8L12 17.2 5.9 20.6l1.4-6.8L2.2 9.1l6.9-.8z"/></svg>
        </div>
        <p>&ldquo;I sell Minecraft ranks in my Discord. Earlier I checked payment screenshots manually — now my bot auto-unlocks ranks in seconds. Best thing I did for my server.&rdquo;</p>
        <div class="who">
          <div class="av" style="background:#0a4bff">A</div>
          <div><b>Aarav Sharma</b><small>Minecraft server owner</small></div>
        </div>
      </div>
      <div class="testi">
        <div class="stars">
          <svg viewBox="0 0 24 24"><path d="M12 2l2.9 6.3 6.9.8-5.1 4.7 1.4 6.8L12 17.2 5.9 20.6l1.4-6.8L2.2 9.1l6.9-.8z"/></svg><svg viewBox="0 0 24 24"><path d="M12 2l2.9 6.3 6.9.8-5.1 4.7 1.4 6.8L12 17.2 5.9 20.6l1.4-6.8L2.2 9.1l6.9-.8z"/></svg><svg viewBox="0 0 24 24"><path d="M12 2l2.9 6.3 6.9.8-5.1 4.7 1.4 6.8L12 17.2 5.9 20.6l1.4-6.8L2.2 9.1l6.9-.8z"/></svg><svg viewBox="0 0 24 24"><path d="M12 2l2.9 6.3 6.9.8-5.1 4.7 1.4 6.8L12 17.2 5.9 20.6l1.4-6.8L2.2 9.1l6.9-.8z"/></svg><svg viewBox="0 0 24 24"><path d="M12 2l2.9 6.3 6.9.8-5.1 4.7 1.4 6.8L12 17.2 5.9 20.6l1.4-6.8L2.2 9.1l6.9-.8z"/></svg>
        </div>
        <p>&ldquo;I make YouTube content for students and sell my notes PDF. No commission means I keep every rupee my subscribers send. Integration took one evening.&rdquo;</p>
        <div class="who">
          <div class="av" style="background:#6e3bff">P</div>
          <div><b>Priya Verma</b><small>Edu-creator, 40K subs</small></div>
        </div>
      </div>
      <div class="testi">
        <div class="stars">
          <svg viewBox="0 0 24 24"><path d="M12 2l2.9 6.3 6.9.8-5.1 4.7 1.4 6.8L12 17.2 5.9 20.6l1.4-6.8L2.2 9.1l6.9-.8z"/></svg><svg viewBox="0 0 24 24"><path d="M12 2l2.9 6.3 6.9.8-5.1 4.7 1.4 6.8L12 17.2 5.9 20.6l1.4-6.8L2.2 9.1l6.9-.8z"/></svg><svg viewBox="0 0 24 24"><path d="M12 2l2.9 6.3 6.9.8-5.1 4.7 1.4 6.8L12 17.2 5.9 20.6l1.4-6.8L2.2 9.1l6.9-.8z"/></svg><svg viewBox="0 0 24 24"><path d="M12 2l2.9 6.3 6.9.8-5.1 4.7 1.4 6.8L12 17.2 5.9 20.6l1.4-6.8L2.2 9.1l6.9-.8z"/></svg><svg viewBox="0 0 24 24"><path d="M12 2l2.9 6.3 6.9.8-5.1 4.7 1.4 6.8L12 17.2 5.9 20.6l1.4-6.8L2.2 9.1l6.9-.8z"/></svg>
        </div>
        <p>&ldquo;My Telegram bot sells premium features. FamAPI&rsquo;s 2-call API was the easiest payment integration I&rsquo;ve ever built — even easier than Razorpay. Support replies fast.&rdquo;</p>
        <div class="who">
          <div class="av" style="background:#0ac66b">R</div>
          <div><b>Rahul Gupta</b><small>Bot developer</small></div>
        </div>
      </div>
    </div>
  </div>
</section>

<!-- ================= FAQ ================= -->
<section class="section" id="faq">
  <div class="wrap">
    <div class="center reveal">
      <span class="eyebrow">FAQ</span>
      <h2 class="section-title">Frequently asked questions</h2>
      <p class="section-sub">Everything you need to know before you start building.</p>
    </div>
    <div class="faq-wrap reveal" id="faqList">
      <?php
      $faqs = [
        ['What is FamAPI by AdityaHost?', 'FamAPI is a payment verification API that plugs into your FamPay account. It generates UPI QRs, reads payment confirmation emails automatically, and tells your bot or website the moment money arrives — with just 2 API calls.'],
        ['Do I need a business account, PAN or GST?', 'No. If you have a FamPay account, you can start today. No merchant onboarding, no approval queues, no KYC documents — perfect for students, creators and bot developers.'],
        ['Does the customer paying me need FamPay?', 'No. Anyone with any UPI app — GPay, PhonePe, Paytm, BHIM — can pay you by scanning the QR. Only you need the FamPay account connected to the API.'],
        ['How much commission does AdityaHost take?', 'Zero percent. FamAPI works on flat-rate access plans starting at ₹5. The entire payment amount goes straight to your own FamPay account, instantly.'],
        ['Is my Gmail password safe?', 'You never give your real password — only a 16-character Gmail App Password, which is AES-256 encrypted before being stored and can be revoked anytime from Google.'],
        ['How fast is payment verification?', 'Usually 5–15 seconds after the customer pays. Your integration simply checks the order status and delivers the product as soon as it returns success.'],
        ['Can I try before paying?', 'Yes — every new account gets free trial API access on signup, and there is a live test demo at index of this site (Try Live Demo) that needs no account.'],
        ['What can I sell with FamAPI?', 'Anything digital: bot ranks, game server access, PDFs, courses, shoutouts, donations, deposits. If it can be delivered after a UPI payment, FamAPI can handle it.'],
      ];
      foreach ($faqs as $i => [$q, $a]):
      ?>
      <div class="faq <?= $i === 0 ? 'open' : '' ?>">
        <div class="faq-q" onclick="this.parentElement.classList.toggle('open')">
          <?= htmlspecialchars($q) ?>
          <span class="chev"><svg viewBox="0 0 24 24" fill="none" stroke-width="2.6" stroke-linecap="round"><path d="m6 9 6 6 6-6"/></svg></span>
        </div>
        <div class="faq-a"><p><?= htmlspecialchars($a) ?></p></div>
      </div>
      <?php endforeach; ?>
    </div>
  </div>
</section>

<!-- ================= BLOG PREVIEW ================= -->
<section class="section section-soft" id="blog">
  <div class="wrap">
    <div class="center reveal">
      <span class="eyebrow">From the blog</span>
      <h2 class="section-title">Learn, build &amp; earn with UPI</h2>
      <p class="section-sub">Practical guides for creators and developers — updated regularly.</p>
    </div>
    <div class="blog-grid reveal">
      <?php foreach (array_slice(ah_all_posts(), 0, 3) as $bp): ?>
      <a class="blog-card" href="blog-post.php?slug=<?= $bp['slug'] ?>">
        <div class="blog-cover"><?= ah_cover($bp) ?><span class="blog-cat"><?= htmlspecialchars($bp['category']) ?></span></div>
        <div class="blog-body">
          <div class="blog-meta"><span><?= date('M j, Y', strtotime($bp['date'])) ?></span><span class="sep"></span><span><?= $bp['readMins'] ?> min read</span></div>
          <h3><?= htmlspecialchars($bp['title']) ?></h3>
          <p class="blog-ex"><?= htmlspecialchars((function_exists("mb_substr") ? mb_substr($bp["metaDesc"], 0, 110) : substr($bp["metaDesc"], 0, 110))) ?>…</p>
          <span class="blog-read">Read guide <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12h14M13 6l6 6-6 6"/></svg></span>
        </div>
      </a>
      <?php endforeach; ?>
    </div>
    <div class="center reveal" style="margin-top:44px">
      <a href="blog.php" class="btn btn-outline btn-lg">View all articles</a>
    </div>
  </div>
</section>

<!-- ================= CTA ================= -->
<section class="section">
  <div class="wrap">
    <div class="cta-band reveal">
      <h2>Start accepting payments today — it&rsquo;s free</h2>
      <p>Set up takes less than two minutes. Connect your FamPay account, grab your key, and begin collecting verified payments. Keep 100% of every rupee.</p>
      <div class="hero-ctas">
        <a href="register.php" class="btn btn-light btn-lg">Create free account</a>
        <a href="docs.php" class="btn btn-outline-light btn-lg">Read the docs</a>
      </div>
    </div>
  </div>
</section>

<!-- ================= SUPPORT STRIP ================= -->
<section class="section" style="padding-top:0">
  <div class="wrap">
    <div class="support">
      <div class="support-item"><div class="num">2</div><div class="label">API calls to go live</div></div>
      <div class="support-item"><div class="num">24/7</div><div class="label">Human support</div></div>
      <div class="support-item"><div class="num">100%</div><div class="label">Uptime focus</div></div>
      <div class="support-item"><div class="num">2 min</div><div class="label">Average setup time</div></div>
    </div>
  </div>
</section>

<?php include __DIR__ . '/includes/public_footer.php'; ?>