It is possible, with pure CSS solution - using CSS variables. Also, if your x and y variables are also dynamic, you could also change them into CSS variables.
Have a look at following article, it also shows you how you can modify CSS variables via JS, if needed. https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties#values_in_javascript
:root {
--preview-card-width: 100%;
}
.preview__card {
width: var(--preview-card-width);
height: calc(var(--preview-card-width) * x) / y);
}
You could also take it further and make it a bit tidier.
:root {
--preview-card-width: 100%;
--preview-card-height: calc(var(--preview-card-width) * x / y);
}
.preview__card {
width: var(--preview-card-width);
height: var(--preview-card-height);
}