These are some ways where nesting could make your code more readable or understandable.
If an element slightly varies on hover and focus (which it should in most cases), it could make sense to add those styles right with the element styles.
<button>Save</button>
<style>
button {
color: blue;
background-color: white;
border: 1px solid currentcolor;
padding: 1em 2em;
&:hover {
color: red;
}
&:focus {
color: black;
}
}
</style>
Maybe you want a card to look different based on media queries. The query could go right with the component.
<div class="card">
</div>
<style>
.card {
width: 50%;
aspect-ratio: 1 / 1;
background-color: orange;
@media (min-width: 200px) {
background-color: black;
}
}
</style>