Righteousness can be defined as "right standing." But it seems to have a couple of connotations. One is the ability of two people to stand before one another because they are living in peace. One person has nothing against the other.
It can can be seen as "right standing" in the sense of standing right. It is the ability of someone to stand not in the wrong, but in innocence and purity.
The gospel demonstrates that God is righteous according to number two. And it proclaims that man is righteous according to number one.
The gospel demonstrates that God is righteous in several ways. One, it points to the standard. It points to how people should think, speak and act. And it shows that only God keeps the standard. All other people fail to keep the standard. Two, because all other people fail to keep the standard, God is justified in punishing those who break the standard. He maintains a just and fair standard. Three, because of his purposes for creation and his heart for man, he finds a way to not compromise the standard, remain just in punishing lawbreaking and have mercy to man.
And so people can be righteous. People broke the standard and deserved the punishment. But we agreed to take God's mercy. and so we can stand in a restored, peaceful relationship with God.
There is more to the agreement between God and man than just "Yes! I want your mercy!" Just as there is more to the agreement between a man and a dealer than "Yes! I want your car!" There is a cost. And there is a choice. Is righteousness worth the cost?