<?php
require_once 'config/config.php';
require_once 'includes/functions.php';
startSecureSession();

$pageTitle = 'API 6A & 6D Certified Industrial Equipment Supplier Pakistan';
$metaDesc = "Rig N Dig is Pakistan's premier supplier of API 6A/6D standard industrial equipment, flanges, valves, wellhead components, and precision workshop services. Strategic sourcing from USA, Europe, and Asia.";
$pageKeywords = "API 6A Flanges, API 6D Valves, Wellhead Equipment Pakistan, Oilfield Supplies, Precision Machining Islamabad, Industrial Sourcing USA, Industrial Rig Spares";

// Featured Products
$featured = Database::fetchAll(
    "SELECT p.*, c.name as category_name FROM products p
     LEFT JOIN categories c ON p.category_id = c.id
     WHERE p.is_featured = 1 AND p.is_active = 1
     ORDER BY p.created_at DESC LIMIT 6"
);

// Categories
$categories = Database::fetchAll("SELECT * FROM categories WHERE is_active=1 ORDER BY sort_order ASC LIMIT 8");

// Testimonials
$testimonials = Database::fetchAll("SELECT * FROM testimonials WHERE is_active=1 ORDER BY id DESC LIMIT 4");

// Stats for counter
$stats = [
    ['number' => 16, 'suffix' => '+', 'label' => 'Years of Precision'],
    ['number' => 5000, 'suffix' => '+', 'label' => 'Technical Assets'],
    ['number' => 120, 'suffix' => '+', 'label' => 'Global Principals'],
    ['number' => 98, 'suffix' => '%', 'label' => 'Technical Accuracy'],
];

include 'includes/header.php';
?>

