diff --git a/app/index.html b/app/index.html index ab6d934..3f05de6 100644 --- a/app/index.html +++ b/app/index.html @@ -1094,9 +1094,16 @@ body { async function maybeLoadCategoryFont(code) { const cat = categoriesByCode[code]; - if (!cat || !cat.font || loadedFonts.has(cat.font)) return; - showFontLoadingBanner(); + if (!cat || !cat.font) { + document.body.style.fontFamily = ''; + return; + } const family = 'mdcms-cat-' + code; + if (loadedFonts.has(cat.font)) { + document.body.style.fontFamily = `"${family}", ${getComputedStyle(document.documentElement).getPropertyValue('--font-body').trim()}`; + return; + } + showFontLoadingBanner(); const css = `@font-face { font-family: "${family}"; src: url("assets/fonts/${cat.font}"); }`; const style = document.createElement('style'); style.textContent = css; @@ -1106,8 +1113,7 @@ body { await face.load(); document.fonts.add(face); loadedFonts.add(cat.font); - // Apply font to body for this session - document.body.style.fontFamily = `"${family}", ${getComputedStyle(document.body).fontFamily}`; + document.body.style.fontFamily = `"${family}", ${getComputedStyle(document.documentElement).getPropertyValue('--font-body').trim()}`; } catch (e) { console.warn('Font load failed:', e); }