<?php
Kirki::add_section( 'author_portfolio_theme_header_settings', array(
    'title'          => esc_html__( 'Header Settings', 'author-portfolio' ),
    'panel'          => 'author_portfolio_global_panel',
) );

Kirki::add_field( 'author_portfolio_config', [
    'type'        => 'toggle',
    'settings'    => 'show_header_social_icons',
    'label'       => esc_html__( 'Show Social Icons', 'author-portfolio' ),
    'section'     => 'author_portfolio_theme_header_settings',
    'default'     => '0',
] );

Kirki::add_field( 'author_portfolio_config', [
    'type'        => 'multicolor',
    'settings'    => 'header_social_icon_colors',
    'label'       => esc_html__( 'Social Icon Colors', 'author-portfolio' ),
    'section'     => 'author_portfolio_theme_header_settings',
    'transport'   => 'auto',
    'active_callback' => [
        [
            'setting'  => 'show_header_social_icons',
            'operator' => '==',
            'value'    => true,
        ]
    ],
    'choices'     => [
        'base'  => esc_html__( 'Base Color', 'author-portfolio' ),
        'hover' => esc_html__( 'Hover Color', 'author-portfolio' ),
    ],
    'default'     => [
        'base'  => '#333333',
        'hover' => '#fb4747',
    ],
    'output' => [
        [
            'choice'   => 'base',
            'element'  => 'div.header-social-links a',
            'property' => 'color',
        ],
        [
            'choice'   => 'hover',
            'element'  => 'div.header-social-links a:hover',
            'property' => 'color',
        ],
    ],
] );


Kirki::add_field( 'author_portfolio_config', [
    'type'        => 'color',
    'settings'    => 'header_bgc_color',
    'label'       => __( 'Header Background Color', 'author-portfolio' ),
    'section'     => 'author_portfolio_theme_header_settings',
    'default'     => '#ffffff',
    'transport'   => 'auto',
    'output' => array(
        array(
            'element'  => 'header#masthead',
            'property' => 'background',
        ),
    ),
] );

Kirki::add_field( 'author_portfolio_config', [
    'type'        => 'color',
    'settings'    => 'header_border_color',
    'label'       => __( 'Header Border Color', 'author-portfolio' ),
    'section'     => 'author_portfolio_theme_header_settings',
    'default'     => 'rgba(221, 221, 221, 0.5)',
    'choices'   => array(
        'alpha' => true,
    ),
    'transport'   => 'auto',
    'output' => array(
        array(
            'element'  => 'header.site-header',
            'property' => 'border-bottom-color',
        ),
    ),
] );

Kirki::add_field( 'author_portfolio_config', [
    'type'        => 'typography',
    'settings'    => 'header_title_typography',
    'label'       => esc_html__( 'Site Title Typography', 'author-portfolio' ),
    'section'     => 'author_portfolio_theme_header_settings',
    'default'     => [
        'font-family'    => 'Roboto',
        'variant'        => 'regular',
        'font-size'      => '1.25rem',
        'line-height'    => '1.6',
        'letter-spacing' => '0px',
        'color'          => '#000000',
        'text-transform' => 'none',
    ],
    'transport'   => 'auto',
    'output'      => [
        [
            'element' => '.site-branding .site-title a',
        ],
    ],
] );

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

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


Kirki::add_field( 'author_portfolio_config', [
    'type'        => 'color',
    'settings'    => 'header_menu_hover_color',
    'label'       => __( 'Menu Hover Color', 'author-portfolio' ),
    'section'     => 'author_portfolio_theme_header_settings',
    'default'     => '#fb4747',
    'transport'   => 'auto',
    'output' => array(
        array(
            'element'  => '#cssmenu>ul>li:hover>a',
            'property' => 'color',
        ),
    ),
] );

Kirki::add_field( 'author_portfolio_config', array(
    'type'        => 'custom',
    'settings'    => 'unlock_header_style_field',
    'label'       => '',
    'section'     => 'author_portfolio_theme_header_settings',
    'default'     => '<a target="_blank" href="'.esc_url( 'https://rswpthemes.com/author-portfolio-pro-wordpress-theme/' ).'">'.esc_html__('Upgrade To Pro To Unlock All Features', 'author-portfolio').'</a>',
) );
