<!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/<%=post.slug%>">
  <meta property="og:title" content="<%=post.meta_title||post.title%>">
  <meta property="og:description" content="<%=post.meta_desc||post.excerpt%>">
  <meta property="og:type" content="article">
  <% if (post.og_image||post.featured_image) { %><meta property="og:image" content="<%=post.og_image||post.featured_image%>"><% } %>
  <meta property="article:published_time" content="<%=post.published_at%>">
  <meta property="article:author" content="<%=post.author_name%>">
  <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>

  <!-- BlogPosting schema -->
  <script type="application/ld+json">
  {
    "@context":"https://schema.org",
    "@type":"BlogPosting",
    "headline":"<%=post.title.replace(/"/g,'&quot;')%>",
    "description":"<%=(post.excerpt||'').replace(/"/g,'&quot;')%>",
    "datePublished":"<%=post.published_at%>",
    "dateModified":"<%=post.updated_at%>",
    "author":{"@type":"Person","name":"<%=post.author_name%>"},
    "publisher":{"@type":"Organization","name":"PinInspect","url":"https://pininspect.com"}
  }
  </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}
    nav a{transition:color .2s}
    /* Article content styles */
    .prose { max-width: none; line-height: 1.8; color: #ccc; }
    .prose h1,.prose h2,.prose h3,.prose h4 { font-family:'Syne',sans-serif; font-weight:700; color:#fff; margin-top:2rem; margin-bottom:1rem; }
    .prose h1 { font-size:1.875rem; }
    .prose h2 { font-size:1.5rem; border-bottom:1px solid rgba(255,255,255,.08); padding-bottom:.5rem; }
    .prose h3 { font-size:1.25rem; }
    .prose p { margin-bottom:1.25rem; }
    .prose a { color:#ff4060; text-decoration:underline; }
    .prose a:hover { color:#fff; }
    .prose ul,.prose ol { padding-left:1.5rem; margin-bottom:1.25rem; }
    .prose li { margin-bottom:.5rem; }
    .prose ul li { list-style:disc; }
    .prose ol li { list-style:decimal; }
    .prose blockquote { border-left:3px solid #e60023; padding-left:1rem; margin:1.5rem 0; color:#999; font-style:italic; }
    .prose code { background:#1a1a1a; border:1px solid rgba(255,255,255,.1); border-radius:5px; padding:2px 6px; font-size:.85em; color:#ff6080; }
    .prose pre { background:#1a1a1a; border:1px solid rgba(255,255,255,.1); border-radius:12px; padding:1.25rem; overflow-x:auto; margin-bottom:1.25rem; }
    .prose pre code { background:none; border:none; padding:0; color:#e2e8f0; }
    .prose img { border-radius:12px; width:100%; margin:1.5rem 0; }
    .prose table { width:100%; border-collapse:collapse; margin-bottom:1.25rem; }
    .prose th { background:#1a1a1a; padding:.75rem 1rem; text-align:left; font-size:.85rem; color:#999; border-bottom:1px solid rgba(255,255,255,.1); }
    .prose td { padding:.75rem 1rem; border-bottom:1px solid rgba(255,255,255,.06); font-size:.9rem; }
    .prose strong { color:#fff; font-weight:600; }
    .card-hover{transition:transform .3s,border-color .3s}.card-hover:hover{transform:translateY(-4px);border-color:rgba(230,0,35,.3)}
    .line-clamp-2{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
  </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="/blog" class="text-sm text-gray-400 hover:text-white">← 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-3xl mx-auto px-4 sm:px-6 lg:px-8 py-14">
      <% if (post.category_name) { %>
      <span class="text-xs font-semibold px-2.5 py-1 rounded-full mb-4 inline-block" style="background:<%=post.category_color||'#e60023'%>22;color:<%=post.category_color||'#ff4060'%>"><%=post.category_name%></span>
      <% } %>
      <h1 class="font-display font-extrabold text-3xl md:text-5xl text-white mb-5 leading-tight"><%=post.title%></h1>
      <div class="flex items-center gap-4 text-xs text-gray-500 mb-8">
        <div class="flex items-center gap-2">
          <div class="w-7 h-7 rounded-full bg-gradient-to-br from-brand to-brand-dark flex items-center justify-center text-white text-xs font-bold"><%=post.author_name.charAt(0)%></div>
          <span><%=post.author_name%></span>
        </div>
        <span>·</span>
        <span><%= new Date(post.published_at).toLocaleDateString('en-US',{month:'long',day:'numeric',year:'numeric'}) %></span>
        <% if (post.read_time) { %><span>·</span><span><%=post.read_time%> min read</span><% } %>
        <span>·</span>
        <span><%=post.view_count%> views</span>
      </div>

      <% if (post.featured_image) { %>
      <div class="rounded-2xl overflow-hidden mb-10" style="max-height:400px">
        <img src="<%=post.featured_image%>" alt="<%=post.title%>" style="width:100%;object-fit:cover;max-height:400px">
      </div>
      <% } %>

      <!-- Content -->
      <article class="prose">
        <%- post.content %>
      </article>

      <!-- Share buttons -->
      <div class="mt-12 pt-8 border-t border-white/5">
        <div class="flex items-center justify-between flex-wrap gap-4">
          <div>
            <p class="text-xs text-gray-500 mb-2">Share this post</p>
            <div class="flex gap-2">
              <a href="https://pinterest.com/pin/create/button/?url=https://pininspect.com/blog/<%=post.slug%>&description=<%=encodeURIComponent(post.title)%>" target="_blank" rel="noopener" class="glass px-4 py-2 rounded-xl text-xs text-gray-400 hover:text-white transition-all hover:border-brand/30">📌 Pinterest</a>
              <a href="https://twitter.com/intent/tweet?url=https://pininspect.com/blog/<%=post.slug%>&text=<%=encodeURIComponent(post.title)%>" target="_blank" rel="noopener" class="glass px-4 py-2 rounded-xl text-xs text-gray-400 hover:text-white transition-all">𝕏 Twitter</a>
              <button onclick="navigator.clipboard.writeText(window.location.href);this.textContent='✓ Copied!';setTimeout(()=>this.textContent='🔗 Copy',2000)" class="glass px-4 py-2 rounded-xl text-xs text-gray-400 hover:text-white transition-all">🔗 Copy</button>
            </div>
          </div>
          <a href="/auth/signup" style="background:linear-gradient(135deg,#e60023,#ad081b)" class="px-5 py-2.5 rounded-xl text-white text-sm font-bold">Try PinInspect free →</a>
        </div>
      </div>
    </div>

    <!-- Related posts -->
    <% if (related && related.length > 0) { %>
    <div class="border-t border-white/5 py-16">
      <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
        <h2 class="font-display font-bold text-2xl text-white mb-8">Related Posts</h2>
        <div class="grid md:grid-cols-3 gap-5">
          <% related.forEach(r => { %>
          <a href="/blog/<%=r.slug%>" class="glass card-hover rounded-2xl overflow-hidden block">
            <% if (r.featured_image) { %>
            <div class="h-36 bg-cover bg-center" style="background-image:url('<%=r.featured_image%>')"></div>
            <% } else { %>
            <div class="h-36 flex items-center justify-center text-4xl" style="background:linear-gradient(135deg,rgba(230,0,35,.12),rgba(173,8,27,.06))">📌</div>
            <% } %>
            <div class="p-4">
              <h3 class="font-display font-bold text-sm text-white line-clamp-2 leading-snug"><%=r.title%></h3>
              <p class="text-xs text-gray-600 mt-2"><%= new Date(r.published_at).toLocaleDateString() %></p>
            </div>
          </a>
          <% }) %>
        </div>
      </div>
    </div>
    <% } %>

    <!-- CTA -->
    <div class="border-t border-white/5 py-16 text-center">
      <div class="max-w-2xl mx-auto px-4">
        <h2 class="font-display font-extrabold text-3xl text-white mb-4">Ready to grow on Pinterest?</h2>
        <p class="text-gray-400 mb-8">Use PinInspect to research keywords, analyze pins, and generate viral content — free forever.</p>
        <a href="/auth/signup" style="background:linear-gradient(135deg,#e60023,#ad081b)" class="inline-block px-8 py-4 rounded-xl text-white font-bold">Start free →</a>
      </div>
    </div>
  </div>

  <footer class="border-t border-white/5 py-8">
    <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 text-center text-xs text-gray-600">
      © <%= 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>
    </div>
  </footer>
</body>
</html>
