Meta Platforms said Wednesday its second-quarter profit declined even as revenue beat Wall Street’s expectations, as legal expenses and severance…