<?php

$wind_energy_custom_css = "";

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

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

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

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

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

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

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

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

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

	$wind_energy_global_color = get_theme_mod('wind_energy_global_color', '#2AB684'); // Add a fallback if the color isn't set

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

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

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

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

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

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

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

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

	// FOOTER

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

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

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

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

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

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

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

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

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

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

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