/* Hilal motion module: sky. The living sky behind the page.
   Every rule is scoped to .m-sky, which <html> carries only while Hilal/motion/sky.js runs (never
   with reduced motion or ?motion=off). Without the class the sky is the still one from
   landing.css. sky.js builds the layers named here inside the fixed .sky element, from the back:

     .sky__gold       the golden light of Asr
     .sky__dawn       the Fajr light on the horizon, breathing; --heart is its wandering centre
     .sky__dusk       the Maghrib glow the sun sinks into
     .sky__deep       three still star layers, each sliding by its own fraction of the scroll
                      position and breathing at its own pace (the core's canvas is in the first)
     .sky__sun-c      the sun: one small canvas inside the core's .sky__sun, scaled up
     .sky__veil       slow clouds for Dhuhr and Asr
     .sky__moonglow   halo and earthshine behind the crescent (the core still moves .sky__moon)
     .sky__sparks     the single stars that swell and glimmer, the brightest with a glint
     .sky__flare      the glint of a star that flares up
     .sky__meteor     the shooting star

   Only transform, translate and opacity are animated. Every opacity belongs to one layer (a
   wrapper fades, its only child breathes), no layer has a mask or a filter, and whatever the
   current phase does not show is hidden with its animation paused. */

/* ---------- Still stars ---------- */
.m-sky .sky__deep{position:absolute;left:0;top:0;width:100%;height:100%;height:100lvh;opacity:0;visibility:hidden;
  transition:opacity 1.3s ease,visibility 0s linear 1.3s;will-change:transform;animation:m-sky-in 1.8s ease backwards}
.m-sky .sky .sky__deep canvas{position:absolute;inset:auto;display:block;opacity:1;transition:none;
  animation:m-sky-shimmer 4.3s ease-in-out infinite alternate;animation-play-state:paused}
.m-sky .sky .sky__deep--1 canvas{animation-duration:6.1s;animation-delay:-2.2s}
.m-sky .sky .sky__deep--2 canvas{animation-duration:7.7s;animation-delay:-5s}
.m-sky[data-phase="fajr"] .sky__deep,.m-sky[data-phase="maghrib"] .sky__deep,.m-sky[data-phase="isha"] .sky__deep{visibility:visible;transition-delay:0s}
.m-sky[data-phase="fajr"] .sky__deep{opacity:.6}
.m-sky[data-phase="maghrib"] .sky__deep{opacity:.22}
.m-sky[data-phase="maghrib"] .sky__deep--2{opacity:.4}
.m-sky[data-phase="isha"] .sky__deep{opacity:1}
.m-sky[data-phase="fajr"] .sky .sky__deep canvas,.m-sky[data-phase="maghrib"] .sky .sky__deep canvas,
.m-sky[data-phase="isha"] .sky .sky__deep canvas{animation-play-state:running}
@keyframes m-sky-shimmer{from{opacity:.36}to{opacity:1}}
@keyframes m-sky-in{from{opacity:0}}

/* ---------- Single stars ---------- */
/* The outer element is placed and faded by sky.js; the inner one is the star, on two clocks of
   its own: a slow swell and a quicker glimmer. */
