chTerm) ||
          post.content.toLowerCase().includes(searchTerm)

        const postTags = new Set(post.tags)
        const matchesTags = activeTags.size === 0 ||
          Array.from(activeTags).every(tag => postTags.has(tag))

        return matchesSearch && matchesTags
      })

      postsContainer.innerHTML = filteredPosts.map(renderPost).join('')
      noResults.classList.toggle('hidden', filteredPosts.length > 0)
    }

    // Debounce function to limit how often filterPosts runs
    function deb