<?php // Load tools with a fallback $tools_data = ['categories' => [['name' => 'None', 'desc' => '']], 'tools' => []]; if (file_exists(__DIR__ . '/data.tools.php')) { $tools_data = include __DIR__ . '/data.tools.php'; } ?> <section id="tools" class="bg-white py-24 px-6 md:px-12"> <div class="max-w-7xl mx-auto text-center mb-14"> <span class="inline-block bg-blue-50 text-blue-600 font-medium px-4 py-1.5 rounded-lg text-sm mb-2">Our Top Tools</span> <h2 class="text-4xl font-semibold text-gray-800 mb-4">Essential Tools for Perfect Fits</h2> <p class="text-gray-500 max-w-xl mx-auto">Discover our smart tools that help you check how well furniture, appliances, and luggage fit into your space—no measuring tape needed.</p> </div> <center><?php include "$data/ads-code3.php";?> </center> <?php foreach ($tools_data['categories'] as $category): ?> <?php $category_tools = array_filter($tools_data['tools'], fn($tool) => $tool['category'] === $category['name']); if (empty($category_tools)) continue; $is_visible = !in_array(strtolower($category['name']), ['none']) && !in_array(strtolower($category['desc']), ['none']); ?> <div class="max-w-7xl mx-auto mb-8"> <?php if ($is_visible): ?> <h3 class="text-2xl sm:text-3xl font-semibold mb-1 mt-20 text-center"><?php echo htmlspecialchars($category['name']); ?></h3> <?php if (!empty($category['desc']) && strtolower($category['desc']) !== 'none'): ?> <p class="text-gray-500 max-w-xl mx-auto mb-10 text-center"><?php echo htmlspecialchars($category['desc']); ?></p> <?php endif; ?> <?php endif; ?> <div class="grid grid-cols-2 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4 sm:gap-8"> <?php foreach ($category_tools as $tool): ?> <div class="relative bg-white p-3 sm:p-6 rounded-2xl sm:rounded-3xl shadow-sm hover:shadow-lg border transition-all hover:scale-105 flex flex-col items-center text-center"> <?php if (!empty($tool['badge'])): ?> <span class="absolute top-2 right-2 sm:top-4 sm:right-4 bg-red-500 text-white text-xs font-semibold px-1.5 py-0.5 sm:px-2 sm:py-1 rounded-full shadow"><?php echo htmlspecialchars($tool['badge']); ?></span> <?php endif; ?> <div class="icon-container mb-2 sm:mb-3"> <div class="icon-wrapper"> <div class="icon-inner w-16 h-16 sm:w-20 sm:h-20"> <i data-lucide="<?php echo htmlspecialchars($tool['icon'] ?? 'tool'); ?>" class="icon-download w-8 h-8 sm:w-10 sm:h-10"></i> </div> </div> </div> <h3 class="text-sm sm:text-xl font-semibold text-gray-800 mb-4 sm:mb-2 capitalize leading-tight"><?php echo htmlspecialchars($tool['name'] ?? ''); ?></h3> <?php if ($is_visible): ?> <!-- <p class="text-sm text-gray-500 mb-2"><?php echo htmlspecialchars($tool['category']); ?></p> --> <?php endif; ?> <p class="hidden sm:block font-light text-gray-400 mb-4 text-sm"><?php echo htmlspecialchars($tool['desc'] ?? ''); ?></p> <?php // Generate URL without .php extension if ($tool['custom_url']) { $url = htmlspecialchars($tool['custom_url']); } else { $file = $tool['file'] ?? '#'; // Remove .php extension if present $file_without_extension = preg_replace('/\.php$/', '', $file); $url = 'tools/' . htmlspecialchars($file_without_extension); } ?> <a href="<?php echo $url; ?>" class="mt-auto py-1.5 px-4 sm:py-2 sm:px-8 bg-blue-600 text-white text-xs sm:text-md font-medium rounded-full hover:bg-blue-700 shadow transition">Try Now →</a> </div> <?php endforeach; ?> </div> </div> <?php endforeach; ?> </section> <style> @media (max-width: 768px) { .gradient{width:350px;height:350px;opacity:.7;filter:blur(60px)} .purple{top:40%} .green{background:#f1ecc4;bottom:10%;left:0} } </style>