<?php
define('VS_INCLUDED',true);
require_once 'includes/config.php';
try{
  $hero   = db()->query("SELECT * FROM vs_hero_slides WHERE status='active' ORDER BY sort_order LIMIT 1")->fetch(PDO::FETCH_ASSOC);
  $prods  = db()->query("SELECT p.*,c.name cat_name,c.id cat_id FROM vs_products p LEFT JOIN vs_categories c ON p.category_id=c.id WHERE p.status='active' ORDER BY p.featured DESC,p.sort_order LIMIT 12")->fetchAll(PDO::FETCH_ASSOC);
  $cats   = db()->query("SELECT c.*,(SELECT COUNT(*) FROM vs_products WHERE category_id=c.id AND status='active') cnt FROM vs_categories c ORDER BY sort_order")->fetchAll(PDO::FETCH_ASSOC);
  $news   = db()->query("SELECT * FROM vs_news WHERE status='active' ORDER BY created_at DESC LIMIT 4")->fetchAll(PDO::FETCH_ASSOC);
  $feat   = array_filter($prods,fn($p)=>$p['featured']);
  $spotlight = array_values($feat)[0] ?? ($prods[0] ?? null);
}catch(Exception $e){$hero=null;$prods=[];$cats=[];$news=[];$spotlight=null;}
include 'includes/header.php';
?>

<!-- ═══════════════ HERO ═══════════════ -->
<section class="hero">
  <div class="hero-media">
    <?php if($hero&&$hero['video_url']): ?>
    <video class="hero-vid" autoplay muted loop playsinline>
      <source src="<?=clean($hero['video_url'])?>" type="video/mp4">
    </video>
    <?php elseif($hero&&$hero['image']): ?>
    <img class="hero-img" src="/volker/assets/uploads/<?=clean($hero['image'])?>" alt="Hero">
    <?php else: ?>
    <div class="hero-fallback"></div>
    <?php endif; ?>
  </div>
  <div class="hero-grid"></div>
  <div class="hero-scan"></div>
  <div class="hero-overlay"></div>
  <div class="hero-overlay-bot"></div>

  <div class="hero-body">
    <div class="hero-text">
      <div class="hero-eyebrow" data-sr>
        <span class="hero-eyebrow-badge">VS-2024</span>
        <span class="hero-eyebrow-line"><?=clean(setting('hero_badge','Türkiye\'nin Güvenilir Savunma Tedarikçisi'))?></span>
      </div>
      <h1 class="hero-h1" data-sr data-d="1">
        <?=clean(setting('hero_line1','GÜÇLÜ'))?>
        <span class="line2"><?=clean(setting('hero_line2','GÜVENİLİR'))?></span>
        <span class="line3"><?=clean(setting('hero_line3','HAZIR'))?></span>
      </h1>
      <p class="hero-sub" data-sr data-d="2">
        <?=clean(setting('hero_subtitle','Akü takviye sistemlerinden taktik ekipmanlara — sahada fark yaratan profesyonel çözümler.'))?>
      </p>
      <div class="hero-btns" data-sr data-d="3">
        <a href="/volker/urunler.php" class="btn btn-primary btn-lg">
          Ürün Kataloğu
          <span class="btn-arrow"><svg width="14" height="14" fill="none" stroke="currentColor" stroke-width="2.5" viewBox="0 0 24 24"><path d="M5 12h14M12 5l7 7-7 7"/></svg></span>
        </a>
        <a href="/volker/iletisim.php" class="btn btn-outline btn-lg">Teklif İste</a>
      </div>
    </div>
    <div class="hero-scroll" data-sr data-d="4">
      <div class="hero-scroll-bar"></div>
      <span class="hero-scroll-txt">Aşağı kaydır</span>
    </div>
  </div>

  <div class="hero-stats" data-sr>
    <div class="hero-stats-grid">
      <div class="h-stat">
        <div class="h-stat-n"><span data-count="<?=intval(setting('stats_products','50'))?>"><?=setting('stats_products','50')?></span><em>+</em></div>
        <div class="h-stat-l">Ürün Çeşidi</div>
      </div>
      <div class="h-stat">
        <div class="h-stat-n"><span data-count="<?=intval(setting('stats_clients','120'))?>"><?=setting('stats_clients','120')?></span></div>
        <div class="h-stat-l">Kurumsal Müşteri</div>
      </div>
      <div class="h-stat">
        <div class="h-stat-n"><span data-count="<?=intval(setting('stats_years','10'))?>"><?=setting('stats_years','10')?></span><em>+</em></div>
        <div class="h-stat-l">Yıllık Deneyim</div>
      </div>
      <div class="h-stat">
        <div class="h-stat-n"><span data-count="<?=intval(setting('stats_projects','500'))?>"><?=setting('stats_projects','500')?></span><em>+</em></div>
        <div class="h-stat-l">Tamamlanan Proje</div>
      </div>
    </div>
  </div>
