Merge pull request 'Polish waitlist material interactions' (#2) from ui-experience-improvements into main

Reviewed-on: #2
This commit is contained in:
naol-yaltopia 2026-10-22 16:02:46 +03:00
commit 754cebeeff
10 changed files with 1580 additions and 53 deletions

View File

@ -0,0 +1,290 @@
---
name: apple-design
description: Apple's approach to interface design and fluid, physical motion, translated for the web. Use when building or reviewing gesture-driven UI, spring animations, drag/swipe/sheet interactions, momentum and interruptible transitions, translucent materials and depth, typography (optical sizing, tracking, leading), reduced-motion, or the design foundations (feedback, spatial consistency, restraint) behind Apple-style interfaces.
---
# Apple Design
## Initial Response
When this skill is first invoked without a specific question, respond only with:
> I'm ready to help you build fluid, Apple-style interfaces on the web, my knowledge comes from Apple's WWDC design talks, translated for the web.
Do not provide any other information until the user asks a question.
How Apple builds interfaces that stop feeling like a computer and start feeling like an extension of you. This knowledge comes from Apple's WWDC design talks — chiefly *Designing Fluid Interfaces* (WWDC 2018) — distilled and translated into the web platform (CSS, Pointer Events, `requestAnimationFrame`, spring libraries like Motion/Framer Motion).
The through-line: **an interface feels alive when motion starts from the current on-screen value, inherits the user's velocity, projects momentum forward, and can be grabbed and reversed at any instant.** Springs are the tool that makes all of this natural, because they are inherently interruptible and velocity-aware.
## The Core Idea
> "When we align the interface to the way we think and move, something magical happens — it stops feeling like a computer and starts feeling like a seamless extension of us."
An interface is fluid when it behaves like the physical world: things respond instantly, move continuously, carry momentum, resist at boundaries, and can be redirected mid-motion. Everything below is a way to get closer to that.
Apple frames design as serving four human needs: **safety/predictability, understanding, achievement, and joy.** Every rule here serves one of them.
## 1. Response — kill latency
The moment lag appears, the feeling of directness "falls off a cliff." Response is the foundation everything else is built on.
- **Respond on pointer-down, not on release.** Highlight a button the instant it's pressed. Waiting for `click`/touch-up to show feedback feels dead.
- **Be vigilant about every latency.** Audit debounces, artificial timers, transition waits, and the ~300ms tap delay. Anything on the input path that isn't essential is a regression.
- **Feedback must be continuous *during* the interaction, not just at the end.** For a drag, slider, or drawer, update the UI 1:1 with the pointer the whole way through — never animate only when the gesture completes.
```css
/* Feedback lives on the press, and it's instant */
.button:active {
transform: scale(0.97);
transition: transform 100ms ease-out;
}
```
## 2. Direct manipulation — 1:1 tracking
> "Touch and content should move together."
When the user drags something, it must stay glued to the finger — and respect the offset from *where they grabbed it*. Snapping to the element's center on grab breaks the illusion immediately.
- Use Pointer Events with `setPointerCapture` so tracking continues even when the pointer leaves the element's bounds.
- Track a short **velocity/position history** (last few `pointermove` events), not just the current point — you'll need velocity at release.
```js
el.addEventListener('pointerdown', (e) => {
el.setPointerCapture(e.pointerId);
const grabOffset = e.clientY - el.getBoundingClientRect().top; // respect where they grabbed
// ...track position + timestamp history for velocity
});
```
## 3. Interruptibility — the single most important principle
> "The thought and the gesture happen in parallel."
Every animation must be interruptible and redirectable at any moment. A user must be able to grab a moving element mid-flight and reverse it without waiting for the animation to finish. A closing modal the user grabs again should follow the finger — not finish closing first, then reopen.
- **Never lock out input during a transition.**
- **Always animate from the *presentation* (current) value, never the target value.** On interrupt, read the element's live on-screen transform and start the new animation from there. Starting from the logical/target value causes a visible jump.
- **Avoid CSS transitions and `@keyframes` for anything gesture-driven** — they can't be smoothly grabbed and reversed mid-flight. Springs animate from the current value by default, which is exactly what interruption needs.
- **When a gesture reverses, blend velocity — don't hard-cut it.** Replacing one animation with another at a reversal creates a velocity discontinuity, a "brick wall." Spring libraries that carry velocity through a re-target avoid it. (This is what iOS's *additive animations* do natively; on the web, choose a spring library that re-targets from the current velocity.)
- **Decompose 2D motion into independent X and Y springs.** A single spring on a 2D distance desyncs when X and Y have different velocities.
## 4. Behavior over animation — use springs
> "Think of animation as a conversation between you and the object, not something prescribed by the interface."
A pre-scripted, fixed-duration animation can't respond to new input. A spring can — new input just changes the target, and the motion stays continuous. Reach for springs for anything a user can touch.
Apple deliberately replaced the physics triplet (mass/stiffness/damping) with two designer-friendly parameters. Think in these:
- **Damping ratio** — controls overshoot. `1.0` = critically damped, no bounce, smooth settle. `< 1.0` = overshoots and oscillates. Lower = bouncier.
- **Response** — how quickly the value reaches the target, in seconds. Lower = snappier. **This is not "duration"** — a spring has no fixed duration; its settle time emerges from the parameters.
**Defaults:**
- Start most UI at **damping `1.0`** (critically damped) — graceful and non-distracting.
- Add bounce (**damping ~`0.8`**) **only when the gesture itself carried momentum** (a flick, a throw, a drag release). Overshoot on a menu that just faded in feels wrong; overshoot on a card you flicked feels right.
**Concrete values Apple ships:**
| Interaction | Damping | Response |
| --- | --- | --- |
| Move / reposition (e.g. PiP) | `1.0` | `0.4` |
| Rotation | `0.8` | `0.4` |
| Drawer / sheet | `0.8` | `0.3` |
**Web mapping (Motion / Framer Motion):** the `bounce` + `duration` spring API maps closely to Apple's damping + response. A safe house style is `damping: 1.0` springs everywhere by default; reserve bounce for momentum-driven, physical interactions.
```js
import { animate } from 'motion';
// Critically damped default (no overshoot)
animate(el, { y: 0 }, { type: 'spring', bounce: 0, duration: 0.4 });
// Momentum interaction — a little bounce, only because a flick preceded it
animate(el, { y: target }, { type: 'spring', bounce: 0.2, duration: 0.4 });
```
## 5. Velocity handoff — the seam between drag and animation
When a gesture ends, the animation must **continue at the finger's exact velocity**, so there's no visible seam between dragging and animating. This is the detail that most separates "fluid" from "fine."
Pass the pointer's release velocity as the spring's initial velocity. Some spring APIs want **relative** velocity — normalize it by the remaining distance to the target:
```
relativeVelocity = gestureVelocity / (targetValue − currentValue)
```
Example: element at `y=50`, target `y=150` (100px to go), finger moving 50px/s → initial spring velocity = `50 / 100 = 0.5`. Framer Motion / Motion take absolute px/s velocity directly (`velocity` option), so you usually hand it the raw value.
## 6. Momentum projection — animate to where the gesture is *going*
> "Take a small input and make a big output."
Don't snap to the nearest boundary from the *release point*. Use velocity to **project the resting position** — exactly like scroll deceleration — then snap to the target nearest that projected point. This is what makes a flick feel like it throws the element.
Apple's exact projection function (from the *Designing Fluid Interfaces* sample code):
```js
// decelerationRate ≈ 0.998 for normal scroll feel; 0.99 for snappier
function project(initialVelocity /* px/s */, decelerationRate = 0.998) {
return (initialVelocity / 1000) * decelerationRate / (1 - decelerationRate);
}
const projectedEndpoint = currentPosition + project(releaseVelocity);
const target = nearestSnapPoint(projectedEndpoint); // choose target from the projection
animateSpringTo(target, { velocity: releaseVelocity }); // then hand off velocity (§5)
```
Note: the physics-textbook `v²/(2·decel)` is *not* what Apple ships — use the exponential-decay form above. This is the standard behavior in good bottom-sheets and carousels (Vaul, Embla).
## 7. Spatial consistency — symmetric paths, anchored origins
> "If something disappears one way, we expect it to emerge from where it came."
- **Enter and exit along the same path.** A panel that slides in from the right must dismiss to the right. In-from-right / out-the-bottom feels disconnected and confusing.
- **Anchor interactions to their source.** A menu, popover, or sheet should originate from the element that triggered it — set `transform-origin` to the trigger, so the spatial relationship between button and content is obvious. (This is the same origin-awareness point as popovers scaling from their trigger, not their center.)
- **Mirror the easing on reversible transitions** so the outbound path matches the return path (use inverse cubic-bézier control points for the two directions).
## 8. Hint in the direction of the gesture
Humans predict a final state from a trajectory. Intermediate motion should telegraph where things are going — Control Center modules "grow up and out toward your finger." Make the in-between frames point at the outcome, not just interpolate blindly to it.
## 9. Rubber-banding — soft boundaries
At an edge, resist progressively instead of stopping hard. A hard stop reads as "frozen"; continuous resistance reads as "responsive, but there's nothing more here." Apply damping that increases the further past the boundary the user drags.
```js
// The further past the bound, the less the element follows — real things slow before they stop
function rubberband(overshoot, dimension, constant = 0.55) {
return (overshoot * dimension * constant) / (dimension + constant * Math.abs(overshoot));
}
```
## 10. Gesture design details (the "feel" checklist)
- **Tap:** highlight on touch-*down* (instant), commit on touch-*up*. Add ~10px of hysteresis/hit padding around the target, and allow cancel-by-dragging-away and back.
- **Drag/swipe:** require a small movement threshold (hysteresis, ~10px) before committing to a direction, then track 1:1.
- **Detect all plausible gestures in parallel from the first move**, then confidently cancel the losers once intent is clear. Avoid recognizers that only report a *final* state (`swipeleft`-type events) — they throw away the continuous tracking you need for feedback.
- **Minimize disambiguation delays.** Double-tap detection unavoidably delays single taps; only pay that cost where double-tap truly exists.
## 11. Frame-level smoothness
Smoothness is about *what's in the frames*, not just the frame rate.
- Keep the per-frame positional change below the perception threshold to avoid strobing.
- For very fast motion, a subtle **motion blur / stretch** encodes speed and reads better than a hard sharp streak.
- `requestAnimationFrame` is the web's display-synced clock (Apple uses `CADisplayLink`). Animate only compositor-friendly properties — `transform` and `opacity` — and hint with `will-change` where motion is imminent.
## 12. Materials & depth — translucency conveys hierarchy
Apple uses translucent materials as a floating functional layer that brings structure without stealing focus. On the web, approximate with `backdrop-filter`.
- **Build nav/toolbars/sheets as translucent layers** (`backdrop-filter: blur()` + a semi-transparent background) with content scrolling underneath — not opaque bars that consume a fixed strip.
- **Material weight encodes hierarchy:** darker/heavier materials separate structural regions (sidebars); lighter materials draw attention to interactive elements (buttons). **Never stack a light translucent surface on another** — legibility collapses.
- **Bigger surfaces should read as thicker:** stronger blur + a deeper shadow than small chips. Consider context-aware shadow — heavier over busy/text content for separation, lighter over plain backgrounds.
- **Dim to focus, separate to keep flow.** A modal task pairs the surface with a dimming scrim and pushes the background back/down. A parallel, non-blocking panel uses translucency and offset *without* a scrim so the flow isn't broken. For stacked sheets, progressively dim and push back each parent layer.
- **Vibrancy keeps text legible over changing backgrounds.** Over blurred/translucent surfaces, don't use flat gray text — use higher-contrast, slightly heavier weight, and a small letter-spacing bump. Put color on a solid layer, not the translucent foreground.
- **Scroll edge effects, not hard dividers.** Instead of a 1px border under a sticky header, fade a small blur/gradient mask where content meets floating chrome — only where floating UI actually overlaps content.
- **Materialize, don't just fade.** For glass/blur surfaces, animate blur radius and scale together on enter/exit, so the surface reads as a real material arriving rather than a plain opacity fade.
```css
.toolbar {
background: rgba(255, 255, 255, 0.6);
backdrop-filter: blur(20px) saturate(180%);
border-top: 1px solid rgba(255, 255, 255, 0.4); /* bright top edge = light catching the material */
}
```
## 13. Multimodal feedback — motion + sound + haptics
Three rules for combining senses (from *Designing Audio-Haptic Experiences*):
1. **Causality** — it must be obvious what caused the feedback. Trigger it on the actual causal event (the toggle flipping, the item snapping home), and match its character to the action's physicality.
2. **Harmony** — the visual, the sound, and the haptic must fire on the **same frame**. Latency between them destroys the illusion. Don't let a CSS transition lag the audio/haptic (Vibration API).
3. **Utility** — add feedback only where it earns its place. Reserve haptics/sound for meaningful moments (success, error, commit, snap). Over-feedback trains users to ignore all of it.
## 14. Reduced motion & accessibility
Reduced motion doesn't mean *no* feedback — it means a gentler, non-vestibular equivalent. Respond to three independent signals and bake them into your components:
- **`prefers-reduced-motion: reduce`** — replace slides/springs/parallax with short opacity **cross-fades or static transitions**. Drop elastic/overshoot. Keep opacity/color changes that aid comprehension.
- **`prefers-reduced-transparency: reduce`** — make translucent surfaces frostier/solid: raise background opacity, drop the blur.
- **`prefers-contrast: more`** — near-solid backgrounds with a defined, contrasting border.
Also: avoid full-viewport moving backgrounds, slow looping oscillations (near 0.2 Hz / one cycle per 5s), and abrupt brightness jumps (ease dark↔light theme changes). Make large moving objects semi-transparent while they travel, and fade big surfaces out during a large reposition and back in once settled.
```css
@media (prefers-reduced-motion: reduce) {
.sheet { transition: opacity 200ms ease; transform: none !important; }
}
@media (prefers-reduced-transparency: reduce) {
.toolbar { background: white; backdrop-filter: none; }
}
```
## 15. Typography — optical sizing, tracking, leading
Apple designs type to change shape with size; the same discipline applies on the web. (From *The Details of UI Typography*, WWDC 2020.)
- **Tracking (letter-spacing) is size-specific — never one value for all sizes.** Large display text wants *negative* tracking (letters read too far apart as they grow); small text wants slightly *positive* tracking for legibility. A fixed `letter-spacing` is wrong somewhere. Tighten headings, leave body near `0`.
- **Leading (line-height) tracks size inversely.** Tight on large headings, looser on body copy. Increase it for scripts with tall ascenders/descenders; tighten it for dense, information-heavy UI.
- **Build hierarchy from weight + size + leading as a set,** not size alone. Emphasize with weight — it adds presence without taking more space.
- **Respect the user's text-size setting** (Dynamic Type). Scale layout *with* the text — spacing in `rem`/`em`, not fixed px — so a larger font doesn't break the layout.
- **Default to the platform's system font** before a custom face; it already ships optical sizing, tracking tables, and legibility tuning. Override only with a reason.
```css
:root { font: 100%/1.5 system-ui, sans-serif; } /* body: system font, comfortable leading */
.display {
font-size: clamp(2rem, 5vw, 4rem);
line-height: 1.05; /* tight leading for large text */
letter-spacing: -0.02em; /* negative tracking as it grows */
font-optical-sizing: auto;
}
```
## 16. Design foundations — the eight principles
The motion and craft above serve Apple's eight design principles (*Principles of Great Design*, WWDC 2026). Use these as the names you reason with:
1. **Purpose.** Make with intention; decide what *not* to build. Every feature asks for the user's time, attention, and trust — spend that budget only where it pays off.
2. **Agency.** Keep people in control: offer choices, don't force a single path. Back it with forgiveness — easy undo for slips, a confirmation dialog only for genuinely destructive, irreversible actions (use sparingly; overusing it trains people to click through).
3. **Responsibility.** Act in the user's interest. Privacy: ask at the right moment, only for what's needed, transparently. Safety: anticipate misuse and harm — especially with AI (an allergy-aware recipe app must not suggest a harmful ingredient). Add previews, confirmations, disclaimers; cut a feature whose risk outweighs its value.
4. **Familiarity.** Build on what people already know. Use metaphors that are neither too literal nor too abstract (a trash can means delete), and honor their physics. Be consistent: things that look the same must behave the same and live in the same place (close is always top-left on macOS) so people can predict what happens next. Only break a familiar pattern if you can prove it's better — then test it, don't assume.
5. **Flexibility.** Design for different contexts, devices, and the full range of abilities. Adapt to the platform (iPhone = quick touch; desktop = deep workflows with precise pointer control) and to the situation. Design inclusively (age, language, expertise, accessibility). When no single layout fits everyone, let people personalize — rearrange controls, hide what they don't use.
6. **Simplicity — not minimalism.** Strip the unnecessary so the core purpose shines; burying everything in one place looks minimal but isn't simple. Be concise (plain language, no jargon, fewer steps) and clear (use hierarchy — order, spacing, contrast — so the most important thing is the most obvious). Every element earns its place; sometimes *adding* context simplifies (a video scrubber that shows time remaining). Show the common path first, advanced options one level deeper.
7. **Craft.** Uncompromising attention to detail builds trust. Beautiful typography, colors that adapt to light/dark, clear iconography, and responsive animations that give immediate, natural feedback. Nothing is random — every spacing, timing, and alignment value is a deliberate choice you can defend. Jittery scroll, misaligned icons, and layouts that break on rotation read as carelessness. Craft needs iteration and longevity — keep evolving the design as features and hardware change.
8. **Delight.** The result of getting the other seven right, not confetti tacked on top. Decide the emotion you want people to feel (calm, confident, excited) and reinforce it in every decision.
Tactical rules that serve these:
- **Feedback comes in four kinds:** status, completion, warning, error. Confirm meaningful actions, expose ongoing status, warn before problems, validate inline (not on submit).
- **Wayfinding.** Every screen should answer: Where am I? Where can I go? What's there? How do I get out? Never trap the user.
- **Grouping & mapping.** Proximity implies relationship; place a control near what it affects and arrange controls to mirror what they change. If you need a label to explain a control, the mapping is weak.
- **Direct, specific labels beat safe generic ones.** Name nav items for their contents ("Progress", "Library"), not vague umbrellas ("Home"). Specificity creates predictability.
## 17. Process
- **Prototype interactively — an interactive demo is worth "a million static designs."** You discover the interface by building and playing with it; a working prototype also sets a concrete bar that prevents a mediocre final implementation.
- **Design interaction and visuals together.** "You shouldn't be able to tell where one ends and the other begins." Motion is not a layer added after the pixels.
- **Test with real people in real context**, and review motion with fresh eyes — play it in slow motion / frame-by-frame to catch what's invisible at full speed.
## Quick Reference
| Need | Technique | Concrete value |
| --- | --- | --- |
| Default UI spring | Critically damped, no overshoot | `damping 1.0`, `response 0.3–0.4` |
| Momentum / flick spring | Under-damped, slight bounce | `damping ~0.8`, `response 0.3–0.4` |
| Gesture → spring velocity | Hand off release velocity | `gestureVelocity / (target − current)` if normalized |
| Flick landing point | Project momentum | `current + (v/1000)·d/(1−d)`, `d ≈ 0.998` |
| Interrupt cleanly | Start from presentation (live) value | read the on-screen transform |
| Avoid reversal "brick wall" | Carry velocity through re-target | spring that blends velocity |
| Reversible transition | Mirror the easing curve | inverse cubic-bézier |
| Decide reverse vs. commit | Use velocity **sign**, not position | at release |
| 1:1 drag | Pointer Events + capture | respect the grab offset |
| Feedback | On pointer-down, continuous | never only at the end |
| Boundary | Rubber-band, don't hard-stop | progressive resistance |
| Translucent chrome | `backdrop-filter` layer | content scrolls under |
| Type tracking | Size-specific, never fixed | tighten large text (`-0.02em`), body near `0` |
| Reduced motion | Cross-fade, not slide/spring | `@media (prefers-reduced-motion)` |

