#109 ui light mobile: native-first Forms & Onboarding

Step-by-Step Conversational Progressive Wizard

One-question-at-a-time progressive form with smooth transitions, keyboard letter shortcuts, and thumb-zone navigation.

Inspired by Typeform ↗

Download .html
Fullscreen ↗

WHY THIS AESTHETIC IS UNIQUE

Eliminates long-form overwhelm by focusing attention on a single conversational prompt at a time with instant visual progress and effortless keyboard/touch flow.

BEST FOR

Client intake & project estimatorsAccount onboarding flowsInteractive quizzes & surveysInsurance & fintech quotes

TAGS

COLOR PALETTE (CLICK TO COPY HEX)

TYPOGRAPHY

Display
Newsreader
Body
Inter
Mono
JetBrains Mono
Scale
Inviting 24-32px serif question prompts paired with crisp 15px choice cards and mono keycap badges (A, B, C).

Google Fonts Stylesheet ↗

ARCHITECTURE & MOBILE NOTES

LAYOUT

Pinned top progress hairline, centered single-prompt stage, and sticky bottom Back/Continue navigation dock.

INTERACTION

Supports tap/click selection, A/B/C/D letter shortcuts, Enter to advance, inline validation feedback, and a final editable summary receipt.

MOBILE

Full-width >=52px choice cards and bottom-docked Continue button keep the entire flow comfortably one-handed on 390px screens.

AI AGENT GUARDRAILS

DO

  • Always display a clear step counter and progress bar so users know how many prompts remain
  • Allow users to go back and edit previous answers without losing later entries
  • Support Enter to advance and letter shortcuts on desktop while keeping large tap targets on mobile

DON'T

  • Do not auto-advance multi-select chip questions before the user explicitly confirms
  • Do not hide validation errors until the final step; validate gently per step
