CSS variables follow the standard cascade and inheritance rules, meaning they can be overridden by more specific selectors or modified within a particular scope.
:root {
--primary-color: #3498db;
}
.header {
--primary-color: #e74c3c; /* Overriding the global primary color */
}
h1 {
color: var(--primary-color); /* Uses the header's primary color inside .header */
}