<?php

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

	$mindful_blog_site_title_font       = get_theme_mod( 'mindful_blog_site_title_font', 'Josefin Sans' );
	$mindful_blog_site_description_font = get_theme_mod( 'mindful_blog_site_description_font', 'Inder' );
	$mindful_blog_header_font           = get_theme_mod( 'mindful_blog_header_font', 'Inder' );
	$mindful_blog_body_font             = get_theme_mod( 'mindful_blog_body_font', 'Inder' );

	$mindful_blog_custom_css  = '';
	$mindful_blog_custom_css .= '
    /* Color */
    :root {
        --header-text-color: ' . esc_attr( '#' . get_header_textcolor() ) . ';
    }
    ';

	$mindful_blog_custom_css .= '
    /* Typograhpy */
    :root {
        --font-heading: "' . esc_attr( $mindful_blog_header_font ) . '", serif;
        --font-main: -apple-system, BlinkMacSystemFont,"' . esc_attr( $mindful_blog_body_font ) . '", "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    }

    body,
	button, input, select, optgroup, textarea {
        font-family: "' . esc_attr( $mindful_blog_body_font ) . '", serif;
	}

	.site-title a {
        font-family: "' . esc_attr( $mindful_blog_site_title_font ) . '", serif;
	}
    
	.site-description {
        font-family: "' . esc_attr( $mindful_blog_site_description_font ) . '", serif;
	}
    ';

	wp_add_inline_style( 'mindful-blog-style', $mindful_blog_custom_css );

}
add_action( 'wp_enqueue_scripts', 'mindful_blog_dynamic_css', 99 );
