From 42a85447bf47d2c721c9b9b2463ca68c613b965a Mon Sep 17 00:00:00 2001 From: n3p-tun3 Date: Wed, 21 Oct 2026 21:07:05 +0300 Subject: [PATCH] feat(waitlist): polish material interactions --- apps/demo/public/waitlist/index.html | 174 +++++++++++++++++++-------- 1 file changed, 121 insertions(+), 53 deletions(-) diff --git a/apps/demo/public/waitlist/index.html b/apps/demo/public/waitlist/index.html index d5b3e2b..afc6ed8 100644 --- a/apps/demo/public/waitlist/index.html +++ b/apps/demo/public/waitlist/index.html @@ -46,22 +46,30 @@ .wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px; } /* ---------- nav ---------- */ - .nav { position: absolute; z-index: 5; inset: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px clamp(16px, 4vw, 48px); } + .nav { position: fixed; z-index: 10; top: 12px; left: clamp(12px, 3vw, 36px); right: clamp(12px, 3vw, 36px); display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 10px 8px 14px; border: 1px solid transparent; border-radius: 18px; background: transparent; transform: translateY(0); transition: background-color 240ms var(--ease-out), border-color 240ms var(--ease-out), box-shadow 300ms var(--ease-out), backdrop-filter 300ms var(--ease-out); } + .nav.scrolled { background: rgba(20, 20, 20, .72); border-color: rgba(255, 255, 255, .1); box-shadow: 0 16px 40px rgba(0, 0, 0, .28), inset 0 1px rgba(255, 255, 255, .05); backdrop-filter: blur(20px) saturate(150%); -webkit-backdrop-filter: blur(20px) saturate(150%); } + .nav::after { content: ''; position: absolute; left: 10%; right: 10%; top: 100%; height: 18px; background: linear-gradient(rgba(10, 10, 10, .24), transparent); opacity: 0; pointer-events: none; transition: opacity 240ms var(--ease-out); } + .nav.scrolled::after { opacity: 1; } .brand { display: inline-flex; align-items: center; text-decoration: none; } .brand img { height: 46px; width: auto; filter: invert(1); } @media (max-width: 420px) { .brand img { height: 36px; } } .links { display: flex; gap: 28px; font-size: 15px; font-weight: 500; } .links a { text-decoration: none; color: var(--ink-2); transition: color 160ms; } .links a:hover { color: #fff; } - .nav .ghost { display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border-radius: 10px; background: #1C1C1C; text-decoration: none; font-weight: 600; font-size: 15px; transition: background 160ms; } + .nav .ghost { display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border-radius: 999px; background: rgba(255, 255, 255, .08); text-decoration: none; font-weight: 600; font-size: 15px; transition: transform 120ms var(--ease-out), background-color 160ms; } .nav .ghost:hover { background: #262626; } + .nav .ghost:active { transform: scale(.96); } + @media (min-width: 761px) { + .nav { left: 50%; right: auto; width: calc(100% - 72px); transform: translateX(-50%); transition: width 300ms var(--ease-out), background-color 240ms var(--ease-out), border-color 240ms var(--ease-out), box-shadow 300ms var(--ease-out), backdrop-filter 300ms var(--ease-out); } + .nav.scrolled { width: min(calc(100% - 48px), 620px); } + } @media (max-width: 760px) { .links { display: none; } } /* ---------- hero: photo cards float around a centered pitch ---------- */ .hero { position: relative; min-height: max(min(100svh, 980px), 760px); display: grid; place-items: center; padding: 120px 16px 96px; overflow: hidden; isolation: isolate; } .collage { position: absolute; inset: 0; z-index: -1; pointer-events: none; } - .card { position: absolute; width: var(--w, 12.5vw); max-width: 250px; aspect-ratio: 9 / 16; border-radius: 14px; overflow: hidden; background: #1A1A1A; - opacity: 0; animation: rise 900ms var(--ease-out) forwards, drift 9s ease-in-out infinite alternate; animation-delay: var(--d), calc(var(--d) + 900ms); } + .card { position: absolute; width: var(--w, 12.5vw); max-width: 250px; aspect-ratio: 9 / 16; border-radius: 14px; overflow: hidden; background: #1A1A1A; outline: 1px solid rgba(255, 255, 255, .1); outline-offset: -1px; + opacity: 0; filter: blur(8px); animation: portrait-in 680ms var(--ease-out) forwards; animation-delay: var(--d); } .card.wide { aspect-ratio: 4 / 5; } .card img { width: 100%; height: 100%; object-fit: cover; object-position: center 22%; } .c1 { left: -1.5%; top: 24%; --d: 120ms; } @@ -71,18 +79,17 @@ .c5 { right: -1%; top: 11%; --w: 13vw; --d: 60ms; } .c6 { right: 8%; bottom: -12%; --d: 300ms; } @keyframes rise { from { opacity: 0; transform: translateY(24px) scale(.98); } to { opacity: 1; transform: none; } } - @keyframes drift { from { translate: 0 0; } to { translate: 0 -10px; } } + @keyframes portrait-in { from { opacity: 0; filter: blur(8px); transform: translateY(22px) scale(.96); } to { opacity: 1; filter: blur(0); transform: none; } } .collage::after { content: ''; position: absolute; inset: 0; background: radial-gradient(48% 46% at 50% 52%, rgba(10, 10, 10, .9), rgba(10, 10, 10, 0) 100%); } .pitch { max-width: 680px; text-align: center; display: flex; flex-direction: column; align-items: center; } .proof { display: inline-flex; align-items: center; gap: 10px; padding: 5px 16px 5px 6px; border-radius: 999px; border: 1px solid #3A3A3A; background: rgba(10, 10, 10, .6); backdrop-filter: blur(8px); font-size: 15px; font-weight: 500; } .faces { display: flex; } - .faces > * { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; object-position: center 20%; border: 2px solid var(--bg); margin-left: -9px; filter: grayscale(.7) brightness(.8); transition: filter 400ms var(--ease-out), transform 400ms var(--ease-out); } + .faces > * { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; object-position: center 20%; border: 2px solid var(--bg); margin-left: -9px; filter: grayscale(.45) brightness(.88); } .faces > :first-child { margin-left: 0; } - .faces > .on { filter: none; transform: translateY(-3px) scale(1.12); z-index: 1; position: relative; } + .faces > .on { filter: none; z-index: 1; position: relative; } .faces b { display: grid; place-items: center; background: #fff; color: #0A0A0A; font-size: 12px; font-weight: 800; filter: none; animation: rise 500ms var(--ease-out); } - .live { width: 8px; height: 8px; border-radius: 50%; background: #4ADE80; flex: none; animation: live 2s infinite; } - @keyframes live { 0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, .6); } 70%, 100% { box-shadow: 0 0 0 8px rgba(74, 222, 128, 0); } } + .live { width: 8px; height: 8px; border-radius: 50%; background: #4ADE80; flex: none; box-shadow: 0 0 0 4px rgba(74, 222, 128, .12); } h1 { font-size: clamp(44px, 6.4vw, 84px); line-height: .98; letter-spacing: -.045em; font-weight: 600; margin: 26px 0 0; text-wrap: balance; } h1 em, h2 em { font-style: normal; color: var(--ink-3); } .lead { max-width: 34ch; margin: 14px 0 0; color: var(--ink-2); font-size: clamp(17px, 1.6vw, 20px); line-height: 1.5; text-wrap: pretty; } @@ -93,7 +100,7 @@ .bar:focus-within { border-color: #4A4A4A; box-shadow: 0 0 0 4px rgba(255, 255, 255, .06); } .bar input { flex: 1; min-width: 0; border: 0; background: none; padding: 0 16px; min-height: 48px; font-size: 16px; outline: none; } input::placeholder { color: var(--ink-3); } - .more { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; animation: rise 500ms var(--ease-out); } + .more { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; } .more[hidden] { display: none; } .more input { min-height: 56px; padding: 0 20px; border-radius: 999px; border: 1px solid var(--line); background: var(--field); font-size: 16px; outline: none; } .more input:focus, .tel:focus-within { border-color: #4A4A4A; box-shadow: 0 0 0 4px rgba(255, 255, 255, .06); } @@ -115,7 +122,7 @@ .fine { margin: 12px 0 0; font-size: 13px; color: var(--ink-3); } .err { margin: 12px 0 0; font-size: 14px; color: var(--bad); font-weight: 600; } .err:empty { display: none; } - .done { display: flex; align-items: center; gap: 14px; text-align: left; padding: 14px 20px 14px 14px; border-radius: 24px; background: var(--field); border: 1px solid var(--line); animation: rise 500ms var(--ease-out); } + .done { display: flex; align-items: center; gap: 14px; text-align: left; padding: 14px 20px 14px 14px; border-radius: 24px; background: var(--field); border: 1px solid var(--line); transform-origin: center; } .done .tick { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: #fff; color: #0A0A0A; } .done h3 { margin: 0; font-size: 18px; letter-spacing: -.01em; } .done p { margin: 2px 0 0; color: var(--ink-2); font-size: 15px; } @@ -183,9 +190,11 @@ footer a:hover { color: var(--ink); } /* ---------- SMS / email toggle: SMS first, since most people here live on their phone ---------- */ - .seg { display: flex; width: max-content; gap: 4px; padding: 4px; margin: 0 auto 10px; border-radius: 999px; background: var(--field); border: 1px solid var(--line); } - .seg button { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 18px; border: 0; border-radius: 999px; background: none; color: var(--ink-3); font-weight: 600; font-size: 14px; cursor: pointer; transition: background 220ms var(--ease-out), color 220ms; } - .seg button[aria-selected="true"] { background: #fff; color: #0A0A0A; } + .seg { position: relative; display: grid; grid-template-columns: 1fr 1fr; width: max-content; gap: 4px; padding: 4px; margin: 0 auto 10px; border-radius: 999px; background: var(--field); border: 1px solid var(--line); } + .seg::before { content: ''; position: absolute; z-index: 0; inset: 4px auto 4px 4px; width: calc(50% - 6px); border-radius: 999px; background: #fff; transform: translateX(0); transition: transform 280ms cubic-bezier(.2, .8, .2, 1); } + .seg[data-channel="email"]::before { transform: translateX(calc(100% + 4px)); } + .seg button { position: relative; z-index: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 18px; border: 0; border-radius: 999px; background: none; color: var(--ink-3); font-weight: 600; font-size: 14px; cursor: pointer; transition: color 180ms var(--ease-out); } + .seg button[aria-selected="true"] { color: #0A0A0A; } .bar .tel { flex: 1; min-width: 0; min-height: 48px; border: 0; background: none; } .bar .tel input { height: 48px; } .bar .cc { margin-left: 2px; } @@ -193,27 +202,24 @@ .more { grid-template-columns: 1fr; } /* ---------- motion: headline words rise, then the rest; sections reveal on scroll ---------- */ - h1 .w { display: inline-block; opacity: 0; animation: rise 900ms var(--ease-out) forwards; animation-delay: calc(var(--i) * 80ms + 200ms); } - .pitch > .proof, .pitch > .lead, .pitch > .join { opacity: 0; animation: rise 800ms var(--ease-out) forwards; } - .pitch > .proof { animation-delay: 80ms; } .pitch > .lead { animation-delay: 620ms; } .pitch > .join { animation-delay: 760ms; } + h1 .w { display: inline-block; } .collage { transform: translateY(var(--py, 0px)); } - .reveal { opacity: 0; transform: translateY(28px); transition: opacity 900ms var(--ease-out), transform 1000ms var(--ease-out); transition-delay: var(--rd, 0ms); } + .reveal { opacity: 0; transform: translateY(18px); transition: opacity 320ms var(--ease-out), transform 380ms var(--ease-out); transition-delay: var(--rd, 0ms); } .reveal.in { opacity: 1; transform: none; } - .looks li.reveal img { transform: scale(1.18); transition: transform 1600ms var(--ease-out); transition-delay: var(--rd, 0ms); } + .looks li.reveal img { transform: scale(1.07); transition: transform 480ms var(--ease-out); transition-delay: var(--rd, 0ms); } .looks li.in img { transform: scale(1); } .looks li.in:hover img { transform: scale(1.05); transition-duration: 700ms; transition-delay: 0ms; } - .cta img { transform: scale(1.12); transition: transform 2400ms var(--ease-out); } + .cta img { transform: scale(1.06); transition: transform 620ms var(--ease-out); } .cta.in img { transform: scale(1); } /* ---------- portrait reel under the hero ---------- */ .reel { overflow: hidden; padding: 8px 0; -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); } - .reel > div { display: flex; gap: 12px; width: max-content; animation: reel 60s linear infinite; } - .reel:hover > div { animation-play-state: paused; } - .reel img { width: 190px; height: 250px; object-fit: cover; object-position: center 22%; border-radius: 18px; filter: grayscale(.4) brightness(.85); transition: filter 500ms var(--ease-out), transform 500ms var(--ease-out); } + .reel > div { display: grid; grid-template-columns: repeat(10, minmax(120px, 190px)); justify-content: center; gap: 12px; width: 100%; } + .reel > div > :nth-child(n + 11) { display: none; } + .reel img { width: 100%; height: 250px; object-fit: cover; object-position: center 22%; border-radius: 18px; outline: 1px solid rgba(255, 255, 255, .1); outline-offset: -1px; filter: grayscale(.25) brightness(.9); transition: filter 300ms var(--ease-out), transform 300ms var(--ease-out); } .reel img:nth-child(even) { margin-top: 28px; } .reel img:hover { filter: none; transform: translateY(-4px); } - @keyframes reel { to { transform: translateX(calc(-50% - 6px)); } } - @media (max-width: 760px) { .reel img { width: 120px; height: 160px; border-radius: 14px; } .reel img:nth-child(even) { margin-top: 18px; } } + @media (max-width: 760px) { .reel > div { grid-template-columns: repeat(5, 120px); } .reel > div > :nth-child(n + 6) { display: none; } .reel img { height: 160px; border-radius: 14px; } .reel img:nth-child(even) { margin-top: 18px; } } /* courses swipe on phones */ @media (max-width: 520px) { .looks { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 78%; overflow-x: auto; scroll-snap-type: x mandatory; margin-inline: -24px; padding-inline: 24px; scroll-padding-inline: 24px; scrollbar-width: none; } .looks::-webkit-scrollbar { display: none; } .looks li { scroll-snap-align: start; } } @@ -243,12 +249,17 @@ .foot-bar details { border: 0; } .foot-bar details p { padding: 8px 0 0; font-size: 13px; color: var(--ink-3); } .foot-bar a { text-decoration: none; } .foot-bar a:hover { color: var(--ink); } .powered { text-align: center; font-size: 12px; color: var(--ink-3); margin: 24px 0 0; letter-spacing: .04em; } - .shine { font-weight: 700; text-decoration: none; color: transparent; background: linear-gradient(110deg, var(--ink-2) 40%, #fff 50%, var(--ink-2) 60%) 0 0 / 250% 100%; -webkit-background-clip: text; background-clip: text; animation: shine 3.2s linear infinite; } - @keyframes shine { from { background-position: 100% 0; } to { background-position: -150% 0; } } + .shine { font-weight: 700; text-decoration: none; color: var(--ink-2); } + + @media (prefers-reduced-transparency: reduce) { + .nav.scrolled { background: #141414; backdrop-filter: none; -webkit-backdrop-filter: none; } + .proof { background: #141414; backdrop-filter: none; } + } + @media (prefers-contrast: more) { .nav.scrolled { background: #0A0A0A; border-color: #fff; } } @media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } - .card, h1 .w, .pitch > *, .reveal { opacity: 1 !important; transform: none !important; } + .card, h1 .w, .pitch > *, .reveal { opacity: 1 !important; transform: none !important; filter: none !important; } .looks li img, .cta img, .collage { transform: none !important; } .shine { color: var(--ink); background: none; } html { scroll-behavior: auto; } @@ -289,7 +300,7 @@
-
+
@@ -387,13 +398,18 @@ const ENDPOINT = ''; document.getElementById('year').textContent = new Date().getFullYear(); - document.querySelectorAll('[data-focus]').forEach((a) => a.addEventListener('click', () => setTimeout(() => document.getElementById(channel === 'sms' ? 'phone' : 'email')?.focus({ preventScroll: true }), 400))); + document.querySelectorAll('[data-focus]').forEach((a) => a.addEventListener('click', () => setTimeout(() => document.getElementById(channel === 'sms' ? 'phone' : 'email')?.focus({ preventScroll: true }), 300))); - // Scroll reveal, and the hero photos drift up a little as the page scrolls. + // The floating material appears only after content starts moving beneath it. + const nav = document.querySelector('.nav'); + const updateNav = () => nav.classList.toggle('scrolled', scrollY > 18); + updateNav(); addEventListener('scroll', updateNav, { passive: true }); + + // Short scroll reveals, plus a subtle user-controlled depth shift in the hero. const still = matchMedia('(prefers-reduced-motion: reduce)').matches; const revealEls = document.querySelectorAll('.reveal'); if ('IntersectionObserver' in window && !still) { - document.querySelectorAll('.looks .reveal').forEach((el, k) => el.style.setProperty('--rd', k * 90 + 'ms')); + document.querySelectorAll('.looks .reveal').forEach((el, k) => el.style.setProperty('--rd', k * 60 + 'ms')); const io = new IntersectionObserver((es) => es.forEach((e) => { if (e.isIntersecting) { e.target.classList.add('in'); io.unobserve(e.target); } }), { rootMargin: '0px 0px -10% 0px' }); revealEls.forEach((el) => io.observe(el)); const collage = document.querySelector('.collage'); @@ -401,17 +417,38 @@ addEventListener('scroll', () => { if (ticking) return; ticking = true; requestAnimationFrame(() => { collage.style.setProperty('--py', Math.min(scrollY, 900) * -0.12 + 'px'); ticking = false; }); }, { passive: true }); } else revealEls.forEach((el) => el.classList.add('in')); - // SMS (default) or email: one contact is enough, the toggle picks which field shows. - let channel = 'sms'; - document.querySelectorAll('.seg button').forEach((b) => b.addEventListener('click', () => { - channel = b.dataset.ch; - document.querySelectorAll('.seg button').forEach((x) => { const on = x === b; x.setAttribute('aria-selected', on); x.setAttribute('aria-checked', on); }); - $('telWrap').hidden = channel !== 'sms'; $('email').hidden = channel !== 'email'; - err.textContent = ''; ['phone', 'email'].forEach((k) => $(k).removeAttribute('aria-invalid')); - $(channel === 'sms' ? 'phone' : 'email').focus(); - })); - const form = document.getElementById('form'), err = document.getElementById('err'), btn = document.getElementById('submit'), more = document.getElementById('more'); const $ = (id) => document.getElementById(id); + const form = $('form'), err = $('err'), btn = $('submit'), more = $('more'), channelSeg = $('channelSeg'); + + // SMS and email share one spatial slot. The outgoing field softens away and the + // incoming field materializes from the same position, so the choice stays mapped. + let channel = 'sms'; + let switching = false; + async function morphContact(nextChannel) { + if (nextChannel === channel || switching) return; + switching = true; + const outgoing = $(channel === 'sms' ? 'telWrap' : 'email'); + const incoming = $(nextChannel === 'sms' ? 'telWrap' : 'email'); + channel = nextChannel; channelSeg.dataset.channel = channel; + if (!still) await outgoing.animate([ + { opacity: 1, transform: 'scale(1)', filter: 'blur(0)' }, + { opacity: 0, transform: 'scale(.97)', filter: 'blur(4px)' }, + ], { duration: 130, easing: 'cubic-bezier(.4,0,1,1)', fill: 'forwards' }).finished.catch(() => {}); + outgoing.hidden = true; incoming.hidden = false; + if (!still) await incoming.animate([ + { opacity: 0, transform: 'scale(.97)', filter: 'blur(4px)' }, + { opacity: 1, transform: 'scale(1)', filter: 'blur(0)' }, + ], { duration: 240, easing: 'cubic-bezier(.2,.8,.2,1)' }).finished.catch(() => {}); + incoming.getAnimations().forEach((a) => a.cancel()); + $(channel === 'sms' ? 'phone' : 'email').focus(); switching = false; + } + document.querySelectorAll('.seg button').forEach((b) => b.addEventListener('click', async () => { + const next = b.dataset.ch; + if (switching || next === channel) return; + document.querySelectorAll('.seg button').forEach((x) => { const on = x === b; x.setAttribute('aria-selected', on); x.setAttribute('aria-checked', on); }); + err.textContent = ''; ['phone', 'email'].forEach((k) => $(k).removeAttribute('aria-invalid')); + await morphContact(next); + })); const digits = (p) => p.replace(/[\s()-]/g, ''); const emailOk = (e) => /^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(e); // Country picker: ISO code + dial code. Names come from Intl.DisplayNames, flags from the regional-indicator letters. @@ -440,12 +477,9 @@ return n.length >= 4 && dial.length + n.length <= 15 ? '+' + dial + n : null; } - // Live pill: faces take turns lighting up, and the count of people waiting comes from the sheet (doGet). + // The count of people waiting comes from the sheet (doGet). Portraits stay still; + // the page has one controlled entrance rather than several competing loops. const faces = () => [...$('faces').querySelectorAll('img')]; - if (!matchMedia('(prefers-reduced-motion: reduce)').matches) { - let fi = 0; - setInterval(() => { fi = (fi + 1) % faces().length; faces().forEach((f, k) => f.classList.toggle('on', k === fi)); }, 2000); - } let waiting = 0; // ponytail: below 20 signups a number reads as empty, so the pill keeps its "be one of the first" line until then. const showWaiting = (joined) => { @@ -467,6 +501,40 @@ return bad.length ? { error: bad[0] } : { data: { name, email, phone, channel, locale: navigator.language || 'en', createdAt: new Date().toISOString() } }; } form.addEventListener('input', (e) => { if (e.target.getAttribute('aria-invalid') === 'true') { if (more.hidden) { const c = contactError(); e.target.setAttribute('aria-invalid', String(!!c && c[0] === e.target.id)); } else check(); } }); + + async function revealNameStep() { + more.hidden = false; btn.textContent = 'Get notified'; + $('fine').textContent = 'Last step: what should we call you?'; + if (!still) await Promise.all([ + more.animate([ + { opacity: 0, transform: 'translateY(-8px) scale(.98)', filter: 'blur(4px)' }, + { opacity: 1, transform: 'none', filter: 'blur(0)' }, + ], { duration: 260, easing: 'cubic-bezier(.2,.8,.2,1)' }).finished.catch(() => {}), + btn.animate([{ transform: 'scale(.96)' }, { transform: 'scale(1)' }], { duration: 220, easing: 'cubic-bezier(.2,.8,.2,1)' }).finished.catch(() => {}), + ]); + $('name').focus(); + } + + async function morphToSuccess(first) { + const join = $('join'), startHeight = join.getBoundingClientRect().height; + if (!still) await form.animate([ + { opacity: 1, transform: 'scale(1)', filter: 'blur(0)' }, + { opacity: 0, transform: 'scale(.97)', filter: 'blur(4px)' }, + ], { duration: 160, easing: 'cubic-bezier(.4,0,1,1)', fill: 'forwards' }).finished.catch(() => {}); + join.innerHTML = `

You're on the list, ${first.replace(/[<>&"]/g, '')}.

We'll ${channel === 'sms' ? 'text' : 'email'} you the day classes open.

`; + const done = join.querySelector('.done'), endHeight = join.scrollHeight; + if (still) return; + join.style.height = startHeight + 'px'; join.style.overflow = 'hidden'; + await Promise.all([ + join.animate([{ height: startHeight + 'px' }, { height: endHeight + 'px' }], { duration: 320, easing: 'cubic-bezier(.2,.8,.2,1)' }).finished.catch(() => {}), + done.animate([ + { opacity: 0, transform: 'scale(.94)', filter: 'blur(4px)' }, + { opacity: 1, transform: 'scale(1)', filter: 'blur(0)' }, + ], { duration: 320, easing: 'cubic-bezier(.2,.8,.2,1)' }).finished.catch(() => {}), + ]); + join.style.height = ''; join.style.overflow = ''; + } + form.addEventListener('submit', async (e) => { e.preventDefault(); err.textContent = ''; // Step 1 asks only for the phone or email; step 2 adds the name. @@ -474,13 +542,11 @@ const c = contactError(); ['phone', 'email'].forEach((k) => $(k).setAttribute('aria-invalid', String(!!c && c[0] === k))); if (c) { err.textContent = c[1]; $(c[0]).focus(); return; } - more.hidden = false; btn.textContent = 'Get notified'; - $('fine').textContent = 'Last step: what should we call you?'; - $('name').focus(); return; + await revealNameStep(); return; } const r = check(); if (r.error) { err.textContent = r.error[1]; $(r.error[0]).focus(); return; } - btn.disabled = true; + btn.disabled = true; btn.textContent = 'Joining…'; try { if (ENDPOINT) { // text/plain keeps this a "simple" request: Apps Script can't answer a CORS preflight. @@ -497,10 +563,12 @@ // The new signup's initial joins the faces in the pill. const me = document.createElement('b'); me.textContent = first[0].toUpperCase(); $('faces').prepend(me); waiting += 1; showWaiting(true); - form.parentElement.innerHTML = `

You're on the list, ${first.replace(/[<>&"]/g, '')}.

We'll ${channel === 'sms' ? 'text' : 'email'} you the day classes open.

`; + btn.textContent = '✓'; + if (!still) await btn.animate([{ transform: 'scale(.96)' }, { transform: 'scale(1.04)' }, { transform: 'scale(1)' }], { duration: 260, easing: 'cubic-bezier(.2,.8,.2,1)' }).finished.catch(() => {}); + await morphToSuccess(first); } catch { err.textContent = "Something went wrong. Please try again in a moment."; - btn.disabled = false; + btn.disabled = false; btn.textContent = 'Get notified'; } });