<?php
if (! defined('ABSPATH')) {
    exit;
} ?>

<main class="puffergo-fullpage-layout">
	<?php puffergo_render_component('blog-hero', array('data' => $data)); ?>

	<!-- 面包屑：分类页展示完整祖先链，横幅只负责当前层的子分类，跟博客归档同一套结构 -->
	<div class="mx-auto max-w-canvas px-4 sm:px-6 lg:px-8">
		<?php puffergo_render_component('breadcrumb', array('items' => $data->get_breadcrumb_items())); ?>
	</div>

	<div class="blog-article-list">
		<?php if (! empty($data->posts)) : ?>
			<div class="articles-grid">
				<?php foreach ($data->posts as $post_item) : puffergo_render_component('blog-article-card', array('post_data' => $post_item)); endforeach; ?>
			</div>
		<?php else : ?>
			<div class="no-posts">
				<p><?php esc_html_e('No posts found', 'puffergo'); ?></p>
			</div>
		<?php endif; ?>
	</div>

	<?php
puffergo_render_component('blog-pagination', array('current_page' => $data->paged, 'max_pages' => $data->max_pages, 'current_url' => '' !== $data->pagination_base_url ? $data->pagination_base_url : $data->current_url, )); ?>
</main>
