ounce(func, wait) {
      let timeout
      return function executedFunction(...args) {
        const later = () => {
          clearTimeout(timeout)
          func(...args)
        }
        clearTimeout(timeout)
        timeout = setTimeout(later, wait)
      }
    }

    // Add event listeners
    searchInput.addEventListener('input', debounce(filterPosts, 300))

    tagButtons.forEach(button => {
      button.addEventListener('click', () => {
        const tag = button.dataset.tag
        if (activeTags