{"template--28263076561271__ux_booster":"<section id=\"shopify-section-template--28263076561271__ux_booster\" class=\"shopify-section uxb-section-wrapper\">\n\n<link href=\"//nordelvia.com/cdn/shop/t/10/assets/collection-ux-booster.css?v=113391556522460998351775817209\" rel=\"stylesheet\" type=\"text/css\" media=\"all\" />\n\n\n<style>\n@media (max-width: 749px) {\n  .content-for-layout > .shopify-section:first-child .section {\n    padding-block-start: 24px !important;\n    padding-block-end: 24px !important;\n  }\n  .content-for-layout > .shopify-section:first-child .section h1 {\n    font-size: 20px !important;\n  }\n}\n@media (min-width: 750px) {\n  .content-for-layout > .shopify-section:first-child .section h1 {\n    font-size: 28px !important;\n  }\n  .content-for-layout > .shopify-section:first-child .section {\n    padding-block-start: 48px !important;\n    padding-block-end: 48px !important;\n  }\n}\n</style>\n\n\n<style>\n@font-face {\n  font-family: 'Material Symbols Outlined';\n  font-style: normal;\n  src: url(https://fonts.gstatic.com/s/materialsymbolsoutlined/v241/kJEhBvYX7BgnkSrUwT8OhrdQw4oELdPIeeII9v6oFsI.woff2) format('woff2');\n}\n.material-symbols-outlined {\n  font-family: 'Material Symbols Outlined';\n  font-weight: normal;\n  font-style: normal;\n  display: inline-block;\n  line-height: 1;\n  text-transform: none;\n  letter-spacing: normal;\n  word-wrap: normal;\n  white-space: nowrap;\n  direction: ltr;\n  -webkit-font-smoothing: antialiased;\n}\n</style>\n\n<div class=\"section uxb-section color-scheme-1\">\n<div class=\"uxb-nav-lines\" style=\"display:flex;flex-direction:column;gap:4px;\">\n\n\n\n<div class=\"uxb-cat-nav\" style=\"order:1;--uxb-icon-wght:200;--uxb-icon-opsz:48;--uxb-label-align:center;--uxb-cat-bg:#ffffff;--uxb-cat-border:#e5e2dc;--uxb-cat-color:#000000;--uxb-cat-active-bg:#9e8f76;--uxb-cat-active-color:#ffffff;\">\n  \n<div class=\"uxb-cat-scroll uxb-align-center\" style=\"--uxb-icon-radius:8px;\">\n    \n      \n\n        \n          <a class=\"uxb-cat-item  uxb-pill-ajax\"\n             href=\"/collections/tapis-de-salle-de-bain/vert+chenille\" data-uxb-tag-check=\"chenille\"\n             >\n            \n              \n              <div class=\"uxb-cat-icon\" style=\"width:20px;height:20px;\">\n                <span class=\"material-symbols-outlined uxb-cat-mat-icon\" style=\"font-size:20px;\">texture</span>\n              </div>\n            \n            <span class=\"uxb-cat-label-txt\">Chenille</span>\n          </a>\n        \n        \n      \n    \n      \n\n        \n          <a class=\"uxb-cat-item  uxb-pill-ajax\"\n             href=\"/collections/tapis-de-salle-de-bain/vert+diatomite\" data-uxb-tag-check=\"diatomite\"\n             >\n            \n              \n              <div class=\"uxb-cat-icon\" style=\"width:20px;height:20px;\">\n                <span class=\"material-symbols-outlined uxb-cat-mat-icon\" style=\"font-size:20px;\">terrain</span>\n              </div>\n            \n            <span class=\"uxb-cat-label-txt\">Diatomite</span>\n          </a>\n        \n        \n      \n    \n      \n\n        \n          <a class=\"uxb-cat-item  uxb-pill-ajax\"\n             href=\"/collections/tapis-de-salle-de-bain/vert+demi-lune\" data-uxb-tag-check=\"demi lune\"\n             >\n            \n              \n              <div class=\"uxb-cat-icon\" style=\"width:20px;height:20px;\">\n                <span class=\"material-symbols-outlined uxb-cat-mat-icon\" style=\"font-size:20px;\">dark_mode</span>\n              </div>\n            \n            <span class=\"uxb-cat-label-txt\">Demi-lune</span>\n          </a>\n        \n        \n      \n    \n      \n\n        \n          <a class=\"uxb-cat-item  uxb-pill-ajax\"\n             href=\"/collections/tapis-de-salle-de-bain/vert+grand\" data-uxb-tag-check=\"grand\"\n             >\n            \n              \n              <div class=\"uxb-cat-icon\" style=\"width:20px;height:20px;\">\n                <span class=\"material-symbols-outlined uxb-cat-mat-icon\" style=\"font-size:20px;\">open_in_full</span>\n              </div>\n            \n            <span class=\"uxb-cat-label-txt\">Grand/XXL</span>\n          </a>\n        \n        \n      \n    \n      \n\n        \n          <a class=\"uxb-cat-item  uxb-pill-ajax\"\n             href=\"/collections/tapis-de-salle-de-bain/vert+antiderapant\" data-uxb-tag-check=\"antiderapant\"\n             >\n            \n              \n              <div class=\"uxb-cat-icon\" style=\"width:20px;height:20px;\">\n                <span class=\"material-symbols-outlined uxb-cat-mat-icon\" style=\"font-size:20px;\">health_and_safety</span>\n              </div>\n            \n            <span class=\"uxb-cat-label-txt\">Antidérapant</span>\n          </a>\n        \n        \n      \n    \n      \n\n        \n          <a class=\"uxb-cat-item  uxb-pill-ajax\"\n             href=\"/collections/tapis-de-salle-de-bain/vert+epais\" data-uxb-tag-check=\"epais\"\n             >\n            \n              \n              <div class=\"uxb-cat-icon\" style=\"width:20px;height:20px;\">\n                <span class=\"material-symbols-outlined uxb-cat-mat-icon\" style=\"font-size:20px;\">layers</span>\n              </div>\n            \n            <span class=\"uxb-cat-label-txt\">Épais</span>\n          </a>\n        \n        \n      \n    \n      \n\n        \n          <a class=\"uxb-cat-item  uxb-pill-ajax\"\n             href=\"/collections/tapis-de-salle-de-bain/vert+design\" data-uxb-tag-check=\"design\"\n             >\n            \n              \n              <div class=\"uxb-cat-icon\" style=\"width:20px;height:20px;\">\n                <span class=\"material-symbols-outlined uxb-cat-mat-icon\" style=\"font-size:20px;\">palette</span>\n              </div>\n            \n            <span class=\"uxb-cat-label-txt\">Design</span>\n          </a>\n        \n        \n      \n    \n      \n\n        \n          <a class=\"uxb-cat-item  uxb-pill-ajax\"\n             href=\"/collections/tapis-de-salle-de-bain/vert+haut-de-gamme\" data-uxb-tag-check=\"haut de gamme\"\n             >\n            \n              \n              <div class=\"uxb-cat-icon\" style=\"width:20px;height:20px;\">\n                <span class=\"material-symbols-outlined uxb-cat-mat-icon\" style=\"font-size:20px;\">diamond</span>\n              </div>\n            \n            <span class=\"uxb-cat-label-txt\">Haut de gamme</span>\n          </a>\n        \n        \n      \n    \n      \n\n        \n          <a class=\"uxb-cat-item  uxb-pill-ajax\"\n             href=\"/collections/tapis-de-salle-de-bain/vert+original\" data-uxb-tag-check=\"original\"\n             >\n            \n              \n              <div class=\"uxb-cat-icon\" style=\"width:20px;height:20px;\">\n                <span class=\"material-symbols-outlined uxb-cat-mat-icon\" style=\"font-size:20px;\">auto_awesome</span>\n              </div>\n            \n            <span class=\"uxb-cat-label-txt\">Original</span>\n          </a>\n        \n        \n      \n    \n      \n    \n      \n    \n      \n    \n      \n    \n      \n    \n      \n    \n      \n    \n      \n    \n      \n    \n      \n    \n      \n    \n  </div>\n</div>\n\n\n\n\n\n\n\n\n  \n\n  \n\n  \n\n  \n\n  \n\n  \n\n  \n\n  \n\n  \n\n  \n    \n    \n\n<div class=\"uxb-color-pills\" style=\"order:3;--uxb-cpill-bg:#ffffff;--uxb-cpill-border:#e5e2dc;--uxb-cpill-color:#000000;--uxb-cpill-active-bg:#8b7355;--uxb-cpill-active-color:#ffffff;--uxb-cpill-outline:#000000;--uxb-pill-radius:20px;margin-bottom:6px;\"><div class=\"uxb-pills-scroll uxb-align-center\" style=\"--uxb-pill-radius:20px;\">\n    \n      \n    \n      \n    \n      \n    \n      \n    \n      \n    \n      \n    \n      \n    \n      \n    \n      \n    \n      \n<a class=\"uxb-color-pill uxb-pill uxb-pill-ajax uxb-color-pill--dot-only\"\n             href=\"/collections/tapis-de-salle-de-bain/blanc\" data-uxb-tag-check=\"blanc\"\n             >\n            <span class=\"uxb-color-dot\" style=\"background:#f9f9f8;width:20px;height:20px;\"></span></a>\n    \n      \n<a class=\"uxb-color-pill uxb-pill on uxb-pill-ajax uxb-color-pill--dot-only\"\n             href=\"/collections/tapis-de-salle-de-bain\" data-uxb-tag-check=\"vert\"\n             >\n            <span class=\"uxb-color-dot\" style=\"background:#6daf6d;width:20px;height:20px;\"></span></a>\n    \n      \n<a class=\"uxb-color-pill uxb-pill uxb-pill-ajax uxb-color-pill--dot-only\"\n             href=\"/collections/tapis-de-salle-de-bain/orange\" data-uxb-tag-check=\"orange\"\n             >\n            <span class=\"uxb-color-dot\" style=\"background:#ed7043;width:20px;height:20px;\"></span></a>\n    \n      \n<a class=\"uxb-color-pill uxb-pill uxb-pill-ajax uxb-color-pill--dot-only\"\n             href=\"/collections/tapis-de-salle-de-bain/noir\" data-uxb-tag-check=\"noir\"\n             >\n            <span class=\"uxb-color-dot\" style=\"background:#333333;width:20px;height:20px;\"></span></a>\n    \n      \n<a class=\"uxb-color-pill uxb-pill uxb-pill-ajax uxb-color-pill--dot-only\"\n             href=\"/collections/tapis-de-salle-de-bain/rose\" data-uxb-tag-check=\"rose\"\n             >\n            <span class=\"uxb-color-dot\" style=\"background:#ee89ee;width:20px;height:20px;\"></span></a>\n    \n      \n<a class=\"uxb-color-pill uxb-pill uxb-pill-ajax uxb-color-pill--dot-only\"\n             href=\"/collections/tapis-de-salle-de-bain/gris\" data-uxb-tag-check=\"gris\"\n             >\n            <span class=\"uxb-color-dot\" style=\"background:#a7a7a7;width:20px;height:20px;\"></span></a>\n    \n      \n<a class=\"uxb-color-pill uxb-pill uxb-pill-ajax uxb-color-pill--dot-only\"\n             href=\"/collections/tapis-de-salle-de-bain/beige\" data-uxb-tag-check=\"beige\"\n             >\n            <span class=\"uxb-color-dot\" style=\"background:#e8d3b8;width:20px;height:20px;\"></span></a>\n    \n      \n<a class=\"uxb-color-pill uxb-pill uxb-pill-ajax uxb-color-pill--dot-only\"\n             href=\"/collections/tapis-de-salle-de-bain/rouge\" data-uxb-tag-check=\"rouge\"\n             >\n            <span class=\"uxb-color-dot\" style=\"background:#cc4444;width:20px;height:20px;\"></span></a>\n    \n      \n<a class=\"uxb-color-pill uxb-pill uxb-pill-ajax uxb-color-pill--dot-only\"\n             href=\"/collections/tapis-de-salle-de-bain/bleu\" data-uxb-tag-check=\"bleu\"\n             >\n            <span class=\"uxb-color-dot\" style=\"background:#4a90d9;width:20px;height:20px;\"></span></a>\n    \n      \n<a class=\"uxb-color-pill uxb-pill uxb-pill-ajax uxb-color-pill--dot-only\"\n             href=\"/collections/tapis-de-salle-de-bain/jaune\" data-uxb-tag-check=\"jaune\"\n             >\n            <span class=\"uxb-color-dot\" style=\"background:#e8d44a;width:20px;height:20px;\"></span></a>\n    \n      \n<a class=\"uxb-color-pill uxb-pill uxb-pill-ajax uxb-color-pill--dot-only\"\n             href=\"/collections/tapis-de-salle-de-bain/marron\" data-uxb-tag-check=\"marron\"\n             >\n            <span class=\"uxb-color-dot\" style=\"background:#8b6f47;width:20px;height:20px;\"></span></a>\n    \n  </div>\n</div>\n\n\n</div> \n\n\n\n<div class=\"uxb-active-filter show\">\n  <div class=\"uxb-af-inner\">\n    <span class=\"uxb-af-count\">33 articles</span>\n    <a class=\"uxb-af-clear uxb-pill-ajax\" href=\"/collections/tapis-de-salle-de-bain\" style=\"background:#9e8f76;color:#ffffff;border-radius:0px;\">✕ Afficher tout</a>\n  </div>\n</div>\n\n\n</div> \n\n\n\n\n\n\n<link rel=\"preload\" href=\"/collections/tapis-de-salle-de-bain/vert?sections=template--28263076561271__ux_booster\" as=\"fetch\" crossorigin>\n\n\n\n<script>\n(function(){\n  'use strict';\n\n\n  /* AJAX filtering via Shopify Section Rendering API */\n  var uxbLoading = false;\n  window.uxbFilterByURL = function(url) {\n    if (uxbLoading) return;\n    uxbLoading = true;\n\n    var boosterEl = document.querySelector('.uxb-section-wrapper')?.closest('.shopify-section');\n    var gridEl = document.querySelector('.product-grid-container')?.closest('.shopify-section');\n    if (!boosterEl || !gridEl) { window.location.href = url; return; }\n\n    var boosterId = boosterEl.id.replace('shopify-section-', '');\n    var gridId = gridEl.id.replace('shopify-section-', '');\n\n    /* Show loading state on clicked pill only */\n    var clickedPill = document.querySelector('.uxb-pill.uxb-loading');\n    if (clickedPill) clickedPill.classList.remove('uxb-loading');\n    var allPills = document.querySelectorAll('.uxb-pill[href=\"' + url + '\"]');\n    allPills.forEach(function(p){ p.classList.add('uxb-loading'); });\n\n    history.pushState({}, '', url);\n\n    /* Build fetch URLs */\n    var fetchUrl = url + (url.indexOf('?') > -1 ? '&' : '?') + 'sections=' + boosterId + ',' + gridId;\n    var mainPromise = fetch(fetchUrl).then(function(r){ return r.json(); });\n\n    \n    /* On translated pages, fetch lightweight French variant data in parallel */\n    var curRoot = '/';\n    var frUrl = url;\n    if(curRoot && curRoot !== '/' && frUrl.indexOf(curRoot + '/') === 0){\n      frUrl = frUrl.substring(curRoot.length);\n    }\n    var varSection = document.querySelector('[id*=\"collection-uxb-variants\"]');\n    var varSectionId = varSection ? varSection.id.replace('shopify-section-', '') : gridId;\n    var _isLw = !!varSection;\n    var frFetchUrl = frUrl + (frUrl.indexOf('?') > -1 ? '&' : '?') + 'sections=' + varSectionId;\n    var frPromise = fetch(frFetchUrl).then(function(r){ return r.json(); }).catch(function(){ return null; });\n\n    /* Wait for BOTH fetches before inserting into DOM */\n    Promise.all([mainPromise, frPromise]).then(function(results){\n      var data = results[0];\n      var frData = results[1];\n\n      /* Replace UX Booster section */\n      if (data[boosterId]) {\n        var tmp = document.createElement('div');\n        tmp.innerHTML = data[boosterId];\n        var newBooster = tmp.querySelector('.section.uxb-section') || tmp.firstElementChild;\n        var oldBooster = boosterEl.querySelector('.section.uxb-section') || boosterEl.firstElementChild;\n        if (newBooster && oldBooster) {\n          oldBooster.parentNode.replaceChild(newBooster, oldBooster);\n        }\n      }\n\n      if (data[gridId]) {\n        var tmp2 = document.createElement('div');\n        tmp2.innerHTML = data[gridId];\n\n        /* Merge French variant data BEFORE inserting into DOM */\n        if(frData && frData[varSectionId]){\n          var frMap = {};\n          if(_isLw){\n            try { frMap = JSON.parse(frData[varSectionId].replace(/<[^>]*>/g, '').trim()); } catch(e){}\n          } else {\n            var frTmp = document.createElement('div');\n            frTmp.innerHTML = frData[varSectionId];\n            frTmp.querySelectorAll('[data-product-id][data-uxb-variants]').forEach(function(el){\n              frMap[el.getAttribute('data-product-id')] = el.getAttribute('data-uxb-variants');\n            });\n          }\n          for(var pid in frMap){\n            var enEl = tmp2.querySelector('[data-product-id=\"' + pid + '\"]');\n            if(enEl) enEl.setAttribute('data-uxb-variants', frMap[pid]);\n          }\n        }\n\n        /* NOW insert into DOM with correct variant data */\n        var newGrid = tmp2.querySelector('.product-grid');\n        var oldGrid = gridEl.querySelector('.product-grid');\n        if (newGrid && oldGrid) {\n          oldGrid.parentNode.replaceChild(newGrid, oldGrid);\n        }\n\n        var newTpl = tmp2.querySelector('#uxb-blocks');\n        var oldTpl = document.querySelector('#uxb-blocks');\n        if (newTpl && oldTpl) oldTpl.parentNode.replaceChild(newTpl, oldTpl);\n\n        var scripts = tmp2.querySelectorAll('script');\n        scripts.forEach(function(s) {\n          if (s.textContent.indexOf('uxb-blocks') !== -1 || s.textContent.indexOf('requestAnimationFrame') !== -1) {\n            var ns = document.createElement('script');\n            ns.textContent = s.textContent;\n            document.body.appendChild(ns);\n            setTimeout(function(){ ns.remove(); }, 100);\n          }\n        });\n\n        document.dispatchEvent(new CustomEvent('filter:update'));\n      }\n\n      uxbLoading = false;\n      if(window.uxbPostRender) window.uxbPostRender();\n    }).catch(function(){\n      uxbLoading = false;\n      window.location.href = url;\n    });\n    return;\n    \n\n    /* Default locale: single fetch */\n    mainPromise.then(function(data) {\n        /* Replace UX Booster section (pills, banner) */\n        if (data[boosterId]) {\n          var tmp = document.createElement('div');\n          tmp.innerHTML = data[boosterId];\n          var newBooster = tmp.querySelector('.section.uxb-section') || tmp.firstElementChild;\n          var oldBooster = boosterEl.querySelector('.section.uxb-section') || boosterEl.firstElementChild;\n          if (newBooster && oldBooster) {\n            oldBooster.parentNode.replaceChild(newBooster, oldBooster);\n          }\n        }\n\n        if (data[gridId]) {\n          var tmp2 = document.createElement('div');\n          tmp2.innerHTML = data[gridId];\n\n          var newGrid = tmp2.querySelector('.product-grid');\n          var oldGrid = gridEl.querySelector('.product-grid');\n          if (newGrid && oldGrid) {\n            oldGrid.parentNode.replaceChild(newGrid, oldGrid);\n          }\n\n          var newTpl = tmp2.querySelector('#uxb-blocks');\n          var oldTpl = document.querySelector('#uxb-blocks');\n          if (newTpl && oldTpl) oldTpl.parentNode.replaceChild(newTpl, oldTpl);\n\n          var scripts = tmp2.querySelectorAll('script');\n          scripts.forEach(function(s) {\n            if (s.textContent.indexOf('uxb-blocks') !== -1 || s.textContent.indexOf('requestAnimationFrame') !== -1) {\n              var ns = document.createElement('script');\n              ns.textContent = s.textContent;\n              document.body.appendChild(ns);\n              setTimeout(function(){ ns.remove(); }, 100);\n            }\n          });\n\n          document.dispatchEvent(new CustomEvent('filter:update'));\n        }\n\n        uxbLoading = false;\n        if(window.uxbPostRender) window.uxbPostRender();\n      })\n      .catch(function() {\n        uxbLoading = false;\n        window.location.href = url;\n      });\n  };\n\n  window.addEventListener('popstate', function() { window.location.reload(); });\n\n  /* Event delegation — survives DOM replacements */\n  document.addEventListener('click', function(e) {\n    var pill = e.target.closest('.uxb-pill-ajax[href]');\n    if (pill) {\n      e.preventDefault();\n      window.uxbFilterByURL(pill.getAttribute('href'));\n      return;\n    }\n    var clear = e.target.closest('.uxb-af-clear');\n    if (clear) {\n      e.preventDefault();\n      window.uxbFilterByURL(clear.getAttribute('href'));\n      return;\n    }\n    var h = e.target.closest('[data-help-tag]');\n    if (h) {\n      var f = h.getAttribute('data-help-tag');\n      if (f && f.trim() !== '') {\n        window.uxbFilterByURL('/collections/tapis-de-salle-de-bain/' + f.toLowerCase().replace(/\\s+/g, '-'));\n      }\n    }\n  });\n\n  /* Sticky bar — event delegation (survives AJAX replacement) */\n  document.addEventListener('click', function(e){\n    var btn = e.target.closest('.uxb-fb-btn');\n    if(!btn) return;\n    var action = btn.getAttribute('data-action');\n    var target;\n    if(action === 'filters' || action === 'matiere' || action === 'prix'){\n      target = document.querySelector('.uxb-pills') || document.querySelector('.uxb-cat-nav');\n    } else if(action === 'sort'){\n      target = document.querySelector('.product-grid');\n    }\n    if(target) target.scrollIntoView({behavior:'smooth', block:'start'});\n  });\n\n  /* === Reusable: hide useless pills + detect active icons === */\n  window.uxbPostRender = function(){\n    var hasTagFilter = window.location.pathname.split('/').length > 3;\n    if(hasTagFilter){\n      var items = document.querySelectorAll('.product-grid__item[data-uxb-tags]');\n      if(items.length){\n        /* Check if an icon (non-color) filter is active */\n        var hasIconFilter = !!document.querySelector('.uxb-cat-item.on, .uxb-cat-inline.on');\n\n        /* Hide ICONS that would give 0 results */\n        document.querySelectorAll('.uxb-cat-item[data-uxb-tag-check], .uxb-cat-inline[data-uxb-tag-check]').forEach(function(icon){\n          if(icon.classList.contains('on')) return;\n          var tag = icon.getAttribute('data-uxb-tag-check');\n          if(!tag) return;\n          var count = 0;\n          items.forEach(function(item){\n            var tags = (item.getAttribute('data-uxb-tags') || '').split('||');\n            for(var i=0;i<tags.length;i++){\n              if(tags[i].trim() === tag){ count++; break; }\n            }\n          });\n          if(count === 0) icon.style.display = 'none';\n          else icon.style.display = '';\n        });\n\n        /* Hide COLOR PILLS that would give 0 results when an icon filter is active */\n        if(hasIconFilter){\n          document.querySelectorAll('.uxb-color-pill[data-uxb-tag-check]').forEach(function(pill){\n            if(pill.classList.contains('on')) return;\n            var tag = pill.getAttribute('data-uxb-tag-check');\n            if(!tag) return;\n            var count = 0;\n            items.forEach(function(item){\n              var tags = (item.getAttribute('data-uxb-tags') || '').split('||');\n              for(var i=0;i<tags.length;i++){\n                if(tags[i].trim() === tag){ count++; break; }\n              }\n            });\n            if(count === 0) pill.style.display = 'none';\n            else pill.style.display = '';\n          });\n        }\n      }\n    }\n\n    /* Active category icon detection */\n    var path = window.location.pathname;\n    document.querySelectorAll('.uxb-cat-item[href], .uxb-cat-inline[href]').forEach(function(a){\n      var href = a.getAttribute('href') || '';\n      if(href && path === href){\n        a.classList.add('on');\n      }\n    });\n\n    /* Center the active icon (already has .on from Liquid) */\n    requestAnimationFrame(function(){\n      var active = document.querySelector('.uxb-cat-scroll .uxb-cat-item.on, .uxb-cat-scroll .uxb-cat-inline.on');\n      if(active){\n        var scroll = active.closest('.uxb-cat-scroll');\n        if(scroll && scroll.scrollWidth > scroll.clientWidth){\n          var target = active.offsetLeft - scroll.clientWidth / 2 + active.offsetWidth / 2;\n          scroll.scrollTo({ left: Math.max(0, target), behavior: 'smooth' });\n        }\n      }\n    });\n\n\n    /* Variant swap based on active tags in URL */\n    window.uxbSwapItems(document.querySelectorAll('.product-grid__item[data-uxb-variants]:not([data-uxb-swapped])'));\n\n    /* Show products without variant data immediately */\n    document.querySelectorAll('.product-grid__item:not([data-uxb-variants])').forEach(function(el){\n      el.setAttribute('data-uxb-swapped', '1');\n    });\n\n    /* Re-run i18n fetch for unswapped products (after AJAX or page load) */\n    if(typeof _uxbStartI18n === 'function'){\n      var _still = document.querySelectorAll('.product-grid__item[data-uxb-variants]:not([data-uxb-swapped])');\n      if(_still.length) _uxbStartI18n();\n    }\n\n  };\n\n  /* ---- Variant swap engine (works on any set of items) ---- */\n  var uxbTagMap = {\"blanc\": \"blanc\",\"vert\": \"vert\",\"orange\": \"orange\",\"noir\": \"noir\",\"rose\": \"rose\",\"gris\": \"gris\",\"beige\": \"beige\",\"rouge\": \"rouge\",\"bleu\": \"bleu\",\"jaune\": \"jaune\",\"marron\": \"marron\"};\n\n  /* i18n: on translated pages, fetch lightweight French variant data */\n\n  /* Strip accents: crème→creme, épaïs→epais */\n  function uxbNorm(s){ return s.normalize('NFD').replace(/[\\u0300-\\u036f]/g,'').toLowerCase(); }\n\n  window.uxbSwapItems = function(items){\n    var matchTerms = [];\n\n    /* 1) Collection metafield variant_match (always applied if present) */\n    \n\n    /* 2) Check for active color tags in URL (only color pill tags, not icon tags) */\n    var path = window.location.pathname;\n    var segs = path.split('/');\n    var collIdx = -1;\n    for(var i=0;i<segs.length;i++){ if(segs[i]==='collections'){ collIdx=i; break; } }\n    if(collIdx !== -1 && segs.length > collIdx + 2){\n      var tagSeg = segs[collIdx + 2];\n      if(tagSeg){\n        var activeTags = tagSeg.split('+').map(function(t){ return decodeURIComponent(t).toLowerCase().trim(); });\n        activeTags.forEach(function(tag){\n          /* Only use color tags (in uxbTagMap) for variant matching */\n          if(uxbTagMap[tag]){\n            uxbTagMap[tag].split(',').forEach(function(k){ k=k.trim(); if(k) matchTerms.push(uxbNorm(k)); });\n          }\n        });\n      }\n    }\n\n    if(!matchTerms.length) return;\n\n    items.forEach(function(item){\n      var raw = item.getAttribute('data-uxb-variants');\n      if(!raw) return;\n      var variants = raw.split('|');\n      for(var v=0; v<variants.length; v++){\n        var vp = variants[v].split('::');\n        if(vp.length < 3) continue;\n        var opts = uxbNorm(vp[0]);\n        var matched = false;\n        for(var t=0; t<matchTerms.length; t++){\n          if(opts.indexOf(matchTerms[t]) !== -1){ matched = true; break; }\n        }\n        if(matched){\n          /* Swap the visible image src (for metafield-based collections + fallback) */\n          var img = item.querySelector('.card-gallery img, .product-media img, .product-card img, slideshow-slide img');\n          if(img){ img.setAttribute('src', vp[1]); img.setAttribute('srcset', ''); }\n          /* Update ALL product links in the card to point to the matching variant */\n          item.querySelectorAll('a[href*=\"/products/\"]').forEach(function(link){\n            link.setAttribute('href', vp[2]);\n          });\n          item.setAttribute('data-uxb-swapped', '1');\n          return;\n        }\n      }\n    });\n  };\n\n  /* ---- MutationObserver: swap variants on infinite scroll + after AJAX ---- */\n  var uxbObs = null;\n  function uxbWatchGrid(){\n    if(uxbObs) uxbObs.disconnect();\n    var grid = document.querySelector('.product-grid');\n    if(!grid) return;\n    var _uxbFetchedPages = {};\n    uxbObs = new MutationObserver(function(mutations){\n      var newItems = [];\n      mutations.forEach(function(m){\n        m.addedNodes.forEach(function(node){\n          if(node.nodeType !== 1) return;\n          if(node.matches && node.matches('.product-grid__item[data-uxb-variants]:not([data-uxb-swapped])')){\n            newItems.push(node);\n          }\n        });\n      });\n      if(!newItems.length) return;\n      window.uxbSwapItems(newItems);\n\n      var unswapped = newItems.filter(function(el){ return !el.hasAttribute('data-uxb-swapped'); });\n      if(!unswapped.length) return;\n\n      /* i18n: try cached French data first */\n      if(typeof _uxbI18nMap !== 'undefined' && _uxbI18nMap){\n        unswapped.forEach(function(item){\n          var pid = item.getAttribute('data-product-id');\n          if(_uxbI18nMap[pid]){\n            item.setAttribute('data-uxb-variants', _uxbI18nMap[pid]);\n            item.removeAttribute('data-uxb-swapped');\n          }\n        });\n        window.uxbSwapItems(unswapped.filter(function(el){ return !el.hasAttribute('data-uxb-swapped'); }));\n      }\n\n      /* i18n: fetch French data for new pages not yet cached */\n      var stillUnswapped = newItems.filter(function(el){ return !el.hasAttribute('data-uxb-swapped'); });\n      if(stillUnswapped.length && typeof _uxbI18nMap !== 'undefined'){\n        var page = stillUnswapped[0].getAttribute('data-page') || '2';\n        if(!_uxbFetchedPages[page]){\n          _uxbFetchedPages[page] = true;\n          var curRoot = '/';\n          var barePath = window.location.pathname;\n          if(curRoot && curRoot !== '/' && barePath.indexOf(curRoot + '/') === 0){\n            barePath = barePath.substring(curRoot.length);\n          }\n          var targetEl = document.querySelector('[id*=\"collection-uxb-variants\"]')\n                      || document.querySelector('results-list[section-id]');\n          var sectionId = targetEl ? (targetEl.id ? targetEl.id.replace('shopify-section-','') : targetEl.getAttribute('section-id')) : '';\n          var isLw = targetEl && targetEl.id && targetEl.id.indexOf('uxb-variants') !== -1;\n          if(sectionId){\n            fetch(barePath + '?page=' + page + '&sections=' + sectionId)\n              .then(function(r){ return r.json(); })\n              .then(function(data){\n                if(!data[sectionId]) return;\n                var pageMap = {};\n                if(isLw){\n                  try { pageMap = JSON.parse(data[sectionId].replace(/<[^>]*>/g,'').trim()); } catch(e){}\n                } else {\n                  var tmp = document.createElement('div');\n                  tmp.innerHTML = data[sectionId];\n                  tmp.querySelectorAll('[data-product-id][data-uxb-variants]').forEach(function(el){\n                    pageMap[el.getAttribute('data-product-id')] = el.getAttribute('data-uxb-variants');\n                  });\n                }\n                /* Merge into main cache */\n                for(var pid in pageMap){ _uxbI18nMap[pid] = pageMap[pid]; }\n                /* Apply to still-unswapped products */\n                document.querySelectorAll('.product-grid__item[data-uxb-variants]:not([data-uxb-swapped])').forEach(function(item){\n                  var id = item.getAttribute('data-product-id');\n                  if(pageMap[id]){\n                    item.setAttribute('data-uxb-variants', pageMap[id]);\n                    item.removeAttribute('data-uxb-swapped');\n                  }\n                });\n                window.uxbSwapItems(document.querySelectorAll('.product-grid__item[data-uxb-variants]:not([data-uxb-swapped])'));\n                /* Reveal all */\n                document.querySelectorAll('.product-grid__item:not([data-uxb-swapped])').forEach(function(el){\n                  el.setAttribute('data-uxb-swapped', '1');\n                });\n              })\n              .catch(function(){\n                stillUnswapped.forEach(function(el){ el.setAttribute('data-uxb-swapped', '1'); });\n              });\n          } else {\n            stillUnswapped.forEach(function(el){ el.setAttribute('data-uxb-swapped', '1'); });\n          }\n        } else {\n          stillUnswapped.forEach(function(el){ el.setAttribute('data-uxb-swapped', '1'); });\n        }\n      }\n    });\n    uxbObs.observe(grid, { childList: true });\n  }\n  /* Re-attach observer after AJAX grid replacement */\n  var _origPostRender = window.uxbPostRender;\n  window.uxbPostRender = function(){\n    _origPostRender();\n    uxbWatchGrid();\n  };\n\n  /* Run on initial page load (handle case where DOMContentLoaded already fired) */\n  if(document.readyState === 'loading'){\n    document.addEventListener('DOMContentLoaded', function(){\n      uxbWatchGrid();\n      window.uxbPostRender();\n    });\n  } else {\n    uxbWatchGrid();\n    window.uxbPostRender();\n  }\n\n})();\n</script>\n\n</section>"}