const TANISMA_TARIHI = "2024-01-20";

// 1. GÜN/SAAT SAYAÇ
function updateCounter() {
    const diff = new Date() - new Date(TANISMA_TARIHI);
    document.getElementById("days").innerText = Math.floor(diff / 86400000).toString().padStart(2, '0');
    document.getElementById("hours").innerText = Math.floor((diff / 3600000) % 24).toString().padStart(2, '0');
}
setInterval(updateCounter, 1000); updateCounter();

// 2. MÜZİK KUTUSU
const playBtn = document.getElementById("play-btn");
const audio = document.getElementById("main-audio");
const album = document.getElementById("album-art");
playBtn.onclick = () => {
    if (audio.paused) { audio.play(); playBtn.innerText = "DURDUR"; album.classList.add("rotating"); }
    else { audio.pause(); playBtn.innerText = "OYNAT"; album.classList.remove("rotating"); }
};

// 3. SESLİ NOT
const vBtn = document.getElementById("voice-btn");
const vAudio = document.getElementById("voice-audio");
vBtn.onclick = () => {
    if (vAudio.paused) { vAudio.play(); vBtn.innerText = "⏸ SES DURAKLAT"; }
    else { vAudio.pause(); vBtn.innerText = "🎤 SESLİ NOTU DİNLE"; }
};

// 4. SÜRPRİZ (KALP YAĞMURU)
document.getElementById("surprise-btn").onclick = () => {
    for(let i=0; i<35; i++) {
        const h = document.createElement("div");
        h.innerHTML = "❤️";
        h.style.cssText = `position:fixed; bottom:-5vh; left:${Math.random()*100}vw; font-size:25px; color:#c5a059; animation: fUp 3s linear forwards; z-index:9999;`;
        document.body.appendChild(h);
        setTimeout(() => h.remove(), 3000);
    }
};

// 5. SCROLL ANIMASYONLARI
const observer = new IntersectionObserver((entries) => {
    entries.forEach(e => { 
        if(e.isIntersecting) { 
            e.target.style.opacity = "1"; 
            e.target.style.transform = "translateY(0) scale(1)"; 
        }
    });
}, { threshold: 0.1 });

document.querySelectorAll('.v-item, .photo').forEach(el => observer.observe(el));