// Copyright (c) 2017-2025, CKSource Holding sp. z o.o. All rights reserved.
// For licensing, see LICENSE.md.

@use 'color';
@use 'globals';
@use 'sass:list';
@use 'sass:map';

$u-font-size-base: 15px;
$u-line-height-base: 1.6;
$u-font-face: 'Source Sans Pro', system-ui, Roboto, 'Helvetica Neue', 'Helvetica', Arial, sans-serif;
$u-font-face-mono: Monaco, Menlo, Consolas, 'Roboto Mono', 'Courier New', 'Ubuntu Mono', monospace;
$u-font-sizes: (
	-2: 0.7,
	-1: 0.75,
	-0.5: 0.8,
	0: 1,
	1: 1.166,
	2: 1.333,
	3: 1.5,
	4: 1.83,
	5: 2.333
);

@function u-font-size( $level ) {
	@return map.get( $u-font-sizes, $level ) + rem;
}

@mixin u-font-mono {
	font-family: $u-font-face-mono;
	font-size: .9em;
	color: color.u-color( text, 20% );
}

$u-baseline-levels: (
	4: ( 2.36em, 1.33em, 1.00em, 1.67em ),
	3: ( 1.68em, 1.68em, 0.8em, 0.4em ),
	2: ( 1.36em, 1.5em, 0.8em, 0.2em ),
	1: ( 1.2em, 1.4em, 0.8em, 0.2em),
	0: ( 1.00em, 1.6em, 0.2em, 0.8em ),
);

@mixin u-baseline-margin( $level ) {
	$rhythm: map.get( $u-baseline-levels, $level );
	margin-bottom: list.nth( $rhythm, 4 );
}

@mixin u-baseline-padding( $level ) {
	$rhythm: map.get( $u-baseline-levels, $level );
	padding-top: list.nth( $rhythm, 3 );
}

@mixin u-baseline( $level ) {
	$rhythm: map.get( $u-baseline-levels, $level );

	font-size: list.nth( $rhythm, 1 );
	line-height: list.nth( $rhythm, 2 );
	padding-top: list.nth( $rhythm, 3 );
	margin-bottom: list.nth( $rhythm, 4 );
}
