/* Motion foundations, loaded in the static <head> of every page (not the helmet), so it
   applies before the first paint: the motion tokens exist before anything animates, the
   page is black from the start, and page transitions are switched on in time for the
   browser to use them. */

/* Motion tokens. Every transition on the site uses one of these four speeds and one of
   the two easing curves. Ambient loops (the scroll hint, the loading bar) keep their own
   lengths. */
:root{
  --dur-quick:200ms;
  --dur-base:400ms;
  --dur-slow:800ms;
  --dur-cinematic:1600ms;
  --ease-out:cubic-bezier(0.16,1,0.3,1);
  --ease-std:cubic-bezier(0.4,0,0.2,1);
}

/* Signal nodes (work/signal.js): a heading marked [data-signal-node] waits in Text Muted until
   the signal reaches it, then turns Text Primary with a green flare that settles into a soft
   glow, so lit and unlit read clearly apart. Its colour is var(--signal-ink) with Text Primary
   as the fallback, so it is never dimmed unless the signal is running. The case study chain
   uses the same flare (hm-ignite) and glow (--signal-glow) on its step titles. */
:root{--signal-glow:0 0 0 rgba(10,255,18,0),0 0 28px rgba(10,255,18,0.22),0 0 0 rgba(10,255,18,0)}
html[data-signal] [data-signal-node]:not([data-lit]){--signal-ink:var(--text-muted)}
html[data-signal] [data-signal-node][data-lit]{text-shadow:var(--signal-glow);animation:hm-ignite var(--dur-cinematic) var(--ease-out)}
@keyframes hm-ignite{
  0%{text-shadow:0 0 0 rgba(10,255,18,0),0 0 0 rgba(10,255,18,0),0 0 0 rgba(10,255,18,0)}
  12%{text-shadow:0 0 2px rgba(10,255,18,0.9),0 0 18px rgba(10,255,18,0.8),0 0 56px rgba(10,255,18,0.5)}
  100%{text-shadow:var(--signal-glow)}
}

/* The signal's pulsing tip (signal.js, opts.tip, on Home): a soft green ring breathing out from
   the head in time with the sculpture's 2.4 s pulse, so the line is alive before any scroll. */
[data-signal-tip]{position:absolute;left:0;top:0;width:0;height:0;pointer-events:none}
[data-signal-tip] span{position:absolute;left:-10px;top:-10px;width:20px;height:20px;border-radius:50%;background:radial-gradient(circle,rgba(10,255,18,0.6),rgba(10,255,18,0.15) 45%,rgba(10,255,18,0) 70%);animation:hm-tip 2400ms cubic-bezier(0.4,0,0.2,1) infinite}
/* The spark a click or tap on the sculpture sends down the signal line (signal.js pulse). */
[data-signal-spark]{position:absolute;left:-4px;top:-4px;width:8px;height:8px;border-radius:50%;background:#0AFF12;box-shadow:0 0 12px 4px rgba(10,255,18,0.55);pointer-events:none;will-change:transform}
@keyframes hm-tip{0%{transform:scale(0.5);opacity:1}70%{transform:scale(2.8);opacity:0}100%{transform:scale(2.8);opacity:0}}

/* The canvas colour from the first paint, so moving between pages never flashes white. */
html{background:#000000}

/* Page transitions between site pages. The next page opens over the current one through a
   hexagon growing from the centre. The next page is black until it has built itself, so
   this reads as a hex shutter closing over the old page, and the new page then makes its
   own entrance. Browsers without cross-document view transitions navigate as before. */
@view-transition{navigation:auto}
::view-transition-old(root){animation:hm-shutter-dim var(--dur-slow) var(--ease-std) both}
::view-transition-new(root){animation:hm-shutter var(--dur-slow) cubic-bezier(0.65,0,0.35,1) both}
/* A pointy-top hexagon around the centre. At 85vmax its inner radius clears the corners
   of any viewport; at 0 it is a point. */
@keyframes hm-shutter{
  from{clip-path:polygon(50% 50%,50% 50%,50% 50%,50% 50%,50% 50%,50% 50%)}
  to{clip-path:polygon(50% calc(50% - 85vmax),calc(50% + 73.6vmax) calc(50% - 42.5vmax),calc(50% + 73.6vmax) calc(50% + 42.5vmax),50% calc(50% + 85vmax),calc(50% - 73.6vmax) calc(50% + 42.5vmax),calc(50% - 73.6vmax) calc(50% - 42.5vmax))}
}
@keyframes hm-shutter-dim{to{opacity:0.4}}
@media (prefers-reduced-motion: reduce){
  ::view-transition-group(*),::view-transition-old(*),::view-transition-new(*){animation:none !important}
  [data-signal-tip] span{animation:none !important}
  [data-lit],[data-lit] h3{animation:none !important}
}
