/* The moving weather pictures (weather-art.js): a scene for the weather now, and a band of the same weather for the
   top of a card. Colours are the scenes' own (sun yellow, cloud whites and greys, snow blues); 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 wx-* so the page can keep them on its clock (dashboard.js). */

/* ---------- The scene ---------- */
.wx-art { display: block; width: 100%; height: auto; overflow: visible; }
.wx-halo { fill: #ffd257; opacity: .35; }
.wx-rays path { stroke: #ffb300; stroke-width: 3.2; stroke-linecap: round; }
.wx-disc { fill: #ffc533; stroke: #f5a800; stroke-width: 1.2; }
/* A cloud: its face, a rim one stroke wider around it, and a soft shadow under it */
.wx-puff { fill: #fff; }
.wx-rim { fill: var(--rim); stroke: var(--rim); stroke-width: 2.4; }
.wx-shade { fill: var(--shade); }
.wx-rim, .wx-shade { --rim: #bccbdd; --shade: #dde6f0; }
.wx-puff.grey { fill: #f1f4f8; }
.wx-rim.grey, .wx-shade.grey { --rim: #a5b3c6; --shade: #cfd8e3; }
.wx-puff.snowy { fill: #f5f8fc; }
.wx-rim.snowy, .wx-shade.snowy { --rim: #9cb4d6; --shade: #cbd9eb; }
.wx-puff.dark { fill: #8692a6; }
.wx-rim.dark, .wx-shade.dark { --rim: #626f84; --shade: #56637a; }
.wx-moon { fill: #f6dc7c; stroke: #e7c04d; stroke-width: 1.2; }
.wx-star { fill: #f2c94c; }
.wx-flake circle { fill: #fff; stroke: #7097cf; stroke-width: 1.2; }
.wx-flake path { fill: none; stroke: #6b93cc; stroke-width: 1.5; stroke-linecap: round; }
.wx-drop { fill: none; stroke: #5d8fd0; stroke-width: 2; stroke-linecap: round; }
.wx-drop.light { stroke-width: 1.6; }
.wx-drop.heavy { stroke: #5579ad; }
.wx-bolt { fill: #ffd02e; stroke: #e9a400; stroke-width: 1; stroke-linejoin: round; }
.wx-fog { fill: #9fadc0; opacity: .75; }

/* Turning, breathing and twinkling about their own centres */
.wx-rays, .wx-halo, .wx-star { transform-box: fill-box; transform-origin: center; }
.wx-rays { animation: wx-turn 26s linear infinite; }
.wx-halo { animation: wx-breathe 3.8s ease-in-out infinite alternate; }
.wx-drift.a { animation: wx-drift-a 7s ease-in-out infinite alternate; }
.wx-drift.b { animation: wx-drift-b 9.5s ease-in-out infinite alternate; }
.wx-star { animation: wx-twinkle 2.4s ease-in-out var(--d, 0s) infinite alternate; }
.wx-flake { animation: wx-fall 3.8s linear var(--d, 0s) infinite; }
.wx-heavy-snow .wx-flake { animation-duration: 2.7s; }
.wx-drop { animation: wx-rain .85s linear var(--d, 0s) infinite; }
.wx-drop.light { animation-duration: 1.3s; }
.wx-drop.heavy { animation-duration: .62s; }
.wx-bolt { animation: wx-flash 4.6s linear infinite; }
.wx-fog.a { animation: wx-fog-a 6s ease-in-out infinite alternate; }
.wx-fog.b { animation: wx-fog-b 7.5s ease-in-out infinite alternate; }

@keyframes wx-turn { to { transform: rotate(360deg); } }
@keyframes wx-breathe { from { transform: scale(.92); opacity: .3; } to { transform: scale(1.12); opacity: .6; } }
@keyframes wx-drift-a { from { transform: translateX(-4px); } to { transform: translateX(5px); } }
@keyframes wx-drift-b { from { transform: translateX(4px); } to { transform: translateX(-5px); } }
@keyframes wx-twinkle { from { transform: scale(.55); opacity: .45; } to { transform: scale(1.1); opacity: 1; } }
/* A flake's own place is the middle of its fall: still, the scene is a snowfall */
@keyframes wx-fall {
  0% { transform: translate(0, -17px); opacity: 0; }
  15% { opacity: 1; }
  50% { transform: translate(2.5px, 0); }
  85% { opacity: 1; }
  100% { transform: translate(-2px, 17px); opacity: 0; }
}
@keyframes wx-rain {
  0% { transform: translate(1.6px, -9px); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: translate(-2.4px, 13px); opacity: 0; }
}
/* Two quick flashes now and then (well under three a second, WCAG 2.3.1); still, the bolt is drawn */
@keyframes wx-flash { 0%, 74% { opacity: 0; } 75.5% { opacity: 1; } 78% { opacity: .15; } 80% { opacity: 1; } 85%, 100% { opacity: 0; } }
@keyframes wx-fog-a { from { transform: translateX(-6px); opacity: .5; } to { transform: translateX(6px); opacity: .9; } }
@keyframes wx-fog-b { from { transform: translateX(6px); opacity: .85; } to { transform: translateX(-7px); opacity: .45; } }

/* ---------- The band at the top of a card, behind its title ---------- */
.wx-sky {
  --sky: rgb(120 140 165 / .14);
  position: absolute; inset: 0 0 auto; height: 136px; overflow: hidden; pointer-events: none;
  background: linear-gradient(to bottom, var(--sky), rgb(255 255 255 / 0));
  -webkit-mask-image: linear-gradient(#000 50%, transparent); mask-image: linear-gradient(#000 50%, transparent);
}
.wx-sky i { position: absolute; left: var(--x); }
.sky-sun { --sky: rgb(255 190 50 / .16); }
.sky-sun::before {
  content: ""; position: absolute; top: -110px; right: -80px; width: 300px; height: 300px; border-radius: 50%;
  background: radial-gradient(closest-side, rgb(255 196 60 / .42), rgb(255 196 60 / 0));
  animation: wx-glow 6s ease-in-out infinite alternate;
}
.sky-night { --sky: rgb(38 60 140 / .14); }
.sky-night i { top: var(--y); width: 3px; height: 3px; border-radius: 50%; background: rgb(110 128 196 / .85); animation: wx-twinkle 2.8s ease-in-out var(--d) infinite alternate; }
.sky-cloud { --sky: rgb(110 128 152 / .15); }
/* Two soft clouds crossing the band: each pseudo-element is the band's width plus the cloud's, so moving it by its own
   width takes the cloud from just off the left edge to just off the right one */
.sky-cloud::before, .sky-cloud::after {
  content: ""; position: absolute; top: 4px; left: -240px; width: calc(100% + 240px); height: 70px;
  background: radial-gradient(closest-side, rgb(255 255 255 / .9), rgb(255 255 255 / 0)) 0 0 / 220px 70px no-repeat;
  animation: wx-sky-cloud 46s linear infinite;
}
.sky-cloud::after { top: 36px; height: 54px; background-size: 170px 54px; animation-duration: 64s; animation-delay: -30s; }
.sky-rain { --sky: rgb(70 104 155 / .14); }
.sky-rain.storm { --sky: rgb(56 64 92 / .2); }
.sky-rain i { top: -18px; width: 1.6px; height: 13px; border-radius: 1px; background: rgb(64 104 168 / .4); animation: wx-sky-rain var(--t) linear var(--d) infinite; }
.sky-snow { --sky: rgb(96 140 210 / .15); }
.sky-snow i {
  top: -10px; width: var(--s); height: var(--s); border-radius: 50%;
  background: #fff; box-shadow: 0 0 0 1px rgb(110 150 210 / .4), 0 1px 3px rgb(60 100 170 / .25);
  animation: wx-sky-snow var(--t) linear var(--d) infinite;
}
@keyframes wx-glow { from { transform: scale(.9); opacity: .75; } to { transform: scale(1.06); opacity: 1; } }
@keyframes wx-sky-cloud { from { transform: translateX(0); } to { transform: translateX(100%); } }
@keyframes wx-sky-rain { from { transform: translate(0, 0) rotate(12deg); } to { transform: translate(-30px, 150px) rotate(12deg); } }
@keyframes wx-sky-snow {
  0% { transform: translate(0, 0); opacity: 0; }
  12% { opacity: 1; }
  50% { transform: translate(9px, 74px); }
  80% { opacity: .9; }
  100% { transform: translate(-5px, 150px); opacity: 0; }
}

/* ---------- Still (reduced motion, or Animations on Home off: dashboard.js puts .dash-still on the body) ---------- */
/* Without the animation every piece is at its own place: flakes and drops in the air, the bolt drawn */
.dash-still :is(.wx-art, .wx-sky) *, .dash-still .wx-sky::before, .dash-still .wx-sky::after { animation: none !important; }
.dash-still .wx-sky i { display: none; }   /* the band keeps its colour; dots that don't fall would look like dust */
.dash-still .sky-cloud::before { transform: translateX(45%); }
.dash-still .sky-cloud::after { transform: translateX(75%); }
@media (prefers-reduced-motion: reduce) {   /* the same where the page doesn't set .dash-still */
  .wx-art *, .wx-sky::before, .wx-sky::after { animation: none !important; }
  .wx-sky i { display: none; }
}
