function scaleOverview() {
	var overview: HTMLDivElement = document.querySelector('.overview');
	var deck: HTMLDivElement = overview.querySelector('.deck');

	if (overview.clientWidth > 0) {
		var margin = 10;

		var widthScale = overview.clientWidth / (deck.clientWidth + margin * 2);
		var heightScale = overview.clientHeight / (deck.clientHeight + margin * 2);

		if (deck.clientHeight * widthScale > overview.clientHeight) deck.style.transform = `scale(${heightScale})`;
		else deck.style.transform = `scale(${widthScale})`;
	} else setTimeout(scaleOverview, 100);
}

window.addEventListener('resize', scaleOverview);
scaleOverview();
