/*
 Theme Name:   Neurofinance 
 Theme URI:    http://neurofinance.hu/
 Description:  Neurofinance Theme based on GeneratePress [child theme]
 Author:       Tom Usborne
 Author URI:   https://tomusborne.com
 Template:     generatepress
 Version:      0.1
*/

/**
 * Check for no-js
 */
add_action( 'wp_head', 'my_child_theme_js_detection_script', 0 );
function my_child_theme_js_detection_script() {
    ?>
    <script>
    document.documentElement.className = document.documentElement.className.replace( /\bno-js\b/, 'js' );
    </script>
    <?php
}


/**
 * 1. Register the "Large Screen" (2K) image size
 */
add_action( 'after_setup_theme', function() {
    // Name: large-screen, Width: 2560, Height: 1440, Crop: false (proportional)
    add_image_size( 'large-screen', 2560, 1440, false );
});

/**
 * 2. Make the "Large Screen" size selectable in the Block Editor / GenerateBlocks
 */
add_filter( 'image_size_names_choose', function( $sizes ) {
    return array_merge( $sizes, array(
        'large-screen' => __( 'Large Screen (2560px)', 'your-text-domain' ),
    ) );
});

/**
 * 3. Increase the "Big Image Threshold" 
 * WordPress normally scales everything down to 2560px automatically.
 * We increase this to 3000px to ensure your original 2560px uploads 
 * are kept at high quality and not "double-processed."
 */
add_filter( 'big_image_size_threshold', function( $threshold ) {
    return 3000; 
});