<!-- views/roadmap.html -->
<section class="mb-8">
  <!-- White card, dark text to override global site color -->
  <div class="bg-white p-6 rounded-lg shadow-md text-gray-900">
    <h2 class="text-2xl font-bold mb-4 text-gray-700">Roadmap</h2>

    <!-- .markdown-body uses your markdown.css rules for headings, etc. -->
    <div id="markdown-container" class="markdown-body">
      <p class="text-gray-500">Loading content...</p>
    </div>
  </div>
</section>

<script>
  (async () => {
    try {
      // Fetch your roadmap markdown
      const response = await fetch("content/roadmap.md");
      if (!response.ok) {
        throw new Error("Failed to load roadmap.md");
      }
      const markdownText = await response.text();

      // Convert markdown to HTML (marked must be globally available)
      const html = marked.parse(markdownText);

      // Insert into the container
      const container = document.getElementById("markdown-container");
      if (container) {
        container.innerHTML = html;
      }

      // Optional: highlight code blocks if highlight.js is globally available
      document.querySelectorAll("pre code").forEach((block) => {
        hljs.highlightBlock(block);
      });
    } catch (err) {
      console.error("Error loading roadmap:", err);
      const container = document.getElementById("markdown-container");
      if (container) {
        container.innerHTML = `
          <p class="text-red-500">Error loading content. Please try again later.</p>
        `;
      }
    }
  })();
</script>
