/* Avatar motion is its own edge layer. Ornament artwork and the portrait keep
   their shape; every selectable preset works with every ornament. */
.avatar__motion {
  --fm-ink: var(--avatar-fx-1, var(--cat-frame-motions-1, var(--accent, #a8baff)));
  --fm-light: var(--avatar-fx-2, var(--cat-frame-motions-2, var(--accent-2, #b4eeef)));
  display: var(--fm-on, none);
  position: absolute;
  inset: -26%;
  width: 152%;
  height: 152%;
  max-width: none;
  overflow: visible;
  z-index: 4;
  pointer-events: none;
  fill: none;
  stroke-linecap: round;
}
.avatar__motion rect { transform-origin: 50px 50px; }
.avatar__motion .fm-track {
  stroke: var(--fm-ink);
  stroke-width: .45;
  opacity: .22;
}
.avatar__motion .fm-primary {
  stroke: var(--fm-ink);
  stroke-width: var(--fm-width, 1.2);
  stroke-dasharray: var(--fm-dash, 16 84);
  animation: var(--fm-a, none);
}
.avatar__motion .fm-secondary {
  stroke: var(--fm-light);
  stroke-width: .65;
  stroke-dasharray: var(--fm-dash-b, 4 46);
  stroke-dashoffset: 25;
  opacity: .7;
  animation: var(--fm-b, none);
}
.avatar--squircle .avatar__motion .fm-track,
.avatar--squircle .avatar__motion .fm-primary { rx: 24px; }
.avatar--squircle .avatar__motion .fm-secondary { rx: 29px; }
.avatar--square .avatar__motion .fm-track,
.avatar--square .avatar__motion .fm-primary { rx: 7px; }
.avatar--square .avatar__motion .fm-secondary { rx: 12px; }
.avatar-fx-none .avatar__motion { display: none; }

/* Retire motion on hidden legacy primitives and generated ornament images.
   Keeping Still out of this selector preserves each ornament's own motion. */
.avatar[class*="frame-motion-"]:not(.frame-motion-none) .avatar__fx,
.avatar[class*="frame-motion-"]:not(.frame-motion-none) .avatar__fx::before,
.avatar[class*="frame-motion-"]:not(.frame-motion-none) .avatar__fx::after {
  animation: none;
  transform: none;
  transform-origin: center;
  translate: none;
  rotate: none;
  scale: none;
}
.avatar[class*="frame-motion-"]:not(.frame-motion-none) .avatar__fx > * { animation: none; }
.avatar[class*="frame-motion-"]:not(.frame-motion-none) .avatar__fx-beam { display: none; }

/* Presets use independent inner and outer tracks, measured in path lengths.
   Dash travel follows square and squircle corners without rotating the frame. */
.avatar.frame-motion-breatheSlow { --fm-on: block; --fm-dash: 100; --fm-dash-b: 2 23; --fm-a: fm2-breathe 4.8s ease-in-out infinite; --fm-b: fm2-breathe-edge 4.8s ease-in-out infinite; }
.avatar.frame-motion-sway { --fm-on: block; --fm-dash: 30 20; --fm-dash-b: 5 45; --fm-a: fm2-sway 4s ease-in-out infinite; --fm-b: fm2-counter-sway 4s ease-in-out infinite; }
.avatar.frame-motion-tick { --fm-on: block; --fm-dash: 2 23; --fm-dash-b: 1 9; --fm-a: fm2-tick 4s steps(8,end) infinite; --fm-b: fm2-forward 12s steps(24,end) infinite; }
.avatar.frame-motion-drift { --fm-on: block; --fm-dash: 24 76; --fm-dash-b: 8 92; --fm-a: fm2-forward 9s linear infinite; --fm-b: fm2-backward 14s linear infinite; }
.avatar.frame-motion-causticBreathe { --fm-on: block; --fm-dash: 12 8 4 26; --fm-dash-b: 16 9; --fm-a: fm2-caustic 5s ease-in-out infinite; --fm-b: fm2-backward 8s linear infinite; }
.avatar.frame-motion-scanSweep { --fm-on: block; --fm-dash: 3 97; --fm-dash-b: 1 99; --fm-a: fm2-forward 2.8s linear infinite; --fm-b: fm2-forward 2.8s linear infinite; }
.avatar.frame-motion-giltTurn { --fm-on: block; --fm-dash: 28 72; --fm-dash-b: 2 48; --fm-a: fm2-metal 6s ease-in-out infinite; --fm-b: fm2-forward 12s linear infinite; }
.avatar.frame-motion-haloDrift { --fm-on: block; --fm-dash: 42 58; --fm-dash-b: 18 82; --fm-a: fm2-forward 8s linear infinite; --fm-b: fm2-backward 11s linear infinite; }
.avatar.frame-motion-orbSlow { --fm-on: block; --fm-dash: 1 99; --fm-dash-b: 1 99; --fm-a: fm2-forward 7s linear infinite; --fm-b: fm2-backward 12s linear infinite; }
.avatar.frame-motion-gapBreathe { --fm-on: block; --fm-dash: 24 1; --fm-dash-b: 8 17; --fm-a: fm2-gap 4.2s ease-in-out infinite; --fm-b: fm2-breathe-edge 4.2s ease-in-out infinite; }
.avatar.frame-motion-lineMarch { --fm-on: block; --fm-dash: 3 3.25; --fm-dash-b: 1 5.25; --fm-a: fm2-forward 4s linear infinite; --fm-b: fm2-backward 6s linear infinite; }
.avatar.frame-motion-softPulse { --fm-on: block; --fm-dash: 100; --fm-dash-b: 100; --fm-a: fm2-soft 3.4s ease-in-out infinite; --fm-b: fm2-soft-echo 3.4s ease-in-out infinite; }
.avatar.frame-motion-rimShift { --fm-on: block; --fm-dash: 35 15; --fm-dash-b: 10 40; --fm-a: fm2-rim 4.6s ease-in-out infinite; --fm-b: fm2-counter-sway 4.6s ease-in-out infinite; }
.avatar.frame-motion-gather { --fm-on: block; --fm-dash: 5 20; --fm-dash-b: 2 23; --fm-a: fm2-gather 3.8s ease-in-out infinite; --fm-b: fm2-gather-echo 3.8s ease-in-out infinite; }
.avatar.frame-motion-etchTurn { --fm-on: block; --fm-dash: .8 3.2; --fm-dash-b: 3 22; --fm-a: fm2-forward 5s steps(25,end) infinite; --fm-b: fm2-backward 10s steps(8,end) infinite; }
.avatar.frame-motion-gutterBreathe { --fm-on: block; --fm-dash: 16 34; --fm-dash-b: 1 49; --fm-a: fm2-gutter 4s ease-in-out infinite; --fm-b: fm2-soft-echo 4s ease-in-out infinite; }
.avatar.frame-motion-stitchTick { --fm-on: block; --fm-dash: 1 3; --fm-dash-b: .5 3.5; --fm-a: fm2-forward 3.2s steps(25,end) infinite; --fm-b: fm2-backward 6.4s steps(25,end) infinite; }
.avatar.frame-motion-foldCrease { --fm-on: block; --fm-dash: 24 26; --fm-dash-b: 12 38; --fm-a: fm2-fold 4.4s ease-in-out infinite; --fm-b: fm2-counter-sway 4.4s ease-in-out infinite; }
.avatar.frame-motion-pressRoll { --fm-on: block; --fm-dash: 6 94; --fm-dash-b: 25 75; --fm-a: fm2-roll 3.8s ease-in-out infinite; --fm-b: fm2-backward 7.6s linear infinite; }
.avatar.frame-motion-caseSweep { --fm-on: block; --fm-dash: 18 82; --fm-dash-b: 2 48; --fm-a: fm2-case 4.8s ease-in-out infinite; --fm-b: fm2-forward 9.6s linear infinite; }
.avatar.frame-motion-plinthRise { --fm-on: block; --fm-dash: 45 5; --fm-dash-b: 20 30; --fm-a: fm2-rise 4s ease-in-out infinite; --fm-b: fm2-rise-echo 4s ease-in-out infinite; }
.avatar.frame-motion-matSettle { --fm-on: block; --fm-dash: 2 23; --fm-dash-b: 6 19; --fm-a: fm2-settle 5s ease-in-out infinite; --fm-b: fm2-soft-echo 5s ease-in-out infinite; }
.avatar.frame-motion-pinRock { --fm-on: block; --fm-dash: 8 42; --fm-dash-b: 1 99; --fm-a: fm2-rock 4.2s ease-in-out infinite; --fm-b: fm2-counter-sway 4.2s ease-in-out infinite; }
.avatar.frame-motion-flareDrift { --fm-on: block; --fm-dash: 1 99; --fm-dash-b: 14 86; --fm-a: fm2-flare 4s linear infinite; --fm-b: fm2-backward 8s linear infinite; }
.avatar.frame-motion-lensBreathe { --fm-on: block; --fm-dash: 100; --fm-dash-b: 1 11.5; --fm-a: fm2-lens 4.8s ease-in-out infinite; --fm-b: fm2-lens-edge 4.8s ease-in-out infinite; }
.avatar.frame-motion-spectrumRun { --fm-on: block; --fm-dash: 16 9; --fm-dash-b: 8 17; --fm-a: fm2-spectrum 4s linear infinite; --fm-b: fm2-backward 6s linear infinite; }
.avatar.frame-motion-haloPulse { --fm-on: block; --fm-dash: 100; --fm-dash-b: 100; --fm-a: fm2-halo 3s ease-out infinite; --fm-b: fm2-halo 3s 1.5s ease-out infinite; }
.avatar.frame-motion-ventCycle { --fm-on: block; --fm-dash: 5 7.5; --fm-dash-b: 2 10.5; --fm-a: fm2-vent 3.6s ease-in-out infinite; --fm-b: fm2-backward 7.2s steps(8,end) infinite; }
.avatar.frame-motion-signalRun { --fm-on: block; --fm-dash: 1 2 1 2 6 88; --fm-dash-b: 2 98; --fm-a: fm2-forward 2.4s linear infinite; --fm-b: fm2-backward 4.8s linear infinite; }
.avatar.frame-motion-meshBreathe { --fm-on: block; --fm-dash: 1 1.5; --fm-dash-b: 1 1.5; --fm-a: fm2-mesh 4.6s ease-in-out infinite; --fm-b: fm2-backward 9.2s linear infinite; }
.avatar.frame-motion-scanLock { --fm-on: block; --fm-dash: 8 17; --fm-dash-b: 1 24; --fm-a: fm2-lock 4s ease-in-out infinite; --fm-b: fm2-lock-echo 4s ease-in-out infinite; }
.avatar.frame-motion-gildShine { --fm-on: block; --fm-dash: 36 64; --fm-dash-b: 3 47; --fm-a: fm2-gild 5.6s ease-in-out infinite; --fm-b: fm2-forward 11.2s linear infinite; }
.avatar.frame-motion-onyxSheen { --fm-on: block; --fm-dash: 16 84; --fm-dash-b: 2 98; --fm-a: fm2-onyx 6s ease-in-out infinite; --fm-b: fm2-backward 12s linear infinite; }
.avatar.frame-motion-inlayGlow { --fm-on: block; --fm-dash: 8 4.5; --fm-dash-b: 2 10.5; --fm-a: fm2-inlay 4s ease-in-out infinite; --fm-b: fm2-soft-echo 4s ease-in-out infinite; }
.avatar.frame-motion-crestLift { --fm-on: block; --fm-dash: 12 88; --fm-dash-b: 3 97; --fm-a: fm2-crest 4.4s ease-in-out infinite; --fm-b: fm2-forward 8.8s linear infinite; }

@keyframes fm2-forward { to { stroke-dashoffset: -100; } }
@keyframes fm2-backward { to { stroke-dashoffset: 125; } }
@keyframes fm2-breathe {
  0%,100% { transform: scale(.985); opacity: .5; stroke-width: .8; }
  50% { transform: scale(1.025); opacity: 1; stroke-width: 1.6; }
}
@keyframes fm2-breathe-edge { 0%,100% { opacity: .25; } 50% { opacity: .85; stroke-dashoffset: 32; } }
@keyframes fm2-sway { 0%,100% { stroke-dashoffset: -10; } 50% { stroke-dashoffset: 10; } }
@keyframes fm2-counter-sway { 0%,100% { stroke-dashoffset: 35; } 50% { stroke-dashoffset: 15; } }
@keyframes fm2-tick { to { stroke-dashoffset: -25; } }
@keyframes fm2-caustic {
  0%,100% { stroke-dashoffset: 0; stroke-width: .8; opacity: .55; }
  45% { stroke-dashoffset: -18; stroke-width: 2; opacity: 1; }
  75% { stroke-dashoffset: -35; stroke-width: 1; opacity: .7; }
}
@keyframes fm2-metal {
  0%,100% { stroke-dashoffset: 0; stroke: var(--fm-ink); }
  50% { stroke-dashoffset: -50; stroke: #fff2d4; }
}
@keyframes fm2-gap { 0%,100% { stroke-dasharray: 24 1; opacity: .65; } 50% { stroke-dasharray: 12 13; opacity: 1; } }
@keyframes fm2-soft { 0%,100% { opacity: .4; stroke-width: .8; } 45% { opacity: 1; stroke-width: 1.8; } }
@keyframes fm2-soft-echo { 0%,30%,100% { opacity: .15; } 70% { opacity: .85; } }
@keyframes fm2-rim { 0%,100% { stroke-dashoffset: 0; } 50% { stroke-dashoffset: -25; } }
@keyframes fm2-gather {
  0%,100% { stroke-dasharray: 2 23; stroke-width: 1.6; }
  50% { stroke-dasharray: 24 1; stroke-width: .9; }
}
@keyframes fm2-gather-echo { 0%,100% { transform: scale(1); opacity: .8; } 50% { transform: scale(.97); opacity: .3; } }
@keyframes fm2-gutter { 0%,100% { stroke-dashoffset: 0; stroke-width: .7; } 50% { stroke-dashoffset: -8; stroke-width: 2.2; } }
@keyframes fm2-fold { 0%,100% { stroke-dashoffset: 0; opacity: .9; } 50% { stroke-dashoffset: -12; opacity: .4; stroke-dasharray: 8 42; } }
@keyframes fm2-roll { 0% { stroke-dashoffset: 0; stroke-width: .8; } 50% { stroke-width: 2.8; } 100% { stroke-dashoffset: -100; stroke-width: .8; } }
@keyframes fm2-case { 0% { stroke-dashoffset: 0; opacity: .35; } 40% { opacity: 1; stroke: #f0fbff; } 100% { stroke-dashoffset: -100; opacity: .35; } }
@keyframes fm2-rise { 0%,100% { transform: translateY(1px); opacity: .55; } 50% { transform: translateY(-1px); opacity: 1; } }
@keyframes fm2-rise-echo { 0%,100% { transform: translateY(1px); opacity: .2; } 50% { transform: translateY(-2px); opacity: .8; } }
@keyframes fm2-settle {
  0%,100% { stroke-dashoffset: 4; opacity: .45; }
  30% { stroke-dashoffset: -1; opacity: 1; }
  42%,78% { stroke-dashoffset: 0; opacity: 1; }
}
@keyframes fm2-rock { 0%,100% { stroke-dashoffset: -3; } 35% { stroke-dashoffset: 6; } 65% { stroke-dashoffset: -6; } }
@keyframes fm2-flare { 0% { stroke-dashoffset: 0; stroke-width: 1.5; } 50% { stroke-width: 3; } 100% { stroke-dashoffset: -100; stroke-width: 1.5; } }
@keyframes fm2-lens { 0%,100% { transform: scale(.985); stroke-width: .6; opacity: .5; } 50% { transform: scale(1.015); stroke-width: 1.4; opacity: 1; } }
@keyframes fm2-lens-edge { 0%,100% { transform: scale(1); stroke-dashoffset: 25; } 50% { transform: scale(.98); stroke-dashoffset: 19; } }
@keyframes fm2-spectrum {
  0% { stroke-dashoffset: 0; stroke: var(--fm-ink); }
  50% { stroke: var(--fm-light); }
  100% { stroke-dashoffset: -100; stroke: var(--fm-ink); }
}
@keyframes fm2-halo { 0% { transform: scale(.98); opacity: .15; stroke-width: .6; } 35% { opacity: .9; stroke-width: 1.2; } 100% { transform: scale(1.055); opacity: .15; stroke-width: .6; } }
@keyframes fm2-vent { 0%,100% { stroke-dasharray: 2 10.5; stroke-dashoffset: 0; } 50% { stroke-dasharray: 10 2.5; stroke-dashoffset: -12.5; } }
@keyframes fm2-mesh { 0%,100% { stroke-width: .5; stroke-dashoffset: 0; } 50% { stroke-width: 1.3; stroke-dashoffset: -10; } }
@keyframes fm2-lock {
  0% { stroke-dashoffset: 12.5; opacity: .5; }
  35% { stroke-dashoffset: -4; opacity: 1; }
  48%,78% { stroke-dashoffset: 0; stroke-width: 1.8; opacity: 1; }
  100% { stroke-dashoffset: 12.5; opacity: .5; }
}
@keyframes fm2-lock-echo { 0%,100% { stroke-dashoffset: -12.5; opacity: .35; } 48%,78% { stroke-dashoffset: 0; opacity: 1; } }
@keyframes fm2-gild { 0% { stroke-dashoffset: 0; stroke: var(--fm-ink); stroke-width: 1; } 50% { stroke: #fff1cc; stroke-width: 1.8; } 100% { stroke-dashoffset: -100; stroke: var(--fm-ink); stroke-width: 1; } }
@keyframes fm2-onyx { 0% { stroke-dashoffset: 0; opacity: .35; } 50% { stroke: #e4e8f3; opacity: .95; } 100% { stroke-dashoffset: -100; opacity: .35; } }
@keyframes fm2-inlay { 0%,100% { stroke-dashoffset: 0; opacity: .45; } 50% { stroke-dashoffset: -12.5; opacity: 1; stroke-width: 1.8; } }
@keyframes fm2-crest { 0%,100% { stroke-dashoffset: 6; transform: translateY(0); opacity: .6; } 50% { stroke-dashoffset: 0; transform: translateY(-1.5px); opacity: 1; stroke-width: 1.8; } }

/* Keep the outline as a static detail on reduced-motion and slow devices. */
html[data-motion="low"] .avatar__motion *,
html.is-slow-device .avatar__motion * { animation: none !important; }
html[data-motion="low"] html .avatar__motion * {
  animation: none !important;
}

