I hope all of you are fine

Just a quick question: What does exactly the permanent residence document offer to an EEA national besides the first big step before applying for a British passport after 12 months? For both cases, if the UK stays within the EU or decides to leave.
I am quite confused because I am not sure if the PR via the EEA route will still be valid if the UK decides to leave the UK.
Sorry for any inconvenience and every response is very much appreciated

Thanks