<?php
$heroBg = setting('hero_background');
$heroBgStyle = '';
if (!empty($heroBg)) {
    $heroBgUrl = (strpos($heroBg, 'http') === 0) ? $heroBg : '/uploads/' . $heroBg;
    $heroBgStyle = ' style="background: linear-gradient(rgba(10, 15, 30, 0.85), rgba(10, 15, 30, 0.85)), url(\'' . e($heroBgUrl) . '\') no-repeat center center; background-size: cover;"';
}
?>
<!-- ── HERO: THE INDUSTRIAL EDGE ─────────────────────────── -->
<section class="hero-section relative min-h-[75vh] lg:min-h-[95vh] flex items-center overflow-hidden py-16 lg:py-0"<?= $heroBgStyle ?>>
  <!-- Glowing HUD Background Elements -->
  <div class="hud-grid"></div>
  <div class="glow-orb-orange top-10 left-10 animate-pulse-soft"></div>
  <div class="glow-orb-blue bottom-10 right-20 animate-float"></div>
  <div class="hero-grid-lines"></div>
  <canvas id="hero-canvas"></canvas>

  <div class="relative z-10 max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
    <div class="grid grid-cols-1 lg:grid-cols-2 gap-12 lg:gap-16 items-center">
      <div class="fade-in flex flex-col items-center lg:items-start text-center lg:text-left">
        <div class="inline-flex items-center gap-2 px-4 py-1.5 rounded-full bg-orange-600/10 border border-orange-600/20 text-orange-500 text-[10px] font-black uppercase tracking-widest mb-6">
          <span class="relative flex h-2 w-2">
            <span class="animate-ping absolute inline-flex h-full w-full rounded-full bg-orange-400 opacity-75"></span>
            <span class="relative inline-flex rounded-full h-2 w-2 bg-orange-500"></span>
          </span>
          Industrial Excellence Since 2008
        </div>
        
        <h1 class="text-4xl sm:text-6xl lg:text-7xl font-black font-display leading-[1.1] mb-6 lg:mb-8 tracking-tight">
          <span class="text-white block"><?= e(setting('hero_title_line1', 'HEAVY INDUSTRIAL')) ?></span>
          <span class="text-orange-500 text-glow block"><?= e(setting('hero_title_line2', 'EQUIPMENT & SPARES')) ?></span>
          <span class="text-white block text-2xl sm:text-3xl lg:text-4xl opacity-90 mt-2"><?= e(setting('hero_title_line3', 'FOR MULTI-SECTOR CRITICAL OPERATIONS')) ?></span>
        </h1>
        
        <p class="text-gray-400 text-sm sm:text-base lg:text-lg leading-relaxed mb-8 lg:mb-10 max-w-xl mx-auto lg:mx-0 font-medium">
          <?= e(setting('hero_description', "Rig N Dig is Pakistan's premier partner for certified plant components, heavy machinery spares, and custom engineering. We deliver precision solutions for Oil & Gas, Batching Plants, Asphalt Works, Mining, and Power infrastructure.")) ?>
        </p>
        
        <div class="flex flex-wrap justify-center lg:justify-start gap-4 mb-10 lg:mb-12">
          <a href="/shop.php" class="btn-primary group relative overflow-hidden px-8 py-4 text-[10px] sm:text-sm font-black uppercase tracking-widest shadow-[0_0_20px_rgba(255,107,0,0.35)] transition-all">
            <span class="relative z-10">Browse Catalog →</span>
            <div class="absolute inset-0 bg-white/10 translate-x-[-100%] group-hover:translate-x-0 transition-transform duration-300"></div>
          </a>
          <a href="/repair-request.php" class="btn-outline px-8 py-4 text-[10px] sm:text-sm font-black uppercase tracking-widest hover:bg-white/5 transition-all shadow-[0_0_15px_rgba(255,255,255,0.05)]">
            Technical Support
          </a>
        </div>

        <!-- Cert Stream -->
        <div class="flex flex-wrap justify-center lg:justify-start gap-4 lg:gap-6 items-center opacity-65">
          <?php foreach(['API 6A', 'API 6D', 'ASME B16.5', 'ISO 9001'] as $cert): ?>
          <span class="text-[9px] lg:text-[10px] font-black border-l-2 border-orange-600 pl-3 tracking-widest text-gray-300 uppercase"><?= $cert ?></span>
          <?php endforeach; ?>
        </div>
      </div>

      <!-- Hero Visuals: Interactive 3D/HUD Cards -->
      <div class="grid grid-cols-2 gap-4 relative mt-8 lg:mt-0">
        <div class="absolute inset-0 bg-orange-600/5 blur-[100px] rounded-full pointer-events-none"></div>
        <?php
        $capabilities = [
          ['⚙️', 'Flow Control', 'High-pressure gates, ball, check, and safety valves.', '98% Flow Accuracy'],
          ['🔩', 'Flange Systems', 'API 6A, 6B & ASME standard forgings and spools.', 'Grade-A Forged Steel'],
          ['🏗️', 'Mining Assets', 'Complete drilling, crushing, and asphalt spares.', 'OEM Certified Quality'],
          ['🎯', 'Workshop', 'ISO-Standard precision machining and overhauling.', 'Micrometer Precision'],
        ];
        foreach ($capabilities as $i => [$icon, $title, $sub, $stat]): ?>
        <div class="glass-panel p-5 sm:p-8 relative group premium-card-hover shimmer-card rounded-2xl border-white/5 <?= $i % 2 === 1 ? 'lg:translate-y-8' : '' ?>">
          <!-- HUD Tech Corners -->
          <div class="hud-corner hud-corner-tl opacity-0 group-hover:opacity-100 transition-opacity"></div>
          <div class="hud-corner hud-corner-tr opacity-0 group-hover:opacity-100 transition-opacity"></div>
          <div class="hud-corner hud-corner-bl opacity-0 group-hover:opacity-100 transition-opacity"></div>
          <div class="hud-corner hud-corner-br opacity-0 group-hover:opacity-100 transition-opacity"></div>
          
          <div class="text-3xl sm:text-4xl mb-4 sm:mb-6 transform group-hover:scale-110 group-hover:rotate-6 transition-all duration-350"><?= $icon ?></div>
          <h3 class="font-black text-[11px] sm:text-xs uppercase tracking-widest mb-2 text-white group-hover:text-orange-400 transition-colors"><?= $title ?></h3>
          <p class="text-[9px] sm:text-[11px] text-gray-400 leading-relaxed font-medium mb-4 line-clamp-2"><?= $sub ?></p>
          
          <!-- Telemetry data inside card -->
          <div class="border-t border-white/5 pt-3 mt-auto flex items-center justify-between text-[8px] font-black uppercase tracking-wider text-orange-500/60 group-hover:text-orange-400">
            <span><?= $stat ?></span>
            <span class="opacity-0 group-hover:opacity-100 transform translate-x-2 group-hover:translate-x-0 transition-all">📊</span>
          </div>
        </div>
        <?php endforeach; ?>
      </div>
    </div>
  </div>
