<?php
/**
 * Catalog lot-card gallery controls (arrows, dots, image counter).
 *
 * Shared by the catalog grid (templates/main/auction.php) and the lot widget
 * (templates/widgets/_lot.php) so both behave identically.
 *
 * Deliberately rendered OUTSIDE the card's <a> wrapper: buttons nested inside an
 * anchor are invalid HTML and, in several browsers, activate the link. The
 * wrapping .bp-lot-gallery element is the positioning context.
 *
 * @var int $bpCount Number of images in this card's gallery.
 */

if (!defined('ABSPATH')) {
    exit;
}

$bpCount = isset($bpCount) ? (int) $bpCount : 0;
if ($bpCount < 2) {
    return;
}
?>
<button type="button" class="bp-lot-gallery__nav bp-lot-gallery__nav--prev"
        aria-label="<?= esc_attr__('Previous image', 'auctionforge') ?>">
    <span aria-hidden="true">&#8249;</span>
</button>
<button type="button" class="bp-lot-gallery__nav bp-lot-gallery__nav--next"
        aria-label="<?= esc_attr__('Next image', 'auctionforge') ?>">
    <span aria-hidden="true">&#8250;</span>
</button>
<div class="bp-lot-gallery__dots">
    <?php for ($bpI = 0; $bpI < $bpCount; $bpI++) { ?>
        <button type="button"
                class="bp-lot-gallery__dot<?= $bpI === 0 ? ' is-active' : '' ?>"
                data-bp-goto="<?= (int) $bpI ?>"
                aria-label="<?= esc_attr(sprintf(__('Show image %d', 'auctionforge'), $bpI + 1)) ?>"></button>
    <?php } ?>
</div>
<span class="bp-lot-gallery__count" aria-hidden="true"><?= (int) $bpCount ?></span>
