<?php
// Never close the PHP tag in functions.php to avoid stray output.

// Enqueue child + calendar assets AFTER Astra so overrides win.
add_action('wp_enqueue_scripts', function () {

  // Child theme main stylesheet
  wp_enqueue_style(
    'astra-child-style',
    get_stylesheet_uri(),
    array('astra-theme-css'),
    '1.0.0'
  );

  // Calendar styles (if file exists)
  $cal_css = get_stylesheet_directory() . '/studiox-calendar.css';
  if (file_exists($cal_css)) {
    wp_enqueue_style(
      'studiox-calendar',
      get_stylesheet_directory_uri() . '/studiox-calendar.css',
      array(),
      '1.0.0'
    );
  }

  // Calendar script (if file exists)
  $cal_js = get_stylesheet_directory() . '/studiox-calendar.js';
  if (file_exists($cal_js)) {
    wp_enqueue_script(
      'studiox-calendar',
      get_stylesheet_directory_uri() . '/studiox-calendar.js',
      array('jquery'),
      '1.0.0',
      true
    );
  }
}, 15);