</section>

<!-- ── MISSION CRITICAL STATS ───────────────────────────── -->
<section class="border-y border-white/5 bg-navy-950 py-16 relative overflow-hidden">
  <div class="absolute inset-0 bg-gradient-to-r from-orange-600/2 to-blue-600/2 pointer-events-none"></div>
  <div class="max-w-7xl mx-auto px-4 grid grid-cols-2 md:grid-cols-4 gap-12 text-center items-center">
    <?php 
    $statWidths = [80, 95, 90, 98];
    foreach ($stats as $idx => $s): 
    ?>
    <div class="fade-in group flex flex-col items-center">
      <div class="stat-number text-4xl sm:text-5xl font-black text-orange-500 mb-2" data-target="<?= $s['number'] ?>" data-suffix="<?= $s['suffix'] ?>">0<?= $s['suffix'] ?></div>
      <div class="text-[10px] font-black uppercase tracking-[0.2em] text-gray-500 group-hover:text-orange-400 transition-colors mb-4"><?= $s['label'] ?></div>
      <!-- Telemetry Visualizer Bar -->
      <div class="w-24 telemetry-bar">
        <div class="telemetry-bar-fill" style="width: <?= $statWidths[$idx] ?>%;"></div>
      </div>
    </div>
    <?php endforeach; ?>
  </div>
</section>

<!-- ── ENGINEERING STANDARDS ──────────────────────────────── -->
<section class="py-24 relative overflow-hidden bg-navy-900">
  <div class="max-w-7xl mx-auto px-4">
    <div class="grid grid-cols-1 lg:grid-cols-2 gap-20 items-center">
      <div class="fade-in">
        <div class="section-tag mb-4">Precision Engineering</div>
        <h2 class="text-4xl font-black text-white mb-8 border-l-4 border-orange-600 pl-6 uppercase tracking-tight">The <span class="text-orange-500">Quality Protocol</span></h2>
        <p class="text-gray-400 text-sm leading-8 mb-8">
          At Rig N Dig, we understand that in high-pressure environments, there is no margin for error. Our procurement process is anchored in international quality standards. Every component supplied—from a simple gasket to a 20,000 PSI wellhead assembly—undergoes a rigorous technical audit.
        </p>
        <ul class="space-y-6">
          <?php foreach([
            ['API 6A & 6D Compliance', 'Strict adherence to pressure containment and pipeline valve standards for hydrocarbons.'],
            ['Mill Traceability', 'Full material test reports (MTR) provided with every component for 100% heat traceability.'],
            ['Third-Party Inspection', 'Sourcing verified by global inspection bodies to ensure material integrity.'],
          ] as [$title, $desc]): ?>
          <li class="flex gap-4">
            <div class="shrink-0 w-6 h-6 rounded bg-orange-600/20 flex items-center justify-center text-orange-500 mt-1">✓</div>
            <div>
              <h4 class="text-sm font-black text-white uppercase tracking-wider mb-1"><?= $title ?></h4>
              <p class="text-xs text-gray-500 leading-relaxed"><?= $desc ?></p>
            </div>
          </li>
          <?php endforeach; ?>
        </ul>
      </div>
      <div class="relative glass-panel p-1 border-white/5 rounded-3xl overflow-hidden aspect-square flex items-center justify-center bg-navy-800/80 premium-card-hover shimmer-card fade-in">
        <!-- HUD Tech Corners -->
        <div class="hud-corner hud-corner-tl opacity-50"></div>
        <div class="hud-corner hud-corner-tr opacity-50"></div>
        <div class="hud-corner hud-corner-bl opacity-50"></div>
        <div class="hud-corner hud-corner-br opacity-50"></div>
        <div class="absolute inset-0 bg-gradient-to-br from-orange-600/5 to-blue-600/5 pointer-events-none"></div>
        <div class="absolute inset-x-0 bottom-0 h-1/2 bg-gradient-to-t from-orange-600/10 to-transparent pointer-events-none"></div>
        
        <div class="text-center p-12 relative z-10">
          <div class="text-7xl mb-6 animate-float">📊</div>
          <h3 class="text-2xl font-black text-white mb-4">Reduce <span class="text-orange-500">Non-Productive Time</span> (NPT)</h3>
          <p class="text-xs text-gray-400 leading-relaxed mb-8">Our rapid global sourcing and precision workshop services are engineered to keep your rigs and plants running at maximum efficiency.</p>
          <a href="/about.php" class="btn-outline px-6 py-3 text-[10px] font-black uppercase tracking-widest hover:shadow-[0_0_15px_rgba(255,107,0,0.2)]">Our Methodology</a>
        </div>
      </div>
    </div>
  </div>
