/* StarSnap shared cosmic background.
   Mirrors the Flutter ConstellationBackground gradient + canvas overlay.
   Inclusion: link this CSS in <head>, place <canvas id="ss-starfield"
   aria-hidden="true"></canvas> as first child of <body>, then load
   /assets/js/starfield.js with defer.
*/
html, body {
  background: #0A0815;
}

/* Two background layers: a faint anchored constellation map (Big Dipper +
   Orion's Belt) painted as an inline SVG, then the deep cosmic radial
   gradient beneath it. The SVG is ~700B, zero JS, zero CPU — it just sits
   there acting as a "named sky" the canvas stars dance around. */
body {
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1920 1080' preserveAspectRatio='xMidYMid slice'><g stroke='%23ffffff' stroke-opacity='.06' fill='%23ffffff' fill-opacity='.13'><path d='M180 150L260 180L340 170L420 200L490 260L560 290L640 340' fill='none' stroke-width='.7'/><circle cx='180' cy='150' r='1.4'/><circle cx='260' cy='180' r='1.5'/><circle cx='340' cy='170' r='1.4'/><circle cx='420' cy='200' r='1.5'/><circle cx='490' cy='260' r='1.7'/><circle cx='560' cy='290' r='1.3'/><circle cx='640' cy='340' r='1.2'/><path d='M1380 720L1480 750L1580 780' fill='none' stroke-width='.7'/><circle cx='1380' cy='720' r='1.5'/><circle cx='1480' cy='750' r='1.8'/><circle cx='1580' cy='780' r='1.5'/></g></svg>"),
    radial-gradient(ellipse 110% 80% at 50% 25%, #14132A 0%, #0A0815 70%);
  background-attachment: fixed, fixed;
  background-position: center center, center center;
  background-size: cover, auto;
  background-repeat: no-repeat, no-repeat;
}

/* z-index: -1 puts the canvas between body's background and its in-flow
   children. body cannot create a stacking context on its own, so this lands
   the stars *behind* every other body child without forcing position rules
   on the page authors (avoids breaking position:fixed overlays etc.). */
#ss-starfield {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
  display: block;
}

/* Occasional shooting star — appended by starfield.js, runs ~once every
   30..60s, then sits idle. Pure CSS animation = no JS-frame cost.
   Travels ~480px diagonally over 1.4s with a soft trailing gradient. */
.ss-shooting {
  position: fixed;
  left: var(--ss-x, 0);
  top: var(--ss-y, 0);
  width: 110px;
  height: 1px;
  background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,.85) 60%, rgba(244,213,141,1) 100%);
  box-shadow: 0 0 6px rgba(255,255,255,.55), 0 0 14px rgba(244,213,141,.35);
  transform: translate3d(0,0,0) rotate(20deg);
  opacity: 0;
  pointer-events: none;
  z-index: -1;
  border-radius: 1px;
  will-change: transform, opacity;
}
.ss-shooting.run {
  animation: ss-shoot 1.4s cubic-bezier(.55,.02,.45,.95) 1;
}
@keyframes ss-shoot {
  0%   { opacity: 0; transform: translate3d(0, 0, 0) rotate(20deg) scaleX(.3); }
  12%  { opacity: 1; }
  85%  { opacity: 1; }
  100% { opacity: 0; transform: translate3d(480px, 174px, 0) rotate(20deg) scaleX(1); }
}
@media (prefers-reduced-motion: reduce) {
  .ss-shooting { display: none; }
}
