<?php

$digital_media_custom_css = "";

	$digital_media_theme_pagination_options_alignment = get_theme_mod('digital_media_theme_pagination_options_alignment', 'Center');
	if ($digital_media_theme_pagination_options_alignment == 'Center') {
		$digital_media_custom_css .= '.navigation.pagination,.navigation.posts-navigation .nav-links{';
		$digital_media_custom_css .= 'justify-content: center;margin: 0 auto;';
		$digital_media_custom_css .= '}';
	} else if ($digital_media_theme_pagination_options_alignment == 'Right') {
		$digital_media_custom_css .= '.navigation.pagination,.navigation.posts-navigation .nav-links{';
		$digital_media_custom_css .= 'justify-content: right;margin: 0 0 0 auto;';
		$digital_media_custom_css .= '}';
	} else if ($digital_media_theme_pagination_options_alignment == 'Left') {
		$digital_media_custom_css .= '.navigation.pagination,.navigation.posts-navigation .nav-links{';
		$digital_media_custom_css .= 'justify-content: left;margin: 0 auto 0 0;';
		$digital_media_custom_css .= '}';
	}

	$digital_media_theme_breadcrumb_enable = get_theme_mod('digital_media_theme_breadcrumb_enable',true);
    if($digital_media_theme_breadcrumb_enable != true){
        $digital_media_custom_css .='nav.breadcrumb-trail.breadcrumbs,nav.woocommerce-breadcrumb{';
            $digital_media_custom_css .='display: none;';
        $digital_media_custom_css .='}';
    }

	$digital_media_theme_breadcrumb_options_alignment = get_theme_mod('digital_media_theme_breadcrumb_options_alignment', 'Left');
	if ($digital_media_theme_breadcrumb_options_alignment == 'Center') {
	    $digital_media_custom_css .= '.breadcrumbs ul,nav.woocommerce-breadcrumb{';
	    $digital_media_custom_css .= 'text-align: center !important;';
	    $digital_media_custom_css .= '}';
	} else if ($digital_media_theme_breadcrumb_options_alignment == 'Right') {
	    $digital_media_custom_css .= '.breadcrumbs ul,nav.woocommerce-breadcrumb{';
	    $digital_media_custom_css .= 'text-align: Right !important;';
	    $digital_media_custom_css .= '}';
	} else if ($digital_media_theme_breadcrumb_options_alignment == 'Left') {
	    $digital_media_custom_css .= '.breadcrumbs ul,nav.woocommerce-breadcrumb{';
	    $digital_media_custom_css .= 'text-align: Left !important;';
	    $digital_media_custom_css .= '}';
	}

	$digital_media_single_page_content_alignment = get_theme_mod('digital_media_single_page_content_alignment', 'left');
	if ($digital_media_single_page_content_alignment == 'left') {
	    $digital_media_custom_css .= '#single-page .type-page,section.theme-custom-block.theme-error-sectiontheme-error-section.error-block-middle,section.theme-custom-block.theme-error-section.error-block-heading .theme-area-header{';
	    $digital_media_custom_css .= 'text-align: left !important;';
	    $digital_media_custom_css .= '}';
	} else if ($digital_media_single_page_content_alignment == 'center') {
	    $digital_media_custom_css .= '#single-page .type-page,section.theme-custom-block.theme-error-sectiontheme-error-section.error-block-middle,section.theme-custom-block.theme-error-section.error-block-heading .theme-area-header{';
	    $digital_media_custom_css .= 'text-align: center !important;';
	    $digital_media_custom_css .= '}';
	} else if ($digital_media_single_page_content_alignment == 'right') {
	    $digital_media_custom_css .= '#single-page .type-page,section.theme-custom-block.theme-error-sectiontheme-error-section.error-block-middle,section.theme-custom-block.theme-error-section.error-block-heading .theme-area-header{';
	    $digital_media_custom_css .= 'text-align: right !important;';
	    $digital_media_custom_css .= '}';
	}

	$digital_media_single_post_content_alignment = get_theme_mod('digital_media_single_post_content_alignment', 'left');
	if ($digital_media_single_post_content_alignment == 'left') {
	    $digital_media_custom_css .= '#single-page .type-post,#single-page .type-post .entry-meta,#single-page .type-post .is-layout-flex{';
	    $digital_media_custom_css .= 'text-align: left !important;justify-content: left;';
	    $digital_media_custom_css .= '}';
	} else if ($digital_media_single_post_content_alignment == 'center') {
	    $digital_media_custom_css .= '#single-page .type-post,#single-page .type-post .entry-meta,#single-page .type-post .is-layout-flex{';
	    $digital_media_custom_css .= 'text-align: center !important;justify-content: center;';
	    $digital_media_custom_css .= '}';
	} else if ($digital_media_single_post_content_alignment == 'right') {
	    $digital_media_custom_css .= '#single-page .type-post,#single-page .type-post .entry-meta,#single-page .type-post .is-layout-flex{';
	    $digital_media_custom_css .= 'text-align: right !important;justify-content: right;';
	    $digital_media_custom_css .= '}';
	}

	$digital_media_footer_widget_title_alignment = get_theme_mod('digital_media_footer_widget_title_alignment', 'left');
	if ($digital_media_footer_widget_title_alignment == 'left') {
	    $digital_media_custom_css .= 'h2.widget-title{';
	    $digital_media_custom_css .= 'text-align: left !important;';
	    $digital_media_custom_css .= '}';
	} else if ($digital_media_footer_widget_title_alignment == 'center') {
	    $digital_media_custom_css .= 'h2.widget-title{';
	    $digital_media_custom_css .= 'text-align: center !important;';
	    $digital_media_custom_css .= '}';
	} else if ($digital_media_footer_widget_title_alignment == 'right') {
	    $digital_media_custom_css .= 'h2.widget-title{';
	    $digital_media_custom_css .= 'text-align: right !important;';
	    $digital_media_custom_css .= '}';
	}

	$digital_media_menu_text_transform = get_theme_mod('digital_media_menu_text_transform', 'uppercase'); 
	if ($digital_media_menu_text_transform == 'capitalize') {
	$digital_media_custom_css .= '.site-navigation .primary-menu > li a{';
	$digital_media_custom_css .= 'text-transform: capitalize !important;';
	$digital_media_custom_css .= '}'; 
	} 
	else if ($digital_media_menu_text_transform == 'uppercase') {
	$digital_media_custom_css .= '.site-navigation .primary-menu > li a{';
	$digital_media_custom_css .= 'text-transform: uppercase !important;';
	$digital_media_custom_css .= '}'; 
	} 
	else if ($digital_media_menu_text_transform == 'lowercase') {
	$digital_media_custom_css .= '.site-navigation .primary-menu > li a{';
	$digital_media_custom_css .= 'text-transform: lowercase !important;';
	$digital_media_custom_css .= '}'; 
	}

	$digital_media_show_hide_related_product = get_theme_mod('digital_media_show_hide_related_product',true);
    if($digital_media_show_hide_related_product != true){
        $digital_media_custom_css .='.related.products{';
            $digital_media_custom_css .='display: none;';
        $digital_media_custom_css .='}';
    }

	/*-------------------- Global First Color -------------------*/

	$digital_media_global_color = get_theme_mod('digital_media_global_color', '#E367E3'); // Add a fallback if the color isn't set

	if ($digital_media_global_color) {
		$digital_media_custom_css .= ':root {';
		$digital_media_custom_css .= '--global-color: ' . esc_attr($digital_media_global_color) . ';';
		$digital_media_custom_css .= '}';
	}	

	/*-------------------- Content Font -------------------*/

	$digital_media_content_typography_font = get_theme_mod('digital_media_content_typography_font', 'PlusJakartaSans'); // Add a fallback if the color isn't set

	if ($digital_media_content_typography_font) {
		$digital_media_custom_css .= ':root {';
		$digital_media_custom_css .= '--font-main: ' . esc_attr($digital_media_content_typography_font) . ';';
		$digital_media_custom_css .= '}';
	}

	/*-------------------- Heading Font -------------------*/

	$digital_media_heading_typography_font = get_theme_mod('digital_media_heading_typography_font', 'PlusJakartaSans'); // Add a fallback if the color isn't set

	if ($digital_media_heading_typography_font) {
		$digital_media_custom_css .= ':root {';
		$digital_media_custom_css .= '--font-head: ' . esc_attr($digital_media_heading_typography_font) . ';';
		$digital_media_custom_css .= '}';
	}
								
	$digital_media_columns = get_theme_mod('digital_media_posts_per_columns', 3);
	$digital_media_columns = absint($digital_media_columns);
	if ( $digital_media_columns < 1 || $digital_media_columns > 6 ) {
		$digital_media_columns = 3;
	}
	$digital_media_custom_css .= "
		.site-content .article-wraper-archive {
			grid-template-columns: repeat({$digital_media_columns}, 1fr);
		}
	";

	// FOOTER

	$digital_media_footer_widget_background_color = get_theme_mod('digital_media_footer_widget_background_color');
	if ($digital_media_footer_widget_background_color) {

		$digital_media_custom_css .= "
			.footer-widgetarea {
				background-color: ". esc_attr($digital_media_footer_widget_background_color) .";
			}
		";
	}

	$digital_media_footer_widget_background_image = get_theme_mod('digital_media_footer_widget_background_image');
	if ($digital_media_footer_widget_background_image) {
		$digital_media_custom_css .= "
			.footer-widgetarea {
				background-image: url(" . esc_url($digital_media_footer_widget_background_image) . ");
			}
		";
	}

	$digital_media_copyright_font_size = get_theme_mod('digital_media_copyright_font_size');
	if ($digital_media_copyright_font_size) {

		$digital_media_custom_css .= "
			.footer-copyright {
				font-size: ". esc_attr($digital_media_copyright_font_size) ."px;
			}
		";
	}

	$digital_media_copyright_alignment = get_theme_mod( 'digital_media_copyright_alignment', 'Default' );
	if ( $digital_media_copyright_alignment === 'Reverse' ) {
		$digital_media_custom_css .= '.site-info .column-row { flex-direction: row-reverse; }';
		$digital_media_custom_css .= '.footer-credits { justify-content: flex-end; }';
		$digital_media_custom_css .= '.footer-copyright { text-align: right; }';
		$digital_media_custom_css .= '.site-info .column.column-3 { text-align: left; }';
	} elseif ( $digital_media_copyright_alignment === 'Center' ) {
		$digital_media_custom_css .= '.site-info .column-row { flex-direction: column; align-items: center; gap: 15px; }';
		$digital_media_custom_css .= '.footer-credits { justify-content: center; }';
		$digital_media_custom_css .= '.footer-copyright { text-align: center; }';
		$digital_media_custom_css .= '.site-info .column.column-3 { text-align: center; }';
	}

	/*-------------------- Menu Color CSS -------------------*/

	$digital_media_header_menus_color = get_theme_mod('digital_media_header_menus_color');
	if($digital_media_header_menus_color != false){
		$digital_media_custom_css .='.site-navigation .primary-menu a{';
			$digital_media_custom_css .='color: '.esc_attr($digital_media_header_menus_color).'!important;';
		$digital_media_custom_css .='}';
	}

	$digital_media_header_menus_hover_color = get_theme_mod('digital_media_header_menus_hover_color');
	if($digital_media_header_menus_hover_color != false){
		$digital_media_custom_css .='.site-navigation .primary-menu a:hover{';
			$digital_media_custom_css .='color: '.esc_attr($digital_media_header_menus_hover_color).'!important;';
		$digital_media_custom_css .='}';
	}

	$digital_media_header_submenus_color = get_theme_mod('digital_media_header_submenus_color');
	if($digital_media_header_submenus_color != false){
		$digital_media_custom_css .='.site-navigation .primary-menu ul.sub-menu li a,.site-navigation .primary-menu li ul li a{';
			$digital_media_custom_css .='color: '.esc_attr($digital_media_header_submenus_color).'!important;';
		$digital_media_custom_css .='}';
	}

	$digital_media_header_submenus_hover_color = get_theme_mod('digital_media_header_submenus_hover_color');
	if($digital_media_header_submenus_hover_color != false){
		$digital_media_custom_css .='.site-navigation .primary-menu > li ul.sub-menu a:hover,.site-navigation .primary-menu li ul li a:hover{';
			$digital_media_custom_css .='color: '.esc_attr($digital_media_header_submenus_hover_color).'!important;';
		$digital_media_custom_css .='}';
	}