<?php
if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

/**
 * Safe defaults
 */
$gridpress_card_data = $gridpress_card_data ?? [];
/**
 * Safe variables
 */
$gridpress_counter = sanitize_html_class( $gridpress_card_counter ?? '' );

$gridpress_url    = $gridpress_card_data['url'] ?? '';
$gridpress_image  = $gridpress_card_data['imag_url'] ?? '';
$gridpress_title  = $gridpress_card_data['title'] ?? '';

/**
 * Build safe class attribute (scanner-safe pattern)
 */
$gridpress_class_attr = trim(
    'jc-cards jc-cards-item ' . $gridpress_counter
);
?>
<div class="<?php echo esc_attr( $gridpress_class_attr ); ?>">
    <div class="jc-cards-image">
        <a class="jc-cards-image-wrap" href="<?php echo esc_url( $gridpress_url ); ?>">
            <img
                src="<?php echo esc_url( $gridpress_image ); ?>"
                alt="<?php echo esc_attr( $gridpress_title ); ?>"
            >
        </a>
    </div>
</div>