</section>

<!-- ═══════════════ MARQUEE (red bar) ═══════════════ -->
<div class="marquee">
  <div class="marquee-track">
    <?php $items=['AKÜ TAKVİYE SİSTEMLERİ','TAKTİK EL FENERLERİ','GÜÇ İSTASYONLARI','ARAÇ EKİPMANLARI','ENDÜSTRİYEL ÇÖZÜMLER','SAVUNMA TEKNOLOJİLERİ','HIZLI TESLİMAT','PROFESYONELSERVİS'];
    $rep=array_merge($items,$items,$items,$items);
    foreach($rep as $it): ?><div class="mq-item"><span class="mq-dot"></span><?=$it?></div><?php endforeach; ?>
  </div>
</div>

<!-- ═══════════════ CATEGORIES ═══════════════ -->
<?php if(!empty($cats)): ?>
<section class="section" style="background:var(--ink2);padding-top:100px;padding-bottom:0;">
  <div class="wrap" style="margin-bottom:40px;" data-sr>
    <span class="eyebrow">Kategoriler <span class="eyebrow-num">04</span></span>
    <h2 style="font-size:clamp(40px,6vw,72px);">Ürün Kategorileri</h2>
  </div>
  <div class="cat-panels" data-sr>
    <?php foreach(array_slice($cats,0,4) as $cat): ?>
    <a href="/volker/urunler.php?kategori=<?=clean($cat['slug'])?>" class="cat-panel">
      <div class="cat-panel-bg" style="background:linear-gradient(135deg,var(--ink4) 0%,var(--ink3) 100%);"></div>
      <div class="cat-panel-grad"></div>
      <div class="cat-panel-body">
        <div class="cat-panel-tag">Kategori · <?=$cat['cnt']?> ürün</div>
        <div class="cat-panel-name"><?=clean($cat['name'])?></div>
        <?php if($cat['description']): ?><div class="cat-panel-count"><?=clean(mb_substr($cat['description'],0,60))?></div><?php endif; ?>
      </div>
      <div class="cat-panel-btn">
        <svg width="16" height="16" fill="none" stroke="#fff" stroke-width="2.5" viewBox="0 0 24 24"><path d="M5 12h14M12 5l7 7-7 7"/></svg>
      </div>
    </a>
    <?php endforeach; ?>
  </div>
</section>
<?php endif; ?>

<!-- ═══════════════ CTA ═══════════════ -->
<section class="cta-band">
  <div class="cta-band-bg"></div>
  <div class="cta-band-grid"></div>
  <div class="cta-inner" data-sr>
    <div>
      <h2 class="cta-h">Profesyonel Çözüm<em>İçin Hazır mısınız?</em></h2>
      <p class="cta-p">Uzman ekibimiz ihtiyaçlarınızı değerlendirip size özel teklif sunsun. Hemen iletişime geçin.</p>
    </div>
    <div class="cta-btns">
      <a href="/volker/iletisim.php" class="btn btn-primary btn-lg">
        Teklif İste
        <span class="btn-arrow"><svg width="14" height="14" fill="none" stroke="currentColor" stroke-width="2.5" viewBox="0 0 24 24"><path d="M5 12h14M12 5l7 7-7 7"/></svg></span>
      </a>
      <a href="/volker/urunler.php" class="btn btn-outline">Ürün Kataloğu</a>
    </div>
  </div>
</section>

