One of the main advantages of CSS variables is that they can be changed at runtime, either by using media queries, pseudo-classes, or JavaScript. Media queries allow you to change the value of a variable based on the screen size, orientation, or other conditions. For example, @media (max-width: 600px) { :root { --main-color: purple; } } changes the value of --main-color to purple when the screen width is less than 600px. Pseudo-classes allow you to change the value of a variable based on the state of an element, such as hover, focus, or active. For example, .button:hover { --main-color: yellow; } changes the value of --main-color to yellow when the mouse is over the element with the class button. JavaScript allows you to change the value of a variable programmatically, by using the setProperty() or getPropertyValue() methods of the style object. For example, document.documentElement.style.setProperty('--main-color', 'pink'); changes the value of --main-color to pink using JavaScript.