<?php
require_once __DIR__ . '/config/config.php';

$seoKey = 'home';
$page = null;
foreach (find_all_json_records('pages') as $p) {
    if ($p['slug'] === 'home') { $page = $p; break; }
}
$services = array_filter(find_all_json_records('services'), fn($s) => ($s['status'] ?? '') === 'published');
usort($services, fn($a, $b) => ($a['order'] ?? 0) <=> ($b['order'] ?? 0));
$featuredServices = array_slice($services, 0, 6);
$faqs = array_filter(find_all_json_records('faqs'), fn($f) => ($f['status'] ?? '') === 'published');
usort($faqs, fn($a, $b) => ($a['order'] ?? 0) <=> ($b['order'] ?? 0));

require INCLUDES_PATH . '/header.php';
?>

<!-- HERO -->
<section class="hero-section">
  <div class="container">
    <div class="row align-items-center gy-5">
      <div class="col-lg-6">
        <span class="badge-pill mb-3">Software &amp; IT Services Company &mdash; Noida</span>
        <h1 class="hero-title"><?= h($page['hero_title'] ?? get_setting('tagline')) ?></h1>
        <p class="hero-subtitle"><?= h($page['hero_subtitle'] ?? '') ?></p>
        <div class="d-flex flex-wrap gap-3 mt-4">
          <a href="/contact" class="btn btn-primary-brand btn-lg">Get a Free Consultation</a>
          <a href="/services" class="btn btn-outline-brand btn-lg">Explore Services</a>
        </div>
        <div class="d-flex flex-wrap gap-4 mt-5 hero-stats">
          <div><span class="stat-number">14+</span><span class="stat-label">Core Services</span></div>
          <div><span class="stat-number">100%</span><span class="stat-label">Client-Focused</span></div>
          <div><span class="stat-number">Noida</span><span class="stat-label">Delhi NCR Based</span></div>
        </div>
      </div>
      <div class="col-lg-6">
        <div class="hero-image-wrap">
          <img src="/assets/images/office-team.jpg" alt="Techeye Software Services team at our Noida office" class="img-fluid rounded-4 shadow">
        </div>
      </div>
    </div>
  </div>
</section>

<!-- ABOUT INTRO -->
<section class="section-py">
  <div class="container">
    <div class="row align-items-center gy-5">
      <div class="col-lg-5">
        <img src="/assets/images/office-desk.jpg" alt="Techeye Software Services office in Sector 65, Noida" class="img-fluid rounded-4 shadow-sm">
      </div>
      <div class="col-lg-7">
        <span class="section-eyebrow">Who We Are</span>
        <h2 class="section-title">Practical software &amp; web solutions, built around your business</h2>
        <p class="section-text"><?= h($page['about_content'] ?? '') ?></p>
        <ul class="check-list">
          <li><i class="bi bi-check-circle-fill"></i> PHP &amp; JSON-driven, lightweight architecture</li>
          <li><i class="bi bi-check-circle-fill"></i> Custom admin panels for easy self-management</li>
          <li><i class="bi bi-check-circle-fill"></i> SEO-friendly, fast and mobile-responsive builds</li>
        </ul>
        <a href="/about" class="btn btn-outline-brand mt-2">More About Us</a>
      </div>
    </div>
  </div>
</section>

<!-- SERVICES -->
<section class="section-py bg-light-brand">
  <div class="container">
    <div class="text-center mb-5">
      <span class="section-eyebrow">What We Do</span>
      <h2 class="section-title">Our Core Services</h2>
      <p class="section-text mx-auto" style="max-width:650px;">End-to-end software, web and IT solutions designed for startups, small businesses and growing organisations.</p>
    </div>
    <div class="row g-4">
      <?php foreach ($featuredServices as $service): ?>
        <div class="col-md-6 col-lg-4">
          <div class="service-card h-100" id="<?= h($service['slug']) ?>">
            <div class="service-icon"><i class="bi <?= h($service['icon']) ?>"></i></div>
            <h3 class="service-title"><?= h($service['title']) ?></h3>
            <p class="service-text"><?= h($service['short_description']) ?></p>
          </div>
        </div>
      <?php endforeach; ?>
    </div>
    <div class="text-center mt-5">
      <a href="/services" class="btn btn-primary-brand btn-lg">View All Services</a>
    </div>
  </div>
</section>

<!-- WHY CHOOSE US -->
<section class="section-py">
  <div class="container">
    <div class="row align-items-center gy-5">
      <div class="col-lg-6 order-lg-2">
        <img src="/assets/images/office-desk.jpg" alt="Techeye Software Services workspace" class="img-fluid rounded-4 shadow-sm">
      </div>
      <div class="col-lg-6 order-lg-1">
        <span class="section-eyebrow">Why Choose Us</span>
        <h2 class="section-title">Solutions built for real businesses, not templates</h2>
        <div class="feature-row">
          <i class="bi bi-gear-fill"></i>
          <div><h4>Custom-Built, Not Generic</h4><p>Every project is engineered around your actual workflow, not a one-size-fits-all template.</p></div>
        </div>
        <div class="feature-row">
          <i class="bi bi-shield-lock-fill"></i>
          <div><h4>Secure &amp; Reliable</h4><p>Security best practices, safe data handling and dependable performance are built in from day one.</p></div>
        </div>
        <div class="feature-row">
          <i class="bi bi-person-workspace"></i>
          <div><h4>Easy to Manage</h4><p>Simple admin panels let you update your content and information without touching code.</p></div>
        </div>
      </div>
    </div>
  </div>
</section>

<!-- FAQ -->
<?php if (!empty($faqs)): ?>
<section class="section-py bg-light-brand">
  <div class="container">
    <div class="text-center mb-5">
      <span class="section-eyebrow">Have Questions?</span>
      <h2 class="section-title">Frequently Asked Questions</h2>
    </div>
    <div class="row justify-content-center">
      <div class="col-lg-9">
        <div class="accordion" id="faqAccordion">
          <?php foreach ($faqs as $i => $faq): ?>
            <div class="accordion-item">
              <h2 class="accordion-header">
                <button class="accordion-button <?= $i === 0 ? '' : 'collapsed' ?>" type="button" data-bs-toggle="collapse" data-bs-target="#faq<?= $i ?>">
                  <?= h($faq['question']) ?>
                </button>
              </h2>
              <div id="faq<?= $i ?>" class="accordion-collapse collapse <?= $i === 0 ? 'show' : '' ?>" data-bs-parent="#faqAccordion">
                <div class="accordion-body"><?= h($faq['answer']) ?></div>
              </div>
            </div>
          <?php endforeach; ?>
        </div>
      </div>
    </div>
  </div>
</section>
<?php endif; ?>

<!-- CTA -->
<section class="cta-section">
  <div class="container text-center">
    <h2>Ready to start your project?</h2>
    <p>Tell us what you need &mdash; we'll help you plan the right software or website solution.</p>
    <a href="/contact" class="btn btn-light btn-lg">Contact Our Team</a>
  </div>
</section>

<?php require INCLUDES_PATH . '/footer.php'; ?>