<!-- ═══════════════ PRODUCT SPOTLIGHT (NOCO style full-bleed) ═══════════════ -->
<?php if($spotlight): $sp_specs=[];if($spotlight['specs']){$d=json_decode($spotlight['specs'],true);if(is_array($d))$sp_specs=array_slice($d,0,4);} ?>
<section style="padding:0;">
  <div class="prod-spotlight" data-sr>
    <div class="prod-spotlight-media">
      <?php if($spotlight['image']): ?>
      <img class="prod-spotlight-img" src="/volker/assets/uploads/<?=clean($spotlight['image'])?>" alt="<?=clean($spotlight['name'])?>">
      <?php else: ?>
      <div class="prod-spotlight-ph">
        <svg width="100" height="100" fill="none" stroke="currentColor" stroke-width=".4" viewBox="0 0 24 24" style="opacity:.06"><rect x="3" y="3" width="18" height="18" rx="1"/><circle cx="8.5" cy="8.5" r="1.5"/><path d="M21 15l-5-5L5 21"/></svg>
      </div>
      <?php endif; ?>
      <div class="prod-spot-overlay"></div>
    </div>
    <div class="prod-spotlight-body">
      <div class="prod-spotlight-num">01</div>
      <div class="prod-spotlight-cat"><?=clean($spotlight['cat_name']??'Öne Çıkan')?></div>
      <h2 class="prod-spotlight-name"><?=clean($spotlight['name'])?></h2>
      <p class="prod-spotlight-desc"><?=clean(mb_substr($spotlight['short_desc']??'',0,160))?></p>
      <?php if(!empty($sp_specs)): ?>
      <div class="prod-spotlight-specs">
        <?php foreach($sp_specs as $k=>$v): ?>
        <div class="ps-spec"><span class="ps-spec-k"><?=clean($k)?></span><span class="ps-spec-v"><?=clean($v)?></span></div>
        <?php endforeach; ?>
      </div>
      <?php endif; ?>
      <div style="display:flex;gap:12px;flex-wrap:wrap;">
        <a href="/volker/urun.php?slug=<?=clean($spotlight['slug'])?>" class="btn btn-primary">
          Ürün Detayı
          <span class="btn-arrow"><svg width="14" height="14" fill="none" stroke="currentColor" stroke-width="2.5" viewBox="0 0 24 24"><path d="M5 12h14M12 5l7 7-7 7"/></svg></span>
        </a>
        <a href="/volker/iletisim.php?urun=<?=urlencode($spotlight['name'])?>" class="btn btn-outline">Teklif İste</a>
      </div>
    </div>
  </div>
</section>
<?php endif; ?>

<!-- ═══════════════ PRODUCT GRID ═══════════════ -->
<section class="section" style="background:var(--ink2);">
  <div class="wrap">
    <div style="display:flex;align-items:flex-end;justify-content:space-between;margin-bottom:52px;" data-sr>
      <div>
        <span class="eyebrow">Ürün Kataloğu <span class="eyebrow-num">02</span></span>
        <h2 style="font-size:clamp(40px,6vw,72px);">Tüm Ürünler</h2>
        <p style="font-size:15px;color:var(--white3);margin-top:12px;max-width:460px;line-height:1.7;">Sahada test edilmiş, güvenilirliği kanıtlanmış ekipmanlar.</p>
      </div>
      <a href="/volker/urunler.php" class="btn btn-outline">
        Kataloğu Gör
        <svg width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M5 12h14M12 5l7 7-7 7"/></svg>
      </a>
    </div>

    <?php if(!empty($cats)): ?>
    <div style="display:flex;gap:4px;flex-wrap:wrap;margin-bottom:44px;" data-sr>
      <button class="btn btn-primary ftab act" data-cat="all" style="font-size:11px;padding:9px 18px;">Tümü</button>
      <?php foreach($cats as $cat): ?>
      <button class="btn btn-outline ftab" data-cat="<?=clean($cat['id'])?>" style="font-size:11px;padding:9px 18px;"><?=clean($cat['name'])?></button>
      <?php endforeach; ?>
    </div>
    <?php endif; ?>

    <div class="pcard-grid" data-sr>
      <?php if(empty($prods)): ?>
      <div style="grid-column:1/-1;background:var(--ink3);padding:80px;text-align:center;color:var(--white4);">
        <p style="font-family:var(--mono);font-size:11px;letter-spacing:.12em;">HENÜZ ÜRÜN EKLENMEMİŞ</p>
      </div>
      <?php else: foreach($prods as $i=>$p): ?>
      <div class="pcard" data-cat="<?=clean($p['category_id']??'')?>">
        <div class="pcard-media">
          <?php if($p['image']): ?><img class="pcard-img" src="/volker/assets/uploads/<?=clean($p['image'])?>" alt="<?=clean($p['name'])?>">
          <?php else: ?><div class="pcard-ph"><svg width="56" height="56" fill="none" stroke="currentColor" stroke-width=".6" viewBox="0 0 24 24" style="opacity:.08"><rect x="3" y="3" width="18" height="18" rx="1"/><circle cx="8.5" cy="8.5" r="1.5"/><path d="M21 15l-5-5L5 21"/></svg></div><?php endif; ?>
          <span class="pcard-badge"><?=str_pad($i+1,2,'0',STR_PAD_LEFT)?></span>
          <?php if($p['featured']): ?><span class="pcard-tag">Öne Çıkan</span><?php endif; ?>
          <div class="pcard-hover">
            <a href="/volker/urun.php?slug=<?=clean($p['slug'])?>" class="btn btn-primary" style="padding:12px 24px;font-size:12px;">İncele</a>
          </div>
        </div>
        <div class="pcard-body">
          <div class="pcard-cat"><?=clean($p['cat_name']??'Ürün')?></div>
          <div class="pcard-name"><?=clean($p['name'])?></div>
          <div class="pcard-desc"><?=clean(mb_substr($p['short_desc']??'',0,80))?></div>
          <div class="pcard-foot">
            <a href="/volker/urun.php?slug=<?=clean($p['slug'])?>" class="pcard-cta">
              Detaylar
              <svg width="12" height="12" fill="none" stroke="currentColor" stroke-width="2.5" viewBox="0 0 24 24"><path d="M5 12h14M12 5l7 7-7 7"/></svg>
            </a>
            <a href="/volker/urun.php?slug=<?=clean($p['slug'])?>" class="pcard-arrow">
              <svg width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M5 12h14M12 5l7 7-7 7"/></svg>
            </a>
          </div>
        </div>
      </div>
      <?php endforeach; endif; ?>
    </div>
  </div>