.m-sky .sky__sparks{position:absolute;inset:0;visibility:hidden}
.m-sky .sky__sparks.is-night{visibility:visible}
.m-sky .sky__sparks > i{position:absolute;left:0;top:0;width:0;height:0;opacity:0}
.m-sky .sky__sparks > i > i{position:absolute;display:block;border-radius:50%;
  background:radial-gradient(circle closest-side,#fff 0,rgba(236,238,250,.9) 16%,rgba(236,238,250,.3) 42%,transparent 100%);
  animation:m-sky-swell 4s ease-in-out infinite alternate,m-sky-glimmer 1.3s ease-in-out infinite alternate;animation-play-state:paused}
.m-sky .sky__sparks.is-night > i > i{animation-play-state:running}
.m-sky .sky__sparks > i > i.is-gold{
  background:radial-gradient(circle closest-side,#FFF6DC 0,rgba(243,212,142,.9) 16%,rgba(243,212,142,.3) 42%,transparent 100%)}
.m-sky .sky__sparks > i > i.is-bright,.m-sky .sky__flare b{border-radius:0;background:
  linear-gradient(90deg,transparent,rgba(236,238,250,.22) 30%,#fff 50%,rgba(236,238,250,.22) 70%,transparent) 50% 50%/100% 1.4px no-repeat,
  linear-gradient(180deg,transparent 14%,rgba(236,238,250,.22) 34%,#fff 50%,rgba(236,238,250,.22) 66%,transparent 86%) 50% 50%/1.4px 100% no-repeat,
  radial-gradient(circle closest-side,#fff 0,rgba(240,242,255,.95) 5%,rgba(236,238,250,.42) 11%,rgba(236,238,250,.13) 24%,transparent 50%)}
.m-sky .sky__sparks > i > i.is-bright.is-gold{background:
  linear-gradient(90deg,transparent,rgba(243,212,142,.24) 30%,#FFF6DC 50%,rgba(243,212,142,.24) 70%,transparent) 50% 50%/100% 1.4px no-repeat,
  linear-gradient(180deg,transparent 14%,rgba(243,212,142,.24) 34%,#FFF6DC 50%,rgba(243,212,142,.24) 66%,transparent 86%) 50% 50%/1.4px 100% no-repeat,
  radial-gradient(circle closest-side,#FFF6DC 0,rgba(247,224,170,.95) 5%,rgba(243,212,142,.42) 11%,rgba(243,212,142,.13) 24%,transparent 50%)}
@keyframes m-sky-swell{from{transform:scale(.56)}to{transform:scale(1.14)}}
@keyframes m-sky-glimmer{from{opacity:.46}to{opacity:1}}
/* The flare and the shooting star are played by sky.js (Web Animations) and rest invisible. */
.m-sky .sky__flare,.m-sky .sky__meteor{position:absolute;left:0;top:0;width:0;height:0;display:block}
.m-sky .sky__flare b{position:absolute;left:-23px;top:-23px;width:46px;height:46px;display:block;opacity:0}
.m-sky .sky__meteor b{position:absolute;right:0;top:-1px;height:2px;display:block;border-radius:2px;opacity:0;transform-origin:100% 50%;
  background:linear-gradient(90deg,rgba(236,238,250,0),rgba(240,240,252,.4) 70%,#FFFCF0)}
.m-sky .sky__meteor u{position:absolute;left:-8px;top:-8px;width:16px;height:16px;display:block;border-radius:50%;opacity:0;
  background:radial-gradient(circle closest-side,#fff 0,rgba(255,250,236,.62) 28%,rgba(236,238,250,.16) 60%,transparent 100%)}

/* ---------- Horizon: dawn and dusk ---------- */
/* Each wrapper fades with the phase; its only child breathes. The wide band only changes its
   strength; the heart is small and also wanders along the horizon. Both stay low and
   saturated, so the light ink above keeps its contrast. */
.m-sky .sky__dawn,.m-sky .sky__dusk{position:absolute;left:0;right:0;bottom:0;height:64vh;opacity:0;visibility:hidden;
  transition:opacity 1.3s ease,visibility 0s linear 1.3s}
.m-sky .sky__dawn{animation:m-sky-in 1.8s ease backwards}
.m-sky .sky__dawn b,.m-sky .sky__dusk b,.m-sky .sky__dusk i{position:absolute;inset:0;display:block}
.m-sky .sky__dawn b,.m-sky .sky__dusk b{animation:m-sky-breathe 5.2s ease-in-out infinite alternate;animation-play-state:paused}
.m-sky .sky__dawn b{background:radial-gradient(84% 100% at 50% 108%,rgba(255,160,100,.46),rgba(232,112,118,.22) 42%,rgba(184,96,156,.08) 66%,transparent 84%)}
.m-sky .sky__dawn--heart{left:24%;right:24%;height:40vh}
.m-sky .sky__dawn--heart b{background:radial-gradient(50% 100% at 50% 114%,rgba(255,206,138,.42),rgba(255,166,108,.16) 52%,transparent 100%);
  animation:m-sky-wander 15s ease-in-out infinite alternate;animation-play-state:paused}
.m-sky .sky__dusk{left:-20vw;right:auto;width:140vw;height:60vh}
.m-sky .sky__dusk i{will-change:transform,opacity}
.m-sky .sky__dusk b{animation-duration:5.6s;background:
  radial-gradient(19% 42% at 50% 108%,rgba(255,190,116,.36),transparent 100%),
  radial-gradient(50% 100% at 50% 106%,rgba(250,130,72,.36),rgba(216,86,104,.16) 46%,transparent 76%)}
.m-sky[data-phase="fajr"] .sky__dawn,.m-sky[data-phase="maghrib"] .sky__dusk{opacity:1;visibility:visible;transition-delay:0s}
.m-sky[data-phase="fajr"] .sky__dawn b,.m-sky[data-phase="maghrib"] .sky__dusk b{animation-play-state:running}
@keyframes m-sky-breathe{from{opacity:.16}to{opacity:1}}
@keyframes m-sky-wander{
  from{opacity:.3;transform:translate3d(-30%,0,0)}
  50%{opacity:1}
  to{opacity:.42;transform:translate3d(30%,0,0)}
}

/* ---------- Sun ---------- */
/* The still gradient of the core is replaced by one canvas, twice as wide as the sun's box.
   sky.js paints the glow, the turning rays and the disc into it and scales it with the height
   of the sun. */
.m-sky .sky .sky__sun{background:none}
.m-sky .sky__sun-c{position:absolute;left:-50%;top:-50%;width:200%;height:200%;display:block;will-change:transform}
.m-sky[data-phase="maghrib"] .sky .sky__sun{opacity:.66}

/* ---------- Clouds and the light of Asr ---------- */
/* Three clouds cross the day sky at their own speeds (sky.js moves them). Each holds its
   picture twice: white for Dhuhr, lit gold for Asr. They only ever lighten the sky, so the
   dark ink on top of them keeps its contrast. */
.m-sky .sky__veil{position:absolute;left:0;top:0;width:0;height:0;display:block}
.m-sky .sky__veil canvas{position:absolute;left:0;top:0;display:block;opacity:0;visibility:hidden;
  transition:opacity 1.6s ease,visibility 0s linear 1.6s}
.m-sky[data-phase="dhuhr"] .sky__veil .is-day,.m-sky[data-phase="asr"] .sky__veil canvas{visibility:visible;transition-delay:0s}
.m-sky[data-phase="dhuhr"] .sky__veil .is-day,.m-sky[data-phase="asr"] .sky__veil .is-gold{opacity:var(--o,.6)}
.m-sky[data-phase="asr"] .sky__veil .is-day{opacity:calc(var(--o,.6) * .2)}
/* A wash of gold from the side the sun is going down on. */
.m-sky .sky__gold{position:absolute;inset:0;opacity:0;visibility:hidden;transition:opacity 1.6s ease,visibility 0s linear 1.6s;
  background:radial-gradient(120% 90% at 96% 78%,rgba(255,196,112,.22),rgba(255,206,140,.09) 46%,transparent 76%)}
.m-sky[data-phase="asr"] .sky__gold{opacity:1;visibility:visible;transition-delay:0s}

/* ---------- Crescent ---------- */
/* A sibling of the moon that sky.js keeps on the moon's spot (--hx and --hy copy the core's
   --mx and --my). Six moons wide, centred on the crescent. */
.m-sky .sky__moonglow{--mw:clamp(46px,7.4vw,104px);position:absolute;left:0;top:0;
  width:calc(var(--mw) * 6);height:calc(var(--mw) * 6);margin:calc(var(--mw) * -2.5 - 52px) 0 0 calc(var(--mw) * -2.5 - 52px);
  transform:translate(calc(var(--hx,84) * 1vw),calc(var(--hy,16) * 1vh));will-change:transform}
.m-sky .sky__moonglow i,.m-sky .sky__moonglow b{position:absolute;display:block;border-radius:50%}
.m-sky .sky__moonglow i{opacity:0;visibility:hidden;transition:opacity 1.6s ease,visibility 0s linear 1.6s}
.m-sky .sky__moonglow-halo{inset:0}
.m-sky .sky__moonglow-halo b{inset:0;
  background:radial-gradient(circle closest-side,rgba(243,212,142,.34),rgba(233,192,106,.14) 26%,rgba(160,170,240,.07) 50%,rgba(190,200,255,.05) 64%,rgba(160,170,240,.02) 80%,transparent 100%);
  animation:m-sky-halo 5.4s ease-in-out infinite alternate;animation-play-state:paused}
.m-sky .sky__moonglow-earth{left:50%;top:50%;width:var(--mw);height:var(--mw);margin:calc(var(--mw) * -.5) 0 0 calc(var(--mw) * -.5);
  background:radial-gradient(circle closest-side,rgba(150,166,236,.13) 0 60%,rgba(132,148,224,.08) 82%,transparent 92%)}
.m-sky[data-phase="maghrib"] .sky__moonglow-halo,.m-sky[data-phase="isha"] .sky__moonglow i{visibility:visible;transition-delay:0s}
.m-sky[data-phase="maghrib"] .sky__moonglow-halo{opacity:.8}
.m-sky[data-phase="isha"] .sky__moonglow i{opacity:1}
.m-sky[data-phase="maghrib"] .sky__moonglow-halo b,.m-sky[data-phase="isha"] .sky__moonglow-halo b{animation-play-state:running}
@keyframes m-sky-halo{from{opacity:.42;transform:scale(.8)}to{opacity:1;transform:scale(1.08)}}
