<?php $page_class = 'page-home'; include __DIR__ . '/_header.php'; ?>
<section class="hero-block">
    <div class="container hero-grid">
        <div class="hero-copy">
            <span class="eyebrow">WELCOME</span>
            <h1><?php echo htmlspecialchars($tplSiteName); ?></h1>
            <p><?php echo htmlspecialchars(tplv(isset($siteConfig) ? $siteConfig : array(), 'site_description', '')); ?></p>
            <div class="hero-actions">
                <a class="btn btn-primary" href="/public/index.php?m=product">查看产品</a>
                <a class="btn btn-outline" href="/public/index.php?m=guestbook">立即咨询</a>
            </div>
        </div>
        <div class="hero-panel">
            <div class="metric-card"><strong><?php echo count(isset($latestProducts) && is_array($latestProducts) ? $latestProducts : array()); ?></strong><span>推荐产品</span></div>
            <div class="metric-card"><strong><?php echo count(isset($latestArticles) && is_array($latestArticles) ? $latestArticles : array()); ?></strong><span>最新资讯</span></div>
            <div class="metric-card"><strong><?php echo count(isset($channels) && is_array($channels) ? $channels : array()); ?></strong><span>网站栏目</span></div>
        </div>
    </div>
</section>
<?php if (!empty($slides)) { ?>
<section class="section-block muted-block"><div class="container card-grid cols-3"><?php foreach ($slides as $slide) { ?><article class="show-card"><div class="show-thumb"><?php echo getLitpicHtml(tplv($slide, 'litpic'), tplv($slide, 'title')); ?></div><div class="show-body"><h3><?php echo htmlspecialchars(tplv($slide, 'title')); ?></h3><p><?php echo htmlspecialchars(tplv($slide, 'link')); ?></p></div></article><?php } ?></div></section>
<?php } ?>
<section class="section-block"><div class="container"><div class="section-head"><span>Product</span><h2>产品中心</h2></div><div class="card-grid cols-4"><?php foreach ((isset($latestProducts) && is_array($latestProducts) ? $latestProducts : array()) as $row) { $desc = tplv($row, 'summary'); if ($desc === '') $desc = tplv($row, 'content'); ?><article class="show-card"><div class="show-thumb"><?php echo getLitpicHtml(tplv($row, 'litpic'), tplv($row, 'title')); ?></div><div class="show-body"><h3><a href="<?php echo tpl_url('product', $row); ?>"><?php echo htmlspecialchars(tplv($row, 'title')); ?></a></h3><p><?php echo htmlspecialchars(tpl_excerpt($desc, 72)); ?></p></div></article><?php } ?></div></div></section>
<section class="section-block"><div class="container"><div class="section-head"><span>News</span><h2>新闻资讯</h2></div><div class="news-stack"><?php foreach ((isset($latestArticles) && is_array($latestArticles) ? $latestArticles : array()) as $row) { $desc = tplv($row, 'summary'); if ($desc === '') $desc = tplv($row, 'content'); ?><article class="news-row"><div class="news-date"><strong><?php echo date('d', intval(tplv($row, 'create_time', time()))); ?></strong><span><?php echo date('M', intval(tplv($row, 'create_time', time()))); ?></span></div><div class="news-copy"><h3><a href="<?php echo tpl_url('article', $row); ?>"><?php echo htmlspecialchars(tplv($row, 'title')); ?></a></h3><p><?php echo htmlspecialchars(tpl_excerpt($desc, 96)); ?></p></div></article><?php } ?></div></div></section>
<?php include __DIR__ . '/_footer.php'; ?>