</section>

<!-- ── PRODUCT DOMAINS ────────────────────────────────────── -->
<section class="py-24 bg-navy-950 relative overflow-hidden">
  <div class="glow-orb-orange bottom-10 left-1/3 animate-pulse-soft"></div>
  <div class="max-w-7xl mx-auto px-4 relative z-10">
    <div class="flex flex-col md:flex-row md:items-end justify-between mb-16 gap-6">
      <div class="fade-in">
        <div class="section-tag mb-4">Inventory & Sourcing</div>
        <h2 class="text-4xl font-black text-white uppercase tracking-tighter">Core <span class="text-orange-500">Capabilities</span></h2>
        <div class="w-20 h-1 bg-orange-600 mt-4"></div>
      </div>
      <p class="text-gray-500 max-w-md text-xs font-medium leading-relaxed fade-in">
        From extensive local stock to rapid global procurement, we provide a unified supply chain for industrial consumables and critical heavy equipment spares.
      </p>
    </div>

    <div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-6">
      <?php foreach ($categories as $cat): ?>
      <a href="/shop.php?category=<?= e($cat['slug']) ?>" class="group flex flex-col h-full relative bg-navy-900/60 border border-white/5 rounded-2xl overflow-hidden premium-card-hover shimmer-card fade-in">
        <!-- Subtle Background Image -->
        <?php if ($cat['image']): ?>
        <div class="absolute inset-0 bg-cover bg-center opacity-10 group-hover:opacity-20 group-hover:scale-105 transition-all duration-700 pointer-events-none" style="background-image: url('/uploads/<?= e($cat['image']) ?>');"></div>
        <?php endif; ?>
        <div class="absolute inset-0 bg-gradient-to-t from-navy-950 via-navy-900/85 to-transparent opacity-90 pointer-events-none"></div>
        
        <div class="p-8 pb-4 relative z-10">
          <div class="text-4xl mb-6 transform group-hover:-translate-y-2 group-hover:scale-110 transition-all duration-500"><?= $cat['icon'] ?: '⚙️' ?></div>
          <h3 class="text-sm font-black text-white uppercase tracking-widest mb-3 group-hover:text-orange-400 transition-colors"><?= e($cat['name']) ?></h3>
          <p class="text-[11px] text-gray-400 leading-relaxed mb-6 line-clamp-3 font-medium"><?= e($cat['description'] ?? 'Technical components engineered for high-performance industrial applications.') ?></p>
        </div>
        <div class="mt-auto px-8 py-5 border-t border-white/5 bg-white/[0.01] flex items-center justify-between relative z-10">
          <span class="text-[10px] font-black uppercase tracking-widest text-gray-400 group-hover:text-white transition-colors">View Series</span>
          <span class="text-orange-500 opacity-0 group-hover:opacity-100 translate-x-4 group-hover:translate-x-0 transition-all font-black">→</span>
        </div>
      </a>
      <?php endforeach; ?>
    </div>
  </div>
</section>

