You’re exactly right. I have heard typographers express the maximum readable width as "two and a half alphabets," which is roughly 40em. A max-width of 40em is extremely responsive, making the most of your screen (on mobile) without overextending and compromising reading comfort (on desktop).