Adequatelio Craft School

A thoughtful reply starts here

Tell us what you are working on.

Ask about a course, describe a learning goal, or request help choosing a starting point. We aim to answer clearly and realistically.

`; document.querySelector('header').innerHTML = headerHTML; document.querySelector('footer').innerHTML = footerHTML; } function initTheme() { const toggle = document.querySelector('[data-theme-toggle]'); if (!toggle) return; toggle.addEventListener('click', () => { document.body.classList.toggle('bg-[#2F2118]'); document.body.classList.toggle('text-[#F5EBDD]'); const panels = document.querySelectorAll('.panel'); panels.forEach(p => { p.style.background = document.body.classList.contains('bg-[#2F2118]') ? '#3D2B22' : '#F5EBDD'; p.style.borderColor = document.body.classList.contains('bg-[#2F2118]') ? '#6F4E37' : '#D8BFA5'; }); }); } function initModals() { const loginModal = document.createElement('div'); loginModal.id = 'login-modal'; loginModal.className = 'hidden fixed inset-0 z-50 flex items-center justify-center bg-black/40'; loginModal.innerHTML = `

Log in to your account

`; document.body.appendChild(loginModal); const registerModal = document.createElement('div'); registerModal.id = 'register-modal'; registerModal.className = 'hidden fixed inset-0 z-50 flex items-center justify-center bg-black/40'; registerModal.innerHTML = `

Create an account

`; document.body.appendChild(registerModal); document.querySelectorAll('[data-open-modal]').forEach(btn => { btn.addEventListener('click', () => { const modalId = btn.getAttribute('data-open-modal'); const modal = document.getElementById(modalId); if (modal) modal.classList.remove('hidden'); }); }); document.querySelectorAll('[data-close-modal]').forEach(btn => { btn.addEventListener('click', () => { const modal = btn.closest('[id$="-modal"]'); if (modal) modal.classList.add('hidden'); }); }); } function initFormValidation() { const form = document.getElementById('contact-form'); const errorModal = document.getElementById('form-error-modal'); const errorText = document.getElementById('form-error-text'); form.addEventListener('submit', function(e) { const name = form.name.value.trim(); const email = form.email.value.trim(); const message = form.message.value.trim(); let errors = []; if (name.length < 2) errors.push('Name must be at least 2 characters.'); if (!email || !email.includes('@')) errors.push('Please enter a valid email address.'); if (message.length < 12) errors.push('Message must be at least 12 characters.'); if (errors.length > 0) { e.preventDefault(); errorText.innerHTML = errors.join('
'); errorModal.classList.remove('hidden'); } }); errorModal.querySelector('[data-close-modal]').addEventListener('click', () => { errorModal.classList.add('hidden'); }); } function initCookieBanner() { setTimeout(() => { const banner = document.getElementById('cookie-banner'); if (!banner) return; const consentKey = 'acs-cookie-consent'; if (localStorage.getItem(consentKey) === 'accepted') { banner.style.display = 'none'; } else { banner.style.display = 'flex'; } const closeBtn = banner.querySelector('[data-cookie-close]'); if (closeBtn) { closeBtn.addEventListener('click', function() { localStorage.setItem(consentKey, 'accepted'); banner.style.display = 'none'; }); } }, 300); } function initAll() { initHeaderFooter(); initTheme(); initModals(); initFormValidation(); initCookieBanner(); } window.onload = initAll;