In 1979, Iran was replaced with an extremist Islamic government, so Afghanistan was an important buffer to prevent Irans new ideology from spreading to the Soviet Union
Amin staged a coup against the pro-soviet government in Afghanistan, taking over Afghanistan. The soviet union was fine with this however as Amin became extremely unpopular, he seeked support from the USA
After Amin asked the USA for support, the soviet union got angry and invaded Afghanistan, claiming to help Amin againsts terrorists trying to overthrow him. However, three days later Amin was assassinated
After Amin was assassinated, he was replaced with a pro-soviet government called Kamal
After the invasion of Afghanistan by the USSR, Carter announced the Carter Doctrine, which stated that the US would extent its policy of containment to the middle east
In 1980 the USA boycotted the Moscow Olympics in protest at the invasion of Afghanistan. The USSR would return the favour by boycotting the 1984 Olympic Games in Los Angeles
The USA may have overreacted to the soviet invasion of Afghanistan in attempt to leave detente, which showed they didnt want a good relationship with the Soviet Union