Magic is not irrational. It's built on the foundation of one of the great currents of Western thought, the Neoplatonist vision of hierarchy of being in which thought is both earlier than and superior to matter.
In ritual magic the purpose of robes and circles and incense and incantation is to put the practitioner into an altered state of consciousness allowing direct interaction with ideational forms at the pinnacle of the hierarchy. Unlike Harry Potter language is secondary. What matters is enhanced consciousness achieved through ritual.
This is the same goal as shamanism, yoga, vision quest, indeed the entire human history of altered consciousness through ritual leading back over millennia to the origins of our nervous systems. Highly intellectualized, partially sublimated, made schematic and doctrinaire and logically consistent.
Perfectly rational.