<?php
Kirki::add_section( 'book_author_blog_theme_header_section', array(
    'title'          => esc_html__( 'Header Settings', 'book-author-blog' ),
    'panel'          => 'book_author_blog_global_panel',
    'priority'      => 10,
) );

Kirki::add_field( 'book_author_blog_config', [
    'type'        => 'color',
    'settings'    => 'header_bg_color',
    'label'       => __( 'Background Color', 'book-author-blog' ),
    'section'     => 'book_author_blog_theme_header_section',
    'default'     => '#000000',
    'transport'   => 'auto',
    'priority'  => 3,
    'output' => array(
        array(
            'element'  => 'header#masthead',
            'property' => 'background-color',
        ),
    ),
] );

Kirki::add_field( 'book_author_blog_config', [
    'type'        => 'typography',
    'settings'    => 'header_title_typography',
    'label'       => esc_html__( 'Site Title Typography', 'book-author-blog' ),
    'section'     => 'title_tagline',
    'priority'     => 80,
    'default'     => [
        'font-family'    => 'Roboto',
        'variant'        => 'bold',
        'font-size'      => '1.3rem',
        'line-height'    => '1.6',
        'letter-spacing' => '0px',
        'color'          => '#ffffff',
        'text-transform' => 'none',
    ],
    'transport'   => 'auto',
    'output'      => [
        [
            'element' => '.site-branding .site-title a',
        ],
    ],
] );

Kirki::add_field( 'book_author_blog_config', [
    'type'        => 'typography',
    'settings'    => 'header_desc_typography',
    'label'       => esc_html__( 'Site Description Typography', 'book-author-blog' ),
    'section'     => 'title_tagline',
    'priority'     => 85,
    'default'     => [
        'font-family'    => 'Roboto',
        'variant'        => 'regular',
        'font-size'      => '1rem',
        'line-height'    => '1.4',
        'letter-spacing' => '0px',
        'color'          => '#ffffff',
        'text-transform' => 'none',
    ],
    'transport'   => 'auto',
    'output'      => [
        [
            'element' => '.site-branding p.site-description',
        ],
    ],
] );

Kirki::add_field( 'book_author_blog_config', [
    'type'        => 'typography',
    'settings'    => 'header_menu_typography',
    'label'       => esc_html__( 'Menu Typography', 'book-author-blog' ),
    'section'     => 'book_author_blog_theme_header_section',
    'default'     => [
        'font-family'    => 'Roboto',
        'variant'        => 'regular',
        'font-size'      => '1rem',
        'line-height'    => '1.6',
        'letter-spacing' => '0px',
        'color'          => '#ffffff',
        'text-transform' => 'none',
    ],
    'transport'   => 'auto',
    'priority'  => 8,
    'output'      => [
        [
            'element' => '#cssmenu>ul>li>a',
        ],
    ],
] );

Kirki::add_field( 'book_author_blog_config', [
    'type'        => 'color',
    'settings'    => 'header_icon_color',
    'label'       => esc_html__( 'Icon Color', 'book-author-blog' ),
    'section'     => 'book_author_blog_theme_header_section',
    'default'     => '#ffffff',
    'transport'   => 'auto',
    'priority'      => 12,
    'output'      => [
        [
            'element' => '.social-links-wrapper.header-social-links a',
        ],
    ],
] );


/**
 * Pro Settings
 */
Kirki::add_field( 'book_author_blog_config', [
    'type'        => 'select',
    'settings'    => 'header_container_size',
    'label'       => esc_html__( 'Header Area Container Size', 'book-author-blog' ),
    'section'     => 'book_author_blog_theme_header_section',
    'default'     => 'container',
    'priority'  => 1,
    'choices'   => [
        'container' => __('Container', 'book-author-blog'),
        'container-fluid' => __('Container Full Width', 'book-author-blog'),
        'container-custom-size' => __('Container Custom Size', 'book-author-blog'),
    ]
] );

Kirki::add_field( 'book_author_blog_config', [
    'type'        => 'number',
    'settings'    => 'header_container_custom_size',
    'label'       => esc_html__( 'Header Container Custom Size px', 'book-author-blog' ),
    'section'     => 'book_author_blog_theme_header_section',
    'default'     => '1170',
    'priority'  => 1,
    'transport' => 'postMessage',
    'active_callback'   => function(){
        $containerSize = get_theme_mod('header_container_size', 'container');
        if ('container-custom-size' == $containerSize) {
            return true;
        }
        return false;
    }
] );

Kirki::add_field( 'book_author_blog_config', [
    'type'        => 'toggle',
    'settings'    => 'show_social_icon',
    'label'       => esc_html__( 'Show Social Icons', 'book-author-blog' ),
    'section'     => 'book_author_blog_theme_header_section',
    'default'     => '1',
    'priority'  => 2
] );

Kirki::add_field( 'book_author_blog_config', [
    'type'        => 'color',
    'settings'    => 'header_bg_overlay_color',
    'label'       => __( 'Header Overly Color', 'book-author-blog' ),
    'section'     => 'book_author_blog_theme_header_section',
    'transport'   => 'auto',
    'priority'    => 4,
    'choices'     => [
            'alpha' => true,
        ],
    'output' => array(
        array(
            'element'  => '.header_overlay_color',
            'property' => 'background',
        ),
    ),
    'active_callback' => function(){
        $headerImg = get_header_image();
        if (!empty($headerImg)) {
            return true;
        }
        return false;
    }
] );

