<?php
/**
 * Template part for displaying post cards in archive views
 *
 * @package HomeProz
 */

// Prevent direct access
if (!defined('ABSPATH')) {
    exit;
}
?>

<article id="post-<?php the_ID(); ?>" <?php post_class('post-card card'); ?>>
    <?php if (has_post_thumbnail()) : ?>
        <a href="<?php the_permalink(); ?>" class="post-card-image">
            <?php the_post_thumbnail('property-card', array('loading' => 'lazy')); ?>
        </a>
    <?php endif; ?>

    <div class="post-card-content">
        <header class="post-card-header">
            <?php if ('post' === get_post_type()) : ?>
                <div class="post-card-meta">
                    <time datetime="<?php echo esc_attr(get_the_date('c')); ?>">
                        <?php echo esc_html(get_the_date()); ?>
                    </time>
                </div>
            <?php endif; ?>

            <?php the_title('<h3 class="post-card-title"><a href="' . esc_url(get_permalink()) . '">', '</a></h3>'); ?>
        </header>

        <div class="post-card-excerpt">
            <?php the_excerpt(); ?>
        </div>

        <a href="<?php the_permalink(); ?>" class="post-card-link">
            Read More
            <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
                <path d="M5 12h14M12 5l7 7-7 7"/>
            </svg>
        </a>
    </div>
</article>
