<?php

/**
 * Asset enqueuing functionality
 *
 * @package Sophia
 * @since 1.0.0
 */

// Prevent direct access
if (!defined('ABSPATH')) {
    exit;
}

if (!function_exists('sophia_enqueue_assets')) :
    /**
     * Enqueue front-end styles and scripts.
     *
     * @since 1.0
     * @return void
     */
    function sophia_enqueue_assets()
    {
        // Theme stylesheet
        wp_enqueue_style(
            'sophia-style',
            get_stylesheet_directory_uri() . '/style.css',
            array(),
            filemtime(get_theme_file_path('style.css'))
        );

        // Custom JavaScript (only if file exists)
        $js_file = get_theme_file_path('assets/js/custom.js');
        if (file_exists($js_file)) {
            wp_enqueue_script(
                'sophia-script',
                get_theme_file_uri('assets/js/custom.js'),
                array(),
                filemtime($js_file),
                true
            );
        }
    }
endif;

add_action('wp_enqueue_scripts', 'sophia_enqueue_assets');