/* Home's small scenes (home-art.js): a strip at the foot of a widget, and a few touches on what's already there (a
   beacon round the SOS icon, a ping on your resort among the favourites and on the closures count). Calm on purpose:
   each scene acts for a few seconds and then rests, each at its own pace and offset (--shift) so they take turns. The
   motion is all CSS, so design/tokens.css's reduced-motion rule and .dash-still (Settings › Animations on Home,
   dashboard.js) stop it, and every still frame is a whole picture. Loops are named ha-* so the page keeps them on its
   clock (dashboard.js), and a widget out of sight is paused (dashboard.css). */

/* ---------- The strip ---------- */
.ha-lane { position: relative; flex: none; height: 60px; margin: 8px -20px -16px; overflow: hidden; pointer-events: none; }
.ha-lane svg { display: block; width: 100%; height: 100%; }
.widget:has(.ha-lane) .widget-mark { display: none; }   /* the scene says what the faint icon in the corner did */

/* Shared pieces: snow, its edge, distant mountains, trees */
.ha-snow { fill: #fff; }   /* the card is the snow; the edge draws the slope */
.ha-edge { fill: none; stroke: #cbd7e6; stroke-width: 1.2; }
.ha-ridge { fill: #e8eef6; }
.ha-pine { fill: #6f9a8b; }

/* ---------- My skiing: the skier (dashboard-skiing.js puts it between the numbers and the buttons) ---------- */
.ha-lane.ha-skier { height: 90px; margin: -2px -18px 0; --ride: 11s; }
.ski-card[data-state="recording"] .ha-skier { --ride: 7.5s; }   /* recording: run after run */
.ha-gate-pole { stroke: #8492a6; stroke-width: 1.6; stroke-linecap: round; }
.ha-gate-flag { fill: var(--sos); }
.ha-track { fill: none; stroke: #a5b8cf; stroke-width: 1.3; stroke-linecap: round; stroke-dasharray: 100 110; stroke-dashoffset: 64.9; }
.ha-ski { fill: none; stroke: #1d1d1f; stroke-width: 1.6; stroke-linecap: round; }
.ha-legs path { fill: none; stroke: #26344d; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.ha-torso { stroke: var(--sos); stroke-width: 4.6; stroke-linecap: round; }
.ha-arm { stroke: #b4241a; stroke-width: 2.2; stroke-linecap: round; }
.ha-pole-l { stroke: #6b7686; stroke-width: 1.1; stroke-linecap: round; }
.ha-helmet { fill: #1d2b44; }
.ha-goggles { fill: #ffb300; }
.ha-speed path { fill: none; stroke: rgb(var(--navy-rgb) / .38); stroke-width: 1.4; stroke-linecap: round; }
.ha-spray circle { fill: #fff; stroke: #9fb4d0; stroke-width: .8; }
/* Still (a paused recording, or no motion): stopped on the slope, upright, with the track behind */
.ha-ride { transform: translate(230.3px, 65.9px) rotate(6.1deg); }
.ha-speed, .ha-spray { opacity: 0; }
.ha-speed { transform-box: fill-box; transform-origin: right center; }
.ha-spray circle { transform-box: fill-box; transform-origin: center; }
/* Moving: stands at the start, pushes off, gains speed all the way down (the keyframes follow the slope's curve, a
   constant acceleration from rest), crouches lower into a tuck as it goes, with speed lines and snow spraying from
   the skis; out of sight on the right, the track fades and the next run starts at the gate */
.ha-skier .ha-ride { animation: ha-ride var(--ride) linear infinite; }
.ha-skier .ha-legs { animation: ha-legs var(--ride) linear infinite; }
.ha-skier .ha-body { animation: ha-body var(--ride) linear infinite; }
.ha-skier .ha-track { animation: ha-track var(--ride) linear infinite; }
.ha-skier .ha-speed { animation: ha-speed var(--ride) linear infinite; }
.ha-skier .ha-spray { animation: ha-spray-on var(--ride) linear infinite; }
.ha-skier .ha-spray circle { animation: ha-puff .5s ease-out var(--d) infinite; }
@keyframes ha-ride {
  0% { transform: translate(34px, 28px) rotate(.5deg); opacity: 1; }
  12% { transform: translate(34px, 28px) rotate(.5deg); }
  14% { transform: translate(35.1px, 28px) rotate(.7deg); }
  16% { transform: translate(38.3px, 28.1px) rotate(1.5deg); }
  18% { transform: translate(43.7px, 28.3px) rotate(3.2deg); }
  20% { transform: translate(51.2px, 28.8px) rotate(5.4deg); }
  22% { transform: translate(60.9px, 30px) rotate(7.8deg); }
  24% { transform: translate(72.6px, 31.8px) rotate(10.1deg); }
  26% { transform: translate(86.3px, 34.5px) rotate(12.1deg); }
  28% { transform: translate(102.1px, 38.1px) rotate(13.6deg); }
  30% { transform: translate(119.9px, 42.6px) rotate(14.6deg); }
  32% { transform: translate(139.7px, 47.9px) rotate(15deg); }
  34% { transform: translate(161.6px, 53.7px) rotate(15deg); }
  36% { transform: translate(185.7px, 59.5px) rotate(10.9deg); }
  38% { transform: translate(212.3px, 63.8px) rotate(7.5deg); }
  40% { transform: translate(241.2px, 67px) rotate(5.5deg); }
  42% { transform: translate(272.4px, 69.6px) rotate(4.2deg); }
  44% { transform: translate(305.7px, 71.8px) rotate(3.2deg); }
  46% { transform: translate(341.3px, 73.5px) rotate(2.5deg); }
  48% { transform: translate(379px, 74.9px) rotate(1.9deg); }
  50% { transform: translate(418.9px, 76.1px) rotate(1.5deg); }
  52% { transform: translate(460.9px, 77px) rotate(1.1deg); }
  54% { transform: translate(505.1px, 77.8px) rotate(.9deg); }
  56% { transform: translate(551.5px, 78.4px) rotate(.7deg); }
  58% { transform: translate(600px, 79px) rotate(.7deg); opacity: 1; }
  59% { transform: translate(600px, 79px) rotate(.7deg); opacity: 0; }
  60%, 86% { transform: translate(34px, 28px) rotate(.5deg); opacity: 0; }
  92%, 100% { transform: translate(34px, 28px) rotate(.5deg); opacity: 1; }
}
/* The legs bend from the feet and the body leans from the hips, dropping as much as the legs bend */
@keyframes ha-legs {
  0%, 9% { transform: none; }
  10.5% { transform: scaleY(.86); }
  12.5% { transform: scaleY(.97); }
  20% { transform: scaleY(.95); }
  44%, 58% { transform: scaleY(.78); }
  60%, 100% { transform: none; }
}
@keyframes ha-body {
  0%, 9% { transform: none; }
  10.5% { transform: translateY(1.7px) rotate(24deg); }   /* the push with the poles */
  12.5% { transform: translateY(.4px) rotate(8deg); }
  20% { transform: translateY(.6px) rotate(14deg); }
  44%, 58% { transform: translateY(2.6px) rotate(40deg); }   /* the tuck */
  60%, 100% { transform: none; }
}
@keyframes ha-track {
  0%, 12% { stroke-dashoffset: 101; opacity: 1; }
  16% { stroke-dashoffset: 99.2; }
  20% { stroke-dashoffset: 97; }
  24% { stroke-dashoffset: 93.2; }
  28% { stroke-dashoffset: 87.9; }
  32% { stroke-dashoffset: 81.1; }
  36% { stroke-dashoffset: 72.8; }
  40% { stroke-dashoffset: 62.9; }
  44% { stroke-dashoffset: 51.6; }
  48% { stroke-dashoffset: 38.8; }
  52% { stroke-dashoffset: 24.4; }
  56% { stroke-dashoffset: 8.5; }
  58% { stroke-dashoffset: 0; }
  66% { opacity: 1; }
  80% { stroke-dashoffset: 0; opacity: 0; }
  81%, 100% { stroke-dashoffset: 101; opacity: 0; }
}
@keyframes ha-speed {
  0%, 26% { opacity: 0; transform: scaleX(.2); }
  36% { opacity: .5; transform: scaleX(.6); }
  46%, 58% { opacity: .9; transform: none; }
  59%, 100% { opacity: 0; transform: scaleX(.2); }
}
@keyframes ha-spray-on { 0%, 22% { opacity: 0; } 34%, 58% { opacity: 1; } 59%, 100% { opacity: 0; } }
@keyframes ha-puff { from { transform: scale(.5); opacity: 1; } to { transform: translate(-10px, -6px) scale(1.6); opacity: 0; } }

/* ---------- Directions: the route draws itself to a pin ---------- */
.ha-route { --shift: -9s; }
.ha-faint { fill: none; stroke: rgb(var(--navy-rgb) / .1); stroke-width: 3; stroke-linecap: round; }
.ha-faint.lift { stroke: rgb(var(--navy-rgb) / .22); stroke-width: 1.2; stroke-dasharray: 1 4; }
.ha-way { fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 100 110; stroke-dashoffset: 0; }
.ha-way.casing { stroke: #fff; stroke-width: 6.5; }
.ha-way:not(.casing) { stroke: var(--accent-map); stroke-width: 3.6; }
.ha-pin path { fill: var(--sos); }
.ha-pin-eye { fill: #fff; }
.ha-ripple { fill: none; stroke: rgb(var(--sos-rgb) / .5); stroke-width: 1.2; opacity: 0; transform-box: fill-box; transform-origin: center; }
.ha-here-halo { fill: rgb(10 132 255 / .18); }
.ha-here-ring { fill: #fff; }
.ha-here { fill: var(--accent-map); }
.ha-route .ha-way { animation: ha-draw 13s linear var(--shift) infinite; }
.ha-route .ha-pin { animation: ha-pin 13s linear var(--shift) infinite; }
.ha-route .ha-ripple { animation: ha-ripple 13s linear var(--shift) infinite; }
@keyframes ha-draw {
  0% { stroke-dashoffset: 101; opacity: 1; }
  6% { stroke-dashoffset: 101; animation-timing-function: cubic-bezier(.45, 0, .55, 1); }
  38%, 86% { stroke-dashoffset: 0; opacity: 1; }
  94% { stroke-dashoffset: 0; opacity: 0; }
  95%, 100% { stroke-dashoffset: 101; opacity: 0; }
}
@keyframes ha-pin {
  0% { transform: translateY(-14px); opacity: 0; }
  38% { transform: translateY(-14px); opacity: 0; animation-timing-function: cubic-bezier(.5, 0, 1, .6); }   /* falling */
  42% { transform: none; opacity: 1; }
  44% { transform: translateY(-3px); }
  46%, 86% { transform: none; opacity: 1; }
  94%, 100% { transform: none; opacity: 0; }
}
@keyframes ha-ripple { 0%, 42% { transform: scale(.3); opacity: 0; } 43% { opacity: .9; } 54%, 100% { transform: scale(1.8); opacity: 0; } }

/* ---------- Friends: the chairlift ---------- */
.ha-lane.ha-chairlift { height: 64px; }
.ha-tower { fill: #a2adbc; }
.ha-tower-arm { stroke: #7d8a9c; stroke-width: 1.6; stroke-linecap: round; }
.ha-cable { fill: none; stroke: #4f5d70; stroke-width: 1; }
.ha-hanger { fill: none; stroke: #5a6678; stroke-width: 1.2; stroke-linejoin: round; stroke-linecap: round; }
.ha-seat { stroke: #3f4b5c; stroke-width: 2.2; stroke-linecap: round; }
.ha-rider-legs { fill: none; stroke: #2c3b57; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.ha-rider-ski { stroke: #1d1d1f; stroke-width: 1.2; stroke-linecap: round; }
.ha-rider-body { fill: none; stroke-width: 3.6; stroke-linecap: round; }
.ha-rider.near .ha-rider-body { stroke: #1f9d55; }
.ha-rider.far .ha-rider-body { stroke: #f2a900; }
.ha-rider.solo .ha-rider-body { stroke: var(--accent-map); }
.ha-rider-head { fill: #1d2b44; }
/* The chairs go up the cable by four chairs a loop (the pattern repeats every four), slowly, swinging a little */
.ha-chairs { animation: ha-lift 44s linear infinite; }
.ha-chair { animation: ha-swing 3.4s ease-in-out var(--d) infinite alternate; }
@keyframes ha-lift { from { transform: none; } to { transform: translate(360px, -26.18px); } }
@keyframes ha-swing { from { transform: rotate(-3deg); } to { transform: rotate(3deg); } }

/* ---------- Offline: tiles into the phone, or the saved map without signal ---------- */
.ha-download { --shift: -6.5s; }
.ha-cloud-rim { fill: #b8c6d8; stroke: #b8c6d8; stroke-width: 3; }
.ha-cloud { fill: #fff; }
.ha-arc { fill: none; stroke: rgb(var(--navy-rgb) / .2); stroke-width: 1.2; stroke-dasharray: 1.5 4; stroke-linecap: round; }
.ha-phone { fill: #fff; stroke: #5d6b80; stroke-width: 1.8; }
.ha-screen { fill: #eef3f9; }
.ha-map { fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-dasharray: 100 110; stroke-dashoffset: 0; }
.ha-map.blue { stroke: var(--piste-blue); }
.ha-map.red { stroke: var(--piste-red); }
.ha-map.green { stroke: var(--piste-green); }
.ha-check circle { fill: #1f9d55; }
.ha-check path { fill: none; stroke: #fff; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ha-check { transform-box: fill-box; transform-origin: center; }
.ha-tile { opacity: 0; }   /* still: the map is on the phone and the tiles are put away */
.ha-tile rect { fill: #fff; stroke: #8ea3be; stroke-width: 1.2; }
.ha-tile path { stroke: var(--piste-blue); stroke-width: 1.3; stroke-linecap: round; }
.ha-download .ha-tile { animation: ha-fly 14s linear calc(var(--d) + var(--shift)) infinite both; }
.ha-download .ha-map { animation: ha-map-in 14s linear calc(var(--d) + var(--shift)) infinite; }
.ha-download .ha-check { animation: ha-check 14s linear var(--shift) infinite; }
/* Along the dotted arc from the cloud into the phone, a little smaller as it goes in */
@keyframes ha-fly {
  0% { transform: translate(114px, 26px) scale(.6); opacity: 0; }
  4% { transform: translate(120px, 22.6px) scale(1); opacity: 1; }
  8% { transform: translate(138.5px, 13.7px) scale(1); }
  12% { transform: translate(167.1px, 8px) scale(1); }
  16% { transform: translate(197.2px, 8.6px) scale(1); }
  20% { transform: translate(226px, 15.3px) scale(1); }
  22% { transform: translate(239.1px, 20.9px) scale(.9); opacity: 1; }
  24%, 100% { transform: translate(251px, 28px) scale(.4); opacity: 0; }
}
@keyframes ha-map-in {
  0%, 23% { stroke-dashoffset: 101; }
  30%, 84% { stroke-dashoffset: 0; opacity: 1; }
  92% { stroke-dashoffset: 0; opacity: 0; }
  93%, 100% { stroke-dashoffset: 101; opacity: 0; }
}
@keyframes ha-check {
  0%, 40% { transform: scale(0); opacity: 0; }
  44% { transform: scale(1.2); opacity: 1; }
  47%, 84% { transform: none; opacity: 1; }
  92%, 100% { transform: none; opacity: 0; }
}
.ha-no-signal { stroke: #8a97a8; stroke-width: 2; stroke-linecap: round; }
.ha-bars rect { fill: none; stroke: #a3afbf; stroke-width: 1; }
.ha-me { fill: var(--accent-map); stroke: #fff; stroke-width: 1.2; }
.ha-offline .ha-me { animation: ha-me 7s ease-in-out infinite alternate; }   /* you, going down the blue piste */
@keyframes ha-me {
  0% { transform: none; }
  25% { transform: translate(3.3px, 4.8px); }
  50% { transform: translate(5.2px, 9.8px); }
  75% { transform: translate(7.6px, 14.3px); }
  100% { transform: translate(12px, 18px); }
}

/* ---------- Lift passes: the gate ---------- */
.ha-gate { --shift: -9s; }
.ha-ground { stroke: #c9d4e2; stroke-width: 1.5; }
.ha-reader { fill: #5b6b80; }
.ha-reader-face { fill: #2b3646; }
.ha-light.red { fill: var(--sos); }
.ha-light.green { fill: #34c759; }
.ha-beep { fill: none; stroke: #34c759; stroke-width: 1.2; opacity: 0; transform-box: fill-box; transform-origin: center; }
.ha-tripod rect { fill: #c3ccd8; stroke: #8996a8; stroke-width: .8; }
.ha-hub { fill: #8996a8; }
.ha-card > rect:first-child { fill: #a4502a; }
.ha-card path { stroke: rgb(255 255 255 / .55); stroke-width: 1.4; }
.ha-card-chip { fill: #f3c969; }
/* Still: the pass at the reader and the light green */
.ha-card { transform: translate(151px, 35px); }
.ha-gate .ha-card { animation: ha-tap 12s linear var(--shift) infinite; }
.ha-gate .ha-light.green { animation: ha-go 12s linear var(--shift) infinite; }
.ha-gate .ha-beep { animation: ha-beep 12s linear var(--shift) infinite; }
.ha-gate .ha-tripod { animation: ha-turn 12s linear var(--shift) infinite; }
@keyframes ha-tap {
  0% { transform: translate(100px, 42px) rotate(-8deg); opacity: 0; }
  5% { transform: translate(108px, 40px) rotate(-8deg); opacity: 1; animation-timing-function: cubic-bezier(.2, .8, .2, 1); }
  18% { transform: translate(151px, 35px) rotate(0deg); }
  21% { transform: translate(153.5px, 34.5px) rotate(3deg); }   /* the tap */
  24%, 34% { transform: translate(151px, 35px) rotate(0deg); opacity: 1; }
  44%, 100% { transform: translate(114px, 41px) rotate(-10deg); opacity: 0; }
}
@keyframes ha-go { 0%, 22% { opacity: 0; } 23%, 66% { opacity: 1; } 70%, 100% { opacity: 0; } }
@keyframes ha-beep { 0%, 22% { transform: scale(.4); opacity: 0; } 23% { opacity: .9; } 34%, 100% { transform: scale(1.7); opacity: 0; } }
@keyframes ha-turn { 0%, 25% { transform: none; animation-timing-function: cubic-bezier(.45, 0, .55, 1); } 36%, 100% { transform: rotate(120deg); } }

/* ---------- Reviews: speech bubbles ---------- */
.ha-talk { --shift: -11s; }
.ha-bubble > path:first-child { fill: #fff; stroke: rgb(245 163 0 / .55); stroke-width: 1.2; stroke-linejoin: round; }
.ha-star { fill: #f5a300; }
.ha-line { fill: none; stroke: #c9d2de; stroke-width: 2.2; stroke-linecap: round; }
.ha-bubble { transform-box: fill-box; transform-origin: 20% 100%; }
.ha-talk .ha-bubble { animation: ha-say 14s linear calc(var(--d) + var(--shift)) infinite both; }
@keyframes ha-say {
  0%, 6% { transform: scale(0); opacity: 0; }
  9% { transform: scale(1.08); opacity: 1; animation-timing-function: ease-out; }
  11% { transform: none; }
  70% { transform: translateY(-2px); opacity: 1; }
  78%, 100% { transform: translateY(-4px); opacity: 0; }
}

/* ---------- Touches on what's there ---------- */
/* SOS: a slow double beacon round the lifebuoy, like an avalanche transceiver's */
.widget.sos .widget-icon { position: relative; }
.widget.sos .widget-icon::before, .widget.sos .widget-icon::after {
  content: ""; position: absolute; inset: 0; border-radius: 12px; border: 2px solid rgb(var(--sos-rgb) / .45);
  opacity: 0; pointer-events: none; animation: ha-beacon 5.2s var(--ease-out) infinite;
}
.widget.sos .widget-icon::after { animation-delay: .45s; }
@keyframes ha-beacon { 0% { transform: none; opacity: .75; } 30%, 100% { transform: scale(1.6); opacity: 0; } }
/* Favourites: your resort's dot pings like your position on the map */
.w-fav-pick.mine .dot { position: relative; }
.w-fav-pick.mine .dot::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; background: rgb(var(--accent-rgb) / .45);
  animation: ha-ping 3.2s var(--ease-out) infinite;
}
@keyframes ha-ping { 0% { transform: none; opacity: .9; } 45%, 100% { transform: scale(3.2); opacity: 0; } }
/* Closures: the count pings now and then while something is closed */
.al-badge { position: relative; }
.al-badge::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; border: 2px solid var(--severe);
  opacity: 0; animation: ha-badge 4.4s var(--ease-out) infinite;
}
@keyframes ha-badge { 0% { transform: none; opacity: .8; } 35%, 100% { transform: scale(1.7, 1.9); opacity: 0; } }

/* ---------- Still ---------- */
/* Reduced motion or Animations on Home off (.dash-still, dashboard.js), and a paused recording: every piece at its own
   place (the skier stopped on the slope, the route drawn, the map on the phone, the pass accepted, the bubbles said) */
.dash-still .ha-lane *, .ski-card[data-state="paused"] .ha-lane * { animation: none !important; }
.dash-still :is(.widget.sos .widget-icon, .w-fav-pick.mine .dot, .al-badge)::after,
.dash-still .widget.sos .widget-icon::before { display: none; }
@media (prefers-reduced-motion: reduce) {   /* the same where the page doesn't set .dash-still */
  .ha-lane * { animation: none !important; }
  :is(.widget.sos .widget-icon, .w-fav-pick.mine .dot, .al-badge)::after, .widget.sos .widget-icon::before { display: none; }
}
@media (max-width: 640px) {
  .ha-lane.ha-skier { margin: 0 -14px; }   /* the card's narrower padding on phones */
}
