<?php get_header(); ?>

<main id="main" class="main-content">
    <div class="container">
        <?php if ( have_posts() ) : ?>
            <?php if ( is_home() && ! is_front_page() ) : ?>
                <header class="archive-header">
                    <h1 class="archive-title"><?php single_post_title(); ?></h1>
                </header>
            <?php endif; ?>
            <div class="posts-grid">
                <?php while ( have_posts() ) : the_post(); ?>
                <article id="post-<?php the_ID(); ?>" <?php post_class( 'post-card' ); ?>>
                    <?php if ( has_post_thumbnail() ) : ?>
                        <a href="<?php the_permalink(); ?>" class="post-card-thumb" tabindex="-1" aria-hidden="true">
                            <?php the_post_thumbnail( 'medium_large' ); ?>
                        </a>
                    <?php endif; ?>
                    <div class="post-card-body">
                        <h2 class="post-card-title">
                            <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
                        </h2>
                        <div class="post-card-excerpt"><?php the_excerpt(); ?></div>
                        <a href="<?php the_permalink(); ?>" class="btn btn-outline">
                            <?php esc_html_e( 'Saber mais', 'municipio' ); ?>
                        </a>
                    </div>
                </article>
                <?php endwhile; ?>
            </div>
            <div class="pagination-wrap">
                <?php the_posts_pagination( [ 'mid_size' => 2 ] ); ?>
            </div>
        <?php else : ?>
            <p class="no-results"><?php esc_html_e( 'Nenhum resultado encontrado.', 'municipio' ); ?></p>
        <?php endif; ?>
    </div>
</main>

<?php get_footer(); ?>
