Glad you have stumbled upon MODX. Currently our latest version is MODX Revolution 2.2.10. MODX supports multiple domains out of the box. These are called "contexts" and are managed in your Resource Tree. When you install MODX a "web" context is automatically created for you with an example homepage. Contexts can be used to host subdomains or even used as subdirectories of another context.
Templates are one of the strong points of MODX. In MODX you have assign a Template to a Resource and that defines what the page will output as well as what Template Variables will be available when managing resources with that Template. This gives you the freedom to create your content however you want. You also have Chunks and Snippets. Chunks are just blocks of text (usually HTML) that can have dynamic placeholders and call other Chunks and Snippets. A Snippet is a piece of PHP code and all Snippets can utilize the functions $modx provides.
You mentioned that you need the Template to vary per website, or context. Now this could obviously be done by creating many Templates, but that could lead to duplication. It may make more sense to have one base template that uses conditional tags that load different Chunks, or simply invoke different property sets on the same Chunks based on the current context.
MODX is also great at working with multiple environments. The easiest way to try this yourself would probably be to sign up for a free MODX Cloud lab account where I believe you will have two development clouds to experiment with.
https://modxcloud.com/signup/lab-account.html?ref=lgnheader
You can create and inject snapshots to move entire, or parts of one MODX site into another. For more advanced users, we've also released a similar tool called Teleport that can create and inject snapshots outside of MODX Cloud.
https://github.com/modxcms/teleport#teleport