The moonroof can be opened or closed electrically only when the ignition is switched ON.

WARNING
Do not let passengers stand up or extend part of the body through the open moonroof while the vehicle is moving:
Extending the head, arms, or other parts of the body through the moonroof is dangerous. The head or arms could hit something while the vehicle is moving. This could cause serious injury or death.
Make sure the opening is clear before closing the moonroof:
A closing moonroof is dangerous. The hands, head, or even neck of a person, especially a child, could be caught in it as it closes, causing serious injury or even death.
NOTE
Before washing your Mazda, make sure the moonroof is completely closed so that water does not get inside the cabin area.
After washing your Mazda or after it rains, wipe the water off the moonroof before operating it to avoid water penetration which could cause rust and water damage to your headliner.
Power Window Lock Switch
Tilt OperationMazda 6 Owners Manual: Climate control unit disassembly/assembly
1. Disassemble in the order indicated in the table.
2. Assemble in the reverse order of disassembly.
Wire Disassembly Note
Disassemble the wires in the shown in the figure.
Wire Assembly Note
Assemble the wires to the position as shown in the figure.
...
Mazda 6 Owners Manual: No.8 no cool air
When performing an asterisked (*) troubleshooting inspection, shake the
wiring harness and connectors while performing the inspection to discover
whether poor contact points are the cause of any intermittent malfunctions.
If there is a problem, check to make sure connectors, terminals ...