These words are not a whole construction, that is why they don't make much sense together for you.
"Por" is explaining the cause why my friends are amazed.
- No puedo usar el coche por no saber manejar.
I can't use the car for not being able to drive.
- Esto me pasa por confiar en la gente.
This is what happens to me for trusting people.
And "lo"'s function is to make a noun out of an adjective ("bonito").
- Lo bueno de despertar temprano es que el día dura más.
What is good about waking up early is that the day lasts longer.
- ¿No te gusta lo verde que se ve el pasto cuando se moja?
Don't you like how green the grass looks when it gets wet?
- Siempre me ha dado miedo lo oscuro que es esa calle.
I have always been afraid of how dark that street is.