<?php
require_once __DIR__ . '/includes/functions.php';
require_once __DIR__ . '/includes/seo.php';

$seo = [
    'title' => 'Buy & Build: Custom Home Construction in Kigali | ' . SITE_NAME,
    'description' => 'Acquire land and build your dream home in Kigali with our Buy & Build service — architecture, contractor management and site supervision, fully managed.',
    'path' => '/buy-and-build',
];
$patrick = get_agent(4);
$buyBuildHero = brand_asset('hero-villa-complex') ?: 'assets/images/buy-build/construction-plans.jpg';
$buyBuildSecondary = brand_asset('hero-estate-aerial') ?: 'assets/images/properties/blueprint-1.jpg';
include __DIR__ . '/includes/header.php';
?>
<section class="hero" style="min-height:60vh;">
  <div class="hero-media"><img src="/<?= e($buyBuildHero) ?>" alt="Modern villa complex built through our Buy & Build service" fetchpriority="high"></div>
  <div class="container hero-content">
    <div class="eyebrow" style="color:var(--color-accent-light);"><?= e(t('buy_build.eyebrow')) ?></div>
    <h1><?= e(t('buy_build.h1')) ?></h1>
    <p class="lede"><?= e(t('buy_build.lede')) ?></p>
    <div class="hero-cta-row">
      <a href="/contact?service=buy-and-build" class="btn btn-accent btn-lg"><?= e(t('cta.schedule_consultation')) ?></a>
      <a href="/category/residential-land" class="btn btn-outline-light btn-lg">Browse Available Land</a>
    </div>
  </div>
</section>

<section class="section-pad">
  <div class="container">
    <div class="section-head center reveal">
      <span class="icon-wrap" style="width:56px;height:56px;border-radius:999px;background:var(--color-cream);display:flex;align-items:center;justify-content:center;color:var(--color-accent-dark);margin:0 auto var(--space-4);"><?= icon('house-build', 26) ?></span>
      <div class="eyebrow" style="justify-content:center;"><?= e(site_content('buy_build.how_it_works_eyebrow', 'How It Works')) ?></div>
      <h2><?= e(site_content('buy_build.how_it_works_heading', 'A Managed Process, Start to Handover')) ?></h2>
    </div>
    <div class="grid grid-4">
      <?php foreach (content_blocks('buy_build', 'how_it_works') as $i => $s): ?>
        <div class="card reveal" data-delay="<?= $i + 1 ?>" style="padding:var(--space-7);text-align:center;">
          <div style="font-family:var(--font-heading);font-size:var(--fs-2xl);color:var(--color-accent);margin-bottom:var(--space-3);"><?= $i + 1 ?></div>
          <h3 style="font-size:var(--fs-md);"><?= e($s['title']) ?></h3>
          <p class="text-muted text-sm"><?= e($s['description']) ?></p>
        </div>
      <?php endforeach; ?>
    </div>
  </div>
</section>

<section class="section-pad" style="background:var(--color-cream);">
  <div class="container">
    <div class="grid grid-2" style="align-items:center;">
      <div class="reveal">
        <div class="media-frame rounded-lg aspect-4-3"><img src="/<?= e($buyBuildSecondary) ?>" alt="Custom-built Kigali home delivered through our Buy & Build service" loading="lazy" width="600" height="450"></div>
      </div>
      <div class="reveal">
        <div class="eyebrow"><?= e(site_content('buy_build.why_eyebrow', 'Why Buy & Build')) ?></div>
        <h2><?= e(site_content('buy_build.why_heading', 'Build Equity From the Ground Up')) ?></h2>
        <ul class="feature-grid" style="grid-template-columns:1fr;">
          <?php foreach (content_blocks('buy_build', 'why_bullets') as $bullet): ?>
            <li><?= icon($bullet['icon'] ?: 'check', 18) ?> <?= e($bullet['title']) ?></li>
          <?php endforeach; ?>
        </ul>
      </div>
    </div>
  </div>
</section>

<?php if ($patrick): ?>
<section class="section-pad-sm">
  <div class="container">
    <div class="section-head center">
      <div class="eyebrow" style="justify-content:center;"><?= e(site_content('buy_build.consultant_eyebrow', 'Your Buy & Build Consultant')) ?></div>
      <h2><?= e(site_content('buy_build.consultant_heading', 'Meet the Team Behind Your Build')) ?></h2>
    </div>
    <div class="agent-card" style="max-width:400px;margin-inline:auto;">
      <?= avatar_html($patrick['name'], 'lg', $patrick['photo']) ?>
      <h3><?= e($patrick['name']) ?></h3>
      <div class="role"><?= e($patrick['title']) ?></div>
      <p class="text-muted text-sm"><?= e($patrick['bio']) ?></p>
      <div class="contact-row">
        <a href="<?= e(whatsapp_link('Hi Patrick, I would like to discuss a Buy & Build project.')) ?>" class="btn btn-whatsapp btn-sm" target="_blank" rel="noopener"><?= icon('whatsapp', 14) ?> WhatsApp</a>
        <a href="<?= e(tel_link()) ?>" class="btn btn-outline btn-sm"><?= icon('phone', 14) ?> Call</a>
      </div>
    </div>
  </div>
</section>
<?php endif; ?>

<section class="section-pad-sm" style="background:var(--color-cream);">
  <div class="container">
    <div class="cta-band" style="background:var(--color-black);">
      <h2><?= e(site_content('buy_build.cta_heading', 'Ready to Build Your Home in Kigali?')) ?></h2>
      <p style="color:var(--color-fog);max-width:52ch;margin-inline:auto;"><?= e(site_content('buy_build.cta_text', '')) ?></p>
      <div class="actions">
        <a href="/contact?service=buy-and-build" class="btn btn-accent">Book a Consultation</a>
      </div>
    </div>
  </div>
</section>
<?php include __DIR__ . '/includes/footer.php'; ?>
