<?php
/**
 * Search results template
 *
 * @package Kutby
 */

declare(strict_types=1);

get_header();
?>

<div class="kutby-container kutby-layout kutby-search">
	<div class="kutby-content">
		<header class="kutby-mb-6">
			<h1 class="page-title">
				نتائج البحث عن: <?php echo esc_html( get_search_query() ); ?>
			</h1>
		</header>

		<?php if ( have_posts() ) : ?>
			<?php while ( have_posts() ) : ?>
				<?php the_post(); ?>
				<article <?php post_class( 'kutby-card kutby-mb-4' ); ?>>
					<h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
					<?php the_excerpt(); ?>
				</article>
			<?php endwhile; ?>
			<nav class="kutby-pagination" aria-label="تصفح نتائج البحث">
				<?php the_posts_pagination(); ?>
			</nav>
		<?php else : ?>
			<p>لا توجد نتائج.</p>
		<?php endif; ?>
	</div>
	<?php get_sidebar(); ?>
</div>

<?php
get_footer();
