{% extends "base.html" %}

{% block title %}Blog{% endblock %}

{% block content %}

<!-- Hero Section -->
<section class="relative text-center py-24 text-white bg-gradient-to-br from-orange-500/20 via-rose-500/10 to-fuchsia-500/10 backdrop-blur border-b border-white/10">
  <div class="max-w-3xl mx-auto px-6">
    <h1 class="text-5xl md:text-6xl font-archivo font-extrabold mb-4">
      Blog
    </h1>
    <p class="text-lg md:text-xl text-white/80 leading-relaxed">
      Insights, tutorials, and thoughts — straight from my keyboard to the world.
    </p>
  </div>
</section>

<!-- Blog Posts Grid -->
<section id="posts" class="py-20 bg-black text-white">
  <div class="max-w-7xl mx-auto px-6">
    {% if blogpost %}
      <div class="grid sm:grid-cols-2 lg:grid-cols-3 gap-8">
        {% for post in blogpost %}
        <article class="bg-white/5 backdrop-blur-md border border-white/10 rounded-2xl p-6 hover:shadow-xl hover:border-orange-400/30 transition-all duration-300">
          <header class="mb-4">
            <h2 class="text-2xl font-semibold font-archivo tracking-tight mb-2">
              <a href="{{ url_for('view_blog', slug=post.slug) }}" class="hover:text-orange-400 transition">
                {{ post.title }}
              </a>
            </h2>
            <p class="text-sm text-orange-400 font-medium">
              {{ post.category }}
            </p>
          </header>

          <div class="text-white/70 line-clamp-4 mb-6">
            {{ post.content[:200] | safe }}{% if post.content|length > 200 %}...{% endif %}
          </div>

          <footer class="flex flex-wrap gap-2">
            {% for tag in post.tags.split(',') %}
            <a href="{{ url_for('view_tag', tag=tag.strip()) }}"
               class="inline-block bg-orange-500/10 text-orange-300 text-xs px-3 py-1 rounded-full border border-orange-500/20 hover:bg-orange-500/20 transition">
              #{{ tag.strip() }}
            </a>
            {% endfor %}
          </footer>
        </article>
        {% endfor %}
      </div>
    {% else %}
      <div class="text-center py-20">
        <p class="text-white/60 text-lg">No blog posts yet — stay tuned for new entries soon!</p>
      </div>
    {% endif %}
  </div>
</section>

{% endblock %}