View File

@ -0,0 +1,187 @@
---
name: make-interfaces-feel-better
description: >-
Design engineering principles for making interfaces feel polished. Use when building UI components, reviewing frontend code, implementing animations, hover states, shadows, borders, typography, icons, micro-interactions, enter/exit animations, or any visual detail work. Supports quick and full review modes. Triggers on UI polish, design details, "make it feel better", "feels off", stagger animations, border radius, optical alignment, font smoothing, tabular numbers, image outlines, box shadows, icons, icon stroke weight, icon states, motion restraint.
---
# Details that make interfaces feel better
Great interfaces rarely come from a single thing. It's usually a collection of small details that compound into a great experience. Apply these principles when building or reviewing UI code. Before suggesting or writing a fix, identify the project's existing styling system and express the change in that system: Tailwind in a Tailwind project, plain CSS in a CSS project, or the established CSS-in-JS approach. Never introduce a second styling system just to apply a polish fix.
When reviewing, slow the interface down: replay motion at 10% speed in the browser's Animations panel and walk every state: hover, focus, active, loading, empty. What feels off at 10% speed is what's subtly wrong at full speed.
## Quick Reference
| Category | When to Use |
| --- | --- |
| [Typography](typography.md) | Text wrapping, font smoothing, tabular numbers |
| [Surfaces](surfaces.md) | Border radius, optical alignment, shadows, image outlines, hit areas |
| [Animations](animations.md) | Interruptible animations, enter/exit transitions, icon animations, scale on press, motion restraint |
| [Icons](icons.md) | Icon stroke weight, states via `currentColor`, outline vs fill, sizing, RTL flipping |
| [Performance](performance.md) | Transition specificity, `will-change` usage |
## Core Principles
### 1. Concentric Border Radius
Outer radius = inner radius + padding. Mismatched radii on nested elements is the most common thing that makes interfaces feel off.
### 2. Optical Over Geometric Alignment
When geometric centering looks off, align optically. Buttons with icons, play triangles, and asymmetric icons all need manual adjustment.
### 3. Shadows for Elevation, Borders for Structure
For buttons, cards, and containers whose border exists only to create depth, prefer layered transparent `box-shadow` values. Keep borders that communicate structure or state: dividers, layout separators, and selected or focus states.
### 4. Interruptible Animations
Use CSS transitions for interactive state changes — they can be interrupted mid-animation. Reserve keyframes for staged sequences that run once.
### 5. Split and Stagger Enter Animations
For an infrequent staged entrance where sequence helps communicate hierarchy, break content into semantic chunks and stagger them by ~100ms instead of animating one container. Do not stagger routine, high-frequency interactions.
### 6. Subtle Exit Animations
Use a small fixed `translateY` instead of full height. Exits should be softer than enters. Use `ease-out` for both enter and exit transitions.
### 7. Contextual Icon Animations
Animate icons with `opacity`, `scale`, and `blur` instead of toggling visibility. Use exactly these values: scale from `0.25` to `1`, opacity from `0` to `1`, blur from `4px` to `0px`. If the project has `motion` or `framer-motion` in `package.json`, match that package's import path (or the established nearby imports when both exist) and use `transition: { type: "spring", duration: 0.3, bounce: 0 }` — bounce must always be `0`. If no motion library is installed, keep both icons in the DOM (one absolute-positioned) and cross-fade with CSS transitions using `cubic-bezier(0.2, 0, 0, 1)` — this gives both enter and exit animations without any dependency.
### 8. Font Smoothing
Apply `-webkit-font-smoothing: antialiased` to the root layout on macOS for crisper text.
### 9. Tabular Numbers
Use `font-variant-numeric: tabular-nums` for any dynamically updating numbers to prevent layout shift.
### 10. Text Wrapping
Use `text-wrap: balance` on headings. Use `text-wrap: pretty` for body text to avoid orphans.
### 11. Image Outlines
Add a subtle `1px` outline with low opacity to images for consistent depth. The color must be pure black in light mode (`oklch(0 0 0 / 0.1)`) and pure white in dark mode (`oklch(1 0 0 / 0.1)`), never a near-black like slate, zinc, or any tinted neutral. A tinted outline picks up the surface color underneath it and reads as dirt on the image edge.
### 12. Scale on Press
A subtle `scale(0.96)` on click gives buttons tactile feedback. Always use `0.96`. Never use a value smaller than `0.95` — anything below feels exaggerated. Add a `static` prop to disable it when motion would be distracting.
### 13. Skip Animation on Page Load
Use `initial={false}` on `AnimatePresence` to prevent enter animations on first render. Verify it doesn't break intentional entrance animations.
### 14. Never Use `transition: all`
Always specify exact properties: `transition-property: scale, opacity`. Tailwind's `transition-transform` covers `transform, translate, scale, rotate`.
### 15. Use `will-change` Sparingly
Only for `transform`, `opacity`, `filter` — properties the GPU can composite. Never use `will-change: all`. Only add when you notice first-frame stutter.
### 16. Minimum Hit Area
Interactive elements should prefer a 44×44px hit area for touch or mobile contexts. In dense desktop interfaces, use at least 40×40px. Extend with a pseudo-element if the visible element is smaller. Never let hit areas of two elements overlap.
### 17. Match Icon Stroke to Text Weight
An icon next to text carries the text's optical weight: `1.5px` stroke beside regular (400) text, `2px` beside semibold (600). One stroke weight per icon set; never mix libraries on one surface.
### 18. One SVG, Recolored per State
Icons use `currentColor` and get their states (hover, selected, disabled) from CSS color and opacity, never from separate assets. Outline variant is the default; fill variant marks the active state.
### 19. Motion Restraint
No custom animation on high-frequency interactions: the attention cost repeats on every trigger. Motion is never the only feedback channel; every animated state change also needs a static cue such as color, icon, or label.
## Common Mistakes
| Mistake | Fix |
| --- | --- |
| Same border radius on parent and child | Calculate `outerRadius = innerRadius + padding` |
| Icons look off-center | Adjust optically with padding or fix SVG directly |
| Border used only to fake elevation | Use layered `box-shadow` with transparency; keep structural and state borders |
| Jarring staged entrance or contextual exit | Stagger infrequent entrances and keep context-preserving exits subtle |
| Numbers cause layout shift | Apply `tabular-nums` |
| Heavy text on macOS | Apply `antialiased` to root |
| Animation plays on page load | Add `initial={false}` to `AnimatePresence` |
| `transition: all` on elements | Specify exact properties |
| First-frame animation stutter | Add `will-change: transform` (sparingly) |
| Tiny hit areas on small controls | Extend with a pseudo-element to 44×44px for touch/mobile, or at least 40×40px in dense desktop UI |
| Hairline icon beside bold text | Match the stroke width to the text weight |
| Separate icon assets per state | One `currentColor` SVG, states via CSS |
| Filled icons everywhere | Outline as default, fill only for the active state |
| Entrance animation on every hover or keystroke | Instant feedback or ≤150ms opacity/color transition |
## Review Output Format
Use `full` when no review mode is supplied.
| Mode | Coverage | Finding cap |
| --- | --- | --- |
| `quick` | Primary user path and highest-traffic states; report only `HIGH` and `MEDIUM` issues | 5 |
| `full` | Entire requested scope across typography, surfaces, animations, icons, and performance | 15 |
### Scope and Coverage
State the mode, exact scope, framework, styling conventions, and any review boundary. Show what was actually inspected:
| Category | Evidence inspected | Result |
| --- | --- | --- |
| Typography | Files, components, states, or checks | Findings count, `Clear`, or `Not reviewed` with a reason |
Include all five Quick Reference categories. Never imply an uninspected surface was reviewed.
### Findings
Group findings by principle. Use a markdown table with **Severity**, **Location**, **Before**, **After**, and **Why** columns. Include every change made or proposed, not a subset. Never use separate "Before:" / "After:" lines.
- **Severity**: `HIGH` makes an interaction inaccessible, misleading, unreadable, or repeatedly disruptive; `MEDIUM` creates a noticeable usability or consistency problem; `LOW` is isolated polish and appears only in `full` mode.
- **Location**: cite `path/to/file:line`. If the artifact has no source files, cite the exact screen and component instead.
- **Before / After**: show the current implementation and an actionable replacement.
- **Why**: name the violated principle and explain its user impact.
Consolidate a repeated systemic issue into one row and list every affected location. Omit principles with no findings and never pad the report to reach the cap.
### Example
#### Concentric border radius
| Severity | Location | Before | After | Why |
| --- | --- | --- | --- | --- |
| LOW | `src/Card.tsx:28` | `rounded-xl` on card + `rounded-xl` on inner button (`p-2`) | `rounded-2xl` on card (`8 + 8 = 16`), `rounded-lg` on inner button | Nested corners should be concentric |
| LOW | `src/card.css:11` | `border-radius: 16px` on both nested surfaces | Outer `24px`, inner `16px` with `8px` padding | Equal nested radii make the inner surface look pinched |
#### Tabular numbers
| Severity | Location | Before | After | Why |
| --- | --- | --- | --- | --- |
| MEDIUM | `src/Counter.tsx:17` | `<span>{count}</span>` | `<span className="tabular-nums">{count}</span>` | Proportional digits cause changing values to shift |
| LOW | `src/timer.css:8` | Default numerals on a timer | Add `font-variant-numeric: tabular-nums` to the timer | Equal-width digits keep the timer stable |
#### Scale on press
| Severity | Location | Before | After | Why |
| --- | --- | --- | --- | --- |
| LOW | `src/Button.tsx:19` | `<button className="...">` | Add `active:scale-[0.96] transition-transform` | Press feedback makes the control feel responsive |
| MEDIUM | `src/button.css:24` | `scale(0.9)` on press | Raise to `scale(0.96)` | Anything below `0.95` feels exaggerated |
### Considered but Rejected
Include 1–3 real candidates in `quick` mode and 2–5 in `full` mode:
| Location | Candidate | Rejected because |
| --- | --- | --- |
| `src/Card.tsx:28` | Increase the shadow | Existing depth matches the shared surface token; changing one card would reduce consistency |
Do not invent filler. If the scope contains fewer borderline candidates, include the ones that exist and say so.
### Verification and Verdict
After the findings:
1. **Verification**: list the exact commands or interactions run and their observed results. Walk every relevant state and inspect motion at 10% speed when animation is involved. If a check was not run, label it **Not verified** and state what remains.
2. **Verdict**: `Block` if any `HIGH` finding remains, `Needs changes` if only `MEDIUM` or `LOW` findings remain, and `Approve` only when no actionable findings remain. List every unverified check beside the verdict.
When there are no findings, omit the findings table, state "No actionable interface-polish findings", report verification and rejected candidates, and end with `Approve`.

