<?php
/**
* Customizer Options
*
* @package GridFeel WordPress Theme
* @copyright Copyright (C) 2025 ThemesDNA
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
* @author ThemesDNA <themesdna@gmail.com>
*/

function gridfeel_inline_css() {
    $custom_css = '';

    if ( !(gridfeel_is_backtotop_active()) ) {
        $custom_css .= '.gridfeel-scroll-top{display:none !important;}';
    }

    if ( gridfeel_get_option('header_image_title_mobile') ) {
        $custom_css .= '.gridfeel-header-image .gridfeel-header-image-info{display:block !important;}';
        $custom_css .= '.gridfeel-header-image .gridfeel-header-image-info .gridfeel-header-image-site-title{display:block !important;}';
    }

    if ( gridfeel_get_option('header_image_description_mobile') ) {
        $custom_css .= '.gridfeel-header-image .gridfeel-header-image-info{display:block !important;}';
        $custom_css .= '.gridfeel-header-image .gridfeel-header-image-info .gridfeel-header-image-site-description{display:block !important;}';
    }

    if ( gridfeel_get_option('header_image_cover') ) {
        if ( gridfeel_get_option('header_image_height_mobile') ) {
            $custom_css .= '@media screen and (max-width: 599px){.gridfeel-header-image-cover .gridfeel-header-img{min-height:'.esc_html( gridfeel_get_option('header_image_height_mobile') ).';}}';
        }
    }
    if ( gridfeel_get_option('header_padding') ) {
        $custom_css .= '.gridfeel-header-inside-content{padding:'.esc_html( gridfeel_get_option('header_padding') ).';}';
    }

    if ( gridfeel_grid_item_height() ) {
        $custom_css .= '.gridfeel-masonry-inactive .gridfeel-grid-post{height:'.esc_html( gridfeel_grid_item_height() ).';}';
    }

    if( '' != $custom_css ) {
        wp_add_inline_style( 'gridfeel-maincss', $custom_css );
    }
}
add_action( 'wp_enqueue_scripts', 'gridfeel_inline_css' );


// Header styles
if ( ! function_exists( 'gridfeel_header_style' ) ) :
function gridfeel_header_style() {
    $header_text_color = get_header_textcolor();
    //if ( get_theme_support( 'custom-header', 'default-text-color' ) === $header_text_color ) { return; }
    ?>
    <style type="text/css">
    <?php if ( ! display_header_text() ) : ?>
        .gridfeel-site-title, .gridfeel-site-description {position: absolute;clip: rect(1px, 1px, 1px, 1px);}
    <?php else : ?>
        .gridfeel-site-title, .gridfeel-site-title a, .gridfeel-site-description {color: #<?php echo esc_attr( $header_text_color ); ?>;}
    <?php endif; ?>
    </style>
    <?php
}
endif;