How the Halvet concept site went from a mobile Lighthouse performance score of 55 to 100 in one release, then got a WebGL hero and a 3D scene back while staying at 99, and why the score did not stay there.
· 5 min read
Halvet is a concept site for builders of hammams, saunas and pools. Its audience expects something that feels expensive: slow, cinematic motion, steam moving over warm stone. The first version had that, and on a phone it was almost unusable. Lighthouse’s mobile profile gave it a performance score of 55, with a Total Blocking Time of 14.4 seconds and a page weight of 3.6 MB.
One release later, on November 9, 2026, the same page scored 100, with Total Blocking Time at zero and the page at 0.65 MB. The next release added a WebGL fog shader and a three.js scene and still scored 99 on mobile and 100 on desktop. This post is about how, and about the honest end of the story: the score is not a trophy you keep.
1MeasureRun Lighthouse in its mobile profile and read the diagnostics, not just the score.
2Find the one thingAlmost all of the 14.4 s of blocking came from a single full-resolution steam canvas.
3Make it cheapDraw the effect at a fraction of the resolution and frame rate, only when visible, and only after load.
4Cut bytesResponsive WebP, self-hosted fonts and immutable caching took the page from 3.6 MB to 0.65 MB.
5Add wow lazilyHeavy effects load only when needed, check for WebGL first, and always have a cheap fallback.
Figure 1
One effect was the whole problem
The hero is a photograph of a hammam with steam drifting across it. In v1 that steam was a 2D canvas: 26 soft sprites redrawn on every animation frame, at up to 1.5× device pixel ratio, composited over the photograph with mix-blend-mode: screen.
Each part of that was reasonable on its own. Together, on a throttled mid-range phone, it was a disaster. A full-resolution canvas the size of the viewport, cleared and redrawn sixty times a second, and then blended with the image underneath on every frame, kept the main thread and the compositor busy from the first paint onwards. Lighthouse counts every long task after first paint toward Total Blocking Time, and almost all of the 14.4 seconds came from this loop.
The fix in v1.1 kept the effect and changed how much it costs:
var Q = 0.35; // draw at 35% resolution: steam is soft, nobody can see the differencevar size = function () { W = cv.clientWidth; H = cv.clientHeight; cv.width = Math.ceil(W * Q); cv.height = Math.ceil(H * Q); ctx.setTransform(Q, 0, 0, Q, 0, 0);};var tick = function (t) { if (!visible || document.hidden) { looping = false; return; } // stop offscreen and in background tabs requestAnimationFrame(tick); if (t - last < 33) return; // about 30 fps is plenty for steam last = t; // ... draw puffs};// start 400 ms after the load event, so it never competes with the first paintwindow.addEventListener('load', function () { setTimeout(startSteam, 400); });
The blend mode went away entirely, and the sprite was redrawn as a cluster of soft blobs so that plain alpha looks right over the photo. On narrow screens the effect uses 9 puffs instead of 18. Steam is blurry by nature, so drawing it at 35% resolution and stretching it is invisible to the eye and costs about an eighth of the pixels of a 1× canvas.
Bytes, fonts and caching
With the main thread free, the remaining work was weight:
Responsive WebP. Each photograph that was a 0.3 to 0.8 MB JPEG became a srcset of WebP files from 640 to 2000 pixels wide, generated by a small script from the source images. A phone downloads the 640 or 1024 version.
Self-hosted fonts. Fonts moved from Google Fonts to the site itself, with preload for the two faces used above the fold; the hero photograph is preloaded too, with fetchpriority="high". That removed a third-party connection from the critical path and let the content security policy drop Google entirely.
Immutable caching. CSS and JavaScript are referenced as styles.css?v=<commit> and served with a long immutable cache, so a returning visitor downloads nothing and a deploy still invalidates everything.
Search engine basics went in the same release: robots.txt, a sitemap, a canonical link and Open Graph tags took the SEO category from 92 to 100.
The same release also cut copy. Removing a hero kicker, a subtitle and several card descriptions was not done for performance, but it made the page lighter to read as well as to load.
Adding the wow back
v1.2 is where the “without losing the wow” part was tested. It added a hero fog written as a WebGL shader (two layers of domain-warped noise, light shafts from the dome’s openings, a pointer trail that pushes the fog around) and a three.js scene of the dome with the real photograph projected onto a hemisphere. It still scored 99 on mobile and 100 on desktop. Three rules made that possible.
Load heavy code only when it is about to be seen. The three.js scene is a separate chunk, imported dynamically when its section comes within 600 pixels of the viewport:
Check before you spend. No WebGL, or the browser’s Save-Data flag set, means the visitor sees the photograph and never downloads three.js at all.
Always keep a fallback. If the fog shader fails or its WebGL context is lost, the page removes the WebGL class and starts the cheap 2D steam from v1.1 instead. With prefers-reduced-motion, the fog renders as a still image and the decorative motion is skipped.
One trap: CSP and inline styles
v1.3 shipped a layered diagram that set a CSS variable through an inline style="..." attribute on each layer. It worked on a local server and broke on the live site, because the production content security policy has style-src 'self', which blocks inline style attributes. The fix was to index the layers with :nth-child in the stylesheet, or to set the variable from JavaScript with style.setProperty, which CSP allows. We now open the browser console on the live site after every deploy.
Limitations: 100 is not permanent
The score is a snapshot of a page on a day, and the page kept growing. v1.8 replaced the fog with a GPU fluid simulation of steam rising from the basins. Compiling its shaders blocked the main thread, so initialisation is staged: shaders compile in the background through the KHR_parallel_shader_compile extension, and the simulation prewarms in slices of about six milliseconds so no single task runs long. After that release the live site measured 92 on mobile, with a Largest Contentful Paint of 2.8 s and a Total Blocking Time of 210 ms.
On November 13, 2026 we ran Lighthouse 12.8.2 again from a desktop workstation against the live site, in the default mobile profile. It reported performance 78, accessibility 96, best practices 100 and SEO 100, with a Largest Contentful Paint of 2.9 s, a Total Blocking Time of 550 ms, no layout shift and 795 KiB transferred. Lab scores move with the machine, the network and Lighthouse’s own variance; a GPU-heavy page swings more than most. The lesson we took is not “get 100” but “know what each effect costs, and pay for it only when the visitor is looking”.
Accessibility stays at 96 to 97 on purpose: a scroll-driven statement fades words from dim to bright as you read, and the dim words fail the contrast check until they light up.
Reproduce this
Check out the v1.1 commit, serve the v1 folder and run Lighthouse in its mobile profile; scores from a local server and your own machine will differ from ours, so compare the before and after commits on the same machine.