View File

@ -0,0 +1,3 @@
interface:
display_name: "Make Interfaces Feel Better"
short_description: "Typography, surfaces, motion, icons and UI polish"

View File

@ -0,0 +1,403 @@
# Animations
Interruptible animations, enter/exit transitions, contextual icon animations, and motion restraint.
## Interruptible Animations
Users change intent mid-interaction. If animations aren't interruptible, the interface feels broken.
### CSS Transitions vs. Keyframes
| | CSS Transitions | CSS Keyframe Animations |
| --- | --- | --- |
| **Behavior** | Interpolate toward latest state | Run on a fixed timeline |
| **Interruptible** | Yes — retargets mid-animation | No — restarts from beginning |
| **Use for** | Interactive state changes (hover, toggle, open/close) | Staged sequences that run once (enter animations, loading) |
| **Duration** | Fixed; retargets the value mid-flight, not the timeline | Fixed timeline, restarts from the beginning |
```css
/* Good — interruptible transition for a toggle */
.drawer {
transform: translateX(-100%);
transition: transform 200ms ease-out;
}
.drawer.open {
transform: translateX(0);
}
/* Clicking again mid-animation smoothly reverses — no jank */
```
```css
/* Bad — keyframe animation for interactive element */
.drawer.open {
animation: slideIn 200ms ease-out forwards;
}
/* Closing mid-animation snaps or restarts — feels broken */
```
**Rule:** Always prefer CSS transitions for interactive elements. Reserve keyframes for one-shot sequences.
## Enter Animations: Split and Stagger
Use this pattern for infrequent staged entrances where sequence helps communicate hierarchy, such as the first load of a page hero, success state, or empty state. Break a large container into semantic chunks and animate each individually. Do not stagger routine interactions such as row hovers, keystrokes, or repeated tab changes.
### Step by Step
1. **Split** into logical groups (title, description, buttons)
2. **Stagger** with ~100ms delay between groups
3. **For titles**, consider splitting into individual words with ~80ms stagger
4. **Combine** `opacity`, `blur`, and `translateY` for the enter effect
### Code Example
```tsx
// Motion (Framer Motion) — staggered enter
function PageHeader() {
return (
<motion.div
initial="hidden"
animate="visible"
variants={{
visible: { transition: { staggerChildren: 0.1 } },
}}
>
<motion.h1
variants={{
hidden: { opacity: 0, y: 12, filter: "blur(4px)" },
visible: { opacity: 1, y: 0, filter: "blur(0px)" },
}}
>
Welcome
</motion.h1>
<motion.p
variants={{
hidden: { opacity: 0, y: 12, filter: "blur(4px)" },
visible: { opacity: 1, y: 0, filter: "blur(0px)" },
}}
>
A description of the page.
</motion.p>
<motion.div
variants={{
hidden: { opacity: 0, y: 12, filter: "blur(4px)" },
visible: { opacity: 1, y: 0, filter: "blur(0px)" },
}}
>
<Button>Get started</Button>
</motion.div>
</motion.div>
);
}
```
### CSS-Only Stagger
```css
.stagger-item {
opacity: 0;
transform: translateY(12px);
filter: blur(4px);
animation: fadeInUp 400ms ease-out forwards;
}
.stagger-item:nth-child(1) { animation-delay: 0ms; }
.stagger-item:nth-child(2) { animation-delay: 100ms; }
.stagger-item:nth-child(3) { animation-delay: 200ms; }
@keyframes fadeInUp {
to {
opacity: 1;
transform: translateY(0);
filter: blur(0);
}
}
```
## Exit Animations
Exit animations should be softer and less attention-grabbing than enter animations. The user's focus is moving to the next thing — don't fight for attention.
### Subtle Exit (Recommended)
```tsx
// Small fixed translateY — indicates direction without drama
<motion.div
exit={{
opacity: 0,
y: -12,
filter: "blur(4px)",
transition: { duration: 0.15, ease: "easeOut" },
}}
>
{content}
</motion.div>
```
### Full Exit (When Context Matters)
```tsx
// Slide fully out — use when spatial context is important
// (e.g., a card returning to a list, a drawer closing)
<motion.div
exit={{
opacity: 0,
x: "-100%",
transition: { duration: 0.2, ease: "easeOut" },
}}
>
{content}
</motion.div>
```
### Good vs. Bad
```css
/* Good — subtle exit */
.item-exit {
opacity: 0;
transform: translateY(-12px);
transition: opacity 150ms ease-out, transform 150ms ease-out;
}
/* Bad — dramatic exit that steals focus */
.item-exit {
opacity: 0;
transform: translateY(-100%) scale(0.5);
transition: all 400ms ease-out;
}
/* Sometimes correct — remove immediately when motion adds no context */
.item-exit {
display: none;
}
```
**Key points:**
- Use a small fixed `translateY` (e.g., `-12px`) instead of the full container height
- Keep some directional movement to indicate where the element went
- Exit duration should be shorter than enter duration (150ms vs 300ms)
- Use a subtle exit when it preserves spatial context. Remove immediately when motion adds no information, the interaction repeats frequently, or reduced motion is requested.
## Contextual Icon Animations
When icons appear or disappear contextually (on hover, on state change), animate them with `opacity`, `scale`, and `blur` rather than just toggling visibility.
### Motion Example
This example uses the `motion` package. If the project instead has `framer-motion`, import the same APIs from `"framer-motion"`; never mix an installed package with the other package's import path.
```tsx
import { AnimatePresence, motion } from "motion/react";
function IconButton({ isActive, icon: Icon }) {
return (
<button>
<AnimatePresence mode="popLayout">
<motion.span
key={isActive ? "active" : "inactive"}
initial={{ opacity: 0, scale: 0.25, filter: "blur(4px)" }}
animate={{ opacity: 1, scale: 1, filter: "blur(0px)" }}
exit={{ opacity: 0, scale: 0.25, filter: "blur(4px)" }}
transition={{ type: "spring", duration: 0.3, bounce: 0 }}
>
<Icon />
</motion.span>
</AnimatePresence>
</button>
);
}
```
### CSS Transition Approach (No Motion)
If the project doesn't use Motion (Framer Motion), keep both icons in the DOM and cross-fade them with CSS transitions. Because neither icon unmounts, both enter and exit animate smoothly.
The trick: one icon is absolutely positioned on top of the other. Toggling state cross-fades them — the entering icon scales up from `0.25` while the exiting icon scales down to `0.25`, both with opacity and blur.
```tsx
function IconButton({ isActive, ActiveIcon, InactiveIcon }) {
return (
<button>
<div className="relative">
<div
className={cn(
"absolute inset-0 flex items-center justify-center",
"transition-[opacity,filter,scale] duration-300",
"ease-[cubic-bezier(0.2,0,0,1)]",
isActive
? "scale-100 opacity-100 blur-0"
: "scale-[0.25] opacity-0 blur-[4px]"
)}
>
<ActiveIcon />
</div>
<div
className={cn(
"transition-[opacity,filter,scale] duration-300",
"ease-[cubic-bezier(0.2,0,0,1)]",
isActive
? "scale-[0.25] opacity-0 blur-[4px]"
: "scale-100 opacity-100 blur-0"
)}
>
<InactiveIcon />
</div>
</div>
</button>
);
}
```
The non-absolute icon (InactiveIcon) defines the layout size. The absolute icon (ActiveIcon) overlays it without affecting flow.
### Choosing Between Motion and CSS
| | Motion (Framer Motion) | CSS transitions (both icons in DOM) |
| --- | --- | --- |
| **Enter animation** | Yes | Yes |
| **Exit animation** | Yes (via `AnimatePresence`) | Yes (cross-fade — icon never unmounts) |
| **Spring physics** | Yes | No — use `cubic-bezier(0.2, 0, 0, 1)` as approximation |
| **When to use** | Project already uses `motion` or `framer-motion` | No motion dependency, or keeping bundle small |
**Rule:** Check the project's `package.json`. Import from `"motion/react"` when `motion` is installed, or from `"framer-motion"` when `framer-motion` is installed. If both exist, follow the imports already used by the component or its nearest peers. If neither is present, use the CSS cross-fade pattern — don't add a dependency just for icon transitions.
### When to Animate Icons
| Animate | Don't animate |
| --- | --- |
| Icons that appear on hover (action buttons) | Static navigation icons |
| State change icons (play → pause, like → liked) | Decorative icons |
| Icons in contextual toolbars | Icons that are always visible |
| Loading/success state indicators | Icon labels (text next to icon) |
**Important:** Always use exactly these values for contextual icon animations — do not deviate:
- `scale`: `0.25` → `1` (never use `0.5` or `0.6`)
- `opacity`: `0` → `1`
- `filter`: `"blur(4px)"` → `"blur(0px)"`
- `transition`: `{ type: "spring", duration: 0.3, bounce: 0 }` — **bounce must always be `0`**, never `0.1` or any other value
## Scale on Press
A subtle scale-down on click gives buttons tactile feedback. Always use `scale(0.96)`. Never use a value smaller than `0.95` — anything below feels exaggerated. Use CSS transitions for interruptibility — if the user releases mid-press, it should smoothly return.
Not every button needs this. Add a `static` prop to your button component that disables the scale effect when the motion would be distracting.
### CSS Example
```css
.button {
transition-property: scale;
transition-duration: 150ms;
transition-timing-function: ease-out;
}
.button:active {
scale: 0.96;
}
```
### Tailwind Example
```tsx
<button className="transition-transform duration-150 ease-out active:scale-[0.96]">
Click me
</button>
```
### Motion Example
```tsx
<motion.button whileTap={{ scale: 0.96 }}>
Click me
</motion.button>
```
### Static Prop Pattern
Extract the scale class into a variable and conditionally apply it based on a `static` prop:
```tsx
const tapScale = "active:not-disabled:scale-[0.96]";
function Button({ static: isStatic, className, children, ...props }) {
return (
<button
className={cn(
"transition-transform duration-150 ease-out",
!isStatic && tapScale,
className,
)}
{...props}
>
{children}
</button>
);
}
// Usage
<Button>Click me</Button> {/* scales on press */}
<Button static>Submit</Button> {/* no scale */}
```
## Skip Animation on Page Load
Use `initial={false}` on `AnimatePresence` to prevent enter animations from firing on first render. Elements that are already in their default state shouldn't animate in on page load — only on subsequent state changes.
### When It Works
```tsx
// Good — icon doesn't animate in on mount, only on state change
<AnimatePresence initial={false} mode="popLayout">
<motion.span
key={isActive ? "active" : "inactive"}
initial={{ opacity: 0, scale: 0.25, filter: "blur(4px)" }}
animate={{ opacity: 1, scale: 1, filter: "blur(0px)" }}
exit={{ opacity: 0, scale: 0.25, filter: "blur(4px)" }}
>
<Icon />
</motion.span>
</AnimatePresence>
```
Works well for: icon swaps, toggles, tabs, segmented controls — anything that has a default state on page load.
### When It Breaks
Don't use `initial={false}` when the component relies on its `initial` prop to set up a first-time enter animation, like a staggered page hero or a loading state. In those cases, removing the initial animation skips the entire entrance.
```tsx
// Bad — initial={false} would skip the staggered page enter entirely
<AnimatePresence initial={false}>
<motion.div initial="hidden" animate="visible" variants={...}>
...
</motion.div>
</AnimatePresence>
```
Verify the component still looks right on a full page refresh before applying this.
## Motion Restraint
Motion is a budget, not a garnish:
- **No custom animation on high-frequency interactions.** Repeated interactions get instant feedback or a minimal `opacity` or `background-color` transition at ≤150ms.
- **Motion is never the only feedback channel.** Every animated state change also needs a static cue such as color, icon, or label.
- **Brief and precise beats prominent.** If a shorter, smaller animation communicates the same thing, use it.
- **Honor reduced-motion preferences.** Preserve the static cue and remove unnecessary movement.
```css
/* Good: high-frequency hover gets a minimal transition */
.row:hover {
background-color: var(--surface-hover);
transition: background-color 100ms ease-out;
}
/* Bad: every hover replays a full entrance */
.row:hover .row-icon {
animation: bounceIn 500ms;
}
```

