I skipped this for a bit because I couldn't think of a simple way to adapt this behavior to a web component + vanilla CSS setting, but then I thought of CSS variables, and sat down and cranked this out!