<?php

/**
 * Dynamic CSS
 */
function minimalistic_blog_dynamic_css() {

	$site_title_font       = get_theme_mod( 'minimalistic_blog_site_title_font', 'Raleway Dots' );
	$site_description_font = get_theme_mod( 'minimalistic_blog_site_description_font', 'Aleo' );
	$header_font           = get_theme_mod( 'minimalistic_blog_header_font', 'Roboto' );
	$body_font             = get_theme_mod( 'minimalistic_blog_body_font', 'Montserrat' );

	$custom_css  = '';
	$custom_css .= '
	/* Color */
	:root {
		--site-title-color: ' . esc_attr( '#' . get_header_textcolor() ) . ';
	}
	';

	$custom_css .= '
	/* Typograhpy */
	:root {
		--font-site-title: "' . esc_attr( $site_title_font ) . '", serif;
		--font-site-description: "' . esc_attr( $site_description_font ) . '", serif;
		--font-heading: "' . esc_attr( $header_font ) . '", serif;
		--font-body: "' . esc_attr( $body_font ) . '", serif;
	}
	';

	wp_add_inline_style( 'minimalistic-blog-style', $custom_css );

}

add_action( 'wp_enqueue_scripts', 'minimalistic_blog_dynamic_css', 99 );