View File

@ -0,0 +1,63 @@
# Icons
Icon weight, states, sizing, and direction: the details that make icons sit naturally in an interface.
## Match Icon Stroke to Text Weight
An icon next to text should carry the same optical weight as the text.
| Adjacent text | Icon stroke width (24px grid) |
| --- | --- |
| Regular (400), 14–16px | `1.5px` |
| Medium/Semibold (500–600) | `2px` |
| Bold (700), or emphasized standalone | `2.5px` |
Use one stroke weight per icon set on a surface. Size inline icons relative to the text's cap height, typically `1em`–`1.25em`.
## One SVG, Recolored per State
Use one SVG drawn with `currentColor`; let CSS drive hover, selected, and disabled states. Strip hardcoded `fill` and `stroke` colors when importing icons.
```html
<svg fill="none" stroke="currentColor" stroke-width="2">…</svg>
```
```css
.icon-button { color: oklch(0.552 0.016 285.938); }
.icon-button:hover { color: oklch(0.21 0.006 285.885); }
.icon-button[aria-pressed="true"] { color: oklch(0.623 0.188 259.815); }
.icon-button:disabled { opacity: 0.4; }
```
## Outline Default, Fill Active
| Variant | Use for |
| --- | --- |
| Outline | Default state: toolbars, list rows, inline with text |
| Fill | Selected or active state: active tab, toggled bookmark, liked heart |
The swap between variants is a contextual icon animation; use the exact cross-fade values in [animations.md](animations.md).
## Design at Render Size
- Test every icon at the smallest size it will render, often `16px`.
- Prefer simplified glyphs for small contexts over scaled-down detailed artwork.
- Use the icon set's native grid sizes (`16`, `20`, `24`) rather than arbitrary fractional scales.
- Use SVG rather than raster assets.
## Icons in RTL
| Flip | Don't flip |
| --- | --- |
| Back/forward arrows, navigation chevrons | Logos and brand marks |
| Text alignment, lists, indent | Checkmarks |
| Directional send glyphs | Clocks, cups, pencils |
| Speaker waves tied to reading direction | Media playback controls |
```css
[dir="rtl"] .icon-directional {
scale: -1 1;
}
```
Analyze composite icons part by part: an overlay may keep its position even when the base glyph flips. Give every icon-only control an accessible name and mark purely decorative icons hidden from assistive technology.

