﻿/* Starry night sky shared by every page.
   Each page needs: <link rel="stylesheet" href="sky.css"> in the head, and right after <body>:
   <div class="sky" aria-hidden="true"><div class="stars"><i class="tw a"></i><i class="tw b"></i></div><i class="shoot one"></i><i class="shoot two"></i></div>
   The sky looks the same in light and dark mode. Animation stops for visitors who ask for reduced motion. */

body {
  --night-ink: #f1eefa;
  --night-muted: #c3bfdc;
  --night-line: rgba(255,255,255,.14);
  --night-link: #b7dcf0;
  background:
    radial-gradient(ellipse 70% 50% at 85% 0%, rgba(140,110,200,.28), transparent 70%) fixed,
    radial-gradient(ellipse 60% 45% at 10% 100%, rgba(60,110,170,.22), transparent 70%) fixed,
    linear-gradient(to bottom, #070b1f 0%, #10143a 50%, #1d1440 100%) fixed;
  background-color: #070b1f;
}

.sky { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }

/* The star field is one tile larger than the screen and drifts one tile's width
   over several minutes, like the slow turn of the night sky; the repeat makes it seamless. */
.stars {
  position: absolute; top: -900px; left: -900px;
  width: calc(100% + 900px); height: calc(100% + 900px);
  background: url("../images/stars.svg") 0 0 / 900px 900px repeat;
  animation: sky-drift 480s linear infinite;
  will-change: transform;
}
.stars .tw { position: absolute; inset: 0; background-repeat: repeat; background-size: 900px 900px; opacity: .2; }
.stars .tw.a { background-image: url("../images/twinkle-a.svg"); animation: twinkle 3.7s ease-in-out infinite alternate; }
.stars .tw.b { background-image: url("../images/twinkle-b.svg"); background-position: 300px 450px; animation: twinkle 5.3s ease-in-out -2s infinite alternate; }

/* Shooting stars: a brief streak every so often, idle the rest of the cycle */
.shoot {
  position: absolute; width: 160px; height: 2px; border-radius: 2px; opacity: 0;
  background: linear-gradient(to right, rgba(255,255,255,.95), rgba(255,255,255,0));
  transform: rotate(-32deg);
}
.shoot.one { top: 12%; left: 78%; animation: shoot 17s ease-out 4s infinite; }
.shoot.two { top: 38%; left: 55%; animation: shoot 29s ease-out 15s infinite; }

@keyframes sky-drift { to { transform: translate3d(900px, 900px, 0); } }
@keyframes twinkle { 0% { opacity: .15; } 60% { opacity: .9; } 100% { opacity: .45; } }
@keyframes shoot {
  0%   { opacity: 0; transform: rotate(-32deg) translateX(0); }
  1%   { opacity: 1; }
  5%   { opacity: 0; transform: rotate(-32deg) translateX(-420px); }
  100% { opacity: 0; transform: rotate(-32deg) translateX(-420px); }
}

@media (prefers-reduced-motion: reduce) {
  .stars, .stars .tw { animation: none; }
  .stars .tw { opacity: .6; }
  .shoot { display: none; }
}

@media print {
  .sky { display: none; }
  body { background: #fff !important; }
}
