.card.show .text {
display: block;
}
const containerSelector = '.card';
const buttonSelector = 'button';
const activeClass = 'show';
document.addEventListener('click', e => {
const button = e.target.closest(buttonSelector);
const container = button && button.closest(containerSelector);
container && container.classList.toggle(activeClass);
});
// или
document
.querySelectorAll(`${containerSelector} ${buttonSelector}`)
.forEach(n => n.addEventListener('click', onClick));
function onClick() {
this.closest(containerSelector).classList.toggle(activeClass);
}