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

/**
 * Safe counter
 */
$gridpress_counter = absint( $gridpress_card_counter ?? 0 );

/**
 * Safe values
 */
$gridpress_url   = isset( $gridpress_card_data['url'] ) ? esc_url_raw( $gridpress_card_data['url'] ) : '';
$gridpress_image = isset( $gridpress_card_data['imag_url'] ) ? esc_url_raw( $gridpress_card_data['imag_url'] ) : '';
$gridpress_title = isset( $gridpress_card_data['title'] ) ? sanitize_text_field( $gridpress_card_data['title'] ) : '';

/**
 * Safe class (scanner-friendly)
 */
$gridpress_class_attr = sprintf(
    /* translators: %d: Grid item counter used in CSS class. */
    'jc-cards jc-cards-shape gridpress-item-%d',
    $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>