<!-- ── WORKSHOP STRATEGY ─────────────────────────────────── -->
<section class="py-24 relative bg-navy-900 overflow-hidden">
  <div class="glow-orb-blue top-1/4 right-0 animate-pulse-soft pointer-events-none"></div>
  <div class="absolute right-0 top-0 w-1/2 h-full bg-orange-600/5 blur-[120px] rounded-full pointer-events-none"></div>
  <div class="max-w-7xl mx-auto px-4 relative z-10">
    <div class="grid grid-cols-1 lg:grid-cols-2 gap-16 items-center">
      <div class="order-2 lg:order-1 grid grid-cols-2 gap-4 fade-in">
        <?php foreach([
          ['Lathe & Milling', 'High-accuracy material removal and surface finishing.', '🎯'],
          ['Fabrication', 'Heavy-duty welding and structural components.', '🏗️'],
          ['Hydraulic Overhaul', 'Complete reseal, testing, and cylinder refurbishment.', '💧'],
          ['Machine Repair', 'Industrial gearbox and rotary equipment lifecycle.', '🔧'],
        ] as [$title, $desc, $icon]): ?>
        <div class="glass-panel p-6 border border-white/5 rounded-2xl relative group premium-card-hover shimmer-card">
          <!-- HUD Corners -->
          <div class="hud-corner hud-corner-tl opacity-0 group-hover:opacity-100 transition-opacity"></div>
          <div class="hud-corner hud-corner-tr opacity-0 group-hover:opacity-100 transition-opacity"></div>
          <div class="hud-corner hud-corner-bl opacity-0 group-hover:opacity-100 transition-opacity"></div>
          <div class="hud-corner hud-corner-br opacity-0 group-hover:opacity-100 transition-opacity"></div>
          
          <div class="text-3xl mb-4 transform group-hover:scale-110 transition-transform"><?= $icon ?></div>
          <h4 class="text-xs font-black text-white uppercase tracking-widest mb-2 group-hover:text-orange-400 transition-colors"><?= $title ?></h4>
          <p class="text-[10px] text-gray-500 leading-relaxed group-hover:text-gray-300 transition-colors font-medium"><?= $desc ?></p>
        </div>
        <?php endforeach; ?>
      </div>
      <div class="order-1 lg:order-2 fade-in">
        <div class="section-tag mb-4">In-House Production</div>
        <h2 class="text-4xl font-black text-white mb-8 border-r-4 border-orange-600 pr-6 text-right uppercase tracking-tight">Precision <span class="text-orange-500">Workshop</span> Services</h2>
        <p class="text-gray-400 text-sm leading-8 text-right mb-10 font-medium">
          Our Islamabad-based workshop facility bridges the gap between sourcing and implementation. We don't just supply; we engineer. Whether it's custom flange machining to obscure dimensions or the complete overhaul of hydraulic mining pumps, our engineering team ensures every part meets its design intent.
        </p>
        <div class="flex justify-end gap-4">
          <a href="/repair-request.php" class="btn-primary px-8 py-3 text-xs font-black uppercase tracking-widest hover:shadow-[0_0_15px_rgba(255,107,0,0.35)] transition-all">Submit Request</a>
          <a href="/services.php" class="btn-outline px-8 py-3 text-xs font-black uppercase tracking-widest hover:shadow-[0_0_15px_rgba(255,255,255,0.05)] transition-all">Service Range</a>
        </div>
      </div>
    </div>
  </div>
</section>

