<?php
/**
 * CloudForge Theme - Case List
 */
$pageDescription = '成功案例展示 - ' . SITE_NAME;
$breadcrumbItems = [['title' => '成功案例']];
?>
<?php echo breadcrumb($breadcrumbItems); ?>

<div class="main-content">
    <div class="container">
        <div class="section-header">
            <span class="section-label">// CASES</span>
            <h2 class="section-title">成功案例</h2>
        </div>

        <?php if (empty($cases)): ?>
        <div class="empty-state">
            <svg width="48" height="48" viewBox="0 0 48 48" fill="none" opacity="0.3"><rect x="8" y="12" width="32" height="28" rx="2" stroke="currentColor" stroke-width="1.5"/><path d="M16 12V8h16v4" stroke="currentColor" stroke-width="1.5"/></svg>
            <p>暂无案例</p>
        </div>
        <?php else: ?>
        <div class="case-grid case-grid--full">
            <?php foreach ($cases as $c): ?>
            <article class="case-card">
                <a href="<?php echo cms_url('case', ['slug' => $c['slug']]); ?>">
                    <div class="case-card-image">
                        <?php if ($c['cover_image']): ?>
                        <img src="<?php echo $c['cover_image']; ?>" alt="<?php echo xss_clean($c['title']); ?>" loading="lazy">
                        <?php else: ?>
                        <div class="case-card-placeholder"></div>
                        <?php endif; ?>
                    </div>
                    <div class="case-card-body">
                        <?php if ($c['client_name']): ?>
                        <span class="case-card-client"><?php echo xss_clean($c['client_name']); ?></span>
                        <?php endif; ?>
                        <h3 class="case-card-title"><?php echo xss_clean($c['title']); ?></h3>
                        <p class="case-card-desc"><?php echo xss_clean(str_cut($c['summary'], 80)); ?></p>
                        <span class="case-card-link">
                            查看详情
                            <svg width="14" height="14" viewBox="0 0 16 16" fill="none"><path d="M3 8h10M9 4l4 4-4 4" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>
                        </span>
                    </div>
                </a>
            </article>
            <?php endforeach; ?>
        </div>
        <?php endif; ?>
    </div>
</div>