STANDALONE SOURCE · demos/conversational-progressive-wizard.html (26.5 KB)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Atelier North — Conversational Progressive Brand Estimator</title>
<style>
  :root {
    --canvas: #FAF7F2;
    --surface: #FFFFFF;
    --ink: #1F1A17;
    --accent: #2563EB;
    --accent-hover: #1D4ED8;
    --accent-soft: #EFF6FF;
    --muted: #6E655E;
    --border: #E7E0D6;
    --danger: #DC2626;
    --success: #059669;
    --radius: 16px;
    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
  }

  * { box-sizing: border-box; margin: 0; padding: 0; }

  html, body {
    height: 100%;
    background: var(--canvas);
    color: var(--ink);
    font-family: var(--font-sans);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: clip;
  }

  .wizard-shell {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
  }

  /* Top Progress & Brand */
  .progress-track {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: #EAE2D7;
    z-index: 30;
  }

  .progress-fill {
    height: 100%;
    width: 20%;
    background: var(--accent);
    transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .top-header {
    max-width: 780px;
    width: 100%;
    margin: 0 auto;
    padding: 20px 18px 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .studio-mark {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-weight: 700;
    font-size: 0.92rem;
    letter-spacing: -0.01em;
  }

  .studio-dot {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    background: var(--ink);
    color: var(--canvas);
    display: grid;
    place-items: center;
    font-family: var(--font-serif);
    font-size: 0.85rem;
  }

  .step-counter {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--muted);
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 5px 11px;
    border-radius: 999px;
  }

  /* Main Stage */
  .stage {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 18px 104px;
  }

  .question-card {
    width: 100%;
    max-width: 680px;
    animation: slideIn 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  }

  @keyframes slideIn {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .q-kicker {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 10px;
  }

  .q-title {
    font-family: var(--font-serif);
    font-size: clamp(1.5rem, 4vw, 2.15rem);
    font-weight: 400;
    line-height: 1.22;
    letter-spacing: -0.015em;
    margin-bottom: 10px;
  }

  .q-subtitle {
    font-size: 0.95rem;
    color: var(--muted);
    margin-bottom: 24px;
  }

  /* Option Cards (Single-select) */
  .options-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  @media (min-width: 600px) {
    .options-list.two-col {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
  }

  .opt-card {
    width: 100%;
    min-height: 58px;
    padding: 13px 15px;
    border-radius: 13px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--ink);
    text-align: left;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: border-color 0.15s, background 0.15s, transform 0.12s, box-shadow 0.15s;
  }

  .opt-card:hover {
    border-color: #BFDBFE;
    background: #FBFDFF;
  }

  .opt-card:active {
    transform: scale(0.99);
  }

  .opt-card.selected {
    border-color: var(--accent);
    background: var(--accent-soft);
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.12);
  }

  .keycap {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    border: 1px solid var(--border);
    background: var(--canvas);
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 700;
    display: grid;
    place-items: center;
    flex-shrink: 0;
  }

  .opt-card.selected .keycap {
    background: var(--accent);
    border-color: var(--accent);
    color: #FFFFFF;
  }

  .opt-text strong {
    display: block;
    font-size: 0.94rem;
    font-weight: 650;
  }

  .opt-text span {
    display: block;
    font-size: 0.78rem;
    color: var(--muted);
  }

  /* Scope Multi-Select Chips */
  .chips-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }

  .scope-chip {
    min-height: 46px;
    padding: 0 15px;
    border-radius: 999px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--ink);
    font-size: 0.88rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.15s;
  }

  .scope-chip:hover { border-color: #93C5FD; }

  .scope-chip.selected {
    background: var(--accent);
    border-color: var(--accent);
    color: #FFFFFF;
  }

  .scope-chip .chip-key {
    font-size: 0.7rem;
    font-weight: 700;
    opacity: 0.72;
    padding: 2px 6px;
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.06);
  }

  .scope-chip.selected .chip-key {
    background: rgba(255, 255, 255, 0.22);
    opacity: 1;
  }

  /* Budget Slider */
  .budget-panel {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 20px;
  }

  .budget-readout {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
    flex-wrap: wrap;
  }

  .budget-figure {
    font-family: var(--font-serif);
    font-size: 2.1rem;
    color: var(--ink);
  }

  .budget-tier {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent);
    background: var(--accent-soft);
    padding: 5px 11px;
    border-radius: 999px;
  }

  .range-input {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: #E7E0D6;
    border-radius: 999px;
    outline: none;
    cursor: pointer;
  }

  .range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent);
    border: 3px solid #FFFFFF;
    box-shadow: 0 3px 10px rgba(37, 99, 235, 0.38);
    cursor: pointer;
  }

  .range-input::-moz-range-thumb {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent);
    border: 3px solid #FFFFFF;
    box-shadow: 0 3px 10px rgba(37, 99, 235, 0.38);
    cursor: pointer;
  }

  .range-ticks {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 0.76rem;
    color: var(--muted);
    font-weight: 600;
  }

  /* Contact Inputs */
  .field-group {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }

  .field label {
    display: block;
    font-size: 0.82rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--ink);
  }

  .text-input {
    width: 100%;
    min-height: 48px;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--ink);
    font-size: 0.96rem;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
  }

  .text-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
  }

  .error-msg {
    margin-top: 12px;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--danger);
    min-height: 20px;
  }

  /* Receipt Summary */
  .receipt-card {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: 0 12px 32px rgba(31, 26, 23, 0.06);
  }

  .receipt-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 0;
    border-bottom: 1px dashed var(--border);
    font-size: 0.9rem;
  }

  .receipt-row:last-of-type { border-bottom: none; }

  .receipt-label {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 600;
  }

  .receipt-val {
    text-align: right;
    font-weight: 650;
  }

  .edit-link {
    border: none;
    background: transparent;
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    margin-left: 8px;
    text-decoration: underline;
  }

  .estimate-box {
    margin-top: 16px;
    padding: 15px 16px;
    border-radius: 12px;
    background: var(--canvas);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .estimate-box strong {
    font-family: var(--font-serif);
    font-size: 1.35rem;
    color: var(--accent);
  }

  /* Bottom Thumb Navigation Bar */
  .bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(250, 247, 242, 0.92);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    padding: 12px 18px;
    z-index: 25;
  }

  .bottom-nav-inner {
    max-width: 680px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .kbd-hint {
    display: none;
    font-size: 0.78rem;
    color: var(--muted);
  }

  @media (min-width: 640px) {
    .kbd-hint { display: inline; }
  }

  .nav-btns {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    width: 100%;
    justify-content: space-between;
  }

  @media (min-width: 640px) {
    .nav-btns { width: auto; }
  }

  .btn-back {
    min-height: 46px;
    min-width: 90px;
    padding: 0 16px;
    border-radius: 12px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--ink);
    font-size: 0.88rem;
    font-weight: 650;
    font-family: inherit;
    cursor: pointer;
  }

  .btn-back:disabled {
    opacity: 0.4;
    cursor: not-allowed;
  }

  .btn-next {
    min-height: 46px;
    min-width: 132px;
    padding: 0 20px;
    border-radius: 12px;
    border: none;
    background: var(--accent);
    color: #FFFFFF;
    font-size: 0.9rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
  }

  .btn-next:hover { background: var(--accent-hover); }

  .submitted-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: #ECFDF5;
    color: var(--success);
    padding: 7px 13px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    margin-bottom: 14px;
  }
