<?php
/**
 * Service Section
 *
 * @package design_studio
 */

 $wp_customize->add_section(
	'design_studio_services_section',
	array(
		'panel'    => 'design_studio_front_page_options',
		'title'    => esc_html__( 'Services Section', 'design-studio' ),
		'priority' => 10,
	)
);

//Service Section - Enable Section.
$wp_customize->add_setting(
	'design_studio_enable_services_section',
	array(
		'default'           => false,
		'sanitize_callback' => 'design_studio_sanitize_switch',
	)
);

$wp_customize->add_control(
	new Design_Studio_Toggle_Switch_Custom_Control(
		$wp_customize,
		'design_studio_enable_services_section',
		array(
			'label'    => esc_html__( 'Enable Services Section', 'design-studio' ),
			'section'  => 'design_studio_services_section',
			'settings' => 'design_studio_enable_services_section'
		)
	)
);

// Partial Refresh
if ( isset( $wp_customize->selective_refresh ) ) {
	$wp_customize->selective_refresh->add_partial(
		'design_studio_enable_services_section',
		array(
			'selector' => '#design_studio_services_section .section-link',
			'settings' => 'design_studio_enable_services_section',
		)
	);
}

// ── New custom-cards settings ─────────────────────────────────────────────────

// Section title (new standalone setting; falls back to trending_post_content if empty).
$wp_customize->add_setting(
	'design_studio_services_section_title',
	array(
		'default'           => '',
		'sanitize_callback' => 'sanitize_text_field',
	)
);
$wp_customize->add_control(
	'design_studio_services_section_title',
	array(
		'label'           => esc_html__( 'Section Title (Heading)', 'design-studio' ),
		'section'         => 'design_studio_services_section',
		'type'            => 'text',
		'active_callback' => 'design_studio_is_services_section_enabled',
	)
);

// Background decorative heading text.
$wp_customize->add_setting(
	'design_studio_services_bg_heading',
	array(
		'default'           => '',
		'sanitize_callback' => 'sanitize_text_field',
	)
);
$wp_customize->add_control(
	'design_studio_services_bg_heading',
	array(
		'label'           => esc_html__( 'Background Text (Decorative)', 'design-studio' ),
		'section'         => 'design_studio_services_section',
		'type'            => 'text',
		'active_callback' => 'design_studio_is_services_section_enabled',
	)
);

// Section description.
$wp_customize->add_setting(
	'design_studio_services_section_desc',
	array(
		'default'           => '',
		'sanitize_callback' => 'sanitize_textarea_field',
	)
);
$wp_customize->add_control(
	'design_studio_services_section_desc',
	array(
		'label'           => esc_html__( 'Section Description', 'design-studio' ),
		'section'         => 'design_studio_services_section',
		'type'            => 'text',
		'active_callback' => 'design_studio_is_services_section_enabled',
	)
);

// Select category for services posts.
$wp_customize->add_setting(
	'design_studio_services_category',
	array(
		'default'           => '',
		'sanitize_callback' => 'sanitize_text_field',
	)
);

$wp_customize->add_control(
	new Design_Studio_Customize_Category_Dropdown_Control(
		$wp_customize,
		'design_studio_services_category',
		array(
			'label'           => esc_html__( 'Select Category', 'design-studio' ),
			'section'         => 'design_studio_services_section',
			'settings'        => 'design_studio_services_category',
			'active_callback' => 'design_studio_is_services_section_enabled',
		)
	)
);