document.addEventListener('DOMContentLoaded', function() {
const overlay = document.getElementById('age-verification-overlay');
if (!overlay) return; //
function getCookie(name) {
let matches = document.cookie.match(new RegExp(
"(?:^|; )" + name.replace(/([$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"
));
return matches ? decodeURIComponent(matches[1]) : undefined;
}
if (getCookie('ageVerified') !== 'true') {
overlay.style.display = 'flex';
}
document.querySelector('.accept-button').addEventListener('click', function() {
const rememberMe = document.querySelector('.toggle-checkbox').checked;
const expiryDate = new Date();
if (rememberMe) {
expiryDate.setTime(expiryDate.getTime() + (30 * 24 * 60 * 60 * 1000));
document.cookie = `ageVerified=true; expires=${expiryDate.toUTCString()}; path=/; SameSite=Lax`;
} else {
document.cookie = 'ageVerified=true; path=/; SameSite=Lax';
}
overlay.style.display = 'none';
});
});