<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1">
  <title><%=title%></title>
  <meta name="description" content="<%=meta_desc%>">
  <link rel="canonical" href="https://pininspect.com/blog">
  <meta property="og:title" content="<%=title%>">
  <meta property="og:description" content="<%=meta_desc%>">
  <meta property="og:type" content="website">
  <link rel="icon" href="/images/favicon.svg">
  <link href="https://fonts.googleapis.com/css2?family=Syne:wght@600;700;800&family=Inter:wght@300;400;500;600&display=swap" rel="stylesheet">
  <script src="https://cdn.tailwindcss.com"></script>
  <script>tailwind.config={theme:{extend:{colors:{brand:'#e60023','brand-dark':'#ad081b','brand-light':'#ff4060'},fontFamily:{display:['Syne','sans-serif']}}}}</script>
  <style>*{box-sizing:border-box}body{background:#0a0a0a;color:#fff;font-family:'Inter',sans-serif;margin:0}.font-display{font-family:'Syne',sans-serif}.glass{background:rgba(255,255,255,0.04);border:1px solid rgba(255,255,255,0.08)}.text-gradient{background:linear-gradient(135deg,#ff4060,#e60023);-webkit-background-clip:text;-webkit-text-fill-color:transparent;background-clip:text}.card-hover{transition:transform .3s,border-color .3s,box-shadow .3s}.card-hover:hover{transform:translateY(-4px);border-color:rgba(230,0,35,.3);box-shadow:0 16px 48px rgba(230,0,35,.08)}.fade-in{animation:fi .5s ease forwards}@keyframes fi{from{opacity:0;transform:translateY(16px)}to{opacity:1;transform:none}}nav a{transition:color .2s}</style>
</head>
<body>
  <!-- Navbar -->
  <nav style="position:fixed;top:0;left:0;right:0;z-index:50;background:rgba(10,10,10,.9);backdrop-filter:blur(20px);border-bottom:1px solid rgba(255,255,255,.06)" class="h-16 flex items-center">
    <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 w-full flex items-center justify-between">
      <a href="/" class="flex items-center gap-2.5">
        <div class="w-7 h-7 rounded-lg bg-brand flex items-center justify-center text-white font-display font-bold text-xs">P</div>
        <span class="font-display font-bold text-base text-white">PinInspect</span>
      </a>
      <div class="flex items-center gap-5">
        <a href="/" class="text-sm text-gray-400 hover:text-white">Home</a>
        <a href="/blog" class="text-sm text-white font-medium">Blog</a>
        <% if (user) { %>
        <a href="/dashboard" style="background:linear-gradient(135deg,#e60023,#ad081b)" class="px-4 py-2 rounded-lg text-white text-sm font-bold">Dashboard</a>
        <% } else { %>
        <a href="/auth/signup" style="background:linear-gradient(135deg,#e60023,#ad081b)" class="px-4 py-2 rounded-lg text-white text-sm font-bold">Start free</a>
        <% } %>
      </div>
    </div>
  </nav>

  <div class="pt-16">
    <!-- Hero -->
    <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-16 text-center">
      <div class="inline-flex items-center gap-2 glass rounded-full px-4 py-1.5 mb-5 text-xs text-gray-400">✦ Pinterest SEO insights</div>
      <h1 class="font-display font-extrabold text-4xl md:text-6xl text-white mb-4">Pinterest SEO <span class="text-gradient">Blog</span></h1>
      <p class="text-gray-400 text-lg max-w-xl mx-auto">Tips, strategies, and data-driven insights to grow your Pinterest traffic and reach.</p>
    </div>

    <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 pb-24">

      <!-- Category filter -->
      <div class="flex flex-wrap gap-2 mb-10 justify-center">
        <a href="/blog" class="text-xs px-4 py-2 rounded-full transition-all <%=!current_category?'bg-brand text-white font-bold':'glass text-gray-400 hover:text-white'%>">All</a>
        <% (categories||[]).forEach(cat => { %>
        <a href="/blog?category=<%=cat.slug%>" class="text-xs px-4 py-2 rounded-full transition-all <%=current_category===cat.slug?'bg-brand text-white font-bold':'glass text-gray-400 hover:text-white'%>"><%=cat.name%></a>
        <% }) %>
      </div>

      <!-- Posts grid -->
      <% if (posts && posts.length > 0) { %>
      <div class="grid md:grid-cols-2 lg:grid-cols-3 gap-6 mb-12">
        <% posts.forEach((post, i) => { %>
        <a href="/blog/<%=post.slug%>" class="glass card-hover rounded-2xl overflow-hidden block fade-in" style="animation-delay:<%=i*0.07%>s">
          <% if (post.featured_image) { %>
          <div class="h-48 bg-cover bg-center" style="background-image:url('<%=post.featured_image%>')"></div>
          <% } else { %>
          <div class="h-48 flex items-center justify-center text-5xl" style="background:linear-gradient(135deg,rgba(230,0,35,.15),rgba(173,8,27,.08))">📌</div>
          <% } %>
          <div class="p-5">
            <% if (post.category_name) { %>
            <span class="text-xs font-semibold px-2.5 py-1 rounded-full mb-3 inline-block" style="background:<%=post.category_color||'#e60023'%>22;color:<%=post.category_color||'#ff4060'%>"><%=post.category_name%></span>
            <% } %>
            <h2 class="font-display font-bold text-base text-white mb-2 line-clamp-2 leading-snug"><%=post.title%></h2>
            <% if (post.excerpt) { %><p class="text-xs text-gray-500 mb-3 line-clamp-2 leading-relaxed"><%=post.excerpt%></p><% } %>
            <div class="flex items-center justify-between text-xs text-gray-600">
              <span><%= new Date(post.published_at).toLocaleDateString('en-US',{month:'short',day:'numeric',year:'numeric'}) %></span>
              <% if (post.read_time) { %><span><%=post.read_time%> min read</span><% } %>
            </div>
          </div>
        </a>
        <% }) %>
      </div>

      <!-- Pagination -->
      <% if (page > 1 || posts.length === 9) { %>
      <div class="flex justify-center gap-3">
        <% if (page > 1) { %><a href="/blog?page=<%=page-1%><%=current_category?'&category='+current_category:''%>" class="glass px-5 py-2.5 rounded-xl text-sm text-gray-400 hover:text-white transition-all">← Previous</a><% } %>
        <% if (posts.length === 9) { %><a href="/blog?page=<%=page+1%><%=current_category?'&category='+current_category:''%>" class="glass px-5 py-2.5 rounded-xl text-sm text-gray-400 hover:text-white transition-all">Next →</a><% } %>
      </div>
      <% } %>

      <% } else { %>
      <div class="text-center py-20 text-gray-600">
        <div class="text-5xl mb-4">📝</div>
        <div class="font-display font-bold text-xl text-gray-500 mb-2">No posts yet</div>
        <p class="text-sm">Check back soon for Pinterest SEO tips and guides.</p>
      </div>
      <% } %>
    </div>
  </div>

  <!-- Footer -->
  <footer class="border-t border-white/5 py-10">
    <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 text-center text-xs text-gray-600">
      <p>© <%= new Date().getFullYear() %> <a href="/" class="hover:text-gray-400">PinInspect</a> · <a href="/privacy" class="hover:text-gray-400">Privacy</a> · <a href="/terms" class="hover:text-gray-400">Terms</a></p>
    </div>
  </footer>
</body>
</html>
