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

$posts = db()->query("SELECT * FROM blog_posts WHERE type='news' ORDER BY published_at DESC")->fetchAll();

$seo = [
    'title' => 'News & Media | ' . SITE_NAME,
    'description' => 'Company announcements, new listings and media coverage from Kigali Yacu Properties.',
    'path' => '/news',
];
include __DIR__ . '/includes/header.php';
?>
<section class="section-pad-sm">
  <div class="container">
    <?= breadcrumb_html([['name' => 'News & Media', 'url' => '/news']]) ?>
    <div class="section-head center">
      <div class="eyebrow" style="justify-content:center;">News &amp; Media</div>
      <h1>Company News &amp; Announcements</h1>
      <p>The latest from Kigali Yacu Properties — new services, expanded coverage and company milestones.</p>
    </div>
    <div class="grid grid-3">
      <?php foreach ($posts as $i => $post): ?>
        <a href="/news/<?= e($post['slug']) ?>" class="post-card reveal" data-delay="<?= $i % 3 + 1 ?>">
          <div class="media-frame rounded-lg"><img src="/<?= e($post['cover_image']) ?>" alt="<?= e($post['title']) ?>" loading="lazy" width="400" height="250"></div>
          <div class="body">
            <div class="meta"><span><?= e($post['category']) ?></span><span><?= time_ago_or_date($post['published_at']) ?></span></div>
            <h3><?= e($post['title']) ?></h3>
            <p class="excerpt"><?= e($post['excerpt']) ?></p>
          </div>
        </a>
      <?php endforeach; ?>
    </div>
  </div>
</section>
<?php include __DIR__ . '/includes/footer.php'; ?>
