<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

/** @var \Magento\Review\Block\Product\ReviewRenderer $block */
?>
<?php if ($block->isReviewEnabled() && $block->getReviewsCount()) : ?>
    <?php $rating = $block->getRatingSummary(); ?>
    <div class="product-reviews-summary<?= !$rating ? ' no-rating' : '' ?>">
        <?php if ($rating) :?>
        <span class="rating-summary">
             <span class="rating-result" title="<?= $block->escapeHtmlAttr($rating); ?>%">
                 <span class="cdz-amp-rating-summary">
                    <span title="<?= $block->escapeHtmlAttr($rating); ?>%" class="cdz-rating-result">
                        <span style="width:<?= $block->escapeHtmlAttr($rating); ?>%"></span>
                    </span>
                </span>
             </span>
             <span class="rating-score"><?= 5 * ((float)$rating/100) ?></span>
         </span>
        <?php endif;?>
        <a class="review-action view" href="#" on="tap: cdz-details-accordion.expand(section=section-details-reviews), section-details-reviews.scrollTo(duration=200)">
            <span><?= $block->escapeHtml($block->getReviewsCount()) ?></span>&nbsp;
            <span><?= ($block->getReviewsCount() == 1) ? $block->escapeHtml(__('Review')) : $block->escapeHtml(__('Reviews')) ?></span>
        </a>
    </div>
<?php elseif ($block->isReviewEnabled() && $block->getDisplayIfEmpty()) : ?>
    <div class="product-reviews-summary empty">
        <a class="review-action view add" href="#" role="button" on="tap: cdz-details-accordion.expand(section=section-details-reviews), section-details-reviews.scrollTo(duration=200)">
            <?= $block->escapeHtml(__('Be the first to review this product')) ?>
        </a>
    </div>
<?php endif; ?>
