First off, congrats on getting your navbar working and sticking with this over several days! 🎉🥂
There are a lot of things which could be improved, but at a glance the most glaring issue is that your styles are spread all across the HTML, CSS, and JS files. This makes it very difficult to reason about them. Here's how you could simplify the situation and ...
SELECT COUNT(DISTINCT comment_post_ID)
FROM ".$wpdb->prefix."comments USE INDEX (left_frame_index)
WHERE comment_approved = 1
AND comment_type = 'comment'
Needs a better index; see the below.
Do NOT compare a VARCHAR (such as comment_approved) with a numeric literal (such as 1), the index cannot be used....