Righteousness is the standard that permeates God’s entire creation, it is expressed as His holiness. When righteousness is violated then justice is the mechanism that God employs to bring things back into balance. This is why there are consequences for actions, good or bad. Justice requires it.
We are all made with an inherent sense of justice. Take a toy away from a small child and you will see him become indignant, mad, or sad. It is because he knows internally that it “just” wasn’t right. We all know when we are wronged and we seek that things be made right (righteous) again.
The problem for all mankind was that the violation of God’s standard was so great that there was no way anyone could get back to it. All religion is mankind’s attempts to recover the righteousness that was lost. Things like what to say, or do, or wear are all works in self-righteousness and they always fail. That is why God had to send His son, Jesus Christ, to pay the price that justice demanded. He paid the price justice demanded so we could all who accept it could enjoy righteousness with the Father.
“Consequently, just as the result of one trespass was condemnation for all men, so also the result of one act of righteousness was justification that brings life for all men.” (Rom 5:18 NIV)