<?php

$green_nursery_custom_css = "";

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

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

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

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

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

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

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

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

	$green_nursery_sticky_sidebar = get_theme_mod('green_nursery_sticky_sidebar',true);
    if($green_nursery_sticky_sidebar != true){
        $green_nursery_custom_css .='.widget-area-wrapper{';
            $green_nursery_custom_css .='position: relative !important;';
        $green_nursery_custom_css .='}';
    }

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

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

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

	$green_nursery_global_secondary_color = get_theme_mod('green_nursery_global_secondary_color', '#1a1a1a'); // Add a fallback if the color isn't set

	if ($green_nursery_global_secondary_color) {
		$green_nursery_custom_css .= ':root {';
		$green_nursery_custom_css .= '--secondary-color: ' . esc_attr($green_nursery_global_secondary_color) . ';';
		$green_nursery_custom_css .= '}';
	}
	
	/*-------------------- Content Font -------------------*/

	$green_nursery_content_typography_font = get_theme_mod('green_nursery_content_typography_font', 'libre-baskerville'); // Add a fallback if the color isn't set

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

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

	$green_nursery_heading_typography_font = get_theme_mod('green_nursery_heading_typography_font', 'libre-baskerville'); // Add a fallback if the color isn't set

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

	/*-------------------- FOOTER -------------------*/

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

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

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

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

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

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

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