javascript:(()=>{const ID="__font_audit_overlay__",STYLE_ID="__font_audit_style__",ATTR="data-font-audit",OUTLINE="__font_audit_outline__";const old=document.getElementById(ID),oldS=document.getElementById(STYLE_ID);if(old)old.remove();if(oldS)oldS.remove();document.querySelectorAll(`[${ATTR}]`).forEach(el=>{el.classList.remove(OUTLINE);el.removeAttribute(ATTR);});const style=document.createElement("style");style.id=STYLE_ID;style.textContent=`.${OUTLINE}{outline:3px solid #ff2d55!important;outline-offset:2px!important;}#${ID}{position:fixed;z-index:2147483647;right:12px;bottom:12px;width:360px;max-height:60vh;overflow:hidden;font:12px/1.35 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;background:rgba(20,20,20,.96);color:#fff;border-radius:12px;box-shadow:0 10px 30px rgba(0,0,0,.35);border:1px solid rgba(255,255,255,.12);}#${ID}.min{width:210px;}#${ID} header{padding:10px 12px;border-bottom:1px solid rgba(255,255,255,.12);display:flex;gap:6px;align-items:center;}#${ID}.min header{border-bottom:none;}#${ID} header .t{font-weight:700;font-size:13px;flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}#${ID} header button{background:rgba(255,255,255,.1);border:1px solid rgba(255,255,255,.15);color:#fff;border-radius:10px;padding:4px 8px;cursor:pointer;font-size:11px;}#${ID} header button:hover{background:rgba(255,255,255,.16);}#${ID} .body{max-height:55vh;overflow:auto;}#${ID}.min .body{display:none;}#${ID} .meta{padding:10px 12px;border-bottom:1px solid rgba(255,255,255,.12);color:rgba(255,255,255,.85);}#${ID} .list{padding:10px 12px;display:grid;gap:8px;}#${ID} .row{padding:8px 10px;border-radius:10px;background:rgba(255,255,255,.06);border:1px solid rgba(255,255,255,.1);cursor:pointer;}#${ID} .row:hover{background:rgba(255,255,255,.10);}#${ID} .row.active{border-color:rgba(255,45,85,.55);background:rgba(255,45,85,.14);}#${ID} .row .ff{font-weight:700;margin-bottom:4px;word-break:break-word;}#${ID} .row .sub{color:rgba(255,255,255,.78);display:flex;justify-content:space-between;gap:8px;}#${ID} .tag{font-size:11px;padding:2px 6px;border-radius:999px;background:rgba(255,45,85,.2);border:1px solid rgba(255,45,85,.35);}#${ID} .hint{padding:10px 12px;color:rgba(255,255,255,.7);}%60;document.documentElement.appendChild(style);const isVisible=el=>{if(!(el instanceof Element))return false;const cs=getComputedStyle(el);if(cs.display==="none"||cs.visibility==="hidden"||parseFloat(cs.opacity)===0)return false;const r=el.getBoundingClientRect();return r.width>0&&r.height>0;};const hasText=el=>{if(!el)return false;const txt=(el.textContent||"").replace(/\s+/g," ").trim();if(txt.length(ff||"").split(",").map(s=>s.trim().replace(/^["']|["']$/g,"")).filter(Boolean).join(", ");const roots=Array.from(document.querySelectorAll(".elementor, .elementor-location-header .elementor, .elementor-location-footer .elementor, .elementor-location-single .elementor, .elementor-location-archive .elementor"));if(!roots.length){alert("Font Audit: No Elementor root found.");return;}const selector=":is(.elementor-section,.elementor-container,.elementor-column,.elementor-widget,.elementor-element,.elementor-text-editor,.elementor-heading-title,.elementor-icon-list-text) *";const seen=new Set(),elems=[],counts=new Map();for(const root of roots){root.querySelectorAll(selector).forEach(el=>{if(seen.has(el))return;seen.add(el);if(!isVisible(el)||!hasText(el))return;const ff=norm(getComputedStyle(el).fontFamily);if(!ff)return;el.setAttribute(ATTR,"1");elems.push({el,ff});counts.set(ff,(counts.get(ff)||0)+1);});}const sorted=Array.from(counts.entries()).sort((a,b)=>b[1]-a[1]);const total=elems.length;const primary=sorted[0]?.[0]||null;let highlightsVisible=true;let mode="outliers";let spotlightFont=null;let currentTargets=new Set();const clearTargets=()=>{currentTargets.forEach(el=>el.classList.remove(OUTLINE));currentTargets=new Set();};const setTargets=t=>{clearTargets();currentTargets=new Set(t);if(highlightsVisible){currentTargets.forEach(el=>el.classList.add(OUTLINE));}};const applyOutliers=()=>{mode="outliers";spotlightFont=null;const t=[];if(primary){for(const {el,ff} of elems){if(ff!==primary)t.push(el);}}setTargets(t);};const applySpotlight=ff=>{mode="spotlight";spotlightFont=ff;const t=[];for(const item of elems){if(item.ff===ff)t.push(item.el);}setTargets(t);};applyOutliers();const overlay=document.createElement("div");overlay.id=ID;const header=document.createElement("header");const title=document.createElement("div");title.className="t";title.textContent="Font Audit (Elementor)";const btnMin=document.createElement("button");btnMin.textContent="Minimize";const btnToggle=document.createElement("button");btnToggle.textContent="Hide HL";const btnClear=document.createElement("button");btnClear.textContent="Clear";header.append(title,btnMin,btnToggle,btnClear);const body=document.createElement("div");body.className="body";const meta=document.createElement("div");meta.className="meta";meta.innerHTML=%60
${sorted.length} unique font stack(s) across ${total} elements.
Primary: ${primary||"—"}
Default highlight: outliers
%60;const list=document.createElement("div");list.className="list";let activeRow=null;sorted.slice(0,50).forEach(([ff,c])=>{const row=document.createElement("div");row.className="row";const pct=total?Math.round(c/total*100):0;row.innerHTML=%60${ff}${ff===primary?%60 primary%60:""}
count: ${c}${pct}%
%60;row.title="Click to spotlight this font (toggle).";row.addEventListener("click",()=>{const isActive=activeRow===row&&mode==="spotlight"&&spotlightFont===ff;if(isActive){row.classList.remove("active");activeRow=null;applyOutliers();meta.innerHTML=%60${sorted.length} unique font stack(s) across ${total} elements.
Primary: ${primary||"—"}
Default highlight: outliers
%60;return;}if(activeRow)activeRow.classList.remove("active");row.classList.add("active");activeRow=row;applySpotlight(ff);meta.innerHTML=%60${sorted.length} unique font stack(s) across ${total} elements.
Spotlight: ${ff}
Click again to return to outliers.
%60;});list.appendChild(row);});const hint=document.createElement("div");hint.className="hint";hint.textContent="Minimize to move the panel. Click a font row to spotlight it; click again to return to outliers.";body.append(meta,list,hint);overlay.append(header,body);document.documentElement.appendChild(overlay);let minimized=false;btnMin.onclick=()=>{minimized=!minimized;overlay.classList.toggle("min",minimized);btnMin.textContent=minimized?"Expand":"Minimize";};btnToggle.onclick=()=>{highlightsVisible=!highlightsVisible;currentTargets.forEach(el=>el.classList.toggle(OUTLINE,highlightsVisible));btnToggle.textContent=highlightsVisible?"Hide HL":"Show HL";};btnClear.onclick=()=>{overlay.remove();style.remove();document.querySelectorAll(%60[${ATTR}]%60).forEach(el=>{el.classList.remove(OUTLINE);el.removeAttribute(ATTR);});};})();