</section>

<!-- ═══════════════ WHY VOLKER ═══════════════ -->
<section style="padding:0;">
  <div class="why-grid" data-sr>
    <div class="why-visual">
      <div class="why-visual-bg"></div>
      <div class="why-visual-inner">
        <div class="why-big-v">V</div>
        <div class="why-visual-tagline">SAVUNMA TEKNOLOJİLERİ</div>
      </div>
    </div>
    <div class="why-content">
      <span class="eyebrow">Neden Volker <span class="eyebrow-num">03</span></span>
      <h2 style="font-size:clamp(36px,5vw,60px);">Güvenin Tek<br>Adresi</h2>
      <p style="font-size:15px;color:var(--white3);line-height:1.75;margin-top:16px;"><?=clean(setting('about_text','VOLKER SAVUNMA, profesyonel savunma ekipmanı tedarikinde 10 yılı aşkın deneyimiyle Türkiye\'nin en güvenilir çözüm ortağıdır.'))?></p>
      <div class="why-feats">
        <div class="why-feat">
          <div class="why-icon"><svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/></svg></div>
          <div class="why-feat-txt"><h4>Askeri Sınıf Kalite</h4><p>Tüm ürünler uluslararası askeri standartta test edilmiş ve sertifikalandırılmıştır.</p></div>
        </div>
        <div class="why-feat">
          <div class="why-icon"><svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M13 2L3 14h9l-1 8 10-12h-9l1-8z"/></svg></div>
          <div class="why-feat-txt"><h4>Hızlı Teslimat</h4><p>Türkiye genelinde stoktan anında teslimat ile operasyonel sürekliliğinizi güvenceye alırız.</p></div>
        </div>
        <div class="why-feat">
          <div class="why-icon"><svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="M12 8v4l3 3"/></svg></div>
          <div class="why-feat-txt"><h4>7/24 Teknik Destek</h4><p>Uzman kadromuz her an yanınızda. Teknik danışmanlık ve satış sonrası hizmet garantisi.</p></div>
        </div>
        <div class="why-feat">
          <div class="why-icon"><svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M9 12l2 2 4-4"/><path d="M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/></svg></div>
          <div class="why-feat-txt"><h4>Sertifikalı Tedarikçi</h4><p>ISO belgeli tedarik süreçleri ve şeffaf iş ortaklığı ile tam güven sağlıyoruz.</p></div>
        </div>
      </div>
    </div>
  </div>
</section>

