<?php

$carpenter_shop_custom_css = "";

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

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

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

	$carpenter_shop_single_page_content_alignment = get_theme_mod('carpenter_shop_single_page_content_alignment', 'left');
	if ($carpenter_shop_single_page_content_alignment == 'left') {
	    $carpenter_shop_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{';
	    $carpenter_shop_custom_css .= 'text-align: left !important;';
	    $carpenter_shop_custom_css .= '}';
	} else if ($carpenter_shop_single_page_content_alignment == 'center') {
	    $carpenter_shop_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{';
	    $carpenter_shop_custom_css .= 'text-align: center !important;';
	    $carpenter_shop_custom_css .= '}';
	} else if ($carpenter_shop_single_page_content_alignment == 'right') {
	    $carpenter_shop_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{';
	    $carpenter_shop_custom_css .= 'text-align: right !important;';
	    $carpenter_shop_custom_css .= '}';
	}

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

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

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

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

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

	$carpenter_shop_global_color = get_theme_mod('carpenter_shop_global_color', '#7C5E30'); // Add a fallback if the color isn't set

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

	/*-------------------- Global Second Color -------------------*/

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

	if ($carpenter_shop_second_color) {
		$carpenter_shop_custom_css .= ':root {';
		$carpenter_shop_custom_css .= '--second-color: ' . esc_attr($carpenter_shop_second_color) . ';';
		$carpenter_shop_custom_css .= '}';
	}

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

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

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

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

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

	if ($carpenter_shop_heading_typography_font) {
		$carpenter_shop_custom_css .= ':root {';
		$carpenter_shop_custom_css .= '--font-head: ' . esc_attr($carpenter_shop_heading_typography_font) . ';';
		$carpenter_shop_custom_css .= '}';
	}

	$carpenter_shop_columns = get_theme_mod('carpenter_shop_posts_per_columns', 3);
	$carpenter_shop_columns = absint($carpenter_shop_columns);
	if ( $carpenter_shop_columns < 1 || $carpenter_shop_columns > 6 ) {
		$carpenter_shop_columns = 3;
	}
	$carpenter_shop_custom_css .= "
		.site-content .article-wraper-archive {
			grid-template-columns: repeat({$carpenter_shop_columns}, 1fr);
		}
	";

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

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

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

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

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

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

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

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

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

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

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