View File

@ -0,0 +1,88 @@
# Performance
Transition specificity and GPU compositing hints.
## Transition Only What Changes
Never use `transition: all` or Tailwind's `transition-all`. Always specify the exact properties that change. Tailwind's bare `transition` maps to a curated default list of colors, opacity, shadow, and transforms, not to `all`; still prefer naming exactly what changes.
### Why
- `transition: all` forces the browser to watch every property for changes
- Causes unexpected transitions on properties you didn't intend to animate (colors, padding, shadows)
- Prevents browser optimizations
### CSS Example
```css
/* Good — only transition what changes */
.button {
transition-property: scale, background-color;
transition-duration: 150ms;
transition-timing-function: ease-out;
}
/* Bad — transition everything */
.button {
transition: all 150ms ease-out;
}
```
### Tailwind
```tsx
// Good — explicit properties
<button className="transition-[scale,background-color] duration-150 ease-out">
// Bad — transition all
<button className="transition-all duration-150 ease-out">
```
### Tailwind `transition-transform` Note
`transition-transform` in Tailwind maps to `transition-property: transform, translate, scale, rotate` — it covers all transform-related properties, not just `transform`. Use this when you're only animating transforms. For multiple non-transform properties, use the bracket syntax: `transition-[scale,opacity,filter]`.
## Use `will-change` Sparingly
`will-change` hints the browser to pre-promote an element to its own GPU compositing layer. Without it, the browser promotes the element only when the animation starts — that one-time layer promotion can cause a micro-stutter on the first frame.
This particularly helps when an element is changing `scale`, `rotation`, or moving around with `transform`. For other properties, it doesn't help much — the browser can't composite them on the GPU anyway.
### Rules
```css
/* Good — specific property that benefits from GPU compositing */
.animated-card {
will-change: transform;
}
/* Good — multiple compositor-friendly properties */
.animated-card {
will-change: transform, opacity;
}
/* Bad — never use will-change: all */
.animated-card {
will-change: all;
}
/* Bad — properties that can't be GPU-composited anyway */
.animated-card {
will-change: background-color, padding;
}
```
### Useful Properties
| Property | GPU-compositable | Worth using `will-change` |
| --- | --- | --- |
| `transform` | Yes | Yes |
| `opacity` | Yes | Yes |
| `filter` (blur, brightness) | Yes | Yes |
| `clip-path` | Newer Chromium only | Rarely; not reliable cross-browser |
| `top`, `left`, `width`, `height` | No | No |
| `background`, `border`, `color` | No | No |
### When to Skip
Modern browsers are already good at optimizing on their own. Only add `will-change` when you notice first-frame stutter — Safari in particular benefits from it. Don't add it preemptively to every animated element; each extra compositing layer costs memory.

