/*
 * Baseword's deep space, for any page that wants it (the home page, the videos
 * pages): the app's starfield split by star size into far, mid and near
 * layers (images/space/, from iOS space_background), as on the 2026-11-04
 * starfield pick. Far stars are cooler and dimmer, near ones carry a faint
 * halo, mid and near drift at 2 and 6 px/s, and a shooting star crosses now
 * and then. Anything on the page sits on a Hull Plate: var(--hull).
 * It sets the body background over the page's own.
 */
:root { --space-bg: #111C20; --hull: rgba(16, 20, 24, .9); }

/* Deep space in three layers. Far is the page's own background; mid and near
   are fixed layers one tile wider than the window, sliding one tile left on a
   loop, which reads as a steady drift. All behind the plates. */
/* html > body: outranks a page's own body background (site.css loads after this). */
html > body { background: var(--space-bg) url(/images/space/stars-far.svg) repeat fixed; background-size: 500px; }
html::before, html::after {
  content: ""; position: fixed; z-index: -1; top: 0; left: 0; pointer-events: none;
  width: calc(100% + 500px); height: 100%;
  background-repeat: repeat; background-size: 500px;
  will-change: transform;
}
html::before { background-image: url(/images/space/stars-mid.svg); animation: star-drift 250s linear infinite; }
html::after { background-image: url(/images/space/stars-near.svg); background-position: 0 0; animation: star-drift 83.333s linear infinite; }
@keyframes star-drift { to { transform: translateX(-500px); } }
/* Shooting stars: two, on long offset loops, so one crosses now and then.
   Behind the plates; none under Reduce Motion. */
body::before, body::after {
  content: ""; position: fixed; z-index: -1; top: 0; left: 0; pointer-events: none;
  width: 160px; height: 2px; border-radius: 2px; opacity: 0;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), #FFFFFF);
  filter: drop-shadow(0 0 4px rgba(255, 255, 255, .8));
}
body::before { animation: shooting-star-a 14s linear 2s infinite; }
body::after { animation: shooting-star-b 23s linear 9s infinite; }
@keyframes shooting-star-a {
  0% { opacity: 0; transform: translate(12vw, 10vh) rotate(18deg); }
  1% { opacity: 1; }
  6% { opacity: 0; transform: translate(calc(12vw + 520px), calc(10vh + 169px)) rotate(18deg); }
  100% { opacity: 0; transform: translate(calc(12vw + 520px), calc(10vh + 169px)) rotate(18deg); }
}
@keyframes shooting-star-b {
  0% { opacity: 0; transform: translate(58vw, 42vh) rotate(28deg); }
  1% { opacity: 1; }
  4% { opacity: 0; transform: translate(calc(58vw + 420px), calc(42vh + 223px)) rotate(28deg); }
  100% { opacity: 0; transform: translate(calc(58vw + 420px), calc(42vh + 223px)) rotate(28deg); }
}
/* Reduce Motion: no drift and no shooting stars; the layers alone still give depth. */
@media (prefers-reduced-motion: reduce) {
  html::before, html::after { animation: none; }
  body::before, body::after { display: none; }
}