<!-- ── GLOBAL SOURCING ────────────────────────────────────── -->
<section class="py-24 bg-navy-950 border-y border-white/5 relative overflow-hidden">
  <div class="glow-orb-orange top-10 right-10 animate-pulse-soft"></div>
  <div class="max-w-7xl mx-auto px-4 text-center relative z-10">
    <div class="fade-in mb-16">
      <div class="section-tag mb-4 mx-auto font-black">Global Principal Network</div>
      <h2 class="text-4xl font-black text-white uppercase tracking-tighter">Strategic <span class="text-orange-500">Sourcing</span> Hub</h2>
      <p class="text-gray-500 max-w-2xl mx-auto mt-6 text-sm leading-relaxed font-medium">
        We maintain a high-speed logistics network with authorized principals and certified manufacturers in the USA, Europe, China, and Middle East to ensure original equipment delivery to Pakistan.
      </p>
    </div>

    <!-- Country Grid -->
    <div class="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-4 mb-20">
      <?php foreach([
        ['🇺🇸', 'USA', 'Oilfield & Valves'],
        ['🇩🇪', 'Germany', 'Hydraulic & Tools'],
        ['🇮🇹', 'Italy', 'Flanges & Forgings'],
        ['🇰🇷', 'S. Korea', 'Marine & Pipe'],
        ['🇦🇪', 'UAE', 'Regional Stockist'],
        ['🇨🇳', 'China', 'Industrial General'],
      ] as [$flag, $country, $focus]): ?>
      <div class="glass-card p-6 border border-white/5 rounded-xl hover:border-orange-500/20 premium-card-hover shimmer-card transition-all fade-in">
        <div class="text-2xl mb-2 transform group-hover:scale-110 transition-transform"><?= $flag ?></div>
        <div class="text-xs font-black text-white uppercase tracking-[0.2em] mb-1 group-hover:text-orange-400 transition-colors"><?= $country ?></div>
        <div class="text-[9px] text-gray-500 font-bold tracking-widest uppercase"><?= $focus ?></div>
      </div>
      <?php endforeach; ?>
    </div>

    <!-- Featured Products Loop -->
    <div class="text-left mb-10 fade-in flex items-end justify-between">
      <div>
        <h3 class="text-xl font-black text-white uppercase tracking-tight">Technical Assets <span class="text-orange-500">for Selection</span></h3>
        <p class="text-xs text-gray-500 font-bold uppercase tracking-widest mt-1">Available via RFQ Protocol</p>
      </div>
      <a href="/shop.php" class="text-xs font-black text-orange-500 uppercase tracking-widest hover:underline">Full Catalog →</a>
    </div>
    
    <div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-8 text-left">
      <?php foreach ($featured as $p): ?>
      <div class="glass-panel p-6 group fade-in flex flex-col h-full border border-white/5 rounded-2xl premium-card-hover shimmer-card transition-all">
        <!-- HUD Corners -->
        <div class="hud-corner hud-corner-tl opacity-0 group-hover:opacity-100 transition-opacity"></div>
        <div class="hud-corner hud-corner-tr opacity-0 group-hover:opacity-100 transition-opacity"></div>
        <div class="hud-corner hud-corner-bl opacity-0 group-hover:opacity-100 transition-opacity"></div>
        <div class="hud-corner hud-corner-br opacity-0 group-hover:opacity-100 transition-opacity"></div>
        
        <div class="relative h-48 mb-6 overflow-hidden rounded-xl bg-navy-900 border border-white/5">
          <?php if ($p['image']): ?>
          <img src="/uploads/<?= e($p['image']) ?>" class="w-full h-full object-cover group-hover:scale-110 transition-all duration-700" alt="<?= e($p['name']) ?>">
          <?php else: ?>
          <div class="w-full h-full flex items-center justify-center text-4xl opacity-20">⚙️</div>
          <?php endif; ?>
          <div class="absolute top-3 right-3"><?= statusBadge($p['stock_status']) ?></div>
        </div>
        <div class="flex-1">
          <div class="text-[10px] font-black text-orange-500 uppercase tracking-widest mb-2"><?= e($p['category_name'] ?? 'Component') ?></div>
          <h4 class="text-sm font-black text-white uppercase tracking-wide mb-3 line-clamp-1 group-hover:text-orange-400 transition-colors"><?= e($p['name']) ?></h4>
          <p class="text-[11px] text-gray-400 leading-relaxed mb-6 line-clamp-2 font-medium"><?= e($p['short_description'] ?? '') ?></p>
        </div>
        <button onclick="addToQuote(<?= $p['id'] ?>, this)" class="btn-primary w-full py-4 text-[10px] font-black uppercase tracking-widest flex items-center justify-center gap-2 hover:shadow-[0_0_15px_rgba(255,107,0,0.35)] transition-all">
          <span>+ Add to Quote</span>
        </button>
      </div>
      <?php endforeach; ?>
    </div>
  </div>
</section>

