One thing with coffee, the often touted ratio is that if you stop drinking it after 12pm and limit to two to three cups max, it won't impact sleep. While this may be true for some, it's not true for all, as we metabolise caffeine differently.
I stopped around 2 years ago. First 7 days was headaches 24/7 and then around day 9 I slept like I had not slept in years, almost like a child's sleep. After around 2-3 months my productivity and alertness was naturally restored.
In hindsight it was funny how I left caffeine to the end. I went through the following:
* Black out curtains
* Stop electronics at 7pm
* Magnesium
* Melatonin
* CBD Oil