<?php
/**
 * The template for displaying all single posts
 *
 * @package Theme_An_Phat
 */

get_header(); ?>

<div class="page-hero text-center py-5">
    <div class="container">
        <span class="badge bg-accent text-primary-dark fw-bold mb-2 uppercase text-xs"><?php the_category(', '); ?></span>
        <h1 class="page-title font-heading fw-bold text-white mb-2 fs-3"><?php the_title(); ?></h1>
        <div class="post-meta text-white-70 text-xs d-flex justify-content-center gap-3">
            <span><i class="fa-regular fa-calendar me-1"></i><?php echo get_the_date(); ?></span>
            <span><i class="fa-regular fa-user me-1"></i><?php printf( esc_html__( 'Đăng bởi %s', 'theme-anphat' ), 'Admin' ); ?></span>
        </div>
    </div>
</div>

<main id="primary" class="site-main py-5 bg-white">
    <div class="container">
        <div class="row">
            <div class="col-lg-8 mx-auto">
                <?php
                while ( have_posts() ) :
                    the_post();
                    ?>
                    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
                        <?php if ( has_post_thumbnail() ) : ?>
                            <div class="post-thumbnail rounded-4 overflow-hidden mb-4 shadow-sm" style="max-height: 400px;">
                                <?php the_post_thumbnail( 'large', array( 'class' => 'w-100 h-100 object-cover' ) ); ?>
                            </div>
                        <?php endif; ?>

                        <div class="entry-content text-dark lh-lg fs-6">
                            <?php the_content(); ?>
                        </div>
                    </article>
                    <?php
                endwhile; // End of the loop.
                ?>
                <div class="post-navigation border-top pt-4 mt-5 d-flex justify-content-between">
                    <div class="prev-post">
                        <?php previous_post_link('%link', '<i class="fa-solid fa-chevron-left me-2"></i>%title'); ?>
                    </div>
                    <div class="next-post">
                        <?php next_post_link('%link', '%title<i class="fa-solid fa-chevron-right ms-2"></i>'); ?>
                    </div>
                </div>
            </div>
        </div>
    </div>
</main>

<?php get_footer(); ?>
