{
  "id": 8,
  "slug": "pudding-visual-essay",
  "name": "The Pudding Visual Essay",
  "kind": "style",
  "family": "Editorial & Data Journalism",
  "sourceSite": {
    "name": "The Pudding",
    "url": "https://pudding.cool",
    "verifiedStatus": 200
  },
  "tagline": "Tactile newsprint paired with playful data-viz spot colors, scrollytelling narrative steps, and annotated charts.",
  "whyUnique": "Bridges magazine storytelling and interactive data visualization: narrative prose steps directly drive a sticky custom SVG/Canvas graphic with hand-tuned editorial callouts and zero corporate dashboard bloat.",
  "theme": "light",
  "mobileStrength": "high",
  "tags": [
    "visual-essay",
    "scrollytelling",
    "data-journalism",
    "editorial-viz",
    "interactive-chart",
    "narrative"
  ],
  "bestFor": [
    "Visual journalism & data essays",
    "Interactive research reports",
    "Cultural analytics & explainers",
    "Educational storytelling"
  ],
  "palette": [
    {
      "role": "canvas",
      "hex": "#F8F6F1",
      "name": "Warm Newsprint"
    },
    {
      "role": "surface",
      "hex": "#EFECE4",
      "name": "Chart Matte"
    },
    {
      "role": "ink",
      "hex": "#1E1E24",
      "name": "Editorial Charcoal"
    },
    {
      "role": "accent",
      "hex": "#0E8A8A",
      "name": "Data Teal"
    },
    {
      "role": "muted",
      "hex": "#64646E",
      "name": "Axis Slate"
    }
  ],
  "typography": {
    "display": "Fraunces, Georgia, serif",
    "body": "Public Sans, -apple-system, sans-serif",
    "mono": "JetBrains Mono, ui-monospace, monospace",
    "googleFontsUrl": "https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,600;0,9..144,700;1,9..144,400&family=JetBrains+Mono:wght@400;500&family=Public+Sans:wght@400;500;600&display=swap",
    "scaleNotes": "Expressive soft-serif Fraunces display headlines paired with crisp Public Sans prose and monospace data labels."
  },
  "layoutNotes": "Centered editorial opener leading into a split scrollytelling stage (sticky interactive data graphic alongside clickable/scrollable narrative steps), followed by an interactive explorer table.",
  "interactionNotes": "Step buttons and scroll-aware triggers morph the live SVG chart state across eras, accompanied by genre filter pills, hover/tap data tooltips, and color-coded inline prose highlights.",
  "mobileNotes": "Split scrollytelling converts into a compact top-pinned or cleanly stacked chart above tappable narrative step pills so 390px readers can scrub the story with one thumb.",
  "agentGuardrails": {
    "do": [
      "Color-code key prose phrases to match the exact data series colors in the chart",
      "Keep charts uncluttered with direct annotations instead of detached legend boxes",
      "Pair expressive editorial headlines with clean sans-serif data labels"
    ],
    "dont": [
      "Do not turn the visual essay into a generic SaaS KPI dashboard with 6 chart cards",
      "Do not rely on hover-only tooltips that fail on touch devices"
    ]
  },
  "demoFile": "demos/pudding-visual-essay.html",
  "thumbDesktop": "thumbs/pudding-visual-essay-desktop.webp",
  "thumbMobile": "thumbs/pudding-visual-essay-mobile.webp",
  "urls": {
    "page": "https://templates.michaelpitts.net/t/pudding-visual-essay",
    "markdown": "https://templates.michaelpitts.net/t/pudding-visual-essay.md",
    "api": "https://templates.michaelpitts.net/api/templates/pudding-visual-essay",
    "demo": "https://templates.michaelpitts.net/demos/pudding-visual-essay.html",
    "thumbDesktop": "https://templates.michaelpitts.net/thumbs/pudding-visual-essay-desktop.webp",
    "thumbMobile": "https://templates.michaelpitts.net/thumbs/pudding-visual-essay-mobile.webp"
  },
  "agentPrompt": "Design & build using template #008 \"The Pudding Visual Essay\" (style / Editorial & Data Journalism, light theme).\nFull AI blueprint & standalone starter code: https://templates.michaelpitts.net/t/pudding-visual-essay.md\nLive demo: https://templates.michaelpitts.net/demos/pudding-visual-essay.html\nReal-world inspiration: The Pudding (https://pudding.cool)\n\nCore aesthetic: Bridges magazine storytelling and interactive data visualization: narrative prose steps directly drive a sticky custom SVG/Canvas graphic with hand-tuned editorial callouts and zero corporate dashboard bloat.\nPalette: canvas: #F8F6F1 (Warm Newsprint), surface: #EFECE4 (Chart Matte), ink: #1E1E24 (Editorial Charcoal), accent: #0E8A8A (Data Teal), muted: #64646E (Axis Slate)\nTypography: Display=\"Fraunces, Georgia, serif\", Body=\"Public Sans, -apple-system, sans-serif\", Mono=\"JetBrains Mono, ui-monospace, monospace\"\nLayout: Centered editorial opener leading into a split scrollytelling stage (sticky interactive data graphic alongside clickable/scrollable narrative steps), followed by an interactive explorer table.\nInteractions: Step buttons and scroll-aware triggers morph the live SVG chart state across eras, accompanied by genre filter pills, hover/tap data tooltips, and color-coded inline prose highlights.\nMobile: Split scrollytelling converts into a compact top-pinned or cleanly stacked chart above tappable narrative step pills so 390px readers can scrub the story with one thumb.\n\nGuardrails:\n- DO: Color-code key prose phrases to match the exact data series colors in the chart\n- DO: Keep charts uncluttered with direct annotations instead of detached legend boxes\n- DO: Pair expressive editorial headlines with clean sans-serif data labels\n- DON'T: Do not turn the visual essay into a generic SaaS KPI dashboard with 6 chart cards\n- DON'T: Do not rely on hover-only tooltips that fail on touch devices",
  "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>How Song Intros Shrank Across 50 Years of Pop — The Visual Essay</title>\n  <link rel=\"preconnect\" href=\"https://fonts.googleapis.com\">\n  <link rel=\"preconnect\" href=\"https://fonts.gstatic.com\" crossorigin>\n  <link href=\"https://fonts.googleapis.com/css2?family=DM+Sans:ital,wght@0,400;0,500;0,700;1,400&family=Fraunces:ital,opsz,wght@0,9..144,600;0,9..144,800;1,9..144,500&family=IBM+Plex+Mono:wght@400;500;600&display=swap\" rel=\"stylesheet\">\n  <style>\n    :root {\n      --canvas: #F8F6F1;\n      --surface: #EFECE4;\n      --ink: #1E1E24;\n      --accent: #0E8A8A;\n      --coral: #E05A47;\n      --mustard: #D99B26;\n      --muted: #64646E;\n      --line: #DCD7CB;\n      --font-display: 'Fraunces', Georgia, serif;\n      --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;\n      --font-mono: 'IBM Plex Mono', ui-monospace, monospace;\n    }\n\n    *, *::before, *::after { box-sizing: border-box; }\n\n    html {\n      background: var(--canvas);\n      color: var(--ink);\n      scroll-behavior: smooth;\n      -webkit-font-smoothing: antialiased;\n    }\n\n    body {\n      margin: 0;\n      font-family: var(--font-sans);\n      background: var(--canvas);\n      color: var(--ink);\n      line-height: 1.65;\n      overflow-x: hidden;\n    }\n\n    a { color: inherit; text-decoration: none; }\n    button { font-family: inherit; color: inherit; cursor: pointer; }\n\n    /* Top Bar */\n    .topbar {\n      border-bottom: 1px solid var(--line);\n      background: rgba(248, 246, 241, 0.94);\n      position: sticky;\n      top: 0;\n      z-index: 40;\n      backdrop-filter: blur(8px);\n    }\n\n    .topbar-inner {\n      max-width: 1200px;\n      margin: 0 auto;\n      padding: 0 20px;\n      height: 58px;\n      display: flex;\n      align-items: center;\n      justify-content: space-between;\n      gap: 12px;\n    }\n\n    .pub-mark {\n      display: inline-flex;\n      align-items: center;\n      gap: 8px;\n      font-family: var(--font-display);\n      font-weight: 800;\n      font-size: 1.1rem;\n      letter-spacing: -0.02em;\n    }\n\n    .pub-dot {\n      width: 12px;\n      height: 12px;\n      border-radius: 50%;\n      background: var(--accent);\n      box-shadow: 10px 0 0 var(--coral), 20px 0 0 var(--mustard);\n      margin-right: 22px;\n    }\n\n    .top-meta {\n      font-family: var(--font-mono);\n      font-size: 0.75rem;\n      color: var(--muted);\n      display: flex;\n      align-items: center;\n      gap: 16px;\n    }\n\n    .top-meta a {\n      padding: 8px 4px;\n      text-decoration: underline;\n      text-underline-offset: 3px;\n    }\n\n    /* Hero */\n    .hero {\n      max-width: 840px;\n      margin: 0 auto;\n      padding: 52px 20px 36px;\n      text-align: center;\n    }\n\n    .kicker {\n      display: inline-block;\n      font-family: var(--font-mono);\n      font-size: 0.74rem;\n      font-weight: 600;\n      text-transform: uppercase;\n      letter-spacing: 0.08em;\n      padding: 5px 12px;\n      border-radius: 999px;\n      background: var(--surface);\n      border: 1px solid var(--line);\n      color: var(--accent);\n      margin-bottom: 18px;\n    }\n\n    .hero h1 {\n      margin: 0;\n      font-family: var(--font-display);\n      font-size: clamp(2.2rem, 5.5vw, 3.85rem);\n      font-weight: 800;\n      line-height: 1.07;\n      letter-spacing: -0.025em;\n    }\n\n    .hero-sub {\n      margin: 18px auto 0;\n      max-width: 630px;\n      font-size: 1.12rem;\n      color: var(--muted);\n    }\n\n    .hero-byline {\n      margin-top: 20px;\n      font-family: var(--font-mono);\n      font-size: 0.78rem;\n      color: var(--muted);\n    }\n\n    /* KPI Strip */\n    .kpi-strip {\n      max-width: 960px;\n      margin: 0 auto 36px;\n      padding: 0 20px;\n      display: grid;\n      grid-template-columns: repeat(3, 1fr);\n      gap: 14px;\n    }\n\n    .kpi-card {\n      background: var(--surface);\n      border: 1px solid var(--line);\n      border-radius: 10px;\n      padding: 16px 18px;\n    }\n\n    .kpi-val {\n      font-family: var(--font-display);\n      font-size: clamp(1.6rem, 3vw, 2.2rem);\n      font-weight: 800;\n      line-height: 1.1;\n    }\n\n    .kpi-val.teal { color: var(--accent); }\n    .kpi-val.coral { color: var(--coral); }\n    .kpi-val.mustard { color: var(--mustard); }\n\n    .kpi-label {\n      margin-top: 4px;\n      font-size: 0.82rem;\n      color: var(--muted);\n    }\n\n    /* Inline Editorial Annotations */\n    .tag-teal {\n      background: rgba(14, 138, 138, 0.14);\n      color: #096464;\n      padding: 1px 6px;\n      border-radius: 4px;\n      font-weight: 600;\n    }\n\n    .tag-coral {\n      background: rgba(224, 90, 71, 0.15);\n      color: #B43928;\n      padding: 1px 6px;\n      border-radius: 4px;\n      font-weight: 600;\n    }\n\n    .tag-mustard {\n      background: rgba(217, 155, 38, 0.18);\n      color: #8F620F;\n      padding: 1px 6px;\n      border-radius: 4px;\n      font-weight: 600;\n    }\n\n    /* Scrollytelling Interactive Stage */\n    .scrolly-wrap {\n      max-width: 1200px;\n      margin: 0 auto;\n      padding: 12px 20px 64px;\n      display: grid;\n      grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.9fr);\n      gap: 28px;\n      align-items: start;\n    }\n\n    .viz-panel {\n      position: sticky;\n      top: 74px;\n      background: #FFFFFF;\n      border: 1px solid var(--line);\n      border-radius: 14px;\n      padding: 20px;\n      box-shadow: 0 8px 28px rgba(30, 30, 36, 0.04);\n    }\n\n    .viz-header {\n      display: flex;\n      flex-wrap: wrap;\n      justify-content: space-between;\n      align-items: center;\n      gap: 12px;\n      margin-bottom: 14px;\n    }\n\n    .viz-title {\n      margin: 0;\n      font-family: var(--font-display);\n      font-size: 1.2rem;\n      font-weight: 700;\n    }\n\n    .filter-pills {\n      display: flex;\n      flex-wrap: wrap;\n      gap: 8px;\n      margin-bottom: 14px;\n    }\n\n    .pill-btn {\n      min-height: 44px;\n      padding: 0 14px;\n      border-radius: 999px;\n      border: 1px solid var(--line);\n      background: var(--canvas);\n      font-size: 0.82rem;\n      font-weight: 500;\n      color: var(--muted);\n      transition: all 0.15s ease;\n    }\n\n    .pill-btn:hover { border-color: var(--ink); color: var(--ink); }\n\n    .pill-btn.active {\n      background: var(--ink);\n      color: #FFFFFF;\n      border-color: var(--ink);\n    }\n\n    .chart-box {\n      position: relative;\n      width: 100%;\n    }\n\n    .chart-svg {\n      width: 100%;\n      height: auto;\n      display: block;\n      overflow: visible;\n    }\n\n    .chart-caption-bar {\n      margin-top: 12px;\n      padding: 12px 14px;\n      background: var(--surface);\n      border-radius: 8px;\n      display: flex;\n      justify-content: space-between;\n      align-items: center;\n      gap: 12px;\n      font-size: 0.84rem;\n    }\n\n    .chart-caption-bar strong {\n      font-family: var(--font-mono);\n      color: var(--accent);\n    }\n\n    /* Narrative Step Switcher */\n    .steps-col {\n      display: flex;\n      flex-direction: column;\n      gap: 16px;\n    }\n\n    .step-nav-bar {\n      display: flex;\n      justify-content: space-between;\n      align-items: center;\n      gap: 8px;\n    }\n\n    .step-btn {\n      min-height: 44px;\n      padding: 0 16px;\n      border-radius: 8px;\n      border: 1px solid var(--line);\n      background: var(--surface);\n      font-size: 0.84rem;\n      font-weight: 600;\n    }\n\n    .step-btn:hover { border-color: var(--accent); color: var(--accent); }\n\n    .step-card {\n      text-align: left;\n      width: 100%;\n      background: var(--surface);\n      border: 2px solid transparent;\n      border-radius: 12px;\n      padding: 20px;\n      transition: background 0.18s, border-color 0.18s, transform 0.18s;\n    }\n\n    .step-card:hover { background: #FFFFFF; }\n\n    .step-card.active {\n      background: #FFFFFF;\n      border-color: var(--accent);\n      box-shadow: 0 6px 20px rgba(14, 138, 138, 0.08);\n    }\n\n    .step-num {\n      font-family: var(--font-mono);\n      font-size: 0.74rem;\n      font-weight: 600;\n      text-transform: uppercase;\n      letter-spacing: 0.08em;\n      color: var(--accent);\n      margin-bottom: 6px;\n      display: block;\n    }\n\n    .step-card h3 {\n      margin: 0 0 8px;\n      font-family: var(--font-display);\n      font-size: 1.25rem;\n      line-height: 1.25;\n    }\n\n    .step-card p {\n      margin: 0;\n      font-size: 0.94rem;\n      color: var(--muted);\n    }\n\n    /* Editorial Closing & Methodology */\n    .essay-wrap {\n      max-width: 740px;\n      margin: 0 auto;\n      padding: 12px 20px 72px;\n    }\n\n    .essay-wrap h2 {\n      font-family: var(--font-display);\n      font-size: 1.8rem;\n      margin: 1.6em 0 0.6em;\n    }\n\n    .essay-wrap p {\n      font-size: 1.04rem;\n      margin: 0 0 1.3em;\n    }\n\n    .method-box {\n      margin-top: 32px;\n      background: var(--surface);\n      border: 1px solid var(--line);\n      border-radius: 12px;\n      padding: 22px;\n      font-size: 0.88rem;\n      color: var(--muted);\n    }\n\n    .method-box h3 {\n      margin: 0 0 8px;\n      font-family: var(--font-mono);\n      font-size: 0.8rem;\n      text-transform: uppercase;\n      color: var(--ink);\n    }\n\n    @media (max-width: 920px) {\n      .scrolly-wrap { grid-template-columns: 1fr; }\n      .viz-panel { position: static; }\n    }\n\n    @media (max-width: 640px) {\n      .kpi-strip { grid-template-columns: 1fr; }\n      .hero { padding: 36px 20px 24px; }\n      .top-meta span { display: none; }\n    }\n  </style>\n</head>\n<body>\n  <header class=\"topbar\">\n    <div class=\"topbar-inner\">\n      <a href=\"#\" class=\"pub-mark\">\n        <span class=\"pub-dot\" aria-hidden=\"true\"></span>\n        <span>Visual Essay Lab</span>\n      </a>\n      <div class=\"top-meta\">\n        <span>DATA JOURNALISM · VOL. 09</span>\n        <a href=\"#methodology\">Methodology</a>\n      </div>\n    </div>\n  </header>\n\n  <main>\n    <section class=\"hero\">\n      <span class=\"kicker\">Music Data Analysis · 1975–2025</span>\n      <h1>How Song Intros Shrank Across 50 Years of Pop</h1>\n      <p class=\"hero-sub\">\n        We timed the arrival of the first sung syllable across 5,000 Hot 100 hits. In 1984, listeners waited 23 seconds for a voice. Today, streaming skip economics leave artists less than six.\n      </p>\n      <div class=\"hero-byline\">By Maya Chen &amp; Jonah Morales · Interactive Dataset</div>\n    </section>\n\n    <section class=\"kpi-strip\" aria-label=\"Key dataset metrics\">\n      <div class=\"kpi-card\">\n        <div class=\"kpi-val teal\" id=\"kpiPeak\">23.4s</div>\n        <div class=\"kpi-label\">Peak median intro length (1985)</div>\n      </div>\n      <div class=\"kpi-card\">\n        <div class=\"kpi-val coral\" id=\"kpiNow\">5.8s</div>\n        <div class=\"kpi-label\">Current median intro length (2025)</div>\n      </div>\n      <div class=\"kpi-card\">\n        <div class=\"kpi-val mustard\" id=\"kpiDrop\">-75%</div>\n        <div class=\"kpi-label\">Compression since the synth era</div>\n      </div>\n    </section>\n\n    <section class=\"scrolly-wrap\" aria-label=\"Interactive scrollytelling chart\">\n      <div class=\"viz-panel\">\n        <div class=\"viz-header\">\n          <h2 class=\"viz-title\" id=\"chartHeading\">Median Seconds Before First Vocal</h2>\n          <span style=\"font-family:var(--font-mono);font-size:0.74rem;color:var(--muted);\">Tap any point to inspect</span>\n        </div>\n\n        <div class=\"filter-pills\" role=\"group\" aria-label=\"Genre filter\">\n          <button type=\"button\" class=\"pill-btn active\" data-genre=\"all\">All Hot 100</button>\n          <button type=\"button\" class=\"pill-btn\" data-genre=\"pop\">Pop</button>\n          <button type=\"button\" class=\"pill-btn\" data-genre=\"hiphop\">Hip-Hop</button>\n          <button type=\"button\" class=\"pill-btn\" data-genre=\"rock\">Rock / Alt</button>\n        </div>\n\n        <div class=\"chart-box\">\n          <svg id=\"introChart\" class=\"chart-svg\" viewBox=\"0 0 600 340\" role=\"img\" aria-label=\"Line chart of song intro lengths from 1975 to 2025\"></svg>\n        </div>\n\n        <div class=\"chart-caption-bar\" id=\"chartInspect\">\n          <span>Click a narrative step or chart node to inspect era details.</span>\n          <strong id=\"inspectVal\">1985 · 23.4s</strong>\n        </div>\n      </div>\n\n      <div class=\"steps-col\">\n        <div class=\"step-nav-bar\">\n          <button type=\"button\" class=\"step-btn\" id=\"prevStep\">← Prev Step</button>\n          <span style=\"font-family:var(--font-mono);font-size:0.78rem;color:var(--muted);\" id=\"stepCounter\">Step 1 / 4</span>\n          <button type=\"button\" class=\"step-btn\" id=\"nextStep\">Next Step →</button>\n        </div>\n\n        <button type=\"button\" class=\"step-card active\" data-step=\"0\">\n          <span class=\"step-num\">01 · 1975–1985 · The FM Ramp</span>\n          <h3>Slow Builds &amp; Radio DJ Talk-Ups</h3>\n          <p>\n            During the <span class=\"tag-teal\">vinyl &amp; FM radio era</span>, long instrumental ramps were functional: DJs talked over the opening 18–25 seconds right up to the vocal \"post\" without stepping on the chorus.\n          </p>\n        </button>\n\n        <button type=\"button\" class=\"step-card\" data-step=\"1\">\n          <span class=\"step-num\">02 · 1985–1995 · Drum Machine Peak</span>\n          <h3>Synthesizer Overatures Hit 23 Seconds</h3>\n          <p>\n            The mid-1980s marked the <span class=\"tag-mustard\">all-time intro peak</span>. Producers layered gated snare fills, bass ostinatos, and synth brass fanfare before a singer ever entered the mix.\n          </p>\n        </button>\n\n        <button type=\"button\" class=\"step-card\" data-step=\"2\">\n          <span class=\"step-num\">03 · 2000–2015 · The MP3 &amp; Hook Shift</span>\n          <h3>The Chorus Moves to the Front Door</h3>\n          <p>\n            Portable players and 30-second digital previews compressed intros into the <span class=\"tag-teal\">10–14 second band</span>. Songwriters began opening with stripped-back pre-choruses to establish identity fast.\n          </p>\n        </button>\n\n        <button type=\"button\" class=\"step-card\" data-step=\"3\">\n          <span class=\"step-num\">04 · 2016–2025 · The Streaming Cliff</span>\n          <h3>Five Seconds to Beat the Skip Button</h3>\n          <p>\n            Because streaming royalties trigger only after 30 seconds of play, modern pop drops into the <span class=\"tag-coral\">5-second cliff</span>—often starting on beat one with vocals already in motion.\n          </p>\n        </button>\n      </div>\n    </section>\n\n    <article class=\"essay-wrap\">\n      <h2>What Disappears When the Prelude Vanishes?</h2>\n      <p>\n        An intro is more than acoustic throat-clearing. In arrangement terms, it establishes tempo, harmonic center, and spatial depth—a musical foyer that lets the listener adjust to a track's room tone before language arrives. When tracks open immediately with a vocal hook, the song behaves less like a short story and more like a billboard seen at highway speed.\n      </p>\n      <p>\n        Yet compression has also bred invention. Producers now pack harmonic tension into two-bar vocal chops, reverse-reverb swells, and micro-intros that announce an artist's sonic signature in under three seconds. The runway has shrunk, but the takeoff has become an art form of its own.\n      </p>\n\n      <aside class=\"method-box\" id=\"methodology\">\n        <h3>Methodology &amp; Audio Timing Notes</h3>\n        <p style=\"margin:0;\">\n          We sampled 100 year-end charting singles per year from 1975 through 2025 (5,100 tracks total). Intro duration is measured from first audible audio onset (-48 dBFS) to first lead vocal syllable, excluding non-lexical ad-libs or producer tags. Genre buckets reflect primary Billboard chart classification.\n        </p>\n      </aside>\n    </article>\n  </main>\n\n  <script>\n    (function () {\n      const years = [1975, 1980, 1985, 1990, 1995, 2000, 2005, 2010, 2015, 2020, 2025];\n      const seriesData = {\n        all:    [19.2, 21.5, 23.4, 20.1, 18.4, 15.8, 13.6, 11.4, 9.2, 6.8, 5.8],\n        pop:    [17.5, 20.4, 22.8, 19.2, 16.5, 14.0, 11.8, 9.5, 7.6, 5.4, 4.6],\n        hiphop: [16.0, 18.2, 19.6, 18.0, 17.2, 15.4, 13.9, 12.1, 10.4, 8.2, 7.1],\n        rock:   [22.4, 24.8, 26.2, 23.5, 21.0, 18.6, 16.4, 14.2, 12.5, 10.1, 8.9]\n      };\n\n      const steps = [\n        { range: [0, 2], color: '#0E8A8A', note: 'FM DJs talked over 20s+ ramps right up to the vocal post.' },\n        { range: [2, 4], color: '#D99B26', note: 'Peak synth & drum-machine preludes averaged over 23s.' },\n        { range: [5, 8], color: '#0E8A8A', note: 'Digital downloads & 30s previews pulled intros under 12s.' },\n        { range: [8, 10], color: '#E05A47', note: 'Streaming skip rates pushed modern pop to a 5.8s median.' }\n      ];\n\n      let currentGenre = 'all';\n      let currentStep = 0;\n\n      const svg = document.getElementById('introChart');\n      const inspectBar = document.getElementById('chartInspect');\n      const kpiPeak = document.getElementById('kpiPeak');\n      const kpiNow = document.getElementById('kpiNow');\n      const kpiDrop = document.getElementById('kpiDrop');\n      const stepCounter = document.getElementById('stepCounter');\n      const stepCards = document.querySelectorAll('.step-card');\n\n      const pad = { l: 44, r: 24, t: 24, b: 36 };\n      const W = 600, H = 340;\n      const plotW = W - pad.l - pad.r;\n      const plotH = H - pad.t - pad.b;\n\n      const xScale = i => pad.l + (i / (years.length - 1)) * plotW;\n      const yScale = v => pad.t + plotH - (v / 30) * plotH;\n\n      function updateKPIs(vals) {\n        const peak = Math.max(...vals);\n        const now = vals[vals.length - 1];\n        const drop = Math.round(((now - peak) / peak) * 100);\n        kpiPeak.textContent = peak.toFixed(1) + 's';\n        kpiNow.textContent = now.toFixed(1) + 's';\n        kpiDrop.textContent = drop + '%';\n      }\n\n      function renderChart() {\n        const vals = seriesData[currentGenre];\n        updateKPIs(vals);\n        const st = steps[currentStep];\n        const x1 = xScale(st.range[0]);\n        const x2 = xScale(st.range[1]);\n\n        let html = '';\n\n        // Highlighted narrative band\n        html += `<rect x=\"${x1}\" y=\"${pad.t}\" width=\"${Math.max(24, x2 - x1)}\" height=\"${plotH}\" fill=\"${st.color}\" fill-opacity=\"0.11\" rx=\"6\"/>`;\n\n        // Horizontal gridlines\n        [0, 10, 20, 30].forEach(tick => {\n          const y = yScale(tick);\n          html += `<line x1=\"${pad.l}\" y1=\"${y}\" x2=\"${W - pad.r}\" y2=\"${y}\" stroke=\"#E5E0D4\" stroke-dasharray=\"${tick === 0 ? '' : '3 4'}\"/>`;\n          html += `<text x=\"${pad.l - 10}\" y=\"${y + 4}\" text-anchor=\"end\" font-family=\"IBM Plex Mono, monospace\" font-size=\"11\" fill=\"#64646E\">${tick}s</text>`;\n        });\n\n        // X-axis labels\n        years.forEach((yr, i) => {\n          if (i % 2 === 0) {\n            html += `<text x=\"${xScale(i)}\" y=\"${H - 10}\" text-anchor=\"middle\" font-family=\"IBM Plex Mono, monospace\" font-size=\"11\" fill=\"#64646E\">${yr}</text>`;\n          }\n        });\n\n        // Area fill\n        const pts = vals.map((v, i) => `${xScale(i)},${yScale(v)}`);\n        const areaD = `M ${xScale(0)},${yScale(0)} L ${pts.join(' L ')} L ${xScale(vals.length - 1)},${yScale(0)} Z`;\n        html += `<path d=\"${areaD}\" fill=\"#0E8A8A\" fill-opacity=\"0.08\"/>`;\n\n        // Main polyline\n        html += `<polyline points=\"${pts.join(' ')}\" fill=\"none\" stroke=\"#1E1E24\" stroke-width=\"2.5\" stroke-linejoin=\"round\" stroke-linecap=\"round\"/>`;\n\n        // Highlighted segment\n        const segPts = vals.slice(st.range[0], st.range[1] + 1).map((v, k) => `${xScale(st.range[0] + k)},${yScale(v)}`);\n        html += `<polyline points=\"${segPts.join(' ')}\" fill=\"none\" stroke=\"${st.color}\" stroke-width=\"4.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>`;\n\n        // Interactive data nodes\n        vals.forEach((v, i) => {\n          const inBand = i >= st.range[0] && i <= st.range[1];\n          const cx = xScale(i), cy = yScale(v);\n          html += `<circle class=\"data-node\" data-idx=\"${i}\" cx=\"${cx}\" cy=\"${cy}\" r=\"${inBand ? 6.5 : 4.5}\" fill=\"${inBand ? st.color : '#FFFFFF'}\" stroke=\"${inBand ? '#FFFFFF' : '#1E1E24'}\" stroke-width=\"2\" style=\"cursor:pointer\"/>`;\n        });\n\n        // Peak annotation\n        const focusIdx = st.range[1];\n        const fx = xScale(focusIdx), fy = yScale(vals[focusIdx]);\n        html += `<text x=\"${Math.min(W - 60, Math.max(pad.l + 30, fx))}\" y=\"${Math.max(pad.t + 16, fy - 14)}\" text-anchor=\"middle\" font-family=\"IBM Plex Mono, monospace\" font-size=\"11\" font-weight=\"600\" fill=\"${st.color}\">${years[focusIdx]}: ${vals[focusIdx].toFixed(1)}s</text>`;\n\n        svg.innerHTML = html;\n\n        // Bind node clicks\n        svg.querySelectorAll('.data-node').forEach(node => {\n          node.addEventListener('click', () => {\n            const idx = Number(node.dataset.idx);\n            inspectBar.innerHTML = `<span><strong>${years[idx]}</strong> (${currentGenre.toUpperCase()}) — Median vocal entry at <strong>${vals[idx].toFixed(1)}s</strong>.</span><strong>${vals[idx].toFixed(1)}s</strong>`;\n          });\n        });\n\n        inspectBar.innerHTML = `<span>${st.note}</span><strong>${years[focusIdx]} · ${vals[focusIdx].toFixed(1)}s</strong>`;\n      }\n\n      function setStep(idx) {\n        currentStep = (idx + steps.length) % steps.length;\n        stepCards.forEach((c, i) => c.classList.toggle('active', i === currentStep));\n        stepCounter.textContent = `Step ${currentStep + 1} / ${steps.length}`;\n        renderChart();\n      }\n\n      stepCards.forEach(card => {\n        card.addEventListener('click', () => setStep(Number(card.dataset.step)));\n      });\n\n      document.getElementById('prevStep').addEventListener('click', () => setStep(currentStep - 1));\n      document.getElementById('nextStep').addEventListener('click', () => setStep(currentStep + 1));\n\n      document.querySelectorAll('.pill-btn').forEach(btn => {\n        btn.addEventListener('click', () => {\n          document.querySelectorAll('.pill-btn').forEach(b => b.classList.remove('active'));\n          btn.classList.add('active');\n          currentGenre = btn.dataset.genre;\n          renderChart();\n        });\n      });\n\n      renderChart();\n    })();\n  </script>\n</body>\n</html>\n"
}
