<?php
/**
 * Project Type Taxonomy Archive Template (plugin override)
 *
 * The projects-portfolio plugin's template loader looks for this filename
 * (archive-project-type.php) via locate_template(); when present it is used
 * in place of the plugin's bundled template. We mirror the pattern used by
 * the post-type archive and the Recent Projects block: a flex-row head
 * with the term title on the left and an "All Projects" link on the right,
 * a divider, then the project card grid.
 *
 * @package KsPortfolio
 */

namespace KsPortfolio;

get_header();

$queried   = get_queried_object();
$term_name = $queried && ! is_wp_error( $queried ) ? $queried->name : __( 'Projects', 'ks-portfolio' );
?>
<section class="tax-project container mx-auto my-section">
	<?php if ( have_posts() ) : ?>
		<div class="tax-project__grid grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
			<?php
			while ( have_posts() ) :
				the_post();
				get_template_part( 'views/components/project-card' );
			endwhile;
			?>
		</div>

		<div class="tax-project__pagination">
			<?php
			the_posts_pagination(
				array(
					'mid_size'  => 2,
					'prev_text' => '&laquo; ' . esc_html__( 'Previous', 'ks-portfolio' ),
					'next_text' => esc_html__( 'Next', 'ks-portfolio' ) . ' &raquo;',
				)
			);
			?>
		</div>
	<?php else : ?>
		<div class="tax-project__empty">
			<h2 class="tax-project__empty-title"><?php echo esc_html__( 'Nothing here yet&hellip;', 'ks-portfolio' ); ?></h2>
			<p class="tax-project__empty-desc"><?php echo esc_html__( 'No published projects found in this category.', 'ks-portfolio' ); ?></p>
		</div>
	<?php endif; ?>
</section>

<?php
get_footer();
