AUTO-INDEXED REPOSITORY DIRECTORY

Interactive Visualizations & Market Telemetry

Drop any single-file .html visualization into a category or nested subdirectory. Cloudflare Pages automatically indexes new pieces into this catalog on every push.

Index: Scanning...

Zero-Effort Cloudflare Pages Auto-Discovery Setup

Set this single-line Node command as your Build command in Cloudflare Pages (Settings → Builds & deployments). Leave Build output directory as /.

1. Cloudflare Pages One-Line Build Command (Generates /manifest.json)
node -e 'const fs=require("fs"),path=require("path");const walk=(d,b="")=>fs.readdirSync(d,{withFileTypes:true}).flatMap(e=>e.name.startsWith(".")?[]:e.isDirectory()?walk(path.join(d,e.name),path.posix.join(b,e.name)):(e.name.endsWith(".html")&&b)?(()=>{const fp=path.join(d,e.name),html=fs.readFileSync(fp,"utf8"),stat=fs.statSync(fp),title=(html.match(/([^<]+)<\/title>/i)||[])[1]||e.name.replace(/[-_]|(\.html$)/g," "),desc=(html.match(/<meta[^>]+name=["\x27]description["\x27][^>]+content=["\x27]([^"\x27]+)["\x27]/i)||html.match(/<meta[^>]+content=["\x27]([^"\x27]+)["\x27][^>]+name=["\x27]description["\x27]/i)||[])[1]||"",segs=b.split("/");return[{segments:segs,category:segs[0],subcategory:segs.slice(1).join(" / "),slug:e.name.replace(/\.html$/,""),title:title.trim(),description:desc.trim(),updatedAt:stat.mtime.toISOString().slice(0,10),path:"/"+path.posix.join(b,e.name)}]})():[]);fs.writeFileSync("manifest.json",JSON.stringify(walk("."),null,2))'</pre>
          </div>
        </div>

        <div class="setup-col-5">
          <div style="font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); text-transform: uppercase;">
            2. Recommended Nested Repository Layout
          </div>
          <div class="code-block-wrap">
            <pre class="code-pre" style="color: #cbd5e1;">/
