<?php include 'koneksi.php';
$query = mysqli_query($koneksi, "SELECT * FROM buku");
while ($data = mysqli_fetch_array($query)) {
?>
    <div
        class="min-w-[150px] md:min-w-[180px] cursor-pointer transition duration-300 hover:brightness-75" onclick="window.location.href='buku/detail.php?id=<?php echo htmlspecialchars($data['id_buku'] ?? ''); ?>'">
        <img src="img/<?php echo htmlspecialchars($data['foto'] ?? ''); ?>"
            alt="Foto Buku"
            class="rounded-lg shadow-md w-[200px] h-[280px]" />
        <p class="text-sm mt-2 font-semibold"><?php echo htmlspecialchars($data['judul_buku'] ?? ''); ?></p>
        <p class="text-xs text-gray-600"><?php echo htmlspecialchars($data['penulis'] ?? ''); ?></p>
    </div>
<?php } ?>