<?php
/**
 * Blog archive template.
 *
 * @package Shabnam_MuchWOW
 */
defined( 'ABSPATH' ) || exit;
get_header();

$shabnam_label   = function_exists( 'shabnam_get_setting' ) ? shabnam_get_setting( 'blog_archive_label', 'مجله' ) : 'مجله';
$shabnam_columns = function_exists( 'shabnam_blog_columns' ) ? shabnam_blog_columns() : 3;
?>
<main id="primary" class="shabnam-blog-archive shabnam-inner-page section panel overflow-hidden">
	<div class="section-outer panel py-8 lg:py-10">
		<div class="container sm:max-w-md xl:max-w-lg">
			<header class="section-header panel sm:max-w-800px mx-auto mb-5 sm:mb-7 text-center" data-anime="onview: -300; targets: >*; translateY: [24, 0]; opacity: [0, 1]; delay: anime.stagger(100, {start: 100});">
				<div class="category"><div class="-rotate-2"><span class="fs-5 xl:fs-4 text-secondary fw-bold"><?php echo esc_html( $shabnam_label ); ?></span></div></div>
				<h1 class="h4 sm:h3 xl:h2 mb-0 mt-2 text-white text-uppercase ls-0"><?php the_archive_title(); ?></h1>
				<?php the_archive_description( '<div class="fs-5 mt-2 text-white text-opacity-70">', '</div>' ); ?>
			</header>

			<?php if ( have_posts() ) : ?>
				<div class="shabnam-blog-grid" style="--shcd-blog-columns:<?php echo esc_attr( $shabnam_columns ); ?>">
					<?php while ( have_posts() ) : the_post(); ?>
						<?php get_template_part( 'template-parts/content', 'card' ); ?>
					<?php endwhile; ?>
				</div>
				<nav class="shabnam-pagination mt-6" aria-label="<?php esc_attr_e( 'صفحه‌بندی نوشته‌ها', 'shabnam-muchwow' ); ?>"><?php the_posts_pagination( array( 'mid_size' => 2, 'prev_text' => '→', 'next_text' => '←' ) ); ?></nav>
			<?php else : ?>
				<div class="shabnam-section-card panel p-5 border border-1 border-gray-100 border-opacity-40 rounded-3 text-center"><p class="m-0"><?php esc_html_e( 'برای این بخش نوشته‌ای پیدا نشد.', 'shabnam-muchwow' ); ?></p></div>
			<?php endif; ?>
		</div>
	</div>
</main>
<?php get_footer(); ?>
