feat(insights): premium animated wellness-score rings

Rebuild the wellness-score strip on /insights as a signature, high-end moment
instead of a flat dial.

- Five distinct per-metric hues — readiness green, recovery teal, sleep
  indigo-blue, stress amber, strain violet — hand-tuned per theme so each holds
  contrast on the white light-mode card. Fixes the dark-theme collapse to a
  cyan/green wash (the semantic info token resolved to the same cyan as three
  rings) and the light-theme wash-out of the raw cyan on white.
- A spring-eased arc sweep that overshoots ~6% then settles, a left-to-right
  staggered reveal with each number trailing its own arc, a conic specular
  sheen that sweeps once, a token-tinted bloom (a gentle breathing pulse only
  on a top-band ring), a segmented instrument-style track, and a faint
  film-grain tile surface for material depth.
- A "vs your normal" ghost arc under the live arc for recovery, stress and
  strain, derived from the trailing score series already on the payload, so the
  user sees today against their baseline at a glance.

The reveal plays once per browser session (sessionStorage-gated) so a
background sync refetch never re-triggers it. All motion is CSS-first — no
animation dependency, @property + a sampled linear() spring — and is fully
disabled under prefers-reduced-motion. The arc stays a hand-rolled SVG gauge;
the band semantic still rides data-band + the band word + the aria-label, never
colour alone.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Marc-André BombeckandClaude Opus 4.8 committed 2026-06-05 23:40:00 +02:00
1 parent 4a31ce41b2
commit 20d7187b0d
5 files changed
+508 -114

No files matched your search

