No results found. Try different keywords like “lesson”, “trial”, or “offline”.
'),
fetch('./footer.html').then(r => r.text()).catch(()=>'
')
]);
document.querySelector('header').innerHTML = h;
document.querySelector('footer').innerHTML = f;
attachHeaderFooterHandlers();
}
function attachHeaderFooterHandlers() {
const root = document.documentElement;
const themeBtn = document.getElementById('btnTheme');
const saved = localStorage.getItem('theme') || 'light';
root.classList.toggle('dark', saved === 'dark');
themeBtn && themeBtn.addEventListener('click', () => {
const next = root.classList.contains('dark') ? 'light' : 'dark';
root.classList.toggle('dark', next === 'dark');
localStorage.setItem('theme', next);
document.getElementById('modalTheme')?.showModal();
});
const mAuth = document.getElementById('modalAuth');
document.getElementById('btnLogin')?.addEventListener('click', () => mAuth.showModal());
document.getElementById('btnSignup')?.addEventListener('click', () => mAuth.showModal());
const cookieBar = document.getElementById('cookieBar');
if (cookieBar && !localStorage.getItem('cookiesAccepted')) cookieBar.classList.remove('hidden');
document.getElementById('cookieAccept')?.addEventListener('click', () => { localStorage.setItem('cookiesAccepted','1'); cookieBar.classList.add('hidden'); });
}
const faqs = [
{q:'What is a school readiness course?', a:'A structured set of short lessons that build early literacy, math, and learning habits to ease the transition into school.'},
{q:'How long is each lesson?', a:'Most lessons are 10–15 minutes with simple steps and clear outcomes.'},
{q:'Do I need special materials?', a:'Common household items and printable worksheets (optional) are enough.'},
{q:'How do I choose a level?', a:'Use our quiz on the homepage or filter by age range, level, and outcomes in the catalog.'},
{q:'Can I study offline?', a:'You can download recommended practice checklists; lessons are designed for short sessions without heavy media.'},
{q:'Is there a free trial?', a:'You can explore sample lessons within each course detail modal.'},
{q:'How do favorites work?', a:'Click the star on any course to save it locally in Favorites.'},
{q:'What payment methods are supported?', a:'Add courses to the cart and proceed to checkout; confirmation is displayed via modal as we do not process real payments here.'},
{q:'Can multiple children use one account?', a:'Yes. You can track progress per child by creating profiles locally on your device.'},
{q:'How do I reset my progress?', a:'Open Settings in the header, choose “Progress”, then select the profile and tap “Reset Progress.”'},
{q:'Will new lessons be added?', a:'Yes, we publish new micro-lessons weekly covering phonological awareness, numeracy, and executive skills.'},
{q:'Do courses support assistive technology?', a:'Our lessons and UI support keyboard navigation, screen readers, and captions on videos where applicable.'}
];
function escapeHTML(s){return s.replace(/[&<>"']/g,m=>({ '&':'&','<':'<','>':'>','"':'"',"'":''' }[m]))}
function highlight(text, q){
if(!q.trim()) return escapeHTML(text);
const words = Array.from(new Set(q.trim().toLowerCase().split(/\s+/).filter(Boolean))).sort((a,b)=>b.length-a.length);
if(!words.length) return escapeHTML(text);
const pattern = words.map(w=>w.replace(/[.*+?^${}()|[\]\\]/g,'\\$&')).join('|');
return escapeHTML(text).replace(new RegExp('('+pattern+')','gi'),'$1');
}
function renderFAQ(filter='') {
const list = document.getElementById('faqList');
const stat = document.getElementById('faqStat');
const nores = document.getElementById('noResults');
const q = filter.trim().toLowerCase();
list.innerHTML = '';
let count = 0;
faqs.filter(f => {
if(!q) return true;
return (f.q + ' ' + f.a).toLowerCase().includes(q);
}).forEach((f, i) => {
const id = 'faq-' + i;
const el = document.createElement('details');
el.className = 'border border-neutral-200 rounded-md bg-white shadow-sm';
const chevron = ``;
el.innerHTML = `
${highlight(f.q, q)}
${chevron}