<?php
/**
 * The template for displaying search results pages
 */

get_header();
?>

<div class="bg-light py-5 border-bottom mb-5">
    <div class="container text-center">
        <h1 class="display-5 fw-bold mb-3">
            <?php
            /* translators: %s: search query. */
            printf(esc_html__('Search Results for: %s', 'wisdom1'), '<span>' . get_search_query() . '</span>');
            ?>
        </h1>
    </div>
</div>

<main id="primary" class="site-main container mb-5">
    <div class="row g-4">
        <?php if (have_posts()): ?>
            <?php
            /* Start the Loop */
            while (have_posts()):
                the_post();
                get_template_part('template-parts/content', 'card');
            endwhile;

            the_posts_navigation(array(
                'screen_reader_text' => 'Posts navigation',
                'prev_text' => '<span class="btn btn-outline-primary">&larr; Older Results</span>',
                'next_text' => '<span class="btn btn-outline-primary">Newer Results &rarr;</span>',
                'class' => 'd-flex justify-content-between my-5 col-12'
            ));

        else:
            ?>
            <div class="col-12 text-center py-5">
                <h2 class="h3 mb-4">Nothing Found</h2>
                <p class="lead text-muted mb-4">Sorry, but nothing matched your search terms. Please try again with some
                    different keywords.</p>
                <div class="search-container mx-auto" style="max-width: 500px;">
                    <?php get_search_form(); ?>
                </div>
            </div>
            <?php
        endif;
        ?>
    </div><!-- .row -->
</main><!-- #main -->

<?php
get_footer();