View File

@ -0,0 +1,256 @@
# Surfaces
Border radius, optical alignment, shadows, and image outlines.
## Concentric Border Radius
When nesting rounded elements, the outer radius must equal the inner radius plus the padding between them:
```
outerRadius = innerRadius + padding
```
This rule is most useful when nested surfaces are close together. If padding is larger than `24px`, treat the layers as separate surfaces and choose each radius independently instead of forcing strict concentric math.
### Example
```css
/* Good — concentric radii */
.card {
border-radius: 20px; /* 12 + 8 */
padding: 8px;
}
.card-inner {
border-radius: 12px;
}
/* Bad — same radius on both */
.card {
border-radius: 12px;
padding: 8px;
}
.card-inner {
border-radius: 12px;
}
```
### Tailwind Example
```tsx
// Good — outer radius accounts for padding
<div className="rounded-2xl p-2"> {/* 16px radius, 8px padding */}
<div className="rounded-lg"> {/* 8px radius = 16 - 8 ✓ */}
...
</div>
</div>
// Bad — same radius on both
<div className="rounded-xl p-2">
<div className="rounded-xl"> {/* same radius, looks off */}
...
</div>
</div>
```
Mismatched border radii on nested elements is one of the most common things that makes interfaces feel off. Always calculate concentrically.
## Optical Alignment
When geometric centering looks off, align optically instead.
### Buttons with Text + Icon
Use slightly less padding on the icon side to make the button feel balanced. A reliable rule of thumb is:
`icon-side padding = text-side padding - 2px`.
```css
/* Good — less padding on icon side */
.button-with-icon {
padding-left: 16px;
padding-right: 14px; /* icon side = text side - 2px */
}
/* Bad — equal padding looks like icon is pushed too far right */
.button-with-icon {
padding: 0 16px;
}
```
```tsx
// Tailwind
<button className="pl-4 pr-3.5 flex items-center gap-2">
<span>Continue</span>
<ArrowRightIcon />
</button>
```
### Play Button Triangles
Play icons are triangular and their geometric center is not their visual center. Shift slightly right:
```css
/* Good — optically centered */
.play-button svg {
margin-left: 2px; /* shift right to account for triangle shape */
}
/* Bad — geometrically centered but looks off */
.play-button svg {
/* no adjustment */
}
```
### Asymmetric Icons (Stars, Arrows, Carets)
Some icons have uneven visual weight. The best fix is adjusting the SVG directly so no extra margin/padding is needed in the component code.
```tsx
// Best — fix in the SVG itself
// Adjust the viewBox or path to visually center the icon
// Fallback — adjust with margin
<span className="ml-px">
<StarIcon />
</span>
```
## Shadows Instead of Borders
For **buttons, cards, and containers** that use a border for depth or elevation, prefer replacing it with a subtle `box-shadow`. Shadows adapt to any background since they use transparency; solid borders don't. This also helps when using images or multiple colors as backgrounds — solid border colors don't work well on backgrounds other than the ones they were designed for.
**Do not apply this to dividers** (`border-b`, `border-t`, side borders) or any border whose purpose is layout separation rather than element depth. Those should stay as borders.
### Shadow as Border (Light Mode)
The shadow is comprised of three layers. The first acts as a 1px border ring, the second adds subtle lift, and the third provides ambient depth:
```css
:root {
--shadow-border:
0px 0px 0px 1px oklch(0 0 0 / 0.06),
0px 1px 2px -1px oklch(0 0 0 / 0.06),
0px 2px 4px 0px oklch(0 0 0 / 0.04);
--shadow-border-hover:
0px 0px 0px 1px oklch(0 0 0 / 0.08),
0px 1px 2px -1px oklch(0 0 0 / 0.08),
0px 2px 4px 0px oklch(0 0 0 / 0.06);
}
```
### Shadow as Border (Dark Mode)
In dark mode, simplify to a single white ring — layered depth shadows aren't visible on dark backgrounds:
```css
/* Dark mode — adapt to whatever setup the project uses
(prefers-color-scheme, class, data attribute, etc.) */
--shadow-border: 0 0 0 1px oklch(1 0 0 / 0.08);
--shadow-border-hover: 0 0 0 1px oklch(1 0 0 / 0.13);
```
### Usage with Hover Transition
Apply the variable and add `transition-[box-shadow]` for a smooth hover:
```css
.card {
box-shadow: var(--shadow-border);
transition-property: box-shadow;
transition-duration: 150ms;
transition-timing-function: ease-out;
}
.card:hover {
box-shadow: var(--shadow-border-hover);
}
```
### When to Use Shadows vs. Borders
| Use shadows | Use borders |
| --- | --- |
| Cards, containers with depth | Dividers between list items |
| Buttons with bordered styles | Table cell boundaries |
| Elevated elements (dropdowns, modals) | Form input outlines (for accessibility) |
| Elements on varied backgrounds | Hairline separators in dense UI |
| Hover/focus states for lift effect | |
## Image Outlines
Add a subtle `1px` outline with low opacity to images. This creates consistent depth, especially in design systems where other elements use borders or shadows.
### Color rules (non-negotiable)
- **Light mode**: pure black, `oklch(0 0 0 / 0.1)`.
- **Dark mode**: pure white, `oklch(1 0 0 / 0.1)`.
- Never use a near-black or near-white from the project palette (e.g. slate-900, zinc-900, `#0a0a0a`, `#111827`, `#f5f5f7`). Tinted outlines pick up the surrounding surface color and read as dirt on the image edge.
- Never match the outline to the project's accent or ink color. The outline is a neutral separator, not a themed element.
### Light Mode
```css
img {
outline: 1px solid oklch(0 0 0 / 0.1);
outline-offset: -1px; /* inset so it doesn't add to layout */
}
```
### Dark Mode
```css
img {
outline: 1px solid oklch(1 0 0 / 0.1);
outline-offset: -1px;
}
```
### Tailwind with Dark Mode
```tsx
<img
className="outline outline-1 -outline-offset-1 outline-black/10 dark:outline-white/10"
src={src}
alt={alt}
/>
```
Use `outline-black/10` and `outline-white/10` specifically — not `outline-slate-*`, `outline-zinc-*`, `outline-neutral-*`, or any tinted scale.
**Why outline instead of border?** `outline` doesn't affect layout (no added width/height), and `outline-offset: -1px` keeps it inset so images stay their intended size.
## Minimum Hit Area
Interactive elements should prefer a 44×44px hit area for touch or mobile contexts. In dense desktop interfaces, use at least 40×40px. If the visible element is smaller (e.g., a 20×20 checkbox), extend the hit area with a pseudo-element.
### CSS Example
```css
/* Small checkbox with expanded 44px hit area */
.checkbox {
position: relative;
width: 20px;
height: 20px;
}
.checkbox::after {
content: "";
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 44px;
height: 44px;
}
```
### Tailwind Example
```tsx
<button className="relative size-5 after:absolute after:top-1/2 after:left-1/2 after:size-11 after:-translate-1/2">
<CheckIcon />
</button>
```
### Collision Rule
If the extended hit area overlaps another interactive element, shrink the pseudo-element — but make it as large as possible without colliding. Two interactive elements should never have overlapping hit areas.