+233 -2
View File
@@ -208,6 +208,36 @@
*/
--dose-accent: oklch(0.714 0.203 305.504);
/*
* v1.14.0 — wellness-ring per-metric gradients (Dracula dark).
* Five DISTINCT single-hue two-stop arcs (from = darker, to = lighter):
* readiness green · recovery teal · sleep indigo-blue · stress amber ·
* strain violet. Vivid on the dark `--card`. Each `to` doubles as the
* ring's bloom colour. The Alucard light set lives on `:root.light`.
*/
--ring-readiness-from: #1f9d57;
--ring-readiness-to: #5cf08f;
--tile-readiness: #50fa7b;
--ring-recovery-from: #0e9e94;
--ring-recovery-to: #4ff0d2;
--tile-recovery: #8be9fd;
--ring-sleep-from: #4f6ef0;
--ring-sleep-to: #8fb4ff;
--tile-sleep: #6f8bff;
--ring-stress-from: #e0922f;
--ring-stress-to: #ffce6b;
--tile-stress: #ffb86c;
--ring-strain-from: #8f6bf0;
--ring-strain-to: #c4a8ff;
--tile-strain: #bd93f9;
/* Band fallback (anatomy detail view, no per-metric hue). */
--ring-green-from: #1f9d57;
--ring-green-to: #5cf08f;
--ring-yellow-from: #e0922f;
--ring-yellow-to: #ffce6b;
--ring-red-from: #c93a2a;
--ring-red-to: #ff7a6b;
color-scheme: dark;
}
@@ -253,6 +283,35 @@
--sidebar-border: #cfcfde;
--sidebar-ring: #644ac9;
/*
* v1.14.0 — wellness-ring per-metric gradients (Alucard light). DEEPER +
* more saturated than the dark set so each hue holds AA-grade presence on
* the white `--card` (raw Dracula cyan/green wash out on white). Same five
* distinct hues: readiness green · recovery teal · sleep royal-blue ·
* stress amber · strain violet.
*/
--ring-readiness-from: #0f7a3a;
--ring-readiness-to: #18a34e;
--tile-readiness: #14720a;
--ring-recovery-from: #07857c;
--ring-recovery-to: #12b3a3;
--tile-recovery: #0a8f86;
--ring-sleep-from: #2d5fc4;
--ring-sleep-to: #4f7ae0;
--tile-sleep: #2d5fc4;
--ring-stress-from: #b06a16;
--ring-stress-to: #d68a2a;
--tile-stress: #a34d14;
--ring-strain-from: #6b4fd0;
--ring-strain-to: #8a6ff0;
--tile-strain: #644ac9;
--ring-green-from: #0f7a3a;
--ring-green-to: #18a34e;
--ring-yellow-from: #b06a16;
--ring-yellow-to: #d68a2a;
--ring-red-from: #a3271a;
--ring-red-to: #cb3a2a;
/*
* Status-pill text in light mode (Alucard). The bright Dracula
* green / orange / red read 1.2–2.7:1 on a near-white tint; these
@@ -399,6 +458,8 @@
*/
.wellness-tile {
--tile-hue: var(--dracula-purple);
position: relative;
overflow: hidden;
background: linear-gradient(
140deg,
color-mix(in srgb, var(--tile-hue) 14%, var(--card)) 0%,
@@ -406,10 +467,180 @@
);
border: 1px solid color-mix(in srgb, var(--tile-hue) 22%, transparent);
box-shadow: 0 10px 30px -26px color-mix(in srgb, var(--tile-hue) 40%, transparent);
transition:
transform 200ms cubic-bezier(0.22, 0.61, 0.36, 1),
box-shadow 200ms cubic-bezier(0.22, 0.61, 0.36, 1),
border-color 200ms cubic-bezier(0.22, 0.61, 0.36, 1);
}
.wellness-tile:hover {
border-color: color-mix(in srgb, var(--tile-hue) 38%, transparent);
/*
* Faint static film-grain over the tile — lifts the flat CSS gradient to a
* "material" surface (the Oura touch). Inline SVG fractalNoise data-URI, zero
* network cost, one paint, no animation (reduced-motion-safe by construction).
* Opacity kept <=3% so it never reads as dirty on the white Alucard card.
*/
.wellness-tile::after {
content: "";
position: absolute;
inset: 0;
border-radius: inherit;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
opacity: 0.025;
mix-blend-mode: overlay;
pointer-events: none;
}
@media (hover: hover) {
.wellness-tile:hover {
transform: translateY(-2px);
border-color: color-mix(in srgb, var(--tile-hue) 38%, transparent);
box-shadow: 0 16px 40px -24px color-mix(in srgb, var(--tile-hue) 52%, transparent);
}
.wellness-tile:hover [data-slot="score-ring"] {
transform: scale(1.015);
}
}
.wellness-tile:active {
transform: translateY(0) scale(0.985);
}
/*
* v1.14.0 — the wellness-strip "signature reveal" motion system.
*
* The whole moment plays ONCE per session (the strip toggles
* `data-revealed="true"` once, gated on a sessionStorage flag) so a
* background Apple-Health-sync refetch never re-triggers it. Three layers:
* 1. tile rise+fade (staggered left-to-right by an inline animation-delay),
* 2. the ring's spring-fill arc sweep (in score-ring.tsx, --ring-spring),
* 3. a conic SHEEN that sweeps the arc once (the "expensive" specular touch).
* A single prefers-reduced-motion block at the bottom zeroes all of it.
*/
@property --shimmer-angle {
syntax: "<angle>";
inherits: false;
initial-value: 0deg;
}
:root {
/* Sampled spring (stiffness ~120, damping ~14): overshoots ~6% then settles
— the Oura/WHOOP fill feel. Falls back to the browser default on very old
engines that ignore linear() (instant fill, not broken). */
--ring-spring: linear(
0, 0.06, 0.23, 0.46, 0.7, 0.89, 1.02, 1.06, 1.03, 1, 0.99, 1
);
--ring-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}
.wellness-tile-rise {
opacity: 0;
transform: translateY(10px);
}
[data-revealed="true"] .wellness-tile-rise {
animation: wellnessTileRise 440ms var(--ring-ease) forwards;
animation-delay: var(--reveal-delay, 0ms);
}
@keyframes wellnessTileRise {
to {
opacity: 1;
transform: translateY(0);
}
}
/* The conic sheen overlay sits over the ring; opacity animates from 0 so a
browser without @property support (Safari <16.4 / FF <128) shows nothing
rather than a frozen highlight band. */
.wellness-ring-sheen {
position: absolute;
inset: 6%;
border-radius: 50%;
opacity: 0;
background: radial-gradient(
circle at 50% 50%,
color-mix(in srgb, var(--card-foreground) 70%, transparent) 0%,
transparent 70%
);
mix-blend-mode: overlay;
pointer-events: none;
-webkit-mask: conic-gradient(
from var(--shimmer-angle),
transparent 0deg,
transparent 38deg,
#000 58deg,
transparent 80deg,
transparent 360deg
);
mask: conic-gradient(
from var(--shimmer-angle),
transparent 0deg,
transparent 38deg,
#000 58deg,
transparent 80deg,
transparent 360deg
);
}
[data-revealed="true"] .wellness-ring-sheen {
animation: ringSheen 1500ms var(--ring-ease) forwards;
animation-delay: calc(var(--reveal-delay, 0ms) + 550ms);
}
@keyframes ringSheen {
0% {
--shimmer-angle: 0deg;
opacity: 0;
}
15% {
opacity: 0.5;
}
85% {
opacity: 0.5;
}
100% {
--shimmer-angle: 360deg;
opacity: 0;
}
}
/* Token-tinted bloom behind the progress arc. The breathing pulse runs only
on the strongest (green-band) ring so the strip celebrates a good score
rather than jittering all five. `--ring-glow` is set inline per ring. */
.wellness-ring-arc {
filter: drop-shadow(0 0 3px color-mix(in srgb, var(--ring-glow) 45%, transparent));
}
.wellness-ring-arc--pulse {
animation: ringGlow 3.4s ease-in-out 2s infinite;
}
@keyframes ringGlow {
0%,
100% {
filter: drop-shadow(0 0 2px color-mix(in srgb, var(--ring-glow) 40%, transparent));
}
50% {
filter: drop-shadow(0 0 8px color-mix(in srgb, var(--ring-glow) 65%, transparent));
}
}
@media (prefers-reduced-motion: reduce) {
.wellness-tile,
.wellness-tile:hover,
.wellness-tile:active,
.wellness-tile:hover [data-slot="score-ring"] {
transform: none;
transition: none;
}
.wellness-tile-rise,
[data-revealed="true"] .wellness-tile-rise {
opacity: 1;
transform: none;
animation: none;
}
[data-revealed="true"] .wellness-ring-sheen {
animation: none;
opacity: 0;
}
.wellness-ring-arc,
.wellness-ring-arc--pulse {
filter: none;
animation: none;
}
}
/*