@use 'sass:math';

/**
 * Sets the fixed aspect ratio of the element.
 *
 * @param    {number}    $width              The needed element width.
 * @param    {number}    $height [$width]    The needed element height.
 */
@mixin aspect-ratio($width, $height: $width) {
	position: relative;
	display: block;

	&::before {
		content: '';
		display: block;
		padding-top: math.div($height, $width) * 100%;
	}
}
