var buttons = document.querySelectorAll('.cat-btn'); var cards = document.querySelectorAll('.dish-card'); buttons.forEach(function(btn) { btn.addEventListener('click', function() { var cat = this.getAttribute('data-cat'); buttons.forEach(function(b) { b.classList.remove('active'); }); this.classList.add('active'); cards.forEach(function(card) { if (cat === 'all' || card.getAttribute('data-cat') === cat) { card.classList.remove('hidden'); } else { card.classList.add('hidden'); } }); }); }); var io = new IntersectionObserver(function(entries) { entries.forEach(function(e) { if (e.isIntersecting) e.target.classList.add('in'); }); }, { threshold: 0.12 }); document.querySelectorAll('.reveal').forEach(function(el) { io.observe(el); });