HTML Links tags accept a media attribute to conditionally load resources.
Dialogs have always been difficult to manage. Modern browsers in 2022 offer a much simpler solution.