The design language that makes your AI harness better at design.
JavaScript
fix(live): retry inline scroll-restore on fonts.ready and load
Paul Bakausf0f2935547b0
diff --git a/.agents/skills/impeccable/scripts/live-inject.mjs b/.agents/skills/impeccable/scripts/live-inject.mjsindex daf44cde8..37a16f1ea 100644--- a/.agents/skills/impeccable/scripts/live-inject.mjs+++ b/.agents/skills/impeccable/scripts/live-inject.mjs@@ -138,14 +138,23 @@ function buildTagBlock(syntax, port) {const open = commentOpen(syntax);const close = commentClose(syntax);// Inline pre-restore: runs before the external live.js is fetched. Sets- // scrollRestoration='manual' and jumps to the saved scrollY *synchronously*+ // scrollRestoration='manual' and jumps to the saved scrollY synchronously// during HTML parse, beating the browser's animated reload-restore.+ //+ // Retries on fonts.ready and load are essential: scrollTo(y) clamps to+ // the document's current scrollHeight, which is often hundreds of+ // pixels short of the final value until async-loaded fonts swap in.// Hardcoded key matches live-browser.js: PREFIX ('impeccable-live') +// LS_KEY suffix ('-session') + SCROLL_KEY_SUFFIX ('-scroll').const preRestore ='<script>(function(){try{history.scrollRestoration="manual";' +'var y=parseFloat(localStorage.getItem("impeccable-live-session-scroll"));' +- 'if(isFinite(y))window.scrollTo(0,y);}catch(e){}})();</script>';+ 'if(!isFinite(y))return;' ++ 'var apply=function(){if(Math.abs(window.scrollY-y)>0.5)window.scrollTo(0,y);};' ++ 'apply();' ++ 'if(document.fonts&&document.fonts.ready)document.fonts.ready.then(apply);' ++ 'window.addEventListener("load",apply,{once:true});' ++ '}catch(e){}})();</script>';return (open + ' ' + MARKER_OPEN_TEXT + ' ' + close + '\n' +preRestore + '\n' +diff --git a/.claude/skills/impeccable/scripts/live-inject.mjs b/.claude/skills/impeccable/scripts/live-inject.mjsindex daf44cde8..37a16f1ea 100644--- a/.claude/skills/impeccable/scripts/live-inject.mjs+++ b/.claude/skills/impeccable/scripts/live-inject.mjs@@ -138,14 +138,23 @@ function buildTagBlock(syntax, port) {const open = commentOpen(syntax);const close = commentClose(syntax);// Inline pre-restore: runs before the external live.js is fetched. Sets- // scrollRestoration='manual' and jumps to the saved scrollY *synchronously*+ // scrollRestoration='manual' and jumps to the saved scrollY synchronously// during HTML parse, beating the browser's animated reload-restore.+ //+ // Retries on fonts.ready and load are essential: scrollTo(y) clamps to+ // the document's current scrollHeight, which is often hundreds of+ // pixels short of the final value until async-loaded fonts swap in.// Hardcoded key matches live-browser.js: PREFIX ('impeccable-live') +// LS_KEY suffix ('-session') + SCROLL_KEY_SUFFIX ('-scroll').const preRestore ='<script>(function(){try{history.scrollRestoration="manual";' +'var y=parseFloat(localStorage.getItem("impeccable-live-session-scroll"));' +- 'if(isFinite(y))window.scrollTo(0,y);}catch(e){}})();</script>';+ 'if(!isFinite(y))return;' ++ 'var apply=function(){if(Math.abs(window.scrollY-y)>0.5)window.scrollTo(0,y);};' ++ 'apply();' ++ 'if(document.fonts&&document.fonts.ready)document.fonts.ready.then(apply);' ++ 'window.addEventListener("load",apply,{once:true});' ++ '}catch(e){}})();</script>';return (open + ' ' + MARKER_OPEN_TEXT + ' ' + close + '\n' +preRestore + '\n' +diff --git a/.cursor/skills/impeccable/scripts/live-inject.mjs b/.cursor/skills/impeccable/scripts/live-inject.mjsindex daf44cde8..37a16f1ea 100644--- a/.cursor/skills/impeccable/scripts/live-inject.mjs+++ b/.cursor/skills/impeccable/scripts/live-inject.mjs@@ -138,14 +138,23 @@ function buildTagBlock(syntax, port) {const open = commentOpen(syntax);const close = commentClose(syntax);// Inline pre-restore: runs before the external live.js is fetched. Sets- // scrollRestoration='manual' and jumps to the saved scrollY *synchronously*+ // scrollRestoration='manual' and jumps to the saved scrollY synchronously// during HTML parse, beating the browser's animated reload-restore.+ //+ // Retries on fonts.ready and load are essential: scrollTo(y) clamps to+ // the document's current scrollHeight, which is often hundreds of+ // pixels short of the final value until async-loaded fonts swap in.// Hardcoded key matches live-browser.js: PREFIX ('impeccable-live') +// LS_KEY suffix ('-session') + SCROLL_KEY_SUFFIX ('-scroll').const preRestore ='<script>(function(){try{history.scrollRestoration="manual";' +'var y=parseFloat(localStorage.getItem("impeccable-live-session-scroll"));' +- 'if(isFinite(y))window.scrollTo(0,y);}catch(e){}})();</script>';+ 'if(!isFinite(y))return;' ++ 'var apply=function(){if(Math.abs(window.scrollY-y)>0.5)window.scrollTo(0,y);};' ++ 'apply();' ++ 'if(document.fonts&&document.fonts.ready)document.fonts.ready.then(apply);' ++ 'window.addEventListener("load",apply,{once:true});' ++ '}catch(e){}})();</script>';return (open + ' ' + MARKER_OPEN_TEXT + ' ' + close + '\n' +preRestore + '\n' +diff --git a/.gemini/skills/impeccable/scripts/live-inject.mjs b/.gemini/skills/impeccable/scripts/live-inject.mjsindex daf44cde8..37a16f1ea 100644--- a/.gemini/skills/impeccable/scripts/live-inject.mjs+++ b/.gemini/skills/impeccable/scripts/live-inject.mjs@@ -138,14 +138,23 @@ function buildTagBlock(syntax, port) {const open = commentOpen(syntax);const close = commentClose(syntax);// Inline pre-restore: runs before the external live.js is fetched. Sets- // scrollRestoration='manual' and jumps to the saved scrollY *synchronously*+ // scrollRestoration='manual' and jumps to the saved scrollY synchronously// during HTML parse, beating the browser's animated reload-restore.+ //+ // Retries on fonts.ready and load are essential: scrollTo(y) clamps to+ // the document's current scrollHeight, which is often hundreds of+ // pixels short of the final value until async-loaded fonts swap in.// Hardcoded key matches live-browser.js: PREFIX ('impeccable-live') +// LS_KEY suffix ('-session') + SCROLL_KEY_SUFFIX ('-scroll').const preRestore ='<script>(function(){try{history.scrollRestoration="manual";' +'var y=parseFloat(localStorage.getItem("impeccable-live-session-scroll"));' +- 'if(isFinite(y))window.scrollTo(0,y);}catch(e){}})();</script>';+ 'if(!isFinite(y))return;' ++ 'var apply=function(){if(Math.abs(window.scrollY-y)>0.5)window.scrollTo(0,y);};' ++ 'apply();' ++ 'if(document.fonts&&document.fonts.ready)document.fonts.ready.then(apply);' ++ 'window.addEventListener("load",apply,{once:true});' ++ '}catch(e){}})();</script>';return (open + ' ' + MARKER_OPEN_TEXT + ' ' + close + '\n' +preRestore + '\n' +diff --git a/.github/skills/impeccable/scripts/live-inject.mjs b/.github/skills/impeccable/scripts/live-inject.mjsindex daf44cde8..37a16f1ea 100644--- a/.github/skills/impeccable/scripts/live-inject.mjs+++ b/.github/skills/impeccable/scripts/live-inject.mjs@@ -138,14 +138,23 @@ function buildTagBlock(syntax, port) {const open = commentOpen(syntax);const close = commentClose(syntax);// Inline pre-restore: runs before the external live.js is fetched. Sets- // scrollRestoration='manual' and jumps to the saved scrollY *synchronously*+ // scrollRestoration='manual' and jumps to the saved scrollY synchronously// during HTML parse, beating the browser's animated reload-restore.+ //+ // Retries on fonts.ready and load are essential: scrollTo(y) clamps to+ // the document's current scrollHeight, which is often hundreds of+ // pixels short of the final value until async-loaded fonts swap in.// Hardcoded key matches live-browser.js: PREFIX ('impeccable-live') +// LS_KEY suffix ('-session') + SCROLL_KEY_SUFFIX ('-scroll').const preRestore ='<script>(function(){try{history.scrollRestoration="manual";' +'var y=parseFloat(localStorage.getItem("impeccable-live-session-scroll"));' +- 'if(isFinite(y))window.scrollTo(0,y);}catch(e){}})();</script>';+ 'if(!isFinite(y))return;' ++ 'var apply=function(){if(Math.abs(window.scrollY-y)>0.5)window.scrollTo(0,y);};' ++ 'apply();' ++ 'if(document.fonts&&document.fonts.ready)document.fonts.ready.then(apply);' ++ 'window.addEventListener("load",apply,{once:true});' ++ '}catch(e){}})();</script>';return (open + ' ' + MARKER_OPEN_TEXT + ' ' + close + '\n' +preRestore + '\n' +diff --git a/.kiro/skills/impeccable/scripts/live-inject.mjs b/.kiro/skills/impeccable/scripts/live-inject.mjsindex daf44cde8..37a16f1ea 100644--- a/.kiro/skills/impeccable/scripts/live-inject.mjs+++ b/.kiro/skills/impeccable/scripts/live-inject.mjs@@ -138,14 +138,23 @@ function buildTagBlock(syntax, port) {const open = commentOpen(syntax);const close = commentClose(syntax);// Inline pre-restore: runs before the external live.js is fetched. Sets- // scrollRestoration='manual' and jumps to the saved scrollY *synchronously*+ // scrollRestoration='manual' and jumps to the saved scrollY synchronously// during HTML parse, beating the browser's animated reload-restore.+ //+ // Retries on fonts.ready and load are essential: scrollTo(y) clamps to+ // the document's current scrollHeight, which is often hundreds of+ // pixels short of the final value until async-loaded fonts swap in.// Hardcoded key matches live-browser.js: PREFIX ('impeccable-live') +// LS_KEY suffix ('-session') + SCROLL_KEY_SUFFIX ('-scroll').const preRestore ='<script>(function(){try{history.scrollRestoration="manual";' +'var y=parseFloat(localStorage.getItem("impeccable-live-session-scroll"));' +- 'if(isFinite(y))window.scrollTo(0,y);}catch(e){}})();</script>';+ 'if(!isFinite(y))return;' ++ 'var apply=function(){if(Math.abs(window.scrollY-y)>0.5)window.scrollTo(0,y);};' ++ 'apply();' ++ 'if(document.fonts&&document.fonts.ready)document.fonts.ready.then(apply);' ++ 'window.addEventListener("load",apply,{once:true});' ++ '}catch(e){}})();</script>';return (open + ' ' + MARKER_OPEN_TEXT + ' ' + close + '\n' +preRestore + '\n' +diff --git a/.opencode/skills/impeccable/scripts/live-inject.mjs b/.opencode/skills/impeccable/scripts/live-inject.mjsindex daf44cde8..37a16f1ea 100644--- a/.opencode/skills/impeccable/scripts/live-inject.mjs+++ b/.opencode/skills/impeccable/scripts/live-inject.mjs@@ -138,14 +138,23 @@ function buildTagBlock(syntax, port) {const open = commentOpen(syntax);const close = commentClose(syntax);// Inline pre-restore: runs before the external live.js is fetched. Sets- // scrollRestoration='manual' and jumps to the saved scrollY *synchronously*+ // scrollRestoration='manual' and jumps to the saved scrollY synchronously// during HTML parse, beating the browser's animated reload-restore.+ //+ // Retries on fonts.ready and load are essential: scrollTo(y) clamps to+ // the document's current scrollHeight, which is often hundreds of+ // pixels short of the final value until async-loaded fonts swap in.// Hardcoded key matches live-browser.js: PREFIX ('impeccable-live') +// LS_KEY suffix ('-session') + SCROLL_KEY_SUFFIX ('-scroll').const preRestore ='<script>(function(){try{history.scrollRestoration="manual";' +'var y=parseFloat(localStorage.getItem("impeccable-live-session-scroll"));' +- 'if(isFinite(y))window.scrollTo(0,y);}catch(e){}})();</script>';+ 'if(!isFinite(y))return;' ++ 'var apply=function(){if(Math.abs(window.scrollY-y)>0.5)window.scrollTo(0,y);};' ++ 'apply();' ++ 'if(document.fonts&&document.fonts.ready)document.fonts.ready.then(apply);' ++ 'window.addEventListener("load",apply,{once:true});' ++ '}catch(e){}})();</script>';return (open + ' ' + MARKER_OPEN_TEXT + ' ' + close + '\n' +preRestore + '\n' +diff --git a/.pi/skills/impeccable/scripts/live-inject.mjs b/.pi/skills/impeccable/scripts/live-inject.mjsindex daf44cde8..37a16f1ea 100644--- a/.pi/skills/impeccable/scripts/live-inject.mjs+++ b/.pi/skills/impeccable/scripts/live-inject.mjs@@ -138,14 +138,23 @@ function buildTagBlock(syntax, port) {const open = commentOpen(syntax);const close = commentClose(syntax);// Inline pre-restore: runs before the external live.js is fetched. Sets- // scrollRestoration='manual' and jumps to the saved scrollY *synchronously*+ // scrollRestoration='manual' and jumps to the saved scrollY synchronously// during HTML parse, beating the browser's animated reload-restore.+ //+ // Retries on fonts.ready and load are essential: scrollTo(y) clamps to+ // the document's current scrollHeight, which is often hundreds of+ // pixels short of the final value until async-loaded fonts swap in.// Hardcoded key matches live-browser.js: PREFIX ('impeccable-live') +// LS_KEY suffix ('-session') + SCROLL_KEY_SUFFIX ('-scroll').const preRestore ='<script>(function(){try{history.scrollRestoration="manual";' +'var y=parseFloat(localStorage.getItem("impeccable-live-session-scroll"));' +- 'if(isFinite(y))window.scrollTo(0,y);}catch(e){}})();</script>';+ 'if(!isFinite(y))return;' ++ 'var apply=function(){if(Math.abs(window.scrollY-y)>0.5)window.scrollTo(0,y);};' ++ 'apply();' ++ 'if(document.fonts&&document.fonts.ready)document.fonts.ready.then(apply);' ++ 'window.addEventListener("load",apply,{once:true});' ++ '}catch(e){}})();</script>';return (open + ' ' + MARKER_OPEN_TEXT + ' ' + close + '\n' +preRestore + '\n' +diff --git a/.rovodev/skills/impeccable/scripts/live-inject.mjs b/.rovodev/skills/impeccable/scripts/live-inject.mjsindex daf44cde8..37a16f1ea 100644--- a/.rovodev/skills/impeccable/scripts/live-inject.mjs+++ b/.rovodev/skills/impeccable/scripts/live-inject.mjs@@ -138,14 +138,23 @@ function buildTagBlock(syntax, port) {const open = commentOpen(syntax);const close = commentClose(syntax);// Inline pre-restore: runs before the external live.js is fetched. Sets- // scrollRestoration='manual' and jumps to the saved scrollY *synchronously*+ // scrollRestoration='manual' and jumps to the saved scrollY synchronously// during HTML parse, beating the browser's animated reload-restore.+ //+ // Retries on fonts.ready and load are essential: scrollTo(y) clamps to+ // the document's current scrollHeight, which is often hundreds of+ // pixels short of the final value until async-loaded fonts swap in.// Hardcoded key matches live-browser.js: PREFIX ('impeccable-live') +// LS_KEY suffix ('-session') + SCROLL_KEY_SUFFIX ('-scroll').const preRestore ='<script>(function(){try{history.scrollRestoration="manual";' +'var y=parseFloat(localStorage.getItem("impeccable-live-session-scroll"));' +- 'if(isFinite(y))window.scrollTo(0,y);}catch(e){}})();</script>';+ 'if(!isFinite(y))return;' ++ 'var apply=function(){if(Math.abs(window.scrollY-y)>0.5)window.scrollTo(0,y);};' ++ 'apply();' ++ 'if(document.fonts&&document.fonts.ready)document.fonts.ready.then(apply);' ++ 'window.addEventListener("load",apply,{once:true});' ++ '}catch(e){}})();</script>';return (open + ' ' + MARKER_OPEN_TEXT + ' ' + close + '\n' +preRestore + '\n' +diff --git a/.trae-cn/skills/impeccable/scripts/live-inject.mjs b/.trae-cn/skills/impeccable/scripts/live-inject.mjsindex daf44cde8..37a16f1ea 100644--- a/.trae-cn/skills/impeccable/scripts/live-inject.mjs+++ b/.trae-cn/skills/impeccable/scripts/live-inject.mjs@@ -138,14 +138,23 @@ function buildTagBlock(syntax, port) {const open = commentOpen(syntax);const close = commentClose(syntax);// Inline pre-restore: runs before the external live.js is fetched. Sets- // scrollRestoration='manual' and jumps to the saved scrollY *synchronously*+ // scrollRestoration='manual' and jumps to the saved scrollY synchronously// during HTML parse, beating the browser's animated reload-restore.+ //+ // Retries on fonts.ready and load are essential: scrollTo(y) clamps to+ // the document's current scrollHeight, which is often hundreds of+ // pixels short of the final value until async-loaded fonts swap in.// Hardcoded key matches live-browser.js: PREFIX ('impeccable-live') +// LS_KEY suffix ('-session') + SCROLL_KEY_SUFFIX ('-scroll').const preRestore ='<script>(function(){try{history.scrollRestoration="manual";' +'var y=parseFloat(localStorage.getItem("impeccable-live-session-scroll"));' +- 'if(isFinite(y))window.scrollTo(0,y);}catch(e){}})();</script>';+ 'if(!isFinite(y))return;' ++ 'var apply=function(){if(Math.abs(window.scrollY-y)>0.5)window.scrollTo(0,y);};' ++ 'apply();' ++ 'if(document.fonts&&document.fonts.ready)document.fonts.ready.then(apply);' ++ 'window.addEventListener("load",apply,{once:true});' ++ '}catch(e){}})();</script>';return (open + ' ' + MARKER_OPEN_TEXT + ' ' + close + '\n' +preRestore + '\n' +diff --git a/.trae/skills/impeccable/scripts/live-inject.mjs b/.trae/skills/impeccable/scripts/live-inject.mjsindex daf44cde8..37a16f1ea 100644--- a/.trae/skills/impeccable/scripts/live-inject.mjs+++ b/.trae/skills/impeccable/scripts/live-inject.mjs@@ -138,14 +138,23 @@ function buildTagBlock(syntax, port) {const open = commentOpen(syntax);const close = commentClose(syntax);// Inline pre-restore: runs before the external live.js is fetched. Sets- // scrollRestoration='manual' and jumps to the saved scrollY *synchronously*+ // scrollRestoration='manual' and jumps to the saved scrollY synchronously// during HTML parse, beating the browser's animated reload-restore.+ //+ // Retries on fonts.ready and load are essential: scrollTo(y) clamps to+ // the document's current scrollHeight, which is often hundreds of+ // pixels short of the final value until async-loaded fonts swap in.// Hardcoded key matches live-browser.js: PREFIX ('impeccable-live') +// LS_KEY suffix ('-session') + SCROLL_KEY_SUFFIX ('-scroll').const preRestore ='<script>(function(){try{history.scrollRestoration="manual";' +'var y=parseFloat(localStorage.getItem("impeccable-live-session-scroll"));' +- 'if(isFinite(y))window.scrollTo(0,y);}catch(e){}})();</script>';+ 'if(!isFinite(y))return;' ++ 'var apply=function(){if(Math.abs(window.scrollY-y)>0.5)window.scrollTo(0,y);};' ++ 'apply();' ++ 'if(document.fonts&&document.fonts.ready)document.fonts.ready.then(apply);' ++ 'window.addEventListener("load",apply,{once:true});' ++ '}catch(e){}})();</script>';return (open + ' ' + MARKER_OPEN_TEXT + ' ' + close + '\n' +preRestore + '\n' +diff --git a/public/index.html b/public/index.htmlindex 6c638efcc..06423fd5f 100644--- a/public/index.html+++ b/public/index.html@@ -725,8 +725,9 @@- <!-- impeccable-variants-start 32275091 -->- <div data-impeccable-variants="32275091" data-impeccable-variant-count="3" style="display: contents">++ <!-- impeccable-variants-start f3c91105 -->+ <div data-impeccable-variants="f3c91105" data-impeccable-variant-count="3" style="display: contents"><!-- Original --><div data-impeccable-variant="original"><div class="consulting-text">@@ -735,7 +736,7 @@</div></div><!-- Variants: insert below this line -->- <style data-impeccable-css="32275091">+ <style data-impeccable-css="f3c91105">@scope ([data-impeccable-variant="1"]) {.consulting-text { display: grid; gap: 14px; max-width: 56ch; }.v1-tag { font-family: var(--font-mono); font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.25em; color: var(--color-accent); }@@ -745,7 +746,7 @@}@scope ([data-impeccable-variant="2"]) {.consulting-text { display: flex; align-items: baseline; gap: 28px; padding: 20px 0; border-block: 1px solid var(--color-ink); }- .v2-mark { font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: 3rem; line-height: 0.9; color: var(--color-accent); }+ .v2-mark { font-family: var(--font-display); font-style: italic; font-size: 3rem; line-height: 0.9; color: var(--color-accent); }.v2-body { display: flex; flex-direction: column; gap: 8px; max-width: 52ch; }.v2-title { font-family: var(--font-display); font-style: italic; font-size: 1.875rem; line-height: 1.15; color: var(--color-ink); margin: 0; }.v2-body p { font-family: var(--font-body); font-size: 0.9375rem; line-height: 1.6; color: var(--color-charcoal); margin: 0; }@@ -781,7 +782,8 @@</div></div></div>- <!-- impeccable-variants-end 32275091 -->+ <!-- impeccable-variants-end f3c91105 -->+@@ -832,7 +834,7 @@<script type="module" src="./app.js"></script><!-- impeccable-live-start -->-<script>(function(){try{history.scrollRestoration="manual";var y=parseFloat(localStorage.getItem("impeccable-live-session-scroll"));if(isFinite(y))window.scrollTo(0,y);}catch(e){}})();</script>+<script>(function(){try{history.scrollRestoration="manual";var y=parseFloat(localStorage.getItem("impeccable-live-session-scroll"));if(!isFinite(y))return;var apply=function(){if(Math.abs(window.scrollY-y)>0.5)window.scrollTo(0,y);};apply();if(document.fonts&&document.fonts.ready)document.fonts.ready.then(apply);window.addEventListener("load",apply,{once:true});}catch(e){}})();</script><script src="http://localhost:8400/live.js"></script><!-- impeccable-live-end --></body>diff --git a/public/privacy.html b/public/privacy.htmlindex 2bb9a7e2b..817b152e4 100644--- a/public/privacy.html+++ b/public/privacy.html@@ -78,7 +78,7 @@<p>Questions about this policy? Open an issue on <a href="https://github.com/pbakaus/impeccable">GitHub</a> or reach out to <a href="https://x.com/pbakaus">@pbakaus</a>.</p></main><!-- impeccable-live-start -->-<script>(function(){try{history.scrollRestoration="manual";var y=parseFloat(localStorage.getItem("impeccable-live-session-scroll"));if(isFinite(y))window.scrollTo(0,y);}catch(e){}})();</script>+<script>(function(){try{history.scrollRestoration="manual";var y=parseFloat(localStorage.getItem("impeccable-live-session-scroll"));if(!isFinite(y))return;var apply=function(){if(Math.abs(window.scrollY-y)>0.5)window.scrollTo(0,y);};apply();if(document.fonts&&document.fonts.ready)document.fonts.ready.then(apply);window.addEventListener("load",apply,{once:true});}catch(e){}})();</script><script src="http://localhost:8400/live.js"></script><!-- impeccable-live-end --></body>diff --git a/source/skills/impeccable/scripts/live-inject.mjs b/source/skills/impeccable/scripts/live-inject.mjsindex daf44cde8..37a16f1ea 100644--- a/source/skills/impeccable/scripts/live-inject.mjs+++ b/source/skills/impeccable/scripts/live-inject.mjs@@ -138,14 +138,23 @@ function buildTagBlock(syntax, port) {const open = commentOpen(syntax);const close = commentClose(syntax);// Inline pre-restore: runs before the external live.js is fetched. Sets- // scrollRestoration='manual' and jumps to the saved scrollY *synchronously*+ // scrollRestoration='manual' and jumps to the saved scrollY synchronously// during HTML parse, beating the browser's animated reload-restore.+ //+ // Retries on fonts.ready and load are essential: scrollTo(y) clamps to+ // the document's current scrollHeight, which is often hundreds of+ // pixels short of the final value until async-loaded fonts swap in.// Hardcoded key matches live-browser.js: PREFIX ('impeccable-live') +// LS_KEY suffix ('-session') + SCROLL_KEY_SUFFIX ('-scroll').const preRestore ='<script>(function(){try{history.scrollRestoration="manual";' +'var y=parseFloat(localStorage.getItem("impeccable-live-session-scroll"));' +- 'if(isFinite(y))window.scrollTo(0,y);}catch(e){}})();</script>';+ 'if(!isFinite(y))return;' ++ 'var apply=function(){if(Math.abs(window.scrollY-y)>0.5)window.scrollTo(0,y);};' ++ 'apply();' ++ 'if(document.fonts&&document.fonts.ready)document.fonts.ready.then(apply);' ++ 'window.addEventListener("load",apply,{once:true});' ++ '}catch(e){}})();</script>';return (open + ' ' + MARKER_OPEN_TEXT + ' ' + close + '\n' +preRestore + '\n' +