How does suicide as a sin work?

TLDR: TALKS ABOUT SUICIDE. I was having a conversation with a few friends and it had brought us to the topic of suicide as a sin. We are all catholic and was wondering. We understand WHY suicide is a sin, but we were wondering about the Church's stance in a situation where someone might have died by suicide after going to confession and being in a state of grace. Would they still face eternal damnation (hell), or does the Church acknowledge the role of mental health struggles in these circumstances? We’re curious about how God’s mercy is understood in these situations, as we know the Church stresses compassion and forgiveness. Would love to hear thoughts from others with a deeper understanding of Catholic teachings.