Kirki::add_field( 'book_author_blog_config', [
    'type'        => 'color',
    'settings'    => 'header_border_color',
    'label'       => __( 'Header Border Color', 'book-author-blog' ),
    'section'     => 'book_author_blog_theme_header_section',
    'default'     => '#f4f4ec',
    'transport'   => 'auto',
    'priority'    => 5,
    'choices'     => [
            'alpha' => true,
        ],
    'output' => array(
        array(
            'element'  => 'header.site-header.header-two .header-menu-area, header.site-header.header-three .header-menu-area, header.site-header.header-five .header-menu-area',
            'property' => 'border-top-color',
        ),
        array(
            'element'  => 'header.site-header.header-four .header-menu-area, header.site-header.header-three .header-menu-area, header.site-header.header-one',
            'property' => 'border-bottom-color',
        ),
    ),
] );

Kirki::add_field( 'book_author_blog_config', [
    'type'        => 'color',
    'settings'    => 'header_menu_hover_color',
    'label'       => __( 'Menu Hover Color', 'book-author-blog' ),
    'section'     => 'book_author_blog_theme_header_section',
    'default'     => '#fb4747',
    'transport'   => 'auto',
    'priority'      => 9,
    'output' => array(
        array(
            'element'  => '#cssmenu>ul>li:hover>a',
            'property' => 'color',
        ),
    ),

] );

Kirki::add_field( 'book_author_blog_config', [
    'type'        => 'color',
    'settings'    => 'header_sub_menu_hover_color',
    'label'       => __( 'Sub Menu Hover Color', 'book-author-blog' ),
    'section'     => 'book_author_blog_theme_header_section',
    'default'     => '#fb4747',
    'transport'   => 'auto',
    'priority'    => 10,
    'output' => array(
        array(
            'element'  => '#cssmenu ul ul li:hover>a, #cssmenu ul ul li a:hover',
            'property' => 'color',
        ),
    ),
] );

Kirki::add_field( 'book_author_blog_config', [
    'type'        => 'typography',
    'settings'    => 'header_social_icons_style',
    'label'       => esc_html__( 'Social Icons Styles', 'book-author-blog' ),
    'section'     => 'book_author_blog_theme_header_section',
    'default'     =>  '1',
    'transport'   => 'auto',
    'priority'    => 11,
    'default'     => [
        'font-size'      => '1rem',
    ],
    'output'      => [
        [
            'element' => '.social-links-wrapper.header-social-links a',
        ],
    ],
] );

Kirki::add_field( 'book_author_blog_config', [
    'type'        => 'color',
    'settings'    => 'header_icon_hover_color',
    'label'       => __( 'Header Icon Hover Color', 'book-author-blog' ),
    'section'     => 'book_author_blog_theme_header_section',
    'default'     => '#fb4747',
    'transport'   => 'auto',
    'priority'    => 13,
    'output' => array(
        array(
            'element'  => '.social-links-wrapper.header-social-links a:hover',
            'property' => 'color',
        ),
    ),
] );

Kirki::add_field( 'book_author_blog_config', [
    'type'        => 'typography',
    'settings'    => 'mobile_menu_icon_typography',
    'label'       => esc_html__( 'Mobile Menu Icon', 'book-author-blog' ),
    'section'     => 'book_author_blog_theme_header_section',
    'priority'    => 14,
    'default'     => [
        'font-size'      => '1.2rem',
        'color'          => '#ffffff',
    ],
    'transport'   => 'auto',
    'output'      => [
        [
            'element' => '#cssmenu.small-screen #menu-button',
        ],
    ],
] );

Kirki::add_field( 'book_author_blog_config', [
    'type'        => 'color',
    'settings'    => 'mobile_menu_icon_hover_color',
    'label'       => __( 'Mobile Menu Icon Hover', 'book-author-blog' ),
    'section'     => 'book_author_blog_theme_header_section',
    'default'     => '#fb4747',
    'priority'    => 15,
    'transport'   => 'auto',
    'output' => array(
        array(
            'element'  => '#cssmenu.small-screen #menu-button:hover',
            'property' => 'color',
        ),
    ),
] );

Kirki::add_field( 'book_author_blog_config', [
    'type'        => 'color',
    'settings'    => 'mobile_menu_item_hover_color',
    'label'       => __( 'Mobile Menu Items Border Color', 'book-author-blog' ),
    'section'     => 'book_author_blog_theme_header_section',
    'default'     => '#ffffff',
    'priority'    => 15,
    'transport'   => 'auto',
    'output' => array(
        array(
            'element'  => '#cssmenu.small-screen ul li, #cssmenu.small-screen ul.menu, #cssmenu.small-screen ul ul li:first-child, #cssmenu.small-screen ul ul li',
            'property' => 'border-color',
        ),
        array(
            'element'  => '#cssmenu.small-screen #menu-button:focus',
            'property' => 'outline-color',
        ),
    ),
] );