{
  "id": 122,
  "slug": "collapsible-accordion-checkout",
  "name": "Single-Page Collapsible Accordion Checkout",
  "kind": "ui",
  "family": "Forms & Commerce",
  "sourceSite": {
    "name": "Everlane",
    "url": "https://www.everlane.com",
    "verifiedStatus": 200
  },
  "tagline": "Single-page accordion checkout where completed steps collapse into scannable summary rows with one-tap Edit.",
  "whyUnique": "Combines the focus of multi-step checkout with the orientation of a single page—shoppers always see what is done, what is next, and can edit any section without page reloads.",
  "theme": "light",
  "mobileStrength": "high",
  "tags": [
    "accordion-checkout",
    "single-page-form",
    "ecommerce-ux",
    "progressive-disclosure",
    "order-summary"
  ],
  "bestFor": [
    "Direct-to-consumer e-commerce",
    "SaaS plan & billing upgrades",
    "Event & travel booking flows",
    "Subscription box signups"
  ],
  "palette": [
    {
      "role": "canvas",
      "hex": "#F7F6F3",
      "name": "Editorial Stone"
    },
    {
      "role": "surface",
      "hex": "#FFFFFF",
      "name": "Atelier White"
    },
    {
      "role": "ink",
      "hex": "#171715",
      "name": "Carbon Black"
    },
    {
      "role": "accent",
      "hex": "#3F4F3B",
      "name": "Olive Moss"
    },
    {
      "role": "muted",
      "hex": "#6F6E68",
      "name": "Linen Gray"
    }
  ],
  "typography": {
    "display": "Plus Jakarta Sans",
    "body": "Inter",
    "mono": "JetBrains Mono",
    "googleFontsUrl": "https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&family=JetBrains+Mono:wght@500&family=Plus+Jakarta+Sans:wght@700;800&display=swap",
    "scaleNotes": "Tracked uppercase brand wordmark, 15-16px accordion headers, and calm 13px summary previews."
  },
  "layoutNotes": "Collapsible top Order Summary strip on mobile that transforms into a sticky right-hand summary rail on desktop, paired with a 4-step accordion stack.",
  "interactionNotes": "Advancing a step marks it complete with a checkmark badge, writes a concise one-line summary into its collapsed header, and smoothly opens the next step; changing shipping updates totals immediately.",
  "mobileNotes": "All inputs and radio cards are >=46-54px tall, single-column on mobile, with a persistent top bag total toggle.",
  "agentGuardrails": {
    "do": [
      "Render a concise one-line summary of the user's entered values inside every collapsed completed step",
      "Keep a clear Edit affordance on completed steps so users can revisit earlier choices without losing progress",
      "Reflect shipping or promo changes immediately in both mobile bag bar and desktop summary rail"
    ],
    "dont": [
      "Do not lock completed accordion steps so users have to refresh to fix a typo in their address",
      "Do not force mobile shoppers to scroll past a huge expanded cart list before seeing Step 1"
    ]
  },
  "demoFile": "demos/collapsible-accordion-checkout.html",
  "thumbDesktop": "thumbs/collapsible-accordion-checkout-desktop.webp",
  "thumbMobile": "thumbs/collapsible-accordion-checkout-mobile.webp",
  "urls": {
    "page": "https://templates.michaelpitts.net/t/collapsible-accordion-checkout",
    "markdown": "https://templates.michaelpitts.net/t/collapsible-accordion-checkout.md",
    "api": "https://templates.michaelpitts.net/api/templates/collapsible-accordion-checkout",
    "demo": "https://templates.michaelpitts.net/demos/collapsible-accordion-checkout.html",
    "thumbDesktop": "https://templates.michaelpitts.net/thumbs/collapsible-accordion-checkout-desktop.webp",
    "thumbMobile": "https://templates.michaelpitts.net/thumbs/collapsible-accordion-checkout-mobile.webp"
  },
  "agentPrompt": "Design & build using template #122 \"Single-Page Collapsible Accordion Checkout\" (ui / Forms & Commerce, light theme).\nFull AI blueprint & standalone starter code: https://templates.michaelpitts.net/t/collapsible-accordion-checkout.md\nLive demo: https://templates.michaelpitts.net/demos/collapsible-accordion-checkout.html\nReal-world inspiration: Everlane (https://www.everlane.com)\n\nCore aesthetic: Combines the focus of multi-step checkout with the orientation of a single page—shoppers always see what is done, what is next, and can edit any section without page reloads.\nPalette: canvas: #F7F6F3 (Editorial Stone), surface: #FFFFFF (Atelier White), ink: #171715 (Carbon Black), accent: #3F4F3B (Olive Moss), muted: #6F6E68 (Linen Gray)\nTypography: Display=\"Plus Jakarta Sans\", Body=\"Inter\", Mono=\"JetBrains Mono\"\nLayout: Collapsible top Order Summary strip on mobile that transforms into a sticky right-hand summary rail on desktop, paired with a 4-step accordion stack.\nInteractions: Advancing a step marks it complete with a checkmark badge, writes a concise one-line summary into its collapsed header, and smoothly opens the next step; changing shipping updates totals immediately.\nMobile: All inputs and radio cards are >=46-54px tall, single-column on mobile, with a persistent top bag total toggle.\n\nGuardrails:\n- DO: Render a concise one-line summary of the user's entered values inside every collapsed completed step\n- DO: Keep a clear Edit affordance on completed steps so users can revisit earlier choices without losing progress\n- DO: Reflect shipping or promo changes immediately in both mobile bag bar and desktop summary rail\n- DON'T: Do not lock completed accordion steps so users have to refresh to fix a typo in their address\n- DON'T: Do not force mobile shoppers to scroll past a huge expanded cart list before seeing Step 1",
  "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>Single-Page Collapsible Accordion Checkout</title>\n<style>\n  :root {\n    --canvas: #F7F6F3;\n    --surface: #FFFFFF;\n    --ink: #171715;\n    --accent: #3F4F3B;\n    --muted: #6F6E68;\n    --border: #E5E3DC;\n    --radius: 14px;\n  }\n  * { box-sizing: border-box; margin: 0; padding: 0; }\n  html, body {\n    background: var(--canvas);\n    color: var(--ink);\n    font-family: -apple-system, BlinkMacSystemFont, \"Inter\", \"Segoe UI\", Roboto, sans-serif;\n    line-height: 1.5;\n    overflow-x: hidden;\n    -webkit-font-smoothing: antialiased;\n  }\n  header {\n    background: var(--surface);\n    border-bottom: 1px solid var(--border);\n    padding: 14px 20px;\n    display: flex;\n    align-items: center;\n    justify-content: space-between;\n  }\n  .wordmark {\n    font-weight: 800;\n    letter-spacing: 0.16em;\n    font-size: 0.9rem;\n    text-transform: uppercase;\n  }\n  .secure-pill {\n    font-size: 0.76rem;\n    color: var(--muted);\n    display: inline-flex;\n    align-items: center;\n    gap: 5px;\n  }\n\n  /* Mobile collapsible order summary strip */\n  .mobile-bag-bar {\n    background: #EFECE6;\n    border-bottom: 1px solid var(--border);\n    padding: 12px 20px;\n    display: flex;\n    align-items: center;\n    justify-content: space-between;\n    cursor: pointer;\n    width: 100%;\n    border-left: none;\n    border-right: none;\n    border-top: none;\n    color: var(--ink);\n    font: inherit;\n    min-height: 48px;\n  }\n  @media (min-width: 900px) {\n    .mobile-bag-bar { display: none; }\n  }\n  .mobile-bag-drawer {\n    display: none;\n    background: var(--surface);\n    border-bottom: 1px solid var(--border);\n    padding: 16px 20px;\n  }\n  .mobile-bag-drawer.open { display: block; }\n  @media (min-width: 900px) {\n    .mobile-bag-drawer.open { display: none; }\n  }\n\n  .checkout-grid {\n    max-width: 1060px;\n    margin: 0 auto;\n    padding: 20px 16px 96px;\n    display: grid;\n    grid-template-columns: 1fr;\n    gap: 24px;\n  }\n  @media (min-width: 900px) {\n    .checkout-grid {\n      grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.85fr);\n      padding: 36px 28px 80px;\n      align-items: start;\n      gap: 36px;\n    }\n  }\n\n  .accordion-stack {\n    display: flex;\n    flex-direction: column;\n    gap: 12px;\n  }\n  .step-card {\n    background: var(--surface);\n    border: 1px solid var(--border);\n    border-radius: var(--radius);\n    overflow: hidden;\n    transition: border-color 0.2s, box-shadow 0.2s;\n  }\n  .step-card.active {\n    border-color: var(--ink);\n    box-shadow: 0 10px 28px rgba(23, 23, 21, 0.06);\n  }\n  .step-header {\n    width: 100%;\n    min-height: 60px;\n    padding: 14px 18px;\n    background: transparent;\n    border: none;\n    color: var(--ink);\n    display: flex;\n    align-items: center;\n    justify-content: space-between;\n    gap: 12px;\n    cursor: pointer;\n    text-align: left;\n    font: inherit;\n  }\n  .step-left {\n    display: flex;\n    align-items: center;\n    gap: 12px;\n    min-width: 0;\n  }\n  .step-num {\n    width: 28px;\n    height: 28px;\n    flex-shrink: 0;\n    border-radius: 50%;\n    border: 1.5px solid var(--border);\n    display: grid;\n    place-items: center;\n    font-size: 0.8rem;\n    font-weight: 700;\n    color: var(--muted);\n  }\n  .step-card.active .step-num {\n    background: var(--ink);\n    border-color: var(--ink);\n    color: #fff;\n  }\n  .step-card.done .step-num {\n    background: var(--accent);\n    border-color: var(--accent);\n    color: #fff;\n  }\n  .step-title-group { min-width: 0; }\n  .step-title {\n    font-size: 0.96rem;\n    font-weight: 700;\n    letter-spacing: -0.01em;\n  }\n  .step-summary {\n    font-size: 0.8rem;\n    color: var(--muted);\n    white-space: nowrap;\n    overflow: hidden;\n    text-overflow: ellipsis;\n    margin-top: 1px;\n  }\n  .edit-label {\n    font-size: 0.78rem;\n    font-weight: 600;\n    text-decoration: underline;\n    color: var(--muted);\n    flex-shrink: 0;\n  }\n  .step-card.active .edit-label { display: none; }\n\n  .step-body {\n    display: none;\n    padding: 4px 18px 20px;\n    border-top: 1px solid #F0EEE8;\n  }\n  .step-card.active .step-body { display: block; }\n\n  .field-grid {\n    display: grid;\n    grid-template-columns: 1fr;\n    gap: 12px;\n    margin-top: 14px;\n  }\n  @media (min-width: 540px) {\n    .field-grid.two { grid-template-columns: 1fr 1fr; }\n  }\n  label.field {\n    display: flex;\n    flex-direction: column;\n    gap: 5px;\n    font-size: 0.78rem;\n    font-weight: 600;\n    color: var(--muted);\n  }\n  input[type=\"text\"], input[type=\"email\"] {\n    min-height: 46px;\n    padding: 0 13px;\n    border-radius: 10px;\n    border: 1px solid var(--border);\n    background: #FDFCFA;\n    color: var(--ink);\n    font: inherit;\n    font-size: 0.92rem;\n  }\n  input:focus {\n    outline: 2px solid var(--accent);\n    outline-offset: 1px;\n    border-color: var(--accent);\n  }\n\n  .radio-stack {\n    display: flex;\n    flex-direction: column;\n    gap: 10px;\n    margin-top: 14px;\n  }\n  .radio-card {\n    display: flex;\n    align-items: center;\n    justify-content: space-between;\n    gap: 12px;\n    min-height: 54px;\n    padding: 12px 14px;\n    border: 1.5px solid var(--border);\n    border-radius: 12px;\n    cursor: pointer;\n    transition: border-color 0.15s, background 0.15s;\n  }\n  .radio-card.selected {\n    border-color: var(--ink);\n    background: #FAF9F6;\n  }\n  .radio-card input { accent-color: var(--ink); width: 18px; height: 18px; }\n  .radio-info { flex: 1; }\n  .radio-info strong { display: block; font-size: 0.88rem; }\n  .radio-info span { font-size: 0.76rem; color: var(--muted); }\n  .radio-price { font-weight: 700; font-size: 0.88rem; }\n\n  .continue-btn {\n    margin-top: 18px;\n    width: 100%;\n    min-height: 48px;\n    border-radius: 10px;\n    border: none;\n    background: var(--ink);\n    color: #fff;\n    font-weight: 700;\n    font-size: 0.92rem;\n    cursor: pointer;\n    transition: opacity 0.15s, transform 0.1s;\n  }\n  .continue-btn:hover { opacity: 0.9; }\n  .continue-btn:active { transform: scale(0.99); }\n  .continue-btn.accent { background: var(--accent); }\n\n  /* Desktop Summary Rail */\n  aside.order-rail {\n    display: none;\n    background: var(--surface);\n    border: 1px solid var(--border);\n    border-radius: var(--radius);\n    padding: 20px;\n    position: sticky;\n    top: 24px;\n  }\n  @media (min-width: 900px) {\n    aside.order-rail { display: block; }\n  }\n  .bag-item {\n    display: flex;\n    gap: 12px;\n    padding-bottom: 14px;\n    margin-bottom: 14px;\n    border-bottom: 1px solid var(--border);\n  }\n  .garment-thumb {\n    width: 60px;\n    height: 72px;\n    border-radius: 10px;\n    background: #ECEAE3;\n    flex-shrink: 0;\n    display: grid;\n    place-items: center;\n  }\n  .bag-meta { flex: 1; font-size: 0.86rem; }\n  .bag-meta strong { display: block; }\n  .bag-meta span { color: var(--muted); font-size: 0.78rem; }\n  .totals-row {\n    display: flex;\n    justify-content: space-between;\n    font-size: 0.88rem;\n    color: var(--muted);\n    margin-bottom: 8px;\n  }\n  .totals-row.grand {\n    color: var(--ink);\n    font-weight: 800;\n    font-size: 1.05rem;\n    padding-top: 10px;\n    margin-top: 10px;\n    border-top: 1px solid var(--border);\n  }\n\n  .confirmation-box {\n    display: none;\n    background: #EDF3EC;\n    border: 1px solid #C5D6C1;\n    border-radius: var(--radius);\n    padding: 20px;\n    text-align: center;\n  }\n  .confirmation-box.show { display: block; }\n  .confirmation-box h2 { font-size: 1.15rem; color: var(--accent); margin-bottom: 6px; }\n  .confirmation-box p { font-size: 0.88rem; color: var(--ink); }\n</style>\n</head>\n<body>\n  <header>\n    <div class=\"wordmark\">ATELIER NORD</div>\n    <div class=\"secure-pill\">\n      <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><rect x=\"4\" y=\"11\" width=\"16\" height=\"10\" rx=\"2\"/><path d=\"M8 11V7a4 4 0 0 1 8 0v4\"/></svg>\n      <span>Encrypted Checkout</span>\n    </div>\n  </header>\n\n  <button id=\"mobileBagBtn\" class=\"mobile-bag-bar\" type=\"button\" aria-expanded=\"false\">\n    <span><strong>Order Summary</strong> (2 items) <span id=\"mobileBagChevron\">▾</span></span>\n    <strong id=\"mobileTotalLabel\">$218.00</strong>\n  </button>\n  <div id=\"mobileBagDrawer\" class=\"mobile-bag-drawer\"></div>\n\n  <main class=\"checkout-grid\">\n    <section class=\"accordion-stack\" aria-label=\"Checkout steps\">\n      <!-- Step 1 -->\n      <article class=\"step-card done\" data-step=\"1\">\n        <button class=\"step-header\" type=\"button\" aria-expanded=\"false\">\n          <div class=\"step-left\">\n            <span class=\"step-num\">✓</span>\n            <div class=\"step-title-group\">\n              <div class=\"step-title\">1. Contact & Delivery</div>\n              <div class=\"step-summary\" id=\"sum1\">claire.vance@studio.co · 418 Mercer St, Portland OR</div>\n            </div>\n          </div>\n          <span class=\"edit-label\">Edit</span>\n        </button>\n        <div class=\"step-body\">\n          <div class=\"field-grid\">\n            <label class=\"field\">Email address\n              <input id=\"emailInput\" type=\"email\" value=\"claire.vance@studio.co\">\n            </label>\n          </div>\n          <div class=\"field-grid two\">\n            <label class=\"field\">Full name\n              <input id=\"nameInput\" type=\"text\" value=\"Claire Vance\">\n            </label>\n            <label class=\"field\">Street address\n              <input id=\"addrInput\" type=\"text\" value=\"418 Mercer St, Portland OR\">\n            </label>\n          </div>\n          <button class=\"continue-btn\" data-next=\"2\" type=\"button\">Save & Continue to Shipping</button>\n        </div>\n      </article>\n\n      <!-- Step 2 -->\n      <article class=\"step-card active\" data-step=\"2\">\n        <button class=\"step-header\" type=\"button\" aria-expanded=\"true\">\n          <div class=\"step-left\">\n            <span class=\"step-num\">2</span>\n            <div class=\"step-title-group\">\n              <div class=\"step-title\">2. Shipping Method</div>\n              <div class=\"step-summary\" id=\"sum2\">Carbon-Neutral Ground · Free</div>\n            </div>\n          </div>\n          <span class=\"edit-label\">Edit</span>\n        </button>\n        <div class=\"step-body\">\n          <div class=\"radio-stack\" id=\"shipOptions\">\n            <label class=\"radio-card selected\">\n              <input type=\"radio\" name=\"ship\" value=\"0\" data-label=\"Carbon-Neutral Ground · Free\" checked>\n              <div class=\"radio-info\">\n                <strong>Carbon-Neutral Ground</strong>\n                <span>Arrives Thu–Fri (4–5 business days)</span>\n              </div>\n              <span class=\"radio-price\">Free</span>\n            </label>\n            <label class=\"radio-card\">\n              <input type=\"radio\" name=\"ship\" value=\"14\" data-label=\"Express Air (2 Days) · $14\">\n              <div class=\"radio-info\">\n                <strong>Express Air (2 Days)</strong>\n                <span>Arrives Tue by 5:00 PM</span>\n              </div>\n              <span class=\"radio-price\">$14.00</span>\n            </label>\n            <label class=\"radio-card\">\n              <input type=\"radio\" name=\"ship\" value=\"0\" data-label=\"Showroom Pickup · Free\">\n              <div class=\"radio-info\">\n                <strong>Pearl District Showroom Pickup</strong>\n                <span>Ready today in 2 hours</span>\n              </div>\n              <span class=\"radio-price\">Free</span>\n            </label>\n          </div>\n          <button class=\"continue-btn\" data-next=\"3\" type=\"button\">Continue to Payment</button>\n        </div>\n      </article>\n\n      <!-- Step 3 -->\n      <article class=\"step-card\" data-step=\"3\">\n        <button class=\"step-header\" type=\"button\" aria-expanded=\"false\">\n          <div class=\"step-left\">\n            <span class=\"step-num\">3</span>\n            <div class=\"step-title-group\">\n              <div class=\"step-title\">3. Payment Details</div>\n              <div class=\"step-summary\" id=\"sum3\">Visa ending in 4242</div>\n            </div>\n          </div>\n          <span class=\"edit-label\">Edit</span>\n        </button>\n        <div class=\"step-body\">\n          <div class=\"field-grid\">\n            <label class=\"field\">Card number\n              <input id=\"cardInput\" type=\"text\" value=\"4242 •••• •••• 4242\">\n            </label>\n          </div>\n          <div class=\"field-grid two\">\n            <label class=\"field\">Expiration\n              <input type=\"text\" value=\"09 / 28\">\n            </label>\n            <label class=\"field\">Security code\n              <input type=\"text\" value=\"842\">\n            </label>\n          </div>\n          <button class=\"continue-btn\" data-next=\"4\" type=\"button\">Review Order</button>\n        </div>\n      </article>\n\n      <!-- Step 4 -->\n      <article class=\"step-card\" data-step=\"4\">\n        <button class=\"step-header\" type=\"button\" aria-expanded=\"false\">\n          <div class=\"step-left\">\n            <span class=\"step-num\">4</span>\n            <div class=\"step-title-group\">\n              <div class=\"step-title\">4. Final Review</div>\n              <div class=\"step-summary\" id=\"sum4\">Ready to place order</div>\n            </div>\n          </div>\n          <span class=\"edit-label\">Edit</span>\n        </button>\n        <div class=\"step-body\">\n          <p style=\"font-size:0.86rem;color:var(--muted);margin-top:12px;\">\n            By placing your order, you agree to 30-day complimentary returns and transparent factory pricing.\n          </p>\n          <button id=\"placeOrderBtn\" class=\"continue-btn accent\" type=\"button\">Place Order · $218.00</button>\n        </div>\n      </article>\n\n      <div id=\"confirmationBox\" class=\"confirmation-box\" role=\"status\" aria-live=\"polite\">\n        <h2>✓ Order #AN-84920 Confirmed</h2>\n        <p id=\"confirmDesc\">Receipt sent to claire.vance@studio.co. You can still inspect or edit steps above to replay the accordion.</p>\n      </div>\n    </section>\n\n    <aside class=\"order-rail\" id=\"desktopSummary\" aria-label=\"Order summary\"></aside>\n  </main>\n\n<script>\n(() => {\n  const subtotal = 218;\n  let shippingCost = 0;\n\n  const cards = [...document.querySelectorAll('.step-card')];\n  const desktopSummary = document.getElementById('desktopSummary');\n  const mobileBagDrawer = document.getElementById('mobileBagDrawer');\n  const mobileBagBtn = document.getElementById('mobileBagBtn');\n  const mobileTotalLabel = document.getElementById('mobileTotalLabel');\n  const placeOrderBtn = document.getElementById('placeOrderBtn');\n  const confirmationBox = document.getElementById('confirmationBox');\n\n  function summaryMarkup() {\n    const total = subtotal + shippingCost;\n    return `\n      <div class=\"bag-item\">\n        <div class=\"garment-thumb\" aria-hidden=\"true\">\n          <svg width=\"34\" height=\"42\" viewBox=\"0 0 34 42\" fill=\"none\"><path d=\"M9 5L17 9L25 5L31 12L26 17V38H8V17L3 12L9 5Z\" fill=\"#3F4F3B\"/></svg>\n        </div>\n        <div class=\"bag-meta\">\n          <strong>Heavyweight Felted Overshirt</strong>\n          <span>Olive Moss · Size M · Qty 1</span>\n        </div>\n        <strong>$138</strong>\n      </div>\n      <div class=\"bag-item\">\n        <div class=\"garment-thumb\" aria-hidden=\"true\">\n          <svg width=\"34\" height=\"42\" viewBox=\"0 0 34 42\" fill=\"none\"><path d=\"M10 6H24L27 38H20L17 20L14 38H7L10 6Z\" fill=\"#2A2925\"/></svg>\n        </div>\n        <div class=\"bag-meta\">\n          <strong>Relaxed Organic Twill Trouser</strong>\n          <span>Warm Charcoal · 30×30 · Qty 1</span>\n        </div>\n        <strong>$80</strong>\n      </div>\n      <div class=\"totals-row\"><span>Subtotal</span><span>$${subtotal.toFixed(2)}</span></div>\n      <div class=\"totals-row\"><span>Shipping</span><span>${shippingCost === 0 ? 'Free' : '$' + shippingCost.toFixed(2)}</span></div>\n      <div class=\"totals-row\"><span>Estimated Tax</span><span>Included</span></div>\n      <div class=\"totals-row grand\"><span>Total</span><span>$${total.toFixed(2)}</span></div>\n    `;\n  }\n\n  function renderTotals() {\n    const html = summaryMarkup();\n    desktopSummary.innerHTML = html;\n    mobileBagDrawer.innerHTML = html;\n    const totalStr = '$' + (subtotal + shippingCost).toFixed(2);\n    mobileTotalLabel.textContent = totalStr;\n    placeOrderBtn.textContent = `Place Order · ${totalStr}`;\n  }\n\n  function openStep(stepNum) {\n    cards.forEach(c => {\n      const n = Number(c.dataset.step);\n      const isActive = n === stepNum;\n      c.classList.toggle('active', isActive);\n      c.querySelector('.step-header').setAttribute('aria-expanded', String(isActive));\n      if (c.classList.contains('done') && !isActive) {\n        c.querySelector('.step-num').textContent = '✓';\n      } else {\n        c.querySelector('.step-num').textContent = String(n);\n      }\n    });\n  }\n\n  cards.forEach(c => {\n    c.querySelector('.step-header').addEventListener('click', () => {\n      openStep(Number(c.dataset.step));\n    });\n  });\n\n  document.querySelectorAll('.continue-btn[data-next]').forEach(btn => {\n    btn.addEventListener('click', () => {\n      const currentCard = btn.closest('.step-card');\n      const curStep = Number(currentCard.dataset.step);\n      currentCard.classList.add('done');\n\n      if (curStep === 1) {\n        const email = document.getElementById('emailInput').value.trim() || 'claire.vance@studio.co';\n        const addr = document.getElementById('addrInput').value.trim() || '418 Mercer St, Portland OR';\n        document.getElementById('sum1').textContent = `${email} · ${addr}`;\n      } else if (curStep === 2) {\n        const checked = document.querySelector('input[name=\"ship\"]:checked');\n        document.getElementById('sum2').textContent = checked.dataset.label;\n      } else if (curStep === 3) {\n        const digits = document.getElementById('cardInput').value.replace(/\\D/g, '').slice(-4) || '4242';\n        document.getElementById('sum3').textContent = `Card ending in ${digits}`;\n      }\n      openStep(Number(btn.dataset.next));\n    });\n  });\n\n  document.querySelectorAll('input[name=\"ship\"]').forEach(radio => {\n    radio.addEventListener('change', () => {\n      document.querySelectorAll('.radio-card').forEach(rc => rc.classList.remove('selected'));\n      radio.closest('.radio-card').classList.add('selected');\n      shippingCost = Number(radio.value);\n      document.getElementById('sum2').textContent = radio.dataset.label;\n      renderTotals();\n    });\n  });\n\n  mobileBagBtn.addEventListener('click', () => {\n    const isOpen = mobileBagDrawer.classList.toggle('open');\n    mobileBagBtn.setAttribute('aria-expanded', String(isOpen));\n    document.getElementById('mobileBagChevron').textContent = isOpen ? '▴' : '▾';\n  });\n\n  placeOrderBtn.addEventListener('click', () => {\n    cards.forEach(c => {\n      c.classList.remove('active');\n      c.classList.add('done');\n      c.querySelector('.step-num').textContent = '✓';\n    });\n    const email = document.getElementById('emailInput').value.trim() || 'claire.vance@studio.co';\n    document.getElementById('confirmDesc').textContent =\n      `Receipt sent to ${email} for $${(subtotal + shippingCost).toFixed(2)}. Tap any step above to inspect or edit.`;\n    confirmationBox.classList.add('show');\n  });\n\n  renderTotals();\n})();\n</script>\n</body>\n</html>\n"
}