</style>
</head>
<body>
<div class="wizard-shell">
  <div class="progress-track"><div id="progressFill" class="progress-fill"></div></div>

  <header class="top-header">
    <div class="studio-mark">
      <span class="studio-dot">A</span>
      <span>Atelier North</span>
    </div>
    <span id="stepCounter" class="step-counter">1 of 5</span>
  </header>

  <main class="stage">
    <div id="stageHost" class="question-card" aria-live="polite"></div>
  </main>

  <footer class="bottom-nav">
    <div class="bottom-nav-inner">
      <span id="kbdHint" class="kbd-hint">Press <strong>A–D</strong> to choose &middot; <strong>Enter</strong> to continue</span>
      <div class="nav-btns">
        <button id="btnBack" class="btn-back" type="button">&larr; Back</button>
        <button id="btnNext" class="btn-next" type="button">Continue &rarr;</button>
      </div>
    </div>
  </footer>
</div>

<script>
(function () {
  const PROJECT_TYPES = [
    { key: "A", id: "rebrand", title: "Full Brand Identity", desc: "Positioning, visual system, guidelines & launch kit", base: 18000 },
    { key: "B", id: "web", title: "Flagship Marketing Site", desc: "Custom editorial web design & interactive frontend", base: 14000 },
    { key: "C", id: "product", title: "Product Design System", desc: "Component library, tokens & core UX architecture", base: 22000 },
    { key: "D", id: "campaign", title: "Launch Campaign", desc: "Art direction, motion assets & landing pages", base: 9500 }
  ];

  const TIMELINES = [
    { key: "A", id: "rush", title: "Sprint (3–4 weeks)", desc: "Dedicated senior pod, expedited milestones", mult: 1.25 },
    { key: "B", id: "standard", title: "Standard (6–8 weeks)", desc: "Balanced discovery, exploration & polish", mult: 1.0 },
    { key: "C", id: "extended", title: "Quarter-long (10–12 weeks)", desc: "Deep research, testing & phased rollout", mult: 1.1 },
    { key: "D", id: "flexible", title: "Flexible / Exploring", desc: "Aligning internally before locking a start date", mult: 1.0 }
  ];

  const SCOPES = [
    { key: "A", label: "Brand Strategy", add: 3500 },
    { key: "B", label: "Logo & Typography", add: 4000 },
    { key: "C", label: "Web Development", add: 5500 },
    { key: "D", label: "Motion & 3D", add: 3000 },
    { key: "E", label: "Copywriting", add: 2500 },
    { key: "F", label: "Design Tokens", add: 3500 }
  ];

  const state = {
    step: 0, // 0..4 questions, 5 = receipt
    projectType: null,
    timeline: null,
    scopes: new Set(["Brand Strategy", "Logo & Typography"]),
    budget: 25000,
    name: "",
    email: "",
    company: "",
    error: "",
    submitted: false
  };

  const els = {
    host: document.getElementById("stageHost"),
    progress: document.getElementById("progressFill"),
    counter: document.getElementById("stepCounter"),
    btnBack: document.getElementById("btnBack"),
    btnNext: document.getElementById("btnNext"),
    kbdHint: document.getElementById("kbdHint")
  };

  function budgetTier(val) {
    if (val < 15000) return "Focused Sprint";
    if (val < 30000) return "Core Studio Engagement";
    if (val < 55000) return "Flagship Transformation";
    return "Enterprise Retainer";
  }

  function calcEstimate() {
    const pt = PROJECT_TYPES.find((p) => p.id === state.projectType) || PROJECT_TYPES[0];
    const tl = TIMELINES.find((t) => t.id === state.timeline) || TIMELINES[1];
    let scopeTotal = 0;
    SCOPES.forEach((s) => { if (state.scopes.has(s.label)) scopeTotal += s.add; });
    const raw = Math.round((pt.base + scopeTotal) * tl.mult / 500) * 500;
    return { low: Math.max(8000, raw - 3000), high: raw + 4000 };
  }

  function validateStep() {
    state.error = "";
    if (state.step === 0 && !state.projectType) {
      state.error = "Choose a project type to continue.";
      return false;
    }
    if (state.step === 1 && !state.timeline) {
      state.error = "Select a target timeline to continue.";
      return false;
    }
    if (state.step === 2 && state.scopes.size === 0) {
      state.error = "Pick at least one deliverable chip.";
      return false;
    }
    if (state.step === 4) {
      if (state.name.trim().length < 2) {
        state.error = "Please enter your name.";
        return false;
      }
      if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(state.email.trim())) {
        state.error = "Please enter a valid work email address.";
        return false;
      }
    }
    return true;
  }

  function render() {
    const pct = state.step >= 5 ? 100 : ((state.step + 1) / 5) * 100;
    els.progress.style.width = pct + "%";
    els.counter.textContent = state.step < 5 ? `${state.step + 1} of 5` : "Summary Receipt";
    els.btnBack.disabled = state.step === 0;

    // Re-trigger entry animation
    els.host.style.animation = "none";
    void els.host.offsetWidth;
    els.host.style.animation = "";

    if (state.step === 0) {
      els.kbdHint.innerHTML = "Press <strong>A–D</strong> to pick &middot; <strong>Enter</strong> to continue";
      els.btnNext.textContent = "Continue →";
      els.host.innerHTML = `
        <div class="q-kicker">Step 01 &middot; Project Type</div>
        <h1 class="q-title">What are we building together?</h1>
        <p class="q-subtitle">Select the primary engagement track so we can tailor deliverables and pacing.</p>
        <div class="options-list">
          ${PROJECT_TYPES.map((p) => `
            <button class="opt-card ${state.projectType === p.id ? "selected" : ""}" data-type="${p.id}" type="button">
              <span class="keycap">${p.key}</span>
              <span class="opt-text"><strong>${p.title}</strong><span>${p.desc}</span></span>
            </button>
          `).join("")}
        </div>
        <div class="error-msg">${state.error}</div>
      `;
    } else if (state.step === 1) {
      els.kbdHint.innerHTML = "Press <strong>A–D</strong> to pick &middot; <strong>Enter</strong> to continue";
      els.btnNext.textContent = "Continue →";
      els.host.innerHTML = `
        <div class="q-kicker">Step 02 &middot; Timeline</div>
        <h1 class="q-title">When do you want to launch?</h1>
        <p class="q-subtitle">This helps us reserve the right creative &amp; engineering pod for your window.</p>
        <div class="options-list two-col">
          ${TIMELINES.map((t) => `
            <button class="opt-card ${state.timeline === t.id ? "selected" : ""}" data-time="${t.id}" type="button">
              <span class="keycap">${t.key}</span>
              <span class="opt-text"><strong>${t.title}</strong><span>${t.desc}</span></span>
            </button>
          `).join("")}
        </div>
        <div class="error-msg">${state.error}</div>
      `;
    } else if (state.step === 2) {
      els.kbdHint.innerHTML = "Press <strong>A–F</strong> to toggle chips &middot; <strong>Enter</strong> to continue";
      els.btnNext.textContent = "Continue →";
      els.host.innerHTML = `
        <div class="q-kicker">Step 03 &middot; Scope</div>
        <h1 class="q-title">Which deliverables should be included?</h1>
        <p class="q-subtitle">Toggle as many as you need — we will factor them into your live estimate.</p>
        <div class="chips-wrap">
          ${SCOPES.map((s) => `
            <button class="scope-chip ${state.scopes.has(s.label) ? "selected" : ""}" data-scope="${s.label}" type="button">
              <span class="chip-key">${s.key}</span>
              <span>${s.label}</span>
            </button>
          `).join("")}
        </div>
        <div class="error-msg">${state.error}</div>
      `;
    } else if (state.step === 3) {
      els.kbdHint.innerHTML = "Use <strong>&larr;/&rarr;</strong> on slider &middot; <strong>Enter</strong> to continue";
      els.btnNext.textContent = "Continue →";
      els.host.innerHTML = `
        <div class="q-kicker">Step 04 &middot; Investment</div>
        <h1 class="q-title">What budget range feels comfortable?</h1>
        <p class="q-subtitle">Slide to set a ballpark target — no commitment required.</p>
        <div class="budget-panel">
          <div class="budget-readout">
            <span id="budgetVal" class="budget-figure">$${state.budget.toLocaleString("en-US")}</span>
            <span id="budgetTier" class="budget-tier">${budgetTier(state.budget)}</span>
          </div>
          <input id="budgetSlider" class="range-input" type="range" min="8000" max="75000" step="1000" value="${state.budget}" aria-label="Target budget">
          <div class="range-ticks">
            <span>$8k</span><span>$25k</span><span>$50k</span><span>$75k+</span>
          </div>
        </div>
        <div class="error-msg">${state.error}</div>
      `;
    } else if (state.step === 4) {
      els.kbdHint.innerHTML = "Press <strong>Enter</strong> to review your summary receipt";
      els.btnNext.textContent = "Review Receipt →";
      els.host.innerHTML = `
        <div class="q-kicker">Step 05 &middot; Contact</div>
        <h1 class="q-title">Where should we send your estimate?</h1>
        <p class="q-subtitle">We reply within one business day with a tailored scope and calendar link.</p>
        <div class="field-group">
          <div class="field">
            <label for="inpName">Your Name *</label>
            <input id="inpName" class="text-input" type="text" placeholder="Maya Lin" value="${state.name.replace(/"/g, "&quot;")}" autocomplete="name">
          </div>
          <div class="field">
            <label for="inpEmail">Work Email *</label>
            <input id="inpEmail" class="text-input" type="email" placeholder="maya@northstar.co" value="${state.email.replace(/"/g, "&quot;")}" autocomplete="email">
          </div>
          <div class="field">
            <label for="inpCompany">Company or Brand (optional)</label>
            <input id="inpCompany" class="text-input" type="text" placeholder="Northstar Labs" value="${state.company.replace(/"/g, "&quot;")}" autocomplete="organization">
          </div>
        </div>
        <div class="error-msg">${state.error}</div>
      `;
    } else {
      const pt = PROJECT_TYPES.find((p) => p.id === state.projectType) || PROJECT_TYPES[0];
      const tl = TIMELINES.find((t) => t.id === state.timeline) || TIMELINES[1];
      const est = calcEstimate();
      els.kbdHint.innerHTML = state.submitted ? "Brief received &middot; Thank you!" : "Review details or jump back to edit any step";
      els.btnNext.textContent = state.submitted ? "Start New Brief" : "Submit Brief ✓";
      els.host.innerHTML = `
        ${state.submitted ? `<div class="submitted-badge">&#10003; Brief sent to Atelier North</div>` : `<div class="q-kicker">Live Summary Receipt</div>`}
        <h1 class="q-title">${state.submitted ? "We have your brief, " + state.name.split(" ")[0] + "." : "Ready to lock in your scope?"}</h1>
        <p class="q-subtitle">${state.submitted ? "A copy of this estimate has been queued for " + state.email + "." : "Everything below updates dynamically from your answers."}</p>
        <div class="receipt-card">
          <div class="receipt-row">
            <span class="receipt-label">Project Track <button class="edit-link" data-jump="0" type="button">Edit</button></span>
            <span class="receipt-val">${pt.title}</span>
          </div>
          <div class="receipt-row">
            <span class="receipt-label">Timeline <button class="edit-link" data-jump="1" type="button">Edit</button></span>
            <span class="receipt-val">${tl.title}</span>
          </div>
          <div class="receipt-row">
            <span class="receipt-label">Deliverables <button class="edit-link" data-jump="2" type="button">Edit</button></span>
            <span class="receipt-val">${Array.from(state.scopes).join(", ")}</span>
          </div>
          <div class="receipt-row">
            <span class="receipt-label">Target Budget <button class="edit-link" data-jump="3" type="button">Edit</button></span>
            <span class="receipt-val">$${state.budget.toLocaleString("en-US")} (${budgetTier(state.budget)})</span>
          </div>
          <div class="receipt-row">
            <span class="receipt-label">Contact <button class="edit-link" data-jump="4" type="button">Edit</button></span>
            <span class="receipt-val">${state.name}${state.company ? " · " + state.company : ""}<br><span style="color:var(--muted);font-weight:500">${state.email}</span></span>
          </div>
          <div class="estimate-box">
            <div>
              <div style="font-size:0.78rem;font-weight:700;color:var(--muted);text-transform:uppercase;letter-spacing:0.04em">Estimated Studio Range</div>
              <div style="font-size:0.8rem;color:var(--muted)">Based on selected scope &amp; pacing</div>
            </div>
            <strong>$${est.low.toLocaleString("en-US")} – $${est.high.toLocaleString("en-US")}</strong>
          </div>
        </div>
      `;
    }
  }

  function advance() {
    if (state.step === 5) {
      if (state.submitted) {
        state.step = 0;
        state.submitted = false;
        state.projectType = null;
        state.timeline = null;
        render();
      } else {
        state.submitted = true;
        render();
      }
      return;
    }
    if (!validateStep()) {
      render();
      return;
    }
    state.step += 1;
    render();
  }

  els.btnNext.addEventListener("click", advance);
  els.btnBack.addEventListener("click", () => {
    if (state.step > 0) {
      state.error = "";
      state.submitted = false;
      state.step -= 1;
      render();
    }
  });

  els.host.addEventListener("click", (e) => {
    const typeBtn = e.target.closest("[data-type]");
    if (typeBtn) {
      state.projectType = typeBtn.dataset.type;
      state.error = "";
      render();
      setTimeout(() => { if (state.step === 0) { state.step = 1; render(); } }, 220);
      return;
    }
    const timeBtn = e.target.closest("[data-time]");
    if (timeBtn) {
      state.timeline = timeBtn.dataset.time;
      state.error = "";
      render();
      setTimeout(() => { if (state.step === 1) { state.step = 2; render(); } }, 220);
      return;
    }
    const scopeBtn = e.target.closest("[data-scope]");
    if (scopeBtn) {
      const lbl = scopeBtn.dataset.scope;
      if (state.scopes.has(lbl)) state.scopes.delete(lbl);
      else state.scopes.add(lbl);
      state.error = "";
      render();
      return;
    }
    const jumpBtn = e.target.closest("[data-jump]");
    if (jumpBtn) {
      state.submitted = false;
      state.step = Number(jumpBtn.dataset.jump);
      render();
    }
  });

  els.host.addEventListener("input", (e) => {
    if (e.target.id === "budgetSlider") {
      state.budget = Number(e.target.value);
      document.getElementById("budgetVal").textContent = "$" + state.budget.toLocaleString("en-US");
      document.getElementById("budgetTier").textContent = budgetTier(state.budget);
    } else if (e.target.id === "inpName") {
      state.name = e.target.value;
    } else if (e.target.id === "inpEmail") {
      state.email = e.target.value;
    } else if (e.target.id === "inpCompany") {
      state.company = e.target.value;
    }
  });

  document.addEventListener("keydown", (e) => {
    const tag = document.activeElement && document.activeElement.tagName;
    const inText = tag === "INPUT" && document.activeElement.type !== "range";

    if (e.key === "Enter") {
      e.preventDefault();
      advance();
      return;
    }
    if (inText) return;

    const k = e.key.toUpperCase();
    if (state.step === 0) {
      const match = PROJECT_TYPES.find((p) => p.key === k);
      if (match) { state.projectType = match.id; state.error = ""; render(); }
    } else if (state.step === 1) {
      const match = TIMELINES.find((t) => t.key === k);
      if (match) { state.timeline = match.id; state.error = ""; render(); }
    } else if (state.step === 2) {
      const match = SCOPES.find((s) => s.key === k);
      if (match) {
        if (state.scopes.has(match.label)) state.scopes.delete(match.label);
        else state.scopes.add(match.label);
        state.error = "";
        render();
      }
    }
  });

  render();
})();
</script>
</body>
</html>