View File

@ -0,0 +1,157 @@
# Typography
Typography rendering details that make interfaces feel better.
## Text Wrapping
### text-wrap: balance
Distributes text evenly across lines, preventing orphaned words on headings and short text blocks. **Only works on blocks of 6 lines or fewer** (Chromium) or 10 lines or fewer (Firefox) — the balancing algorithm is computationally expensive, so browsers limit it to short text.
```css
/* Good — even line lengths on short text */
h1, h2, h3 {
text-wrap: balance;
}
```
```css
/* Bad — default wrapping leaves orphans */
h1 {
/* no text-wrap rule → "Read our
blog" instead of balanced lines */
}
```
```css
/* Bad — balance on long paragraphs (silently ignored, wastes intent) */
.article-body p {
text-wrap: balance;
}
```
**Tailwind:** `text-balance`
### text-wrap: pretty
Prevents orphaned words (a single word dangling on the last line) by adjusting line breaks throughout the paragraph. Unlike `balance`, it doesn't try to equalize line lengths — it just ensures the last line isn't embarrassingly short. Works on text of any length with no line-count limit.
This should be your **default for short-to-medium text** — paragraphs, descriptions, captions, list items, card text. For very long text (10+ lines), skip both `pretty` and `balance` — the browser's default wrapping is fine and you avoid unnecessary layout cost.
```css
/* Good — descriptions, captions, short paragraphs */
p, li, figcaption, blockquote {
text-wrap: pretty;
}
```
```tsx
// Tailwind
<p className="text-pretty">
A short paragraph that won't leave an orphan on the last line.
</p>
```
**Tailwind:** `text-pretty`
### When to Use Which
| Scenario | Use |
| --- | --- |
| Headings, titles where even distribution matters | `text-wrap: balance` |
| Short-to-medium text — paragraphs, descriptions, captions, UI text | `text-wrap: pretty` |
| Long text (10+ lines), code blocks, pre-formatted text | Neither — leave default |
## Font Smoothing (macOS)
On macOS, text renders heavier than intended by default. Apply antialiased smoothing to the root layout so all text renders crisper and thinner.
```css
/* CSS */
html {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
```
```tsx
// Tailwind — apply to root layout
<html className="antialiased">
```
### Good vs. Bad
```css
/* Good — applied once at the root */
html {
-webkit-font-smoothing: antialiased;
}
/* Bad — applied per-element, inconsistent */
.heading {
-webkit-font-smoothing: antialiased;
}
.body {
/* no smoothing → heavier than heading */
}
```
**Note:** This only affects macOS rendering. Other platforms ignore these properties, so it's safe to apply universally.
## Font Family Scope
This skill does not require a specific font family. Do not introduce a paid or proprietary typeface just to satisfy the polish checklist.
Use the product's existing type system unless the task explicitly asks for a type change. If the design calls for a system-native macOS feel, use the system font stack. If the design calls for a commercial face such as Helvetica Now, treat it as an optional brand decision and keep a practical fallback stack.
```css
/* System-native macOS/iOS feel */
html {
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
```
```css
/* Commercial brand face with safe fallbacks */
html {
font-family: "Helvetica Now", "Helvetica Neue", Arial, sans-serif;
}
```
**Rule:** font smoothing, text wrapping, and tabular numbers are rendering details. They do not override the project's chosen font family.
## Tabular Numbers
When numbers update dynamically (counters, prices, timers, table columns), use tabular-nums to make all digits equal width. This prevents layout shift as values change.
```css
/* CSS */
.counter {
font-variant-numeric: tabular-nums;
}
```
```tsx
// Tailwind
<span className="tabular-nums">{count}</span>
```
### When to Use
| Use tabular-nums | Don't use tabular-nums |
| --- | --- |
| Counters and timers | Static display numbers |
| Prices that update | Decorative large numbers |
| Table columns with numbers | Phone numbers, zip codes |
| Animated number transitions | Version numbers (v2.1.0) |
| Scoreboards, dashboards | |
### Caveat
Some fonts (like Inter) change the visual appearance of numerals with this property — specifically, the digit `1` becomes wider and centered. This is expected behavior and usually desirable for alignment, but verify it looks right in your specific font.
```css
/* With Inter font:
Default: 1234 → proportional, "1" is narrow
Tabular: 1234 → all digits equal width, "1" centered */
```

