STAIR: Improving Safety Alignment with Introspective Reasoning