<!-- ── TESTIMONIALS / B2B TRUST ──────────────────────────── -->
<?php if ($testimonials): ?>
<section class="py-24 max-w-7xl mx-auto px-4">
  <div class="flex flex-col lg:flex-row gap-16 items-start">
    <div class="lg:w-1/3 fade-in">
      <div class="section-tag mb-4">B2B Relations</div>
      <h2 class="text-3xl font-black text-white uppercase tracking-tighter mb-6">Client <span class="text-orange-500">Perspectives</span></h2>
      <p class="text-gray-400 text-sm leading-relaxed">Direct reviews from procurement managers and maintenance lead engineers who rely on Rig N Dig for critical asset delivery.</p>
    </div>
    <div class="lg:w-2/3 grid grid-cols-1 md:grid-cols-2 gap-6">
      <?php foreach ($testimonials as $t): ?>
      <div class="glass-panel p-8 rounded-2xl fade-in relative overflow-hidden group">
        <div class="absolute top-0 right-0 p-4 text-4xl opacity-5 group-hover:opacity-20 transition-opacity">"</div>
        <div class="flex gap-1 text-orange-500 mb-6 text-xs">
          <?php for ($i=0;$i<($t['rating']??5);$i++) echo '★'; ?>
        </div>
        <p class="text-gray-300 text-[13px] leading-relaxed mb-8 italic">"<?= e($t['message']) ?>"</p>
        <div class="flex items-center gap-4 border-t border-white/5 pt-6">
          <div class="w-10 h-10 rounded-lg bg-orange-600 flex items-center justify-center font-black text-xs text-white">
            <?= strtoupper(substr($t['name'],0,1)) ?>
          </div>
          <div>
            <div class="font-black text-xs text-white uppercase tracking-widest"><?= e($t['name']) ?></div>
            <div class="text-[10px] text-gray-500 font-bold uppercase tracking-wider"><?= e($t['designation'] ?? 'Technical Lead') ?></div>
          </div>
        </div>
      </div>
      <?php endforeach; ?>
    </div>
  </div>
</section>
<?php endif; ?>

<!-- ── PIONEER MOBILE PORTAL ──────────────────────────────── -->
<section class="py-24 bg-navy-950/50 border-y border-white/5 relative overflow-hidden">
  <div class="glow-orb-blue top-1/2 left-0 -translate-y-1/2 animate-pulse-soft pointer-events-none"></div>
  <div class="glow-orb-orange bottom-0 right-1/4 animate-float pointer-events-none"></div>
  <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 relative z-10">
    <div class="grid grid-cols-1 lg:grid-cols-2 gap-16 items-center">
      <div class="fade-in">
        <div class="text-orange-500 text-[10px] font-black uppercase tracking-[0.4em] mb-4">Mobile Ecosystem</div>
        <h2 class="text-4xl sm:text-5xl font-black text-white leading-tight mb-8">
          INDUSTRIAL ACCESS<br><span class="text-orange-500 italic">ANYWHERE, ANYTIME.</span>
        </h2>
        <p class="text-gray-400 text-base leading-relaxed mb-10 max-w-lg font-medium">
          Transform your procurement workflow with the Rig N Dig Mobile Portal. Track orders, verify technical certificates, and browse our live inventory directly from your smartphone.
        </p>
        
        <div class="space-y-6 mb-12">
          <?php foreach([
            ['⚡', 'Real-time manufacturing milestone tracking'],
            ['🛡️', 'Instant Digital Vault accessibility'],
            ['📦', 'Native B2B Request for Quotation engine']
          ] as [$icon, $text]): ?>
          <div class="flex items-center gap-4 group">
            <span class="w-10 h-10 rounded-xl bg-navy-800 border border-white/5 flex items-center justify-center text-xl group-hover:border-orange-500/35 transition-colors"><?= $icon ?></span>
            <span class="text-xs font-black text-gray-300 uppercase tracking-widest group-hover:text-white transition-colors"><?= $text ?></span>
          </div>
          <?php endforeach; ?>
        </div>

        <!-- Android Download Badge -->
        <a href="/RigNDig_Pioneer_v1.0.apk" class="inline-flex items-center gap-4 bg-black border border-white/10 px-8 py-3 rounded-2xl hover:bg-navy-800 transition-all group scale-100 hover:scale-105 hover:border-orange-500/35">
          <div class="text-2xl opacity-80 group-hover:opacity-100">🤖</div>
          <div class="text-left">
            <div class="text-[9px] text-gray-500 font-bold uppercase tracking-widest leading-none">Download for Android</div>
            <div class="text-sm font-black text-white uppercase tracking-wider">Direct APK (v1.0)</div>
          </div>
        </a>
        <div class="mt-4 text-[9px] text-gray-600 font-bold uppercase tracking-widest ml-1">
          Pioneer Suite v1.0.0 • Native Industrial Client
        </div>
      </div>

      <div class="relative flex justify-center lg:justify-end">
        <!-- App Preview Mockup (Visual) -->
        <div class="relative w-[280px] h-[580px] bg-navy-900 border-[8px] border-navy-800 rounded-[3rem] shadow-[0_0_50px_rgba(255,107,0,0.15)] overflow-hidden animate-float">
          <!-- Top Bar Notch -->
          <div class="absolute top-0 left-1/2 -translate-x-1/2 w-32 h-6 bg-navy-800 rounded-b-2xl z-25"></div>
          
          <div class="absolute inset-0 bg-gradient-to-br from-navy-850 to-navy-950"></div>
          <!-- Splash Simulation -->
          <div class="absolute inset-0 flex flex-col items-center justify-center p-6 text-center">
            <div class="text-5xl mb-6 transform hover:rotate-180 transition-all duration-1000 cursor-pointer">⚙️</div>
            <div class="text-sm font-black text-white tracking-[0.3em] uppercase">RIG N DIG</div>
            <div class="text-[8px] text-orange-500 font-bold tracking-[0.5em] mt-2 uppercase">Mobile Portal</div>
            <div class="mt-20 w-8 h-8 border-2 border-orange-600/30 border-t-orange-600 rounded-full animate-spin"></div>
            
            <!-- Simulated Tech metrics at bottom -->
            <div class="absolute bottom-6 inset-x-6 flex justify-between text-[8px] font-mono text-gray-500 uppercase tracking-widest border-t border-white/5 pt-4">
              <span>SYSTEM: ONLINE</span>
              <span>v1.0.0</span>
            </div>
          </div>
        </div>
        <!-- Decorative Elements -->
        <div class="absolute -top-10 -right-10 w-40 h-40 bg-orange-600/10 rounded-full blur-3xl animate-pulse pointer-events-none"></div>
      </div>
    </div>
  </div>