View File

@ -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 @@
<div class="join" id="join">
<form id="form" novalidate>
<label class="sr-only" aria-hidden="true">Company<input id="company" name="company" tabindex="-1" autocomplete="off" /></label>
<div class="seg" role="radiogroup" aria-label="How should we reach you?">
<div class="seg" id="channelSeg" data-channel="sms" role="radiogroup" aria-label="How should we reach you?">
<button type="button" role="radio" aria-selected="true" aria-checked="true" data-ch="sms"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="6" y="2" width="12" height="20" rx="3"/><path d="M11 18h2"/></svg>SMS</button>
<button type="button" role="radio" aria-selected="false" aria-checked="false" data-ch="email"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 6h18v12H3zM3 7l9 6 9-6"/></svg>Email</button>
</div>
@ -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 = `<div class="done" role="status"><div class="tick"><svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7"/></svg></div><div><h3>You're on the list, ${first.replace(/[<>&"]/g, '')}.</h3><p>We'll ${channel === 'sms' ? 'text' : 'email'} you the day classes open.</p></div></div>`;
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 = `<div class="done" role="status"><div class="tick"><svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7"/></svg></div><div><h3>You're on the list, ${first.replace(/[<>&"]/g, '')}.</h3><p>We'll ${channel === 'sms' ? 'text' : 'email'} you the day classes open.</p></div></div>`;
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';
}
});
</script>

View File

@ -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"
}
}
}