<!-- ═══════════════ NUMBERS ═══════════════ -->
<div class="numbers-band" data-sr>
  <div class="numbers-inner">
    <div class="nb-item"><div class="nb-val"><?=setting('stats_products','50')?>+</div><div class="nb-label">Ürün Çeşidi</div></div>
    <div class="nb-item"><div class="nb-val"><?=setting('stats_clients','120')?></div><div class="nb-label">Kurumsal Müşteri</div></div>
    <div class="nb-item"><div class="nb-val"><?=setting('stats_years','10')?>+</div><div class="nb-label">Yıllık Deneyim</div></div>
    <div class="nb-item"><div class="nb-val"><?=setting('stats_projects','500')?>+</div><div class="nb-label">Tamamlanan Proje</div></div>
  </div>
</div>

<!-- ═══════════════ NEWS ═══════════════ -->
<?php if(!empty($news)): ?>
<section class="section" style="background:var(--ink);">
  <div class="wrap" style="margin-bottom:48px;" data-sr>
    <div style="display:flex;align-items:flex-end;justify-content:space-between;">
      <div>
        <span class="eyebrow">Haberler <span class="eyebrow-num">05</span></span>
        <h2 style="font-size:clamp(36px,5vw,64px);">Son Gelişmeler</h2>
      </div>
    </div>
  </div>
  <div class="wrap" data-sr>
    <div class="news-layout">
      <?php $n=$news[0]; ?>
      <div class="news-hero">
        <?php if($n['image']): ?><img class="news-hero-img" src="/volker/assets/uploads/<?=clean($n['image'])?>" alt="<?=clean($n['title'])?>">
        <?php else: ?><div class="news-hero-ph"><svg width="48" height="48" fill="none" stroke="currentColor" stroke-width=".7" viewBox="0 0 24 24" style="opacity:.1"><rect x="3" y="3" width="18" height="18" rx="1"/></svg></div><?php endif; ?>
        <div class="news-hero-body">
          <div class="news-date"><?=date('d.m.Y',strtotime($n['created_at']))?></div>
          <h3 class="news-hero-ttl"><?=clean($n['title'])?></h3>
          <p class="news-hero-ex"><?=clean(mb_substr($n['excerpt']??'',0,180))?></p>
        </div>
      </div>
      <div class="news-list">
        <?php foreach(array_slice($news,1) as $row): ?>
        <div class="news-row">
          <div class="news-row-date"><?=date('d.m.Y',strtotime($row['created_at']))?></div>
          <div class="news-row-ttl"><?=clean($row['title'])?></div>
        </div>
        <?php endforeach; ?>
      </div>
    </div>
  </div>
</section>
<?php endif; ?>

<!-- ═══════════════ CONTACT STRIP ═══════════════ -->
<div class="cstrip" data-sr>
  <div class="cstrip-inner">
    <a href="tel:<?=clean(setting('contact_phone','+903120000000'))?>" class="cstrip-item">
      <div class="cstrip-ico"><svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M22 16.92v3a2 2 0 01-2.18 2 19.79 19.79 0 01-8.63-3.07A19.5 19.5 0 014.69 13a19.79 19.79 0 01-3.07-8.67A2 2 0 013.6 2h3a2 2 0 012 1.72 12.84 12.84 0 00.7 2.81 2 2 0 01-.45 2.11L8.09 9.91a16 16 0 006 6l1.27-1.27a2 2 0 012.11-.45 12.84 12.84 0 002.81.7A2 2 0 0122 16.92z"/></svg></div>
      <div><div class="cstrip-lbl">Telefon</div><div class="cstrip-val"><?=clean(setting('contact_phone','+90 312 000 00 00'))?></div></div>
    </a>
    <a href="mailto:<?=clean(setting('contact_email','info@volkersavunma.com'))?>" class="cstrip-item">
      <div class="cstrip-ico"><svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"/><polyline points="22,6 12,13 2,6"/></svg></div>
      <div><div class="cstrip-lbl">E-Posta</div><div class="cstrip-val"><?=clean(setting('contact_email','info@volkersavunma.com'))?></div></div>
    </a>
    <div class="cstrip-item">
      <div class="cstrip-ico"><svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0118 0z"/><circle cx="12" cy="10" r="3"/></svg></div>
      <div><div class="cstrip-lbl">Adres</div><div class="cstrip-val"><?=clean(setting('contact_address','Ankara, Türkiye'))?></div></div>
    </div>
  </div>
</div>

<?php include 'includes/footer.php'; ?>
