It is not matter. It is the reflection of matter, of the real world, in the human mind. Information about the material world is transmitted to the human brain. The brain transforms this information into human thought. An idea, by itself, is of a momentary quality.
Different ideas come and go.
They have no moorings. They are not connected to other ideas. However, when ideas are connected as a result of human thought, they become a system of thought, an ideology into which all thoughts then fit. In a sense, ideology is a product of the human brain, because only the human brain can think. How we see and reflect the real world depends on our class position in society.