When two words are used together to yield a new meaning, a compound is formed. Compound words can be written in three ways: as open compounds (spelled as two words, e.g., ice cream), closed compounds (joined to form a single word, e.g., doorknob), or hyphenated compounds (two words joined by a hyphen, e.g., long-term). Sometimes, more than two words can form a compound (e.g., mother-in-law).
The most common spelling quandary writers face is whether to write compounds as separate words, one word, or hyphenated words.
Open Compound Words
An open compound word is created in cases when the modifying adjective is used with its noun to create a new noun. This isn’t quite the same as a noun with a modifying adjective. We just use a space between the adjective and the noun, so sometimes it can be hard to identify as a compound; however, if the two words are commonly used together, it’s considered to be a compound word. Examples:
When adverbs ending in -ly combine with another word, the resulting compound is always spelled as two separate words.
Closed Compound Words
https://www.grammarly.com/blog/open-and-closed-compound-words/