Your cart

Adjust quantities or remove items. Even with careful stitch techniques using vellum and thimble, your selections remain flexible.

Browse catalog
`; document.getElementById('footer-container').innerHTML = ``; // Re-attach modal listeners setTimeout(() => { document.querySelectorAll('[data-open-modal]').forEach(b => b.addEventListener('click', () => document.getElementById(b.dataset.openModal).hidden = false)); document.querySelectorAll('[data-close-modal]').forEach(b => b.addEventListener('click', () => b.closest('[role=dialog]').hidden = true)); document.querySelector('[data-theme-toggle]')?.addEventListener('click', () => { document.body.classList.toggle('bg-[#F8F3E7]'); localStorage.setItem('evenstitch-theme', 'light'); }); }, 50); // Cart logic let catalog = []; let cart = {}; function loadCart() { try { cart = JSON.parse(localStorage.getItem('evenstitch-cart') || '{}'); } catch(e) { cart = {}; } } function saveCart() { localStorage.setItem('evenstitch-cart', JSON.stringify(cart)); } async function fetchCatalog() { const res = await fetch('./catalog.json'); catalog = await res.json(); } function renderCart() { const container = document.getElementById('cart-content'); const empty = document.getElementById('empty-state'); container.innerHTML = ''; container.className = ''; const items = Object.entries(cart).filter(([id, qty]) => qty > 0); if (items.length === 0) { empty.classList.remove('hidden'); container.classList.add('hidden'); return; } empty.classList.add('hidden'); container.classList.remove('hidden'); let subtotal = 0; const list = document.createElement('div'); list.className = 'space-y-4'; items.forEach(([id, qty]) => { const product = catalog.find(p => p.id == id); if (!product) return; const lineTotal = product.price * qty; subtotal += lineTotal; const row = document.createElement('div'); row.className = 'xk9h7 flex flex-col md:flex-row md:items-center justify-between gap-4 border border-[#34506D] bg-[#0D2340] p-6'; row.innerHTML = `
${product.name}
${product.duration}
$${product.price}
${qty}
$${lineTotal}
`; list.appendChild(row); }); container.appendChild(list); const totals = document.createElement('div'); totals.className = 'mt-12 flex flex-col items-end gap-4 border-t border-[#34506D] pt-8'; totals.innerHTML = `
Subtotal $${subtotal}
Total $${subtotal}
Enquire about enrollment
`; container.appendChild(totals); // Attach listeners document.querySelectorAll('[data-increment]').forEach(btn => { btn.onclick = () => changeQty(btn.dataset.increment, 1); }); document.querySelectorAll('[data-decrement]').forEach(btn => { btn.onclick = () => changeQty(btn.dataset.decrement, -1); }); document.querySelectorAll('[data-remove]').forEach(btn => { btn.onclick = () => removeItem(btn.dataset.remove); }); document.getElementById('checkout-btn').onclick = () => { document.getElementById('checkout-modal').hidden = false; }; } function changeQty(id, delta) { cart[id] = Math.max(1, Math.min(20, (cart[id] || 1) + delta)); saveCart(); renderCart(); } function removeItem(id) { delete cart[id]; saveCart(); renderCart(); } async function init() { loadCart(); await fetchCatalog(); renderCart(); // Cookie banner check (footer already handles) const c = document.getElementById('cookie-banner'); if (c && localStorage.getItem('evenstitch-cookies')) c.hidden = true; } init();