{
  "id": 116,
  "slug": "sticky-alphabet-index-bar",
  "name": "Sticky Section-Header Alphabet/Index Jump Bar",
  "kind": "ui",
  "family": "Lists & Directories",
  "sourceSite": {
    "name": "Bandcamp",
    "url": "https://bandcamp.com",
    "verifiedStatus": 200
  },
  "tagline": "Alphabetical directory with sticky section headers and a touch-scrubbable vertical index rail with floating loupe.",
  "whyUnique": "Makes browsing hundreds of sorted entries instantaneous on mobile by combining sticky orientation headers with continuous finger-scrubbing along an A-Z edge rail.",
  "theme": "dark",
  "mobileStrength": "native-first",
  "tags": [
    "alphabet-index",
    "sticky-headers",
    "directory-list",
    "touch-scrub",
    "loupe-bubble"
  ],
  "bestFor": [
    "Music & vinyl artist catalogs",
    "Contact & team directories",
    "Glossary & medical indexes",
    "Country & airport pickers"
  ],
  "palette": [
    {
      "role": "canvas",
      "hex": "#111317",
      "name": "Vinyl Matte"
    },
    {
      "role": "surface",
      "hex": "#1B1F26",
      "name": "Sleeve Slate"
    },
    {
      "role": "ink",
      "hex": "#F3F4F6",
      "name": "Liner White"
    },
    {
      "role": "accent",
      "hex": "#1DA0C3",
      "name": "Bandcamp Cyan"
    },
    {
      "role": "muted",
      "hex": "#94A3B8",
      "name": "Groove Gray"
    }
  ],
  "typography": {
    "display": "Space Grotesk",
    "body": "Inter",
    "mono": "JetBrains Mono",
    "googleFontsUrl": "https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&family=JetBrains+Mono:wght@600&family=Space+Grotesk:wght@700&display=swap",
    "scaleNotes": "Bold 15px sticky letter headers, crisp 11px right-rail index letters, and a 44px floating loupe badge during scrub."
  },
  "layoutNotes": "Single-column directory with right padding reserved for the fixed vertical A-Z index rail; sticky letter headers pin seamlessly beneath the search header.",
  "interactionNotes": "Tapping or dragging vertically along the A-Z rail displays a floating magnification loupe bubble and jumps immediately to that letter section while highlighting the active letter.",
  "mobileNotes": "Touch-action: none on the right-edge index rail enables smooth continuous thumb scrubbing without accidental page bounce.",
  "agentGuardrails": {
    "do": [
      "Show a large floating magnification loupe offset to the left of the finger so the user's thumb never hides the active letter",
      "Reserve right-side padding on list rows so the vertical A-Z rail never overlaps row actions or badges",
      "Visually dim or skip letters that have zero matching items when a search filter is active"
    ],
    "dont": [
      "Do not make the index rail wider than ~32px on 390px viewports where horizontal space is precious",
      "Do not use sluggish smooth-scroll animations during rapid continuous scrubbing along the index rail"
    ]
  },
  "demoFile": "demos/sticky-alphabet-index-bar.html",
  "thumbDesktop": "thumbs/sticky-alphabet-index-bar-desktop.webp",
  "thumbMobile": "thumbs/sticky-alphabet-index-bar-mobile.webp",
  "urls": {
    "page": "https://templates.michaelpitts.net/t/sticky-alphabet-index-bar",
    "markdown": "https://templates.michaelpitts.net/t/sticky-alphabet-index-bar.md",
    "api": "https://templates.michaelpitts.net/api/templates/sticky-alphabet-index-bar",
    "demo": "https://templates.michaelpitts.net/demos/sticky-alphabet-index-bar.html",
    "thumbDesktop": "https://templates.michaelpitts.net/thumbs/sticky-alphabet-index-bar-desktop.webp",
    "thumbMobile": "https://templates.michaelpitts.net/thumbs/sticky-alphabet-index-bar-mobile.webp"
  },
  "agentPrompt": "Design & build using template #116 \"Sticky Section-Header Alphabet/Index Jump Bar\" (ui / Lists & Directories, dark theme).\nFull AI blueprint & standalone starter code: https://templates.michaelpitts.net/t/sticky-alphabet-index-bar.md\nLive demo: https://templates.michaelpitts.net/demos/sticky-alphabet-index-bar.html\nReal-world inspiration: Bandcamp (https://bandcamp.com)\n\nCore aesthetic: Makes browsing hundreds of sorted entries instantaneous on mobile by combining sticky orientation headers with continuous finger-scrubbing along an A-Z edge rail.\nPalette: canvas: #111317 (Vinyl Matte), surface: #1B1F26 (Sleeve Slate), ink: #F3F4F6 (Liner White), accent: #1DA0C3 (Bandcamp Cyan), muted: #94A3B8 (Groove Gray)\nTypography: Display=\"Space Grotesk\", Body=\"Inter\", Mono=\"JetBrains Mono\"\nLayout: Single-column directory with right padding reserved for the fixed vertical A-Z index rail; sticky letter headers pin seamlessly beneath the search header.\nInteractions: Tapping or dragging vertically along the A-Z rail displays a floating magnification loupe bubble and jumps immediately to that letter section while highlighting the active letter.\nMobile: Touch-action: none on the right-edge index rail enables smooth continuous thumb scrubbing without accidental page bounce.\n\nGuardrails:\n- DO: Show a large floating magnification loupe offset to the left of the finger so the user's thumb never hides the active letter\n- DO: Reserve right-side padding on list rows so the vertical A-Z rail never overlaps row actions or badges\n- DO: Visually dim or skip letters that have zero matching items when a search filter is active\n- DON'T: Do not make the index rail wider than ~32px on 390px viewports where horizontal space is precious\n- DON'T: Do not use sluggish smooth-scroll animations during rapid continuous scrubbing along the index rail",
  "sourceCode": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"UTF-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n<title>WaxIndex — Sticky Alphabet Artist Directory</title>\n<style>\n  :root {\n    --canvas: #111317;\n    --surface: #1B1F26;\n    --surface-hover: #222731;\n    --ink: #F3F4F6;\n    --accent: #1DA0C3;\n    --accent-soft: rgba(29, 160, 195, 0.16);\n    --muted: #94A3B8;\n    --border: rgba(255, 255, 255, 0.08);\n    --font: -apple-system, BlinkMacSystemFont, \"Inter\", \"Segoe UI\", system-ui, sans-serif;\n    --mono: ui-monospace, \"SF Mono\", Menlo, monospace;\n  }\n\n  * { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }\n\n  html, body {\n    background: var(--canvas);\n    color: var(--ink);\n    font-family: var(--font);\n    min-height: 100dvh;\n    overflow-x: hidden;\n  }\n\n  .layout {\n    max-width: 960px;\n    margin: 0 auto;\n    padding: 16px 46px 64px 14px;\n  }\n\n  @media (min-width: 760px) {\n    .layout { padding: 28px 68px 80px 28px; }\n  }\n\n  .masthead {\n    display: flex;\n    flex-wrap: wrap;\n    align-items: flex-end;\n    justify-content: space-between;\n    gap: 12px;\n    margin-bottom: 16px;\n  }\n\n  .brand-row {\n    display: flex;\n    align-items: center;\n    gap: 10px;\n  }\n\n  .brand-mark {\n    width: 34px;\n    height: 34px;\n    border-radius: 8px;\n    background: var(--accent);\n    display: grid;\n    place-items: center;\n    flex-shrink: 0;\n  }\n\n  .masthead h1 {\n    font-size: 22px;\n    font-weight: 750;\n    letter-spacing: -0.02em;\n  }\n\n  .masthead p {\n    font-size: 13px;\n    color: var(--muted);\n    margin-top: 2px;\n  }\n\n  .catalog-stat {\n    font-family: var(--mono);\n    font-size: 12px;\n    color: var(--accent);\n    background: var(--accent-soft);\n    border: 1px solid rgba(29, 160, 195, 0.35);\n    padding: 6px 10px;\n    border-radius: 8px;\n  }\n\n  /* Filter toolbar */\n  .toolbar {\n    display: flex;\n    flex-wrap: wrap;\n    gap: 8px;\n    margin-bottom: 18px;\n  }\n\n  .search-box {\n    flex: 1 1 210px;\n    min-height: 44px;\n    padding: 0 14px;\n    border-radius: 12px;\n    border: 1px solid var(--border);\n    background: var(--surface);\n    color: var(--ink);\n    font-size: 14px;\n    outline: none;\n  }\n  .search-box:focus { border-color: var(--accent); }\n\n  .genre-pills {\n    display: flex;\n    gap: 6px;\n    overflow-x: auto;\n    scrollbar-width: none;\n  }\n  .genre-pills::-webkit-scrollbar { display: none; }\n\n  .genre-btn {\n    min-height: 44px;\n    padding: 0 13px;\n    border-radius: 10px;\n    border: 1px solid var(--border);\n    background: var(--surface);\n    color: var(--muted);\n    font-size: 12px;\n    font-weight: 600;\n    cursor: pointer;\n    white-space: nowrap;\n    transition: all 0.14s;\n  }\n  .genre-btn:hover { color: var(--ink); }\n  .genre-btn[aria-pressed=\"true\"] {\n    background: var(--accent);\n    color: #081217;\n    border-color: var(--accent);\n  }\n\n  /* Sticky Letter Sections */\n  .directory {\n    display: flex;\n    flex-direction: column;\n    gap: 18px;\n  }\n\n  .letter-section {\n    scroll-margin-top: 12px;\n  }\n\n  .sticky-header {\n    position: sticky;\n    top: 0;\n    z-index: 10;\n    display: flex;\n    align-items: center;\n    justify-content: space-between;\n    padding: 9px 14px;\n    background: rgba(17, 19, 23, 0.90);\n    backdrop-filter: blur(10px);\n    -webkit-backdrop-filter: blur(10px);\n    border-bottom: 1px solid var(--border);\n    margin-bottom: 8px;\n  }\n\n  .sticky-letter {\n    font-family: var(--mono);\n    font-size: 16px;\n    font-weight: 800;\n    color: var(--accent);\n    letter-spacing: 0.04em;\n  }\n\n  .sticky-count {\n    font-family: var(--mono);\n    font-size: 11px;\n    color: var(--muted);\n  }\n\n  .artist-list {\n    display: grid;\n    grid-template-columns: 1fr;\n    gap: 8px;\n  }\n\n  @media (min-width: 720px) {\n    .artist-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }\n  }\n\n  .artist-card {\n    background: var(--surface);\n    border: 1px solid var(--border);\n    border-radius: 14px;\n    padding: 10px 12px;\n    display: flex;\n    align-items: center;\n    gap: 12px;\n    transition: background 0.15s, border-color 0.15s;\n  }\n  .artist-card:hover {\n    background: var(--surface-hover);\n    border-color: rgba(29, 160, 195, 0.35);\n  }\n\n  .sleeve {\n    width: 52px;\n    height: 52px;\n    border-radius: 8px;\n    flex-shrink: 0;\n    overflow: hidden;\n    border: 1px solid rgba(255,255,255,0.1);\n  }\n\n  .artist-info {\n    flex: 1;\n    min-width: 0;\n  }\n\n  .artist-name {\n    font-size: 15px;\n    font-weight: 700;\n    color: var(--ink);\n    white-space: nowrap;\n    overflow: hidden;\n    text-overflow: ellipsis;\n  }\n\n  .artist-release {\n    font-size: 12px;\n    color: var(--muted);\n    white-space: nowrap;\n    overflow: hidden;\n    text-overflow: ellipsis;\n    margin-top: 2px;\n  }\n\n  .artist-tags {\n    display: flex;\n    align-items: center;\n    gap: 6px;\n    margin-top: 5px;\n    font-size: 11px;\n    font-family: var(--mono);\n  }\n\n  .tag-genre {\n    color: var(--accent);\n    background: var(--accent-soft);\n    padding: 2px 6px;\n    border-radius: 5px;\n  }\n  .tag-city { color: var(--muted); }\n\n  .save-btn {\n    min-width: 44px;\n    min-height: 44px;\n    border-radius: 10px;\n    border: 1px solid var(--border);\n    background: transparent;\n    color: var(--muted);\n    font-size: 16px;\n    cursor: pointer;\n    display: grid;\n    place-items: center;\n    flex-shrink: 0;\n    transition: all 0.14s;\n  }\n  .save-btn:hover { color: var(--ink); border-color: rgba(255,255,255,0.2); }\n  .save-btn.saved { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }\n\n  /* Right-Edge Touch-Scrubbable Alphabet Index Rail */\n  .index-rail {\n    position: fixed;\n    right: 6px;\n    top: 50%;\n    transform: translateY(-50%);\n    z-index: 30;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    padding: 6px 2px;\n    border-radius: 999px;\n    background: rgba(27, 31, 38, 0.86);\n    backdrop-filter: blur(8px);\n    -webkit-backdrop-filter: blur(8px);\n    border: 1px solid var(--border);\n    touch-action: none;\n    user-select: none;\n    -webkit-user-select: none;\n    cursor: ns-resize;\n  }\n\n  @media (min-width: 760px) {\n    .index-rail { right: 16px; padding: 8px 4px; }\n  }\n\n  .index-letter {\n    width: 28px;\n    height: 19px;\n    display: grid;\n    place-items: center;\n    font-family: var(--mono);\n    font-size: 10px;\n    font-weight: 700;\n    color: var(--muted);\n    border-radius: 999px;\n    transition: color 0.1s, background 0.1s, transform 0.1s;\n    pointer-events: none;\n  }\n\n  .index-letter.has-items { color: var(--ink); }\n  .index-letter.empty { opacity: 0.3; }\n  .index-letter.active {\n    background: var(--accent);\n    color: #081217;\n    transform: scale(1.15);\n  }\n\n  /* Floating Magnification Loupe Bubble */\n  .loupe {\n    position: fixed;\n    right: 52px;\n    top: 50%;\n    width: 58px;\n    height: 58px;\n    border-radius: 50% 50% 6px 50%;\n    transform: translateY(-50%) rotate(-45deg) scale(0.7);\n    background: var(--accent);\n    color: #071318;\n    display: grid;\n    place-items: center;\n    box-shadow: 0 12px 30px rgba(29, 160, 195, 0.45);\n    pointer-events: none;\n    opacity: 0;\n    z-index: 35;\n    transition: opacity 0.14s, transform 0.14s cubic-bezier(0.2, 0.9, 0.3, 1.2);\n  }\n\n  @media (min-width: 760px) {\n    .loupe { right: 68px; }\n  }\n\n  .loupe.visible {\n    opacity: 1;\n    transform: translateY(-50%) rotate(-45deg) scale(1);\n  }\n\n  .loupe-char {\n    transform: rotate(45deg);\n    font-family: var(--mono);\n    font-size: 26px;\n    font-weight: 800;\n  }\n\n  .empty-dir {\n    padding: 40px 20px;\n    text-align: center;\n    color: var(--muted);\n    background: var(--surface);\n    border: 1px dashed var(--border);\n    border-radius: 14px;\n  }\n</style>\n</head>\n<body>\n  <div class=\"layout\">\n    <header class=\"masthead\">\n      <div class=\"brand-row\">\n        <div class=\"brand-mark\" aria-hidden=\"true\">\n          <svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"#081217\">\n            <polygon points=\"3,18 9,6 21,6 15,18\"/>\n          </svg>\n        </div>\n        <div>\n          <h1>Independent Vinyl Catalog</h1>\n          <p>Scrub the right-edge A–Z rail to jump across pressings</p>\n        </div>\n      </div>\n      <div class=\"catalog-stat\" id=\"catalogStat\">28 ARTISTS · A–Z</div>\n    </header>\n\n    <div class=\"toolbar\">\n      <input id=\"searchInput\" class=\"search-box\" type=\"search\" placeholder=\"Filter artists, pressings, or cities...\" aria-label=\"Filter artist catalog\">\n      <div class=\"genre-pills\" role=\"group\" aria-label=\"Filter by genre\">\n        <button class=\"genre-btn\" data-genre=\"all\" aria-pressed=\"true\">All</button>\n        <button class=\"genre-btn\" data-genre=\"Ambient\" aria-pressed=\"false\">Ambient</button>\n        <button class=\"genre-btn\" data-genre=\"Post-Punk\" aria-pressed=\"false\">Post-Punk</button>\n        <button class=\"genre-btn\" data-genre=\"Jazz\" aria-pressed=\"false\">Jazz</button>\n        <button class=\"genre-btn\" data-genre=\"Electronic\" aria-pressed=\"false\">Electronic</button>\n      </div>\n    </div>\n\n    <main class=\"directory\" id=\"directory\"></main>\n  </div>\n\n  <nav class=\"index-rail\" id=\"indexRail\" aria-label=\"Alphabet Jump Index\" tabindex=\"0\"></nav>\n  <div class=\"loupe\" id=\"loupe\" aria-hidden=\"true\"><span class=\"loupe-char\" id=\"loupeChar\">A</span></div>\n\n<script>\n(() => {\n  const ARTISTS = [\n    { name: 'Alder & Moss', release: 'Stillwater Tapes (180g LP)', genre: 'Ambient', city: 'Portland', colors: ['#164e63','#0ea5e9','#e0f2fe'] },\n    { name: 'Amina Kouri', release: 'Casablanca Nocturnes', genre: 'Jazz', city: 'Marseille', colors: ['#7c2d12','#f59e0b','#fef3c7'] },\n    { name: 'Boreal Drift', release: 'Subzero Telemetry', genre: 'Electronic', city: 'Reykjavik', colors: ['#1e3a8a','#38bdf8','#f0f9ff'] },\n    { name: 'Brutal Linen', release: 'Concrete Choirs', genre: 'Post-Punk', city: 'Manchester', colors: ['#3f3f46','#a1a1aa','#f4f4f5'] },\n    { name: 'Cinder Block Club', release: 'Late Tram 7\"', genre: 'Post-Punk', city: 'Glasgow', colors: ['#881337','#fb7185','#ffe4e6'] },\n    { name: 'Daisuke Mori', release: 'Kyoto Rain Studies', genre: 'Ambient', city: 'Osaka', colors: ['#064e3b','#34d399','#d1fae5'] },\n    { name: 'Elowen Quartet', release: 'Brass & Cedar', genre: 'Jazz', city: 'Bristol', colors: ['#78350f','#fbbf24','#fef9c3'] },\n    { name: 'Feral Telemetry', release: 'Patchbay Ghost', genre: 'Electronic', city: 'Berlin', colors: ['#312e81','#818cf8','#e0e7ff'] },\n    { name: 'Glass Harbor', release: 'Foghorn Echoes', genre: 'Ambient', city: 'Halifax', colors: ['#155e75','#22d3ee','#cffafe'] },\n    { name: 'Halcyon Press', release: 'Mono Tape Vol. 3', genre: 'Electronic', city: 'Detroit', colors: ['#4c1d95','#c084fc','#f3e8ff'] },\n    { name: 'Iona & The Static', release: 'Sodium Streetlights', genre: 'Post-Punk', city: 'Dublin', colors: ['#7f1d1d','#f87171','#fee2e2'] },\n    { name: 'Juno Vermeer', release: 'Velvet Rhodes Sessions', genre: 'Jazz', city: 'Rotterdam', colors: ['#14532d','#4ade80','#dcfce7'] },\n    { name: 'Kestrel Radio', release: 'Shortwave Winter', genre: 'Ambient', city: 'Oslo', colors: ['#0c4a6e','#7dd3fc','#e0f2fe'] },\n    { name: 'Loom & Loom', release: 'Shuttle Rhythm 12\"', genre: 'Electronic', city: 'Leeds', colors: ['#701a75','#e879f9','#fae8ff'] },\n    { name: 'Maren Solberg', release: 'Fjord Harmonic', genre: 'Ambient', city: 'Bergen', colors: ['#134e4a','#2dd4bf','#ccfbf1'] },\n    { name: 'Nadia Osei Trio', release: 'Accra Midnight', genre: 'Jazz', city: 'London', colors: ['#9a3412','#fb923c','#ffedd5'] },\n    { name: 'Ochre Signals', release: 'Dust on the Needle', genre: 'Post-Punk', city: 'Melbourne', colors: ['#713f12','#eab308','#fef9c3'] },\n    { name: 'Pale Concrete', release: 'Station Platform 9', genre: 'Post-Punk', city: 'Warsaw', colors: ['#27272a','#71717a','#e4e4e7'] },\n    { name: 'Quarry Sound', release: 'Limestone Dubs', genre: 'Electronic', city: 'Sheffield', colors: ['#1e1b4b','#6366f1','#e0e7ff'] },\n    { name: 'Riven Oak', release: 'Cello & Tape Loop', genre: 'Ambient', city: 'Montreal', colors: ['#365314','#a3e635','#ecfccb'] },\n    { name: 'Sable Meridian', release: 'Blue Note Transit', genre: 'Jazz', city: 'Chicago', colors: ['#1e3a8a','#60a5fa','#dbeafe'] },\n    { name: 'Taro Takahashi', release: 'Modular Tea House', genre: 'Electronic', city: 'Tokyo', colors: ['#0f766e','#5eead4','#f0fdfa'] },\n    { name: 'Umber & Ash', release: 'Dry Heat EP', genre: 'Post-Punk', city: 'Tucson', colors: ['#7c2d12','#ea580c','#ffedd5'] },\n    { name: 'Vespera Ensemble', release: 'Candlelight Sax', genre: 'Jazz', city: 'Vienna', colors: ['#581c87','#a855f7','#f3e8ff'] },\n    { name: 'Wren Collective', release: 'Dawn Chorus Cassette', genre: 'Ambient', city: 'Edinburgh', colors: ['#065f46','#10b981','#d1fae5'] },\n    { name: 'Xylo Circuit', release: 'Arpeggio Motel', genre: 'Electronic', city: 'Toronto', colors: ['#831843','#f472b6','#fce7f3'] },\n    { name: 'Yuki & The Wire', release: 'Shibuya Feedback', genre: 'Post-Punk', city: 'Yokohama', colors: ['#991b1b','#ef4444','#fee2e2'] },\n    { name: 'Zoraida Brass', release: 'Havana Dusk LP', genre: 'Jazz', city: 'Miami', colors: ['#92400e','#f59e0b','#fef3c7'] }\n  ];\n\n  const ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');\n  const savedSet = new Set(['Alder & Moss', 'Nadia Osei Trio', 'Taro Takahashi']);\n\n  let activeGenre = 'all';\n  let searchQuery = '';\n  let activeLetter = 'A';\n  let availableLetters = new Set();\n\n  const directoryEl = document.getElementById('directory');\n  const railEl = document.getElementById('indexRail');\n  const loupeEl = document.getElementById('loupe');\n  const loupeChar = document.getElementById('loupeChar');\n  const catalogStat = document.getElementById('catalogStat');\n\n  function sleeveSvg([c1, c2, c3], idx) {\n    return `\n      <svg class=\"sleeve\" viewBox=\"0 0 52 52\" aria-hidden=\"true\">\n        <rect width=\"52\" height=\"52\" fill=\"${c1}\"/>\n        <circle cx=\"${16 + (idx * 9) % 24}\" cy=\"${16 + (idx * 7) % 22}\" r=\"18\" fill=\"${c2}\" opacity=\"0.82\"/>\n        <circle cx=\"26\" cy=\"26\" r=\"14\" fill=\"none\" stroke=\"${c3}\" stroke-width=\"1.2\" opacity=\"0.5\"/>\n        <circle cx=\"26\" cy=\"26\" r=\"3\" fill=\"${c3}\"/>\n      </svg>\n    `;\n  }\n\n  function renderRail() {\n    railEl.innerHTML = '';\n    ALPHABET.forEach(ch => {\n      const span = document.createElement('span');\n      const has = availableLetters.has(ch);\n      span.className = `index-letter ${has ? 'has-items' : 'empty'}${ch === activeLetter ? ' active' : ''}`;\n      span.dataset.letter = ch;\n      span.textContent = ch;\n      railEl.appendChild(span);\n    });\n  }\n\n  function setActiveLetterUI(letter) {\n    if (activeLetter === letter) return;\n    activeLetter = letter;\n    railEl.querySelectorAll('.index-letter').forEach(el => {\n      el.classList.toggle('active', el.dataset.letter === letter);\n    });\n  }\n\n  function renderDirectory() {\n    const q = searchQuery.trim().toLowerCase();\n    const filtered = ARTISTS.filter(a => {\n      const genreOk = activeGenre === 'all' || a.genre === activeGenre;\n      const queryOk = !q || `${a.name} ${a.release} ${a.city} ${a.genre}`.toLowerCase().includes(q);\n      return genreOk && queryOk;\n    });\n\n    const grouped = new Map();\n    filtered.forEach(a => {\n      const ch = a.name[0].toUpperCase();\n      if (!grouped.has(ch)) grouped.set(ch, []);\n      grouped.get(ch).push(a);\n    });\n\n    availableLetters = new Set(grouped.keys());\n    catalogStat.textContent = `${filtered.length} ARTISTS · ${availableLetters.size} SECTIONS`;\n\n    directoryEl.innerHTML = '';\n    if (filtered.length === 0) {\n      directoryEl.innerHTML = `<div class=\"empty-dir\">No vinyl pressings match your current filter.</div>`;\n      renderRail();\n      return;\n    }\n\n    let idx = 0;\n    for (const ch of ALPHABET) {\n      const items = grouped.get(ch);\n      if (!items) continue;\n      const section = document.createElement('section');\n      section.className = 'letter-section';\n      section.id = `sec-${ch}`;\n      section.dataset.letter = ch;\n\n      section.innerHTML = `\n        <div class=\"sticky-header\">\n          <span class=\"sticky-letter\">${ch}</span>\n          <span class=\"sticky-count\">${items.length} ${items.length === 1 ? 'PRESSING' : 'PRESSINGS'}</span>\n        </div>\n        <div class=\"artist-list\"></div>\n      `;\n\n      const listEl = section.querySelector('.artist-list');\n      items.forEach(artist => {\n        idx++;\n        const card = document.createElement('article');\n        card.className = 'artist-card';\n        const isSaved = savedSet.has(artist.name);\n        card.innerHTML = `\n          ${sleeveSvg(artist.colors, idx)}\n          <div class=\"artist-info\">\n            <div class=\"artist-name\">${artist.name}</div>\n            <div class=\"artist-release\">${artist.release}</div>\n            <div class=\"artist-tags\">\n              <span class=\"tag-genre\">${artist.genre}</span>\n              <span class=\"tag-city\">${artist.city}</span>\n            </div>\n          </div>\n          <button class=\"save-btn${isSaved ? ' saved' : ''}\" aria-label=\"Wishlist ${artist.name}\" aria-pressed=\"${isSaved}\">\n            ${isSaved ? '★' : '☆'}\n          </button>\n        `;\n        card.querySelector('.save-btn').addEventListener('click', e => {\n          const btn = e.currentTarget;\n          if (savedSet.has(artist.name)) savedSet.delete(artist.name);\n          else savedSet.add(artist.name);\n          const nowSaved = savedSet.has(artist.name);\n          btn.classList.toggle('saved', nowSaved);\n          btn.setAttribute('aria-pressed', String(nowSaved));\n          btn.textContent = nowSaved ? '★' : '☆';\n        });\n        listEl.appendChild(card);\n      });\n\n      directoryEl.appendChild(section);\n    }\n\n    if (!availableLetters.has(activeLetter) && availableLetters.size > 0) {\n      activeLetter = [...availableLetters][0];\n    }\n    renderRail();\n  }\n\n  // Scrubbing interaction on right-edge index rail\n  let scrubbing = false;\n\n  function jumpToClientY(clientY, smooth = false) {\n    const rect = railEl.getBoundingClientRect();\n    const ratio = Math.max(0, Math.min(0.9999, (clientY - rect.top) / rect.height));\n    const idx = Math.floor(ratio * ALPHABET.length);\n    const letter = ALPHABET[idx];\n\n    // Position magnification loupe vertically aligned with finger/pointer\n    const clampedY = Math.max(rect.top + 10, Math.min(rect.bottom - 10, clientY));\n    loupeEl.style.top = `${clampedY}px`;\n    loupeChar.textContent = letter;\n    loupeEl.classList.add('visible');\n\n    // Find exact or nearest available section\n    let targetLetter = letter;\n    if (!availableLetters.has(targetLetter) && availableLetters.size > 0) {\n      let best = null, bestDist = 99;\n      for (const ch of availableLetters) {\n        const d = Math.abs(ch.charCodeAt(0) - letter.charCodeAt(0));\n        if (d < bestDist) { bestDist = d; best = ch; }\n      }\n      targetLetter = best;\n    }\n\n    if (targetLetter) {\n      setActiveLetterUI(targetLetter);\n      const sec = document.getElementById(`sec-${targetLetter}`);\n      if (sec) {\n        sec.scrollIntoView({ behavior: smooth ? 'smooth' : 'auto', block: 'start' });\n      }\n    }\n  }\n\n  railEl.addEventListener('pointerdown', e => {\n    scrubbing = true;\n    railEl.setPointerCapture(e.pointerId);\n    jumpToClientY(e.clientY, true);\n  });\n\n  railEl.addEventListener('pointermove', e => {\n    if (!scrubbing) return;\n    jumpToClientY(e.clientY, false);\n  });\n\n  const endScrub = () => {\n    if (!scrubbing) return;\n    scrubbing = false;\n    setTimeout(() => { if (!scrubbing) loupeEl.classList.remove('visible'); }, 220);\n  };\n  railEl.addEventListener('pointerup', endScrub);\n  railEl.addEventListener('pointercancel', endScrub);\n\n  // Keyboard navigation on rail\n  railEl.addEventListener('keydown', e => {\n    const list = [...availableLetters];\n    if (!list.length) return;\n    const curIdx = Math.max(0, list.indexOf(activeLetter));\n    if (e.key === 'ArrowDown') {\n      e.preventDefault();\n      const next = list[(curIdx + 1) % list.length];\n      setActiveLetterUI(next);\n      document.getElementById(`sec-${next}`)?.scrollIntoView({ behavior: 'smooth', block: 'start' });\n    } else if (e.key === 'ArrowUp') {\n      e.preventDefault();\n      const prev = list[(curIdx - 1 + list.length) % list.length];\n      setActiveLetterUI(prev);\n      document.getElementById(`sec-${prev}`)?.scrollIntoView({ behavior: 'smooth', block: 'start' });\n    }\n  });\n\n  // Sync active letter during normal page scroll\n  let scrollTicking = false;\n  window.addEventListener('scroll', () => {\n    if (scrubbing || scrollTicking) return;\n    scrollTicking = true;\n    requestAnimationFrame(() => {\n      const sections = document.querySelectorAll('.letter-section');\n      let current = activeLetter;\n      for (const sec of sections) {\n        if (sec.getBoundingClientRect().top <= 64) current = sec.dataset.letter;\n      }\n      setActiveLetterUI(current);\n      scrollTicking = false;\n    });\n  }, { passive: true });\n\n  // Search & genre filters\n  document.getElementById('searchInput').addEventListener('input', e => {\n    searchQuery = e.target.value;\n    renderDirectory();\n  });\n\n  document.querySelectorAll('.genre-btn').forEach(btn => {\n    btn.addEventListener('click', () => {\n      document.querySelectorAll('.genre-btn').forEach(b => b.setAttribute('aria-pressed', 'false'));\n      btn.setAttribute('aria-pressed', 'true');\n      activeGenre = btn.dataset.genre;\n      renderDirectory();\n    });\n  });\n\n  renderDirectory();\n})();\n</script>\n</body>\n</html>\n"
}
