/* The things in the sky by season (js/sky-art.js): koinobori and butterflies in spring, soap bubbles
   and swallows in summer, the harvest moon and a V of geese in autumn, sky lanterns in winter; kites only with
   html[data-newyear]. In the spot views' shared sky (.grounds .sky) and in the path's far layer. All of
   it sits behind the scenes and the header and takes no taps. SVG pieces turn about their own origin. */

/* ---------- which set shows ---------- */
.sky-s { display: none; }
html[data-season="spring"]:not([data-newyear]) .sky-s.spring,
html[data-season="summer"]:not([data-newyear]) .sky-s.summer,
html[data-season="autumn"]:not([data-newyear]) .sky-s.autumn,
html[data-season="winter"]:not([data-newyear]) .sky-s.winter,
html[data-newyear] .sky-s.newyear { display: block; }
.sky-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---------- the spot views' sky ---------- */
.grounds .sky { position: absolute; inset: 0; pointer-events: none; transition: opacity .45s ease; }
body[data-view="path"] .grounds .sky { opacity: 0; }
/* the band of sky things: from under the header down to about the middle of the window */
.sk-band { position: absolute; left: 0; right: 0; top: calc(env(safe-area-inset-top) + var(--head) + 12px); height: 44%; }
.sk { display: block; overflow: visible; }
.wo { display: none !important; }
@media (min-width: 760px) {
  .wo { display: block !important; }
  .po { display: none !important; }
}

