The joke goes like this
How Long did Cain hate his brother?
As long as he was Abel
Not much of a joke really, not for Abel anyway.
Hebrews tells us that Abel’s offering to God was accepted and Cain’s wasn’t.
4 By faith Abel offered God a better sacrifice than Cain did. By faith he was commended as a righteous man, when God spoke well of his offerings. And by faith he still speaks, even though he is dead.
Hebrews 11 v 4
But the issue wasn’t the substance of his offering but the attitude in which it was given. Abel made an offering in faith Cain didn’t.
Abel gave believing that He was and would receive his gift.
6 And without faith it is impossible to please God, because anyone who comes to him must believe that he exists and that he rewards those who earnestly seek him.
Cain was given opportunity to repent and told that his repentance would be accepted and relationship restored. Instead his anger lead him to sin and murder, separation and judgement.
We can think of faith as an elusive and etherial thing, here in Hebrews we have 17+ stories of people who lived a life full of faith.
They orientated their lives around God, their decisions were made believing in His promises. This faith was cemented in action.
Cain failed to understand this at the entry point and it cost him his relationship with God.