<section class="page-section"><div class="container"><header class="page-heading"><span>BLOG · 자료실</span><h1>시공 이야기 &amp; 알아두면 좋은 정보</h1><p>네트워크·키폰·CCTV 시공 사례와 장비 선택 정보를 정리했습니다.</p></header>
  <nav class="category-filter" aria-label="게시글 분류"><a href="/blog"<?= $category === '' ? ' aria-current="page"' : '' ?>>전체</a><?php foreach (['네트워크','키폰시스템','CCTV','시공사례'] as $item): ?><a href="/blog?category=<?= rawurlencode($item) ?>"<?= $category === $item ? ' aria-current="page"' : '' ?>><?= e($item) ?></a><?php endforeach; ?></nav>
  <?php if ($posts): ?><div class="post-grid"><?php foreach ($posts as $post): ?><article class="post-card"><div class="post-thumbnail"><?php if (!empty($post['image_path'])): ?><img src="<?= e($post['image_path']) ?>" alt="<?= e($post['image_alt']) ?>" loading="lazy"><?php else: ?><div class="post-placeholder" data-category="<?= e($post['category']) ?>" aria-hidden="true"><img src="<?= e(asset('images/company-logo-v3.png')) ?>" alt="" width="136" height="63"><small>TECH FIELD NOTE</small></div><?php endif; ?><span class="post-category"><?= e($post['category']) ?></span></div><div class="post-body"><h2><a href="/blog/<?= e($post['slug']) ?>"><?= e($post['title']) ?></a></h2><p><?= e($post['excerpt']) ?></p><time datetime="<?= e(date('Y-m-d', strtotime($post['published_at']))) ?>"><?= e(date('Y.m.d', strtotime($post['published_at']))) ?></time></div></article><?php endforeach; ?></div>
  <?php else: ?><div class="empty-state"><h2>등록된 게시글이 없습니다</h2><p>선택한 분류의 콘텐츠를 준비하고 있습니다.</p></div><?php endif; ?>
  <?php $pageCount = max(1, (int) ceil($total / $perPage)); if ($pageCount > 1): ?><nav class="pagination" aria-label="페이지 이동"><?php for ($index = 1; $index <= $pageCount; $index++): ?><a href="/blog?page=<?= $index ?><?= $category ? '&amp;category=' . rawurlencode($category) : '' ?>"<?= $index === $page ? ' aria-current="page"' : '' ?>><?= $index ?></a><?php endfor; ?></nav><?php endif; ?>
</div></section>
