<?php
$tamu = isset($_GET['to']) ? ucwords(urldecode($_GET['to'])) : 'Tamu Undangan';
?>

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

<!-- 🔒 OVERLAY PEMBUKA -->
<div id="overlay">
    <div class="cover-text">
        <p class="small-text">The Wedding Of</p>
        <h1>Nuryadi & Suhaeni</h1>

        <p class="small-text">SPESIAL INVITATION TO</p>
        <h4><?= $tamu ?></h4>

        <button class="open-invite-btn" onclick="openInvite()">
            <i class="fa-solid fa-envelope-open"></i>
            Buka Undangan
        </button>
    </div>
</div>

<!-- 🌐 MAIN CONTENT -->
<div id="main-content" style="display:none;">

    <?php include 'sections/cover.php'; ?>
    <?php include 'sections/couple.php'; ?>
    <?php include 'sections/event.php'; ?>
    <?php include 'sections/countdown.php'; ?>
    <?php include 'sections/gallery.php'; ?>
    <?php include 'sections/weddinggift.php'; ?>
    <?php include 'sections/location.php'; ?>
    <?php include 'sections/rsvp.php'; ?>

</div>

<!-- 🎵 MUSIC FLOAT -->
<div id="music-player" class="music-btn" onclick="toggleMusic()" style="display:none;">

    <img src="assets/img/cp6.jpeg" id="music-img">

    <div class="music-icon">
        <i id="music-icon" class="fa-solid fa-play"></i>
    </div>

</div>

<audio id="bg-music" loop>
    <source src="assets/music/laguwedding.mp3" type="audio/mpeg">
</audio>

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

<!-- 🔥 SCRIPT TAMBAHAN -->
<script>
// kirim nama tamu ke section
document.addEventListener("DOMContentLoaded", function() {
    const tamu = "<?= $tamu ?>";
    const el = document.getElementById("nama-tamu");
    if (el) el.innerText = tamu;
});
</script>