@use '../tools' as tools;

@mixin mediumComplete($font-prefix: $font-prefix) {
	@font-face {
		font-family: 'IBM Plex Serif';
		font-style: normal;
		font-weight: 500;
		src: local('IBM Plex Serif Medium'), local('IBMPlexSerif-Medium'), url('#{$font-prefix}/fonts/complete/woff2/IBMPlexSerif-Medium.woff2') format('woff2'), url('#{$font-prefix}/fonts/complete/woff/IBMPlexSerif-Medium.woff') format('woff');
	}
}

@mixin mediumSplit($font-prefix: $font-prefix, $unicode-ranges: $unicode-ranges) {
	@each $unicode-range in $unicode-ranges {
		@font-face {
			font-family: 'IBM Plex Serif';
			font-style: normal;
			font-weight: 500;
			src: local('IBM Plex Serif Medium'), local('IBMPlexSerif-Medium'), url('#{$font-prefix}/fonts/split/woff2/IBMPlexSerif-Medium-#{tools.split-range($unicode-range)}.woff2') format('woff2');
			unicode-range: tools.get-range($unicode-range);
		}	}
}

@mixin all($font-prefix: $font-prefix, $unicode-ranges: $unicode-ranges) {
	@include mediumComplete($font-prefix);
	@include mediumSplit($font-prefix, $unicode-ranges);
}