CSS runs through the tag tree from top to bottom and outside to the inside. This is part of ideology, and it will probably remain so until the end of CSS’s life as a standard.
Therefore, to go to the ancestors, or to the neighbors to the current element - use js.