:root {
  --bg-dark: #0f1115;
  --bg-card: #181b21;
  --accent-red: #d5001c;
  --accent-gold: #c5a059;
  --text-main: #f4f4f6;
  --text-muted: #a0a6b1;
  --border: #2a2f3a;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  line-height: 1.6;
}

header {
  background-color: rgba(15, 17, 21, 0.95);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-main);
  text-decoration: none;
}

.logo span {
  color: var(--accent-red);
}

nav ul {
  list-style: none;
  display: flex;
  gap: 2rem;
}

nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 1px;
  transition: color 0.2s;
}

nav a:hover,
nav a.active {
  color: var(--text-main);
  border-bottom: 2px solid var(--accent-red);
  padding-bottom: 4px;
}

.hero {
  background: linear-gradient(135deg, #1b1f27 0%, #0f1115 100%);
  border-bottom: 1px solid var(--border);
  padding: 5rem 1.5rem;
  text-align: center;
}

.hero h1 {
  font-size: 2.75rem;
  letter-spacing: 1px;
  margin-bottom: 1rem;
  text-transform: uppercase;
}

.hero p {
  max-width: 650px;
  margin: 0 auto 2rem;
  color: var(--text-muted);
  font-size: 1.1rem;
}

.btn {
  display: inline-block;
  background-color: var(--accent-red);
  color: #fff;
  padding: 0.85rem 1.75rem;
  text-decoration: none;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 0.85rem;
  border-radius: 3px;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn:hover {
  background-color: #a80016;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 4rem 1.5rem;
}

.section-title {
  font-size: 1.75rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 0.5rem;
}

.section-subtitle {
  color: var(--text-muted);
  margin-bottom: 2.5rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.card-banner {
  height: 160px;
  background: linear-gradient(45deg, #232834, #14171d);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-gold);
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
}

.card-body {
  padding: 1.5rem;
  flex-grow: 1;
}

.tag {
  display: inline-block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent-gold);
  margin-bottom: 0.5rem;
  font-weight: 700;
}

.card h3 {
  margin-bottom: 0.75rem;
  font-size: 1.25rem;
}

.card p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Contact Form */
.contact-wrapper {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 3rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}

input, select, textarea {
  width: 100%;
  padding: 0.85rem;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-main);
  border-radius: 4px;
  font-family: inherit;
  font-size: 1rem;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-red);
}

footer {
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 2.5rem 1.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 3rem;
}

@media (max-width: 768px) {
  .contact-wrapper {
    grid-template-columns: 1fr;
  }
  .hero h1 {
    font-size: 2rem;
  }
}
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Forum | Mobile-Porsche.com</title>
  <link rel="stylesheet" href="style.css" />
</head>
<body>
  <header>
    <div class="nav-container">
      <a href="index.html" class="logo">Mobile<span>-</span>Porsche</a>
      <nav>
        <ul>
          <li><a href="index.html">Home</a></li>
          <li><a href="about.html">About</a></li>
          <li><a href="forum.html" class="active">Forum</a></li>
          <li><a href="contact.html">Contact</a></li>
        </ul>
      </nav>
    </div>
  </header>

  <section class="hero">
    <h1>Paddock &amp; Collectors Forum</h1>
    <p>Discuss air-cooled builds, transaxle restorations, motorsport history, and rare Porsche memorabilia with fellow enthusiasts.</p>
  </section>

  <main class="container">
    <!-- Category Filter Bar & New Topic Button -->
    <div class="forum-toolbar">
      <div class="filter-group" id="categoryFilters">
        <button class="filter-btn active" data-category="All">All Topics</button>
        <button class="filter-btn" data-category="Air-Cooled 911 & 356">Air-Cooled 911 &amp; 356</button>
        <button class="filter-btn" data-category="Water-Cooled & GT">Water-Cooled &amp; GT</button>
        <button class="filter-btn" data-category="Memorabilia & Literature">Memorabilia &amp; Literature</button>
        <button class="filter-btn" data-category="Motorsport">Motorsport</button>
      </div>
      <button class="btn" id="toggleNewTopicBtn">+ New Discussion</button>
    </div>

    <!-- Collapsible New Discussion Form -->
    <div class="card forum-form-card" id="newTopicPanel" style="display: none;">
      <div class="card-body">
        <h3 style="margin-bottom: 1rem;">Start a New Discussion</h3>
        <form id="newTopicForm">
          <div class="form-row">
            <div class="form-group">
              <label for="postAuthor">Your Name / Handle</label>
              <input type="text" id="postAuthor" placeholder="e.g., CarreraRS73" required />
            </div>
            <div class="form-group">
              <label for="postCategory">Category</label>
              <select id="postCategory">
                <option value="Air-Cooled 911 & 356">Air-Cooled 911 &amp; 356</option>
                <option value="Water-Cooled & GT">Water-Cooled &amp; GT</option>
                <option value="Memorabilia & Literature">Memorabilia &amp; Literature</option>
                <option value="Motorsport">Motorsport</option>
              </select>
            </div>
          </div>

          <div class="form-group">
            <label for="postTitle">Topic Title</label>
            <input type="text" id="postTitle" placeholder="e.g., Identifying original 1971 Le Mans factory poster printings" required />
          </div>

          <div class="form-group">
            <label for="postBody">Message</label>
            <textarea id="postBody" rows="4" placeholder="Share details, photos links, part numbers, or questions..." required></textarea>
          </div>

          <div style="display: flex; gap: 1rem;">
            <button type="submit" class="btn">Post Topic</button>
            <button type="button" class="btn btn-secondary" id="cancelTopicBtn">Cancel</button>
          </div>
        </form>
      </div>
    </div>

    <!-- Thread List -->
    <div id="threadList" class="thread-list"></div>
  </main>

  <footer>
    <p>&copy; 2026 Mobile-Porsche.com &mdash; Independent Porsche Cars &amp; Memorabilia Archive. Not affiliated with Dr. Ing. h.c. F. Porsche AG.</p>
  </footer>

  <script>
    const defaultThreads = [
      {
        id: 1,
        category: "Memorabilia & Literature",
        title: "How to spot original 1970s Porsche Werbeabteilung posters vs. reprints?",
        author: "StuttgartPaper",
        date: "2 hours ago",
        body: "Looking at a 1970 Le Mans 917K victory poster. Aside from checking the W-number print code in the bottom corner and paper weight, are there specific UV or lithograph dot patterns you look for?",
        replies: [
          {
            author: "WeissachArchive",
            date: "1 hour ago",
            text: "Check the exact dimensions in millimeters—factory originals were printed to strict DIN formats, whereas many 1990s museum reprints are slightly trimmed or on glossier stock."
          }
        ]
      },
      {
        id: 2,
        category: "Air-Cooled 911 & 356",
        title: "993 Carrera S vs. 964 Carrera 2 for weekend B-road driving",
        author: "FlatSixUK",
        date: "Yesterday",
        body: "Debating between a late-model 964 C2 manual and a 993 C2S. The 964 feels closer to the classic upright-fender 911, while the 993 multi-link rear suspension is noticeably more composed. Thoughts from owners?",
        replies: []
      },
      {
        id: 3,
        category: "Motorsport",
        title: "Favorite Rothmans or Martini livery chassis?",
        author: "GroupC_Fan",
        date: "3 days ago",
        body: "For me nothing beats the short-tail 917K in Martini stripes at Sebring, though the 956 in Rothmans colors at Le Mans is a very close second.",
        replies: []
      }
    ];

    let threads = JSON.parse(localStorage.getItem("mobilePorscheThreads")) || defaultThreads;
    let activeCategory = "All";

    const threadListEl = document.getElementById("threadList");
    const newTopicPanel = document.getElementById("newTopicPanel");
    const toggleNewTopicBtn = document.getElementById("toggleNewTopicBtn");
    const cancelTopicBtn = document.getElementById("cancelTopicBtn");
    const newTopicForm = document.getElementById("newTopicForm");

    function saveThreads() {
      localStorage.setItem("mobilePorscheThreads", JSON.stringify(threads));
    }

    function escapeHTML(str) {
      return str.replace(/[&<>"']/g, m => ({
        '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;'
      }[m]));
    }

    function renderThreads() {
      const filtered = activeCategory === "All"
        ? threads
        : threads.filter(t => t.category === activeCategory);

      if (filtered.length === 0) {
        threadListEl.innerHTML = `<div class="card" style="padding: 2rem; text-align: center;"><p>No discussions in this category yet. Start the first one!</p></div>`;
        return;
      }

      threadListEl.innerHTML = filtered.map(thread => `
        <article class="card thread-card">
          <div class="card-body">
            <div class="thread-meta">
              <span class="tag">${escapeHTML(thread.category)}</span>
              <span class="meta-info">Posted by <strong>${escapeHTML(thread.author)}</strong> &bull; ${escapeHTML(thread.date)}</span>
            </div>
            <h3>${escapeHTML(thread.title)}</h3>
            <p class="thread-body">${escapeHTML(thread.body)}</p>

            <div class="replies-section">
              <div class="replies-header">${thread.replies.length} ${thread.replies.length === 1 ? 'Reply' : 'Replies'}</div>
              ${thread.replies.map(r => `
                <div class="reply-item">
                  <div class="reply-meta"><strong>${escapeHTML(r.author)}</strong> &bull; ${escapeHTML(r.date)}</div>
                  <p>${escapeHTML(r.text)}</p>
                </div>
              `).join('')}

              <form class="reply-form" onsubmit="addReply(event, ${thread.id})">
                <input type="text" name="replyAuthor" placeholder="Your name" required class="reply-name-input" />
                <input type="text" name="replyText" placeholder="Write a reply..." required class="reply-text-input" />
                <button type="submit" class="btn btn-small">Reply</button>
              </form>
            </div>
          </div>
        </article>
      `).join('');
    }

    function addReply(event, threadId) {
      event.preventDefault();
      const form = event.target;
      const author = form.replyAuthor.value.trim();
      const text = form.replyText.value.trim();
      if (!author || !text) return;

      const thread = threads.find(t => t.id === threadId);
      if (thread) {
        thread.replies.push({ author, date: "Just now", text });
        saveThreads();
        renderThreads();
      }
    }

    toggleNewTopicBtn.addEventListener("click", () => {
      newTopicPanel.style.display = newTopicPanel.style.display === "none" ? "block" : "none";
    });

    cancelTopicBtn.addEventListener("click", () => {
      newTopicPanel.style.display = "none";
    });

    newTopicForm.addEventListener("submit", (e) => {
      e.preventDefault();
      const author = document.getElementById("postAuthor").value.trim();
      const category = document.getElementById("postCategory").value;
      const title = document.getElementById("postTitle").value.trim();
      const body = document.getElementById("postBody").value.trim();

      threads.unshift({
        id: Date.now(),
        category,
        title,
        author,
        date: "Just now",
        body,
        replies: []
      });

      saveThreads();
      newTopicForm.reset();
      newTopicPanel.style.display = "none";
      renderThreads();
    });

    document.querySelectorAll(".filter-btn").forEach(btn => {
      btn.addEventListener("click", () => {
        document.querySelectorAll(".filter-btn").forEach(b => b.classList.remove("active"));
        btn.classList.add("active");
        activeCategory = btn.dataset.category;
        renderThreads();
      });
    });

    renderThreads();
  </script>
</body>
</html>