/* spring: koinobori on a tall pole (its foot goes behind the hills) */
.sk-koi-wrap { position: absolute; width: 104px; right: 7%; top: calc(env(safe-area-inset-top) + var(--head) + 22px); bottom: calc(var(--ctl) + 90px + var(--lift, 0px)); }
.sk-koi-wrap .sk-koi-art { position: absolute; left: 0; top: 0; width: 100%; }
.sk-koi-pole { position: absolute; top: 12px; bottom: 0; left: calc(100% * 72 / 76 - 3px); width: 6px; border-radius: 3px; background: #f7e4b4; border: 1.6px solid #e3c67e; }
@media (min-width: 760px) {
  .sk-koi-wrap { width: 150px; right: 9%; top: calc(env(safe-area-inset-top) + var(--head) + 4%); }
  .sk-koi-wrap.kb { right: auto; left: 13%; top: calc(env(safe-area-inset-top) + var(--head) + 12%); width: 130px; }
  .sk-koi-pole { left: calc(100% * 72 / 76 - 4px); width: 8px; }
}
.sk-pole { fill: #f7e4b4; stroke: #e3c67e; stroke-width: 1.6; }
.sk-ball { fill: #ffe9a3; stroke: #e9c25c; stroke-width: 1.4; }
.sk-hub { fill: #fff6d6; stroke: #e3c67e; stroke-width: 1.2; }
.sk-spoke path { stroke: #e3c67e; stroke-width: 1.2; stroke-linecap: round; }
.sk-blade { stroke-width: 1.1; stroke-linejoin: round; }
.sk-blade.b0 { fill: #ffd3dc; stroke: #f0adbd; } .sk-blade.b1 { fill: #d3e2ff; stroke: #a7bcef; }
.sk-blade.b2 { fill: #fff0b8; stroke: #e9c86a; } .sk-blade.b3 { fill: #cdeedf; stroke: #9dd5bd; }
.sk-cord { fill: none; stroke: #e3c67e; stroke-width: 1.2; }
.sk-ln { stroke-width: 1.8; stroke-linejoin: round; }
.sk-wheel { animation: skSpin 1.7s linear infinite; }
@keyframes skSpin { to { transform: rotate(360deg); } }
/* each carp swings about its mouth and fills with the wind; the tail flicks */
.sk-carp { animation: skCarp 2.3s ease-in-out infinite alternate; }
.sk-carp.c1 { animation-duration: 2s; } .sk-carp.c2 { animation-duration: 1.8s; }
@keyframes skCarp {
  0% { transform: rotate(-7deg) scale(1, .86); }
  50% { transform: rotate(1deg) scale(1, 1.04); }
  100% { transform: rotate(6deg) scale(1, .94); }
}
.sk-tail { animation: skTail .75s ease-in-out infinite alternate; }
@keyframes skTail { from { transform: rotate(-20deg) scale(1, .9); } to { transform: rotate(18deg) scale(1, 1.08); } }

/* butterflies */
.sk-fly-wrap { position: absolute; width: 40px; }
.sk-bw { fill: #fff3b8; stroke: #ecc96a; stroke-width: 1.2; stroke-linejoin: round; }
.sk-bw.lo { fill: #ffe6a6; }
.sk-bdot { fill: #fffbe8; }
.t1 .sk-bw { fill: #ffdbe4; stroke: #f0afbf; } .t1 .sk-bw.lo { fill: #ffc9d6; }
.t2 .sk-bw { fill: #e4dcff; stroke: #b9acf0; } .t2 .sk-bw.lo { fill: #d6ccff; }
.sk-bbody { fill: #a99cd8; }
.sk-bant { fill: none; stroke: #a99cd8; stroke-width: .9; stroke-linecap: round; }
.sk-wing { animation: skFlap .24s ease-in-out infinite alternate; }
.sk-wing.r { animation-delay: 0s; }
@keyframes skFlap { from { transform: scaleX(1); } to { transform: scaleX(.56); } }
.sk-flutter { animation: skFlutter .9s ease-in-out infinite alternate; }
@keyframes skFlutter { from { transform: translateY(-1.6px); } to { transform: translateY(1.8px); } }
.sk-flight { animation: skFlight 11s ease-in-out infinite; }
.f1 .sk-flight, .sk-flight.f1 { animation-duration: 13s; animation-direction: reverse; }
.f2 .sk-flight, .sk-flight.f2 { animation-duration: 9.5s; }
@keyframes skFlight {
  0% { transform: translate(0, 0) rotate(-6deg); }
  20% { transform: translate(18px, -12px) rotate(8deg); }
  40% { transform: translate(40px, -4px) rotate(14deg); }
  60% { transform: translate(34px, 14px) rotate(-4deg); }
  80% { transform: translate(10px, 10px) rotate(-12deg); }
  100% { transform: translate(0, 0) rotate(-6deg); }
}

/* summer: soap bubbles drifting up and wobbling; swallows */
.sk-rise { position: absolute; top: 0; height: 100%; width: 0; transform: translateY(calc(var(--rest) * -1)); animation: skRise 15s linear infinite; }
.sk-riser { position: absolute; top: 100%; left: 0; translate: -50% -50%; }
@keyframes skRise {
  0% { transform: translateY(0); opacity: 0; }
  9% { opacity: 1; }
  80% { opacity: 1; }
  100% { transform: translateY(-100%); opacity: 0; }
}
.sk-bub-ring { stroke: #c4bbf0; stroke-width: 1.1; stroke-opacity: .85; }
.sk-bub-hi { fill: #fff; opacity: .95; }
.sk-bub-sheen { fill: none; stroke: #ffc9dc; stroke-width: 1.6; stroke-linecap: round; opacity: .85; }
.sk-wob { animation: skWob 1.7s ease-in-out infinite alternate; }
@keyframes skWob { from { transform: translate(-2.4px, 0) scale(1.07, .94); } to { transform: translate(2.4px, 0) scale(.94, 1.07); } }
.sk-swal-wrap { position: absolute; left: 0; --sx: 30vw; transform: translate(var(--sx), 0); animation: skSwal 21s linear infinite; }
.sk-swal-wrap.s1 { --sx: 62vw; animation-duration: 27s; }
@keyframes skSwal {
  0% { transform: translate(-70px, 14px); }
  28% { transform: translate(calc(100vw + 70px), -26px); }
  100% { transform: translate(calc(100vw + 70px), -26px); }
}
.sk-sw { fill: #b4acdf; stroke: #9b92cf; stroke-width: 1.1; stroke-linejoin: round; }
.sk-sw-throat { fill: #ffc9b8; }
.sk-sw-belly { fill: none; stroke: #fff6f1; stroke-width: 1.6; stroke-linecap: round; }
.sk-swing { animation: skSwFlap 2.6s ease-in-out infinite; }
@keyframes skSwFlap { 0%, 60%, 100% { transform: scale(1, 1); } 66% { transform: scale(1, .35); } 72% { transform: scale(1, 1.05); } 78% { transform: scale(1, .4); } 84% { transform: scale(1, 1); } }
.sk-glide { animation: skGlide 3.2s ease-in-out infinite alternate; }
@keyframes skGlide { from { transform: rotate(-7deg); } to { transform: rotate(5deg); } }

/* autumn: a big pale harvest moon low in the daytime sky, and one small V of geese gliding across far
   away. Placed per view where no roof or header covers it on a phone (the free sky differs per view). */
.sk-moon-wrap {
  position: absolute; width: var(--moon-w, 112px); left: var(--moon-x, 26%); top: var(--moon-y, 240px);
  translate: -50% -50%;
}
body[data-view="omikuji"] { --moon-x: 24%; --moon-y: calc(env(safe-area-inset-top) + var(--head) + 168px); --moon-w: 126px; }
body[data-view="temizu"], body[data-view="ema"] { --moon-x: 79%; --moon-y: calc(env(safe-area-inset-top) + var(--head) + 82px); --moon-w: 104px; }
body[data-view="haiden"] { --moon-x: calc(100% - 46px); --moon-y: calc(env(safe-area-inset-top) + var(--head) + 50px); --moon-w: 92px; }
@media (min-width: 760px) {
  /* a wide window: low over the hills on the right, bigger */
  body[data-view] { --moon-x: 88%; --moon-y: calc(100% - var(--ctl) - 350px - var(--lift, 0px)); --moon-w: 190px; }
}
.sk-moon-art { display: block; width: 100%; }
.sk-moon-disc { stroke: #f4dfb0; stroke-width: 1.6; }
.sk-moon-mark { fill: #f6e3b8; opacity: .62; }
.sk-moon-stick { fill: none; stroke: #f6e3b8; stroke-width: 2.6; stroke-linecap: round; }
.sk-moon-shine { fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; opacity: .9; }
.sk-moon-glow { animation: skMoonGlow 4.8s ease-in-out infinite alternate; }
@keyframes skMoonGlow { from { opacity: .7; transform: scale(.94); } to { opacity: 1; transform: scale(1.06); } }
.sk-moon-bob { animation: skMoonBob 7s ease-in-out infinite alternate; }
@keyframes skMoonBob { from { transform: translateY(-2.5px); } to { transform: translateY(2.5px); } }
/* the geese: a small V far away, crossing slowly (about 40 s across, then a pause), wings beating softly */
.sk-geese-wrap {
  position: absolute; left: 0; top: calc(env(safe-area-inset-top) + var(--head) + 12px); width: 70px;
  transform: translate(36vw, 0); animation: skGeese 52s linear infinite; animation-delay: -15s;
}
@media (min-width: 760px) { .sk-geese-wrap { width: 92px; top: calc(env(safe-area-inset-top) + var(--head) - 4px); } }
@keyframes skGeese {
  0% { transform: translate(-90px, 18px); }
  80% { transform: translate(calc(100vw + 40px), -16px); }
  100% { transform: translate(calc(100vw + 40px), -16px); }
}
.sk-geese-art { display: block; width: 100%; }
.sk-gw { fill: none; stroke: #a89ccf; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.sk-gbody { fill: #b9afdc; stroke: #a89ccf; stroke-width: .8; stroke-linejoin: round; }
.sk-gwing { animation: skGFlap 1.5s ease-in-out infinite alternate; }
.g1 .sk-gwing { animation-delay: -.3s; } .g2 .sk-gwing { animation-delay: -.5s; }
.g3 .sk-gwing { animation-delay: -.8s; } .g4 .sk-gwing { animation-delay: -1.1s; }
@keyframes skGFlap { from { transform: scale(1, 1.05); } to { transform: scale(1, .45); } }
.sk-geese { animation: skGeeseBob 5s ease-in-out infinite alternate; }
@keyframes skGeeseBob { from { transform: translateY(-1.5px) rotate(-2deg); } to { transform: translateY(1.5px) rotate(1deg); } }

/* winter: sky lanterns rise slowly, swaying, and fade near the top; the far ones small and paler */
.sk-lan-rise { animation-name: skRiseLan; }
@keyframes skRiseLan {
  0% { transform: translateY(0); opacity: 0; }
  10% { opacity: 1; }
  74% { opacity: 1; }
  100% { transform: translateY(-100%); opacity: 0; }
}
.sk-lan-rise.far .sk-riser, .skf-lan.far .sk-lan { opacity: .72; }
.sk-lan-body { stroke: #efbf9b; stroke-width: 1.6; stroke-linejoin: round; }
.sk-lan-rib { fill: none; stroke: #f6d5b7; stroke-width: 1.2; stroke-linecap: round; }
.sk-lan-mouth { fill: #f6c7a1; stroke: #efbf9b; stroke-width: 1.2; }
.sk-flame { fill: #ffe38e; stroke: #f5c463; stroke-width: .8; animation: skFlame .45s ease-in-out infinite alternate; }
@keyframes skFlame { from { transform: scale(.9, .82); } to { transform: scale(1.08, 1.12); } }
.sk-lan-shine { fill: none; stroke: #fffdf8; stroke-width: 2; stroke-linecap: round; opacity: .9; }
.sk-lan-halo { animation: skHalo 2.6s ease-in-out infinite alternate; }
@keyframes skHalo { from { opacity: .8; } to { opacity: 1; } }
.sk-sway { animation: skSway 4.4s ease-in-out infinite alternate; }
@keyframes skSway { from { transform: rotate(-5deg); } to { transform: rotate(5deg); } }

/* ---------- the path's far layer ---------- */
.skf-rise { transform: translateY(var(--rest)); animation: skRiseF 15s linear infinite; }
@keyframes skRiseF {
  0% { transform: translateY(0); opacity: 0; }
  9% { opacity: 1; }
  80% { opacity: 1; }
  100% { transform: translateY(-300px); opacity: 0; }
}
.skf-lan { animation-name: skRiseFLan; }
@keyframes skRiseFLan {
  0% { transform: translateY(0); opacity: 0; }
  10% { opacity: 1; }
  74% { opacity: 1; }
  100% { transform: translateY(-310px); opacity: 0; }
}
.skf-geese { transform: translate(150px, 0); animation: skGeeseF 56s linear infinite; animation-delay: -18s; }
@keyframes skGeeseF {
  0% { transform: translate(-560px, 14px); }
  80% { transform: translate(940px, -24px); }
  100% { transform: translate(940px, -24px); }
}
/* in autumn the geese take the place of the path's three little birds */
html[data-season="autumn"]:not([data-newyear]) .far-birds { display: none; }
.skf-swal { transform: translate(var(--sx, 120px), 0); animation: skSwalF 24s linear infinite; }
.skf-swal.s0 { --sx: 120px; } .skf-swal.s1 { --sx: 230px; animation-duration: 31s; }
@keyframes skSwalF {
  0% { transform: translate(-560px, 10px); }
  34% { transform: translate(940px, -30px); }
  100% { transform: translate(940px, -30px); }
}

@media (prefers-reduced-motion: reduce) {
  .sky-s *, .sk-rise, .sk-swal-wrap, .sk-geese-wrap { animation: none !important; }
  .sk-rise, .skf-rise { opacity: 1; }
}
