const isDec = now.getMonth() === 11;
const lights = document.getElementById('christmas-lights');
if (!isDec && lights) lights.style.display = 'none';
if(isDec) {
const c = document.getElementById('snow-canvas');
const ctx = c.getContext('2d');
let w, h; const flakes = [];
const kochCanvas = document.createElement('canvas');
const kochSize = 100; kochCanvas.width = kochSize; kochCanvas.height = kochSize;
const kCtx = kochCanvas.getContext('2d');
function kochLine(x1, y1, x2, y2, depth) { if (depth === 0) { kCtx.lineTo(x2, y2); } else { const dx = x2 - x1;
const dy = y2 - y1; const dist = Math.sqrt(dx * dx + dy * dy); const unit = dist / 3; const angle =
Math.atan2(dy, dx); const paX = x1 + dx / 3; const paY = y1 + dy / 3; const pbX = paX + Math.cos(angle - Math.PI
/ 3) * unit; const pbY = paY + Math.sin(angle - Math.PI / 3) * unit; const pcX = x1 + dx * 2 / 3; const pcY = y1
+ dy * 2 / 3; kochLine(x1, y1, paX, paY, depth - 1); kochLine(paX, paY, pbX, pbY, depth - 1); kochLine(pbX, pbY,
pcX, pcY, depth - 1); kochLine(pcX, pcY, x2, y2, depth - 1); } }
kCtx.fillStyle = 'rgba(255, 255, 255, 0.9)'; kCtx.shadowBlur = 5; kCtx.shadowColor = "white";
const s = kochSize * 0.7; const h_k = s * (Math.sqrt(3) / 2); const cx = kochSize / 2; const cy = kochSize / 2 +
(h_k / 6);
const p1 = { x: cx - s / 2, y: cy - h_k / 2 }; const p2 = { x: cx + s / 2, y: cy - h_k / 2 }; const p3 = { x:
cx, y: cy + h_k / 2 };
kCtx.beginPath(); kCtx.moveTo(p1.x, p1.y); kochLine(p1.x, p1.y, p2.x, p2.y, 4); kochLine(p2.x, p2.y, p3.x, p3.y,
4); kochLine(p3.x, p3.y, p1.x, p1.y, 4); kCtx.closePath(); kCtx.fill();
const resize = () => { w = c.width = window.innerWidth; h = c.height = window.innerHeight; };
window.addEventListener('resize', resize); resize();
for(let i=0; i<50; i++) flakes.push({x:Math.random()*w, y:Math.random()*h, s:Math.random()*25+10,
vy:Math.random()*1+0.5, r:Math.random()*360}); function draw() { ctx.clearRect(0,0,w,h); flakes.forEach(f=>{
ctx.save(); ctx.translate(f.x, f.y); ctx.rotate(f.r * Math.PI / 180);
ctx.drawImage(kochCanvas, -f.s / 2, -f.s / 2, f.s, f.s); ctx.restore();
f.y+=f.vy; if(f.y>h) f.y=-50;
});
requestAnimationFrame(draw);
}
draw();
} else { document.getElementById('snow-canvas').style.display='none'; }
`n