{% if posts %}
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
    {% for post in posts %}
    <article class="card-hover flex flex-col p-7 group">
        <div class="text-xs font-medium tracking-wide mb-4" style="color: #6b6b8a;">{{ post.created_at.strftime('%B %d, %Y') }}</div>
        <h2 class="text-lg font-bold mb-3 leading-snug" style="font-family: 'Syne', sans-serif;">
            <a href="{{ url_for('blog_post', slug=post.slug) }}" class="text-gray-100 hover:text-primary-300 transition-colors">
                {{ post.title }}
            </a>
        </h2>
        <p class="text-sm leading-relaxed mb-6 flex-grow" style="color: #8b8ca8;">
            {{ post.excerpt or post.content[:150] }}{% if post.content|length > 150 %}…{% endif %}
        </p>
        <div class="flex items-center justify-between mt-auto pt-5" style="border-top: 1px solid rgba(255,255,255,0.05);">
            <div class="flex items-center gap-2.5">
                <div class="avatar w-7 h-7 text-xs">{{ post.author.username[0].upper() }}</div>
                <span class="text-xs" style="color: #6b6b8a;">{{ post.author.username }}</span>
            </div>
            <a href="{{ url_for('blog_post', slug=post.slug) }}" class="text-xs font-semibold text-primary-400 hover:text-primary-300 flex items-center gap-1 transition-colors">
                Read more
                <svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 8l4 4m0 0l-4 4m4-4H3"/>
                </svg>
            </a>
        </div>
    </article>
    {% endfor %}
</div>
{% else %}
<div class="text-center py-20">
    <div class="w-16 h-16 rounded-2xl flex items-center justify-center mx-auto mb-5"
         style="background: rgba(92,184,44,0.1); border: 1px solid rgba(92,184,44,0.2);">
        <svg class="w-8 h-8 text-primary-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M19 20H5a2 2 0 01-2-2V6a2 2 0 012-2h10a2 2 0 012 2v1m2 13a2 2 0 01-2-2V7m2 13a2 2 0 002-2V9a2 2 0 00-2-2h-2m-4-3H9M7 16h6M7 8h6v4H7V8z" />
        </svg>
    </div>
    <h3 class="text-xl font-bold mb-2" style="font-family: 'Syne', sans-serif; color: #f1f0ff;">No posts yet</h3>
    <p class="text-sm" style="color: #6b6b8a;">Check back soon for new content!</p>
</div>
{% endif %}
