+
@@ -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';
}
});
diff --git a/skills-lock.json b/skills-lock.json
index 6c85cde..d4ee786 100644
--- a/skills-lock.json
+++ b/skills-lock.json
@@ -1,6 +1,12 @@
{
"version": 1,
"skills": {
+ "apple-design": {
+ "source": "emilkowalski/skills",
+ "sourceType": "github",
+ "skillPath": "skills/apple-design/SKILL.md",
+ "computedHash": "0190417d092a0df447b000154e39733ea6d97efad6d3bec8a6ce3845aeb88914"
+ },
"emil-design-eng": {
"source": "emilkowalski/skill",
"sourceType": "github",
@@ -12,6 +18,12 @@
"sourceType": "github",
"skillPath": "skills/productivity/grill-me/SKILL.md",
"computedHash": "9cdbb4b8f7a3aeaef82e6230c9e823500d4a8a1214c726cf342cf9829d34fc7d"
+ },
+ "make-interfaces-feel-better": {
+ "source": "jakubkrehel/make-interfaces-feel-better",
+ "sourceType": "github",
+ "skillPath": "skills/make-interfaces-feel-better/SKILL.md",
+ "computedHash": "c8b15b529e088a318b2d3c17f0a97e15a7b1ce9ddab8bbdf9209e6ab7315cbde"
}
}
}