├── index.html          <span style="color:#64748b;"># This hub page</span>
├── manifest.json       <span style="color:#76b900;"># Auto-built on push</span>
├── markets/
│   └── semiconductors/
│       └── 2026/
│           └── jensen-return.html
├── ai-economics/
│   └── hyperscaler-capex.html
└── og-images/          <span style="color:#64748b;"># Optional PNG cards</span></pre>
          </div>
        </div>
      </div>
    </section>

    <!-- Search, View Toggle & Category Filter Pills -->
    <section class="controls-section gs-reveal">
      <div class="search-and-view">
        <div class="search-box">
          <svg class="search-icon" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">
            <circle cx="11" cy="11" r="8"></circle>
            <line x1="21" y1="21" x2="16.65" y2="16.65"></line>
          </svg>
          <input id="search-input" type="search" class="search-input" placeholder="Search titles, categories, nested folders, or keywords..." autocomplete="off" />
          <span class="kbd-shortcut">/</span>
        </div>

        <div class="right-controls">
          <span id="result-counter" class="result-counter">0 items</span>

          <div class="view-switcher" role="tablist" aria-label="Catalog View Mode">
            <button id="btn-view-grid" type="button" class="view-btn active">
              <svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.3">
                <rect x="3" y="3" width="7" height="7"></rect>
                <rect x="14" y="3" width="7" height="7"></rect>
                <rect x="14" y="14" width="7" height="7"></rect>
                <rect x="3" y="14" width="7" height="7"></rect>
              </svg>
              <span>Grid</span>
            </button>
            <button id="btn-view-tree" type="button" class="view-btn">
              <svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.3">
                <path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"></path>
              </svg>
              <span>Folder Tree</span>
            </button>
          </div>
        </div>
      </div>

      <!-- Dynamic Category & Breadcrumb Filter Pills -->
      <div id="filter-bar" class="filter-bar" role="navigation" aria-label="Category Filters"></div>
    </section>

    <!-- Grid View Container -->
    <main id="cards-grid" class="cards-grid"></main>

    <!-- Folder Tree View Container -->
    <section id="tree-container" class="tree-container" aria-label="Hierarchical Directory Tree">
      <div class="tree-header">
        <span>REPOSITORY DIRECTORY TREE (ALL DEPTHS)</span>
        <div style="display: flex; gap: 10px;">
          <button id="btn-expand-all" type="button" class="btn-copy-link">Expand All</button>
          <button id="btn-collapse-all" type="button" class="btn-copy-link">Collapse All</button>
        </div>
      </div>
      <div id="tree-root" class="tree-root"></div>
    </section>

    <!-- Empty Filter State -->
    <div id="empty-state" class="empty-state">
      <h3 style="font-size: 16px; font-weight: 800; color: #ffffff; margin-bottom: 6px;">No matching visualizations found</h3>
      <p style="font-size: 13px; color: var(--text-muted); margin-bottom: 14px;">Try clearing your search query or switching back to all categories.</p>
      <button id="btn-reset-filters" type="button" class="btn-outline" style="margin: 0 auto;">Reset Filters</button>
    </div>

    <!-- Footer -->
    <footer class="hub-footer">
      <div>Hosted on Cloudflare Pages • Zero-dependency static directory index</div>
      <div id="footer-repo-info">Tip: Append <code>?owner=iggym&repo=your-repo</code> to preview any GitHub repo</div>
    </footer>

  </div>

  <!-- Toast Banner -->
  <div id="toast" class="toast" role="status"></div>

  <script>
    (() => {
      // =========================================================================
      // 1. BUILT-IN FALLBACK CATALOG (Used only when offline / local preview)
      // =========================================================================
      const DEMO_CATALOG = [
        {
          segments: ['markets', 'semiconductors', '2026'],
          category: 'markets',
          subcategory: 'semiconductors / 2026',
          slug: 'jensen-return',
          title: 'The Trillion-Dollar Return: Jensen Huang’s Reinstatement (+$952B Record)',
          description: 'Interactive market shockwave analysis of Nov 23, 2026: NVDA +31.48% close (+$952B gain, +$990B peak), QQQ ~+8% open gap, SOXX +15%, and geographic revenue shift.',
          updatedAt: '2026-11-23',
          path: '/markets/semiconductors/2026/jensen-return.html'
        },
        {
          segments: ['ai-economics', 'infrastructure'],
          category: 'ai-economics',
          subcategory: 'infrastructure',
          slug: 'hyperscaler-capex-vs-dotcom',
          title: 'AI Hyperscaler Capex vs. 1999 Telecom Vendor Financing',
          description: 'Comparative balance-sheet telemetry examining circular GPU financing commitments against late-1990s Lucent, Nortel, and Cisco vendor-financed router buildouts.',
          updatedAt: '2026-11-18',
          path: '/ai-economics/infrastructure/hyperscaler-capex-vs-dotcom.html'
        },
        {
          segments: ['geopolitics', 'supply-chains'],
          category: 'geopolitics',
          subcategory: 'supply-chains',
          slug: 'national-champions-compute-map',
          title: 'National Champions vs. Sovereign Compute Clusters',
          description: 'Tracking global AI compute concentration across U.S. hyperscalers, East Asian foundry hubs, and sovereign cluster deployments.',
          updatedAt: '2026-11-10',
          path: '/geopolitics/supply-chains/national-champions-compute-map.html'
        }
      ];

      // =========================================================================
      // 2. APPLICATION STATE
      // =========================================================================
      let allItems = [];
      let activeCategory = 'ALL';
      let activeSegmentPrefix = '';
      let searchQuery = '';
      let viewMode = 'grid'; // 'grid' | 'tree'

      const cardsGridEl = document.getElementById('cards-grid');
      const treeContainerEl = document.getElementById('tree-container');
      const treeRootEl = document.getElementById('tree-root');
      const filterBarEl = document.getElementById('filter-bar');
      const resultCounterEl = document.getElementById('result-counter');
      const emptyStateEl = document.getElementById('empty-state');
      const searchInputEl = document.getElementById('search-input');
      const discoveryModeLabelEl = document.getElementById('discovery-mode-label');
      const toastEl = document.getElementById('toast');

      let toastTimer = null;
      function showToast(msg) {
        toastEl.textContent = msg;
        toastEl.classList.add('show');
        clearTimeout(toastTimer);
        toastTimer = setTimeout(() => toastEl.classList.remove('show'), 2800);
      }

      // =========================================================================
      // 3. DUAL-MODE AUTOMATIC DISCOVERY ENGINE (/manifest.json -> GitHub API)
      // =========================================================================
      function normalizeItem(raw) {
        const cleanPath = raw.path.startsWith('/') ? raw.path : `/${raw.path}`;
        const parts = cleanPath.replace(/^\//, '').split('/');
        const filename = parts.pop() || 'index.html';
        const segments = Array.isArray(raw.segments) && raw.segments.length ? raw.segments : parts;
        const category = raw.category || segments[0] || 'general';
        const subcategory = raw.subcategory !== undefined ? raw.subcategory : segments.slice(1).join(' / ');
        const slug = raw.slug || filename.replace(/\.html$/i, '');
        const fallbackTitle = slug
          .split(/[-_]+/)
          .map(w => w.charAt(0).toUpperCase() + w.slice(1))
          .join(' ');

        return {
          segments,
          category,
          subcategory,
          slug,
          title: raw.title || fallbackTitle,
          description: raw.description || `Interactive visualization located at ${cleanPath}`,
          updatedAt: raw.updatedAt || '',
          path: cleanPath
        };
      }

      async function discoverCatalog() {
        const params = new URLSearchParams(window.location.search);
        const ownerParam = params.get('owner');
        const repoParam = params.get('repo');

        // 1. Primary: Fetch Cloudflare Pages /manifest.json (unless ?owner=&repo= explicitly overrides)
        if (!ownerParam && !repoParam) {
          try {
            const res = await fetch('/manifest.json', { cache: 'no-cache' });
            if (res.ok) {
              const data = await res.json();
              if (Array.isArray(data) && data.length > 0) {
                discoveryModeLabelEl.textContent = '/manifest.json (Edge)';
                return data.map(normalizeItem);
              }
            }
          } catch (_) {
            // Fall through to GitHub Trees API
          }
        }

        // 2. Secondary: Recursive GitHub Trees API
        const inferredOwner = ownerParam || (window.location.hostname.endsWith('.github.io') ? window.location.hostname.split('.')[0] : 'iggym');
        const inferredRepo = repoParam || (window.location.hostname.endsWith('.github.io') && window.location.pathname.split('/')[1] ? window.location.pathname.split('/')[1] : 'visuals');

        try {
          const ghUrl = `https://api.github.com/repos/${encodeURIComponent(inferredOwner)}/${encodeURIComponent(inferredRepo)}/git/trees/main?recursive=1`;
          const ghRes = await fetch(ghUrl);
          if (ghRes.ok) {
            const payload = await ghRes.json();
            if (Array.isArray(payload.tree)) {
              const htmlNodes = payload.tree.filter(node =>
                node.type === 'blob' &&
                node.path.toLowerCase().endsWith('.html') &&
                node.path.includes('/')
              );
              if (htmlNodes.length > 0) {
                discoveryModeLabelEl.textContent = `GitHub (${inferredOwner}/${inferredRepo})`;
                return htmlNodes.map(node => normalizeItem({ path: `/${node.path}` }));
              }
            }
          }
        } catch (_) {
          // Fall through to built-in preview catalog
        }

        // 3. Local / Offline Preview Catalog
        discoveryModeLabelEl.textContent = 'Preview Catalog';
        return DEMO_CATALOG.map(normalizeItem);
      }

      // =========================================================================
      // 4. FILTERING & RENDERING (GRID + HIERARCHICAL TREE)
      // =========================================================================
      function getFilteredItems() {
        return allItems.filter(item => {
          if (activeCategory !== 'ALL' && item.category !== activeCategory) {
            return false;
          }
          if (activeSegmentPrefix) {
            const itemPrefix = item.segments.join('/');
            if (itemPrefix !== activeSegmentPrefix && !itemPrefix.startsWith(`${activeSegmentPrefix}/`)) {
              return false;
            }
          }
          if (searchQuery) {
            const haystack = `${item.title} ${item.description} ${item.category} ${item.subcategory} ${item.slug} ${item.path}`.toLowerCase();
            if (!haystack.includes(searchQuery)) {
              return false;
            }
          }
          return true;
        });
      }

      function renderCategoryPills() {
        const counts = {};
        allItems.forEach(item => {
          counts[item.category] = (counts[item.category] || 0) + 1;
        });

        const categories = Object.keys(counts).sort();
        const pillsHtml = [
          `<button type="button" class="pill-btn ${activeCategory === 'ALL' && !activeSegmentPrefix ? 'active' : ''}" data-cat="ALL">
            <span>All</span>
            <span class="pill-count">${allItems.length}</span>
          </button>`,
          ...categories.map(cat => `
            <button type="button" class="pill-btn ${activeCategory === cat && !activeSegmentPrefix ? 'active' : ''}" data-cat="${escapeHtml(cat)}">
              <span>${escapeHtml(cat)}</span>
              <span class="pill-count">${counts[cat]}</span>
            </button>
          `)
        ];

        if (activeSegmentPrefix) {
          pillsHtml.push(`
            <button type="button" class="pill-btn active" data-clear-prefix="1" title="Click to clear subfolder filter">
              <span>Folder: ${escapeHtml(activeSegmentPrefix)} ✕</span>
            </button>
          `);
        }

        filterBarEl.innerHTML = pillsHtml.join('');

        filterBarEl.querySelectorAll('[data-cat]').forEach(btn => {
          btn.addEventListener('click', () => {
            activeCategory = btn.dataset.cat;
            activeSegmentPrefix = '';
            renderAll();
          });
        });

        const clearPrefixBtn = filterBarEl.querySelector('[data-clear-prefix]');
        if (clearPrefixBtn) {
          clearPrefixBtn.addEventListener('click', () => {
            activeSegmentPrefix = '';
            renderAll();
          });
        }
      }

      function renderGridView(items) {
        cardsGridEl.innerHTML = items.map(item => {
          const cleanUrl = item.path.replace(/\.html$/i, '');
          const breadcrumbHtml = item.segments.map((seg, idx) => {
            const prefix = item.segments.slice(0, idx + 1).join('/');
            return `<span class="crumb-link" data-prefix="${escapeHtml(prefix)}" title="Filter by /${escapeHtml(prefix)}">${escapeHtml(seg)}</span>`;
          }).join('<span>/</span>');

          return `
            <article class="viz-card">
              <div>
                <div class="card-meta-top">
                  <span class="cat-tag">${escapeHtml(item.category)}</span>
                  ${item.updatedAt ? `<span style="font-family:var(--font-mono); font-size:11px; color:var(--text-dim);">${escapeHtml(item.updatedAt)}</span>` : ''}
                </div>

                <div class="breadcrumb-trail" aria-label="Directory path">
                  <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" style="margin-right:2px;">
                    <path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"></path>
                  </svg>
                  ${breadcrumbHtml}
                </div>

                <h2 class="card-title">${escapeHtml(item.title)}</h2>
                <p class="card-desc">${escapeHtml(item.description)}</p>
              </div>

              <div class="card-footer-actions">
                <a href="${escapeHtml(cleanUrl)}" class="btn-launch">
                  <span>Open Visualization</span>
                  <svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
                    <line x1="7" y1="17" x2="17" y2="7"></line>
                    <polyline points="7 7 17 7 17 17"></polyline>
                  </svg>
                </a>

                <button type="button" class="btn-copy-link" data-copy-path="${escapeHtml(cleanUrl)}" title="Copy full URL for X reply">
                  <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2">
                    <rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
                    <path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
                  </svg>
                  <span>Copy Link</span>
                </button>
              </div>
            </article>
          `;
        }).join('');

        // Bind breadcrumb clicks to filter by nested directory
        cardsGridEl.querySelectorAll('.crumb-link').forEach(el => {
          el.addEventListener('click', () => {
            const prefix = el.dataset.prefix;
            activeCategory = prefix.split('/')[0];
            activeSegmentPrefix = prefix;
            renderAll();
          });
        });

        bindCopyButtons(cardsGridEl);
      }

      // Build recursive nested directory tree from arbitrary folder depth
      function buildTreeStructure(items) {
        const root = { folders: {}, files: [] };
        items.forEach(item => {
          let cursor = root;
          item.segments.forEach(seg => {
            if (!cursor.folders[seg]) {
              cursor.folders[seg] = { folders: {}, files: [] };
            }
            cursor = cursor.folders[seg];
          });
          cursor.files.push(item);
        });
        return root;
      }

      function renderTreeNode(node, depth = 0) {
        const folderNames = Object.keys(node.folders).sort();
        let html = '';

        folderNames.forEach(name => {
          const child = node.folders[name];
          html += `
            <div class="tree-branch">
              <button type="button" class="tree-folder-btn" data-folder-toggle="1" aria-expanded="true">
                <span class="folder-caret">▾</span>
                <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="#fbbf24" stroke-width="2.2">
                  <path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"></path>
                </svg>
                <span>${escapeHtml(name)}/</span>
              </button>
              <div class="tree-children">
                ${renderTreeNode(child, depth + 1)}
              </div>
            </div>
          `;
        });

        node.files.forEach(file => {
          const cleanUrl = file.path.replace(/\.html$/i, '');
          html += `
            <div class="tree-file-row">
              <div>
                <a href="${escapeHtml(cleanUrl)}" class="tree-file-link">
                  <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="#10b981" stroke-width="2.2">
                    <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path>
                    <polyline points="14 2 14 8 20 8"></polyline>
                  </svg>
                  <span>${escapeHtml(file.title)}</span>
                </a>
                <div class="tree-slug" style="margin-left: 22px;">${escapeHtml(file.path)}</div>
              </div>
              <div style="display:flex; align-items:center; gap:8px;">
                <button type="button" class="btn-copy-link" data-copy-path="${escapeHtml(cleanUrl)}">Copy Link</button>
                <a href="${escapeHtml(cleanUrl)}" class="btn-launch" style="padding:6px 11px; font-size:11.5px;">Open →</a>
              </div>
            </div>
          `;
        });

        return html;
      }

      function renderTreeView(items) {
        const treeData = buildTreeStructure(items);
        treeRootEl.innerHTML = renderTreeNode(treeData);

        treeRootEl.querySelectorAll('[data-folder-toggle]').forEach(btn => {
          btn.addEventListener('click', () => {
            const expanded = btn.getAttribute('aria-expanded') === 'true';
            btn.setAttribute('aria-expanded', String(!expanded));
            btn.querySelector('.folder-caret').textContent = expanded ? '▸' : '▾';
            const childrenEl = btn.nextElementSibling;
            if (childrenEl) {
              childrenEl.style.display = expanded ? 'none' : 'block';
            }
          });
        });

        bindCopyButtons(treeRootEl);
      }

      function renderAll() {
        renderCategoryPills();
        const filtered = getFilteredItems();
        resultCounterEl.textContent = `${filtered.length} ${filtered.length === 1 ? 'piece' : 'pieces'}`;

        if (filtered.length === 0) {
          cardsGridEl.style.display = 'none';
          treeContainerEl.classList.remove('active');
          emptyStateEl.classList.add('visible');
          return;
        }

        emptyStateEl.classList.remove('visible');

        if (viewMode === 'grid') {
          cardsGridEl.style.display = 'grid';
          treeContainerEl.classList.remove('active');
          renderGridView(filtered);
        } else {
          cardsGridEl.style.display = 'none';
          treeContainerEl.classList.add('active');
          renderTreeView(filtered);
        }
      }

      // =========================================================================
      // 5. CLIPBOARD HELPER (IFRAME-SAFE execCommand FALLBACK)
      // =========================================================================
      function copyTextToClipboard(text, successMsg) {
        const textarea = document.createElement('textarea');
        textarea.value = text;
        textarea.setAttribute('readonly', '');
        textarea.style.position = 'fixed';
        textarea.style.left = '-9999px';
        document.body.appendChild(textarea);
        textarea.select();

        try {
          document.execCommand('copy');
          showToast(successMsg);
        } catch (_) {
          if (navigator.clipboard && navigator.clipboard.writeText) {
            navigator.clipboard.writeText(text).then(() => showToast(successMsg));
          }
        } finally {
          document.body.removeChild(textarea);
        }
      }

      function bindCopyButtons(scopeEl) {
        scopeEl.querySelectorAll('[data-copy-path]').forEach(btn => {
          btn.addEventListener('click', () => {
            const fullUrl = `${window.location.origin}${btn.dataset.copyPath}`;
            copyTextToClipboard(fullUrl, `Copied X reply URL: ${fullUrl}`);
          });
        });
      }

      function escapeHtml(str) {
        return String(str)
          .replace(/&/g, '&')
          .replace(/</g, '<')
          .replace(/>/g, '>')
          .replace(/"/g, '"')
          .replace(/'/g, ''');
      }

      // =========================================================================
      // 6. EVENT LISTENERS & INITIALIZATION
      // =========================================================================
      searchInputEl.addEventListener('input', (e) => {
        searchQuery = e.target.value.trim().toLowerCase();
        renderAll();
      });

      // Press '/' anywhere outside inputs to focus search
      document.addEventListener('keydown', (e) => {
        if (e.key === '/' && document.activeElement !== searchInputEl) {
          e.preventDefault();
          searchInputEl.focus();
        } else if (e.key === 'Escape' && document.activeElement === searchInputEl) {
          searchInputEl.value = '';
          searchQuery = '';
          searchInputEl.blur();
          renderAll();
        }
      });

      const btnViewGrid = document.getElementById('btn-view-grid');
      const btnViewTree = document.getElementById('btn-view-tree');

      btnViewGrid.addEventListener('click', () => {
        viewMode = 'grid';
        btnViewGrid.classList.add('active');
        btnViewTree.classList.remove('active');
        renderAll();
      });

      btnViewTree.addEventListener('click', () => {
        viewMode = 'tree';
        btnViewTree.classList.add('active');
        btnViewGrid.classList.remove('active');
        renderAll();
      });

      document.getElementById('btn-reset-filters').addEventListener('click', () => {
        activeCategory = 'ALL';
        activeSegmentPrefix = '';
        searchQuery = '';
        searchInputEl.value = '';
        renderAll();
      });

      document.getElementById('btn-toggle-setup').addEventListener('click', () => {
        document.getElementById('setup-drawer').classList.toggle('open');
      });

      document.getElementById('btn-copy-cmd').addEventListener('click', () => {
        const cmd = document.getElementById('build-command-text').textContent.trim();
        copyTextToClipboard(cmd, 'Copied Cloudflare Pages build command to clipboard');
      });

      document.getElementById('btn-expand-all').addEventListener('click', () => {
        treeRootEl.querySelectorAll('[data-folder-toggle]').forEach(btn => {
          btn.setAttribute('aria-expanded', 'true');
          btn.querySelector('.folder-caret').textContent = '▾';
          if (btn.nextElementSibling) btn.nextElementSibling.style.display = 'block';
        });
      });

      document.getElementById('btn-collapse-all').addEventListener('click', () => {
        treeRootEl.querySelectorAll('[data-folder-toggle]').forEach(btn => {
          btn.setAttribute('aria-expanded', 'false');
          btn.querySelector('.folder-caret').textContent = '▸';
          if (btn.nextElementSibling) btn.nextElementSibling.style.display = 'none';
        });
      });

      // Boot catalog discovery
      discoverCatalog().then(items => {
        allItems = items;
        renderAll();

        if (window.gsap) {
          gsap.from('.gs-reveal', {
            y: 14,
            opacity: 0,
            duration: 0.55,
            stagger: 0.08,
            ease: 'power3.out'
          });
        }
      });
    })();
  </script>
</body>
</html>