</section>

<!-- ── FINAL EXECUTION CTA ───────────────────────────────── -->
<section class="py-24 relative overflow-hidden mesh-gradient-animated border-t border-white/5">
  <!-- Subtle dark overlay to keep text highly readable -->
  <div class="absolute inset-0 bg-black/40 pointer-events-none"></div>
  
  <div class="relative z-10 max-w-4xl mx-auto px-4 text-center fade-in">
    <h2 class="text-4xl sm:text-5xl font-black font-display text-white uppercase tracking-tighter mb-6">Ready to <span class="bg-orange-600 px-4 py-1.5 inline-block text-white rounded shadow-lg">Execute?</span></h2>
    <p class="text-orange-50/90 text-lg mb-10 leading-relaxed font-medium">Trigger our global sourcing protocol or workshop services today. Our engineering team is standing by to deliver comprehensive pricing and technical validation.</p>
    <div class="flex flex-wrap gap-4 justify-center">
      <a href="/shop.php" class="bg-navy-950 text-orange-500 font-black px-10 py-5 rounded-xl uppercase tracking-[0.2em] text-xs hover:bg-black transition-all shadow-2xl hover:text-orange-400">Browse Assets</a>
      <a href="/contact.php" class="border-2 border-white text-white font-black px-10 py-5 rounded-xl uppercase tracking-[0.2em] text-xs hover:bg-white hover:text-navy-950 transition-all backdrop-blur-md">Contact HQ</a>
    </div>
    
    <div class="mt-12 flex flex-wrap justify-center gap-8 opacity-70">
      <div class="flex items-center gap-2 text-[9px] font-black text-white uppercase tracking-widest">🛡️ Secure Transmission</div>
      <div class="flex items-center gap-2 text-[9px] font-black text-white uppercase tracking-widest">⏱️ Priority RFP Handling</div>
      <div class="flex items-center gap-2 text-[9px] font-black text-white uppercase tracking-widest">📋 ISO/API Compliant</div>
    </div>
  </div>
</section>

<!-- Quick View Modal -->
<div id="quick-view-overlay" class="modal-overlay hidden" onclick="if(event.target===this)closeQuickView()">
  <div class="modal-box relative bg-navy-900 border border-white/10 rounded-3xl overflow-hidden shadow-[0_0_100px_rgba(0,0,0,0.8)]">
    <div id="quick-view-content"></div>
  </div>
</div>

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