<?php
// banner_2 固定单图+标题
if (!isset($banner) || !is_array($banner)) { $banner = array('images'=>array(), 'notice'=>''); }
$b2_images = isset($banner['images']) && is_array($banner['images']) ? $banner['images'] : array();
$b2_img = ''; $b2_url = '';
foreach ($b2_images as $b2_im) { if (isset($b2_im['img']) && $b2_im['img'] !== '') { $b2_img = $b2_im['img']; $b2_url = isset($b2_im['url']) ? $b2_im['url'] : ''; break; } }
$b2_notice = isset($banner['notice']) ? $banner['notice'] : '';
?>
<style>
.yk-banner2{position:relative;max-width:1200px;margin:0 auto;}
.yk-banner2 .yk-b2-box{position:relative;height:300px;overflow:hidden;border-radius:6px;}
.yk-banner2 .yk-b2-box img{width:100%;height:100%;object-fit:cover;display:block;}
.yk-banner2 .yk-b2-ph{width:100%;height:100%;background:linear-gradient(135deg,#3a1c5c 0%,#7a2f8e 60%,#c14b8a 100%);}
.yk-banner2 .yk-b2-mask{position:absolute;inset:0;background:rgba(10,8,30,.42);display:flex;flex-direction:column;align-items:center;justify-content:center;color:#fff;text-align:center;padding:0 20px;}
.yk-banner2 .yk-b2-title{font-size:30px;font-weight:700;letter-spacing:3px;margin-bottom:10px;}
.yk-banner2 .yk-b2-sub{font-size:14px;letter-spacing:2px;opacity:.9;max-width:640px;}
.yk-banner2 .yk-b2-line{width:56px;height:3px;background:#f0c94a;margin:14px auto 0;border-radius:2px;}
.yk-banner2 .yk-b2-notice{margin-top:12px;font-size:13px;color:#666;text-align:center;line-height:1.8;}
.yk-banner2 .yk-b2-notice b{color:#7a2f8e;margin-right:6px;}
@media (max-width:1199px){
  .yk-banner2{padding:0 16px;}
  .yk-banner2 .yk-b2-box{height:240px;}
  .yk-banner2 .yk-b2-title{font-size:24px;}
}
@media (max-width:767px){
  .yk-banner2{padding:0 10px;}
  .yk-banner2 .yk-b2-box{height:170px;}
  .yk-banner2 .yk-b2-title{font-size:18px;letter-spacing:1px;}
  .yk-banner2 .yk-b2-sub{font-size:12px;letter-spacing:1px;}
  .yk-banner2 .yk-b2-notice{font-size:12px;}
}
</style>
<div class="yk-banner2">
  <div class="yk-b2-box">
    <?php if ($b2_img !== '') { ?>
      <?php if ($b2_url !== '') { ?><a href="<?php echo e($b2_url); ?>"><?php } ?>
      <img src="<?php echo e($b2_img); ?>" alt="<?php echo e(site_config('company_name','')); ?>">
      <?php if ($b2_url !== '') { ?></a><?php } ?>
    <?php } else { ?>
      <div class="yk-b2-ph"></div>
    <?php } ?>
    <div class="yk-b2-mask">
      <div class="yk-b2-title"><?php echo e(site_config('company_name','炎酷CMS')); ?></div>
      <div class="yk-b2-sub"><?php echo e(site_config('slogan','专业 · 专注 · 值得信赖')); ?></div>
      <div class="yk-b2-line"></div>
    </div>
  </div>
  <?php if ($b2_notice !== '') { ?>
  <div class="yk-b2-notice"><b>[公告]</b><?php echo e($b2_notice); ?></div>
  <?php } ?>
</div>
