<?php
/**
 * Codex Theme 2026 (Twenty Twenty-Five child theme) functions.
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Enqueue parent + child styles.
 *
 * Block themes mainly use theme.json, but the parent may still ship CSS in style.css.
 */
add_action( 'wp_enqueue_scripts', function () {

	$parent_handle = 'twentytwentyfive-parent-style';
	$parent_path   = get_template_directory() . '/style.css';

	if ( file_exists( $parent_path ) ) {
		wp_enqueue_style(
			$parent_handle,
			get_template_directory_uri() . '/style.css',
			[],
			wp_get_theme( get_template() )->get( 'Version' )
		);
	}

	wp_enqueue_style(
		'codex-theme-2026-style',
		get_stylesheet_uri(),
		file_exists( $parent_path ) ? [ $parent_handle ] : [],
		wp_get_theme()->get( 'Version' )
	);

}, 20 );
