:has() is a very useful tool in CSS that is ready to use.

It often allows you to remove JS—for example by linking :hover in one branch of the DOM tree with a reaction in another.

See how we at oklch.com threw away a lot of JS code
https://github.com/evilmartians/oklch-picker/pull/157

Sync hover of logo and em link hovers with CSS only by baileys-li · Pull Request #157 · evilmartians/oklch-picker

GitHub