Google will view everything and ignore any attempts to hide content with CSS. A human visitor will only see what you want them to see…
Now if the heading was different to the displayed heading, it could have potential to be an issue if done en masse with multiple headings which were hidden with CSS , keyword stuffed and ‘just for search engines’.
But it’s one heading, a duplicate of an existing heading. So hardly like you’re out to deceive Google.
A similar example would be carousel sliders, hiding headings until they scroll into view.
Accordians which could be hiding headings until toggled into view.
Maybe a desktop or mobile version of a heading, hidden for design purposes.
Plenty of reasons why a heading could be hidden legitimately and many more for trying to game Google I’m sure!