/* Boot splash -- plays the North Star mark once on app load, then fades to
   reveal the app (already rendered underneath). The artwork is the owner's
   logo (2026-09-27): a blue ribbon ring round a star; the glow, shockwave and
   sparks sit on that star, tinted to it. Class names are namespaced with sp-
   so nothing here collides with the rest of the app. */

.sp-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  /* Matches the artwork's own black canvas exactly (not var(--bg), which is
     a slightly lighter navy) so the image's square edge is invisible. */
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  transition: opacity 0.6s var(--ease);
}

.sp-overlay.sp-fade-out {
  opacity: 0;
  pointer-events: none;
}

.sp-stage {
  position: relative;
  width: 100%;
  max-width: 560px;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sp-hint {
  position: absolute;
  bottom: 6%;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 12px;
  color: var(--text-faint);
  letter-spacing: 0.06em;
  z-index: 8;
  opacity: 0;
  animation: sp-hint-in 1s var(--ease) 1.4s forwards;
}

@keyframes sp-hint-in {
  to {
    opacity: 1;
  }
}

/* ---------- background stars ---------- */
.sp-stars {
  position: absolute;
  inset: -10%;
  background-image: radial-gradient(1.5px 1.5px at 10% 20%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 80% 10%, #fff, transparent), radial-gradient(1px 1px at 40% 60%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 90% 70%, #fff, transparent), radial-gradient(1px 1px at 20% 85%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 60% 30%, #fff, transparent), radial-gradient(1px 1px at 70% 90%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 30% 40%, #fff, transparent);
  background-repeat: repeat;
  background-size: 300px 300px;
  animation: sp-twinkle 4s ease-in-out infinite alternate;
}

@keyframes sp-twinkle {
  0% {
    opacity: 0.2;
  }
  50% {
    opacity: 0.55;
  }
  100% {
    opacity: 0.3;
  }
}

/* ---------- underlying aura, breathes with the instability cycle ---------- */
.sp-aura {
  position: absolute;
  width: 60%;
  height: 60%;
  top: 20%;
  left: 20%;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    rgba(60, 150, 255, 0.55),
    rgba(40, 80, 220, 0.45),
    rgba(110, 90, 230, 0.45),
    rgba(70, 200, 255, 0.5),
    rgba(60, 150, 255, 0.55)
  );
  filter: blur(40px);
  animation: sp-aura-spin 11s linear infinite, sp-aura-cycle 6s ease-in-out infinite;
}

@keyframes sp-aura-spin {
  from {
    transform: rotate(0);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes sp-aura-cycle {
  0% {
    transform: scale(1);
    opacity: 0.5;
  }
  70% {
    transform: scale(1.22);
    opacity: 0.85;
  }
  82% {
    transform: scale(1.5);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 0.5;
  }
}

/* ---------- the artwork itself, jitters as it destabilizes ---------- */
.sp-logo-img {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: contain;
  z-index: 3;
  animation: sp-instability 6s ease-in-out infinite, sp-chroma-flicker 6s ease-in-out infinite;
  transform-origin: 50% 50%;
}

@keyframes sp-instability {
  0% {
    transform: translate(0, 0) rotate(0deg) scale(1);
    filter: drop-shadow(0 0 20px rgba(120, 140, 255, 0.3));
  }
  55% {
    transform: translate(0, 0) rotate(0deg) scale(1.005);
    filter: drop-shadow(0 0 22px rgba(120, 140, 255, 0.35));
  }
  65% {
    transform: translate(1.5px, -1px) rotate(0.4deg) scale(1.01);
  }
  70% {
    transform: translate(-2px, 1.5px) rotate(-0.5deg) scale(1.015);
  }
  75% {
    transform: translate(2px, 1px) rotate(0.6deg) scale(1.02);
  }
  79% {
    transform: translate(-1.5px, -2px) rotate(-0.4deg) scale(1.03);
  }
  82% {
    transform: translate(0, 0) rotate(0deg) scale(1.06);
    filter: drop-shadow(0 0 55px rgba(120, 180, 255, 0.75));
  }
  88% {
    transform: translate(0, 0) rotate(0deg) scale(1);
    filter: drop-shadow(0 0 25px rgba(120, 140, 255, 0.4));
  }
  100% {
    transform: translate(0, 0) rotate(0deg) scale(1);
    filter: drop-shadow(0 0 20px rgba(120, 140, 255, 0.3));
  }
}

@keyframes sp-chroma-flicker {
  0%,
  60%,
  89%,
  100% {
    filter: drop-shadow(0 0 20px rgba(120, 140, 255, 0.3));
  }
  72% {
    filter: drop-shadow(1.5px 0 0 rgba(255, 60, 90, 0.5)) drop-shadow(-1.5px 0 0 rgba(60, 180, 255, 0.5));
  }
  76% {
    filter: drop-shadow(-1.5px 0.5px 0 rgba(255, 60, 90, 0.5)) drop-shadow(1.5px -0.5px 0 rgba(60, 180, 255, 0.5));
  }
  80% {
    filter: drop-shadow(0 0 40px rgba(150, 200, 255, 0.9));
  }
}

/* ---------- animated ring highlights riding on top of the artwork's rings ---------- */
/* ---------- core: the star's heartbeat, quickens right before release ---------- */
.sp-core-glow {
  position: absolute;
  width: 16%;
  height: 16%;
  top: 40.3%;
  left: 42%;
  border-radius: 50%;
  z-index: 5;
  mix-blend-mode: screen;
  background: radial-gradient(circle, rgba(235, 245, 255, 1) 0%, rgba(120, 185, 255, 0.55) 35%, rgba(60, 130, 255, 0) 70%);
  filter: blur(5px);
  animation: sp-heartbeat 6s ease-in-out infinite;
}

@keyframes sp-heartbeat {
  0% {
    transform: scale(0.8);
    opacity: 0.55;
  }
  50% {
    transform: scale(1);
    opacity: 0.7;
  }
  60% {
    transform: scale(1.3);
    opacity: 0.9;
  }
  65% {
    transform: scale(0.9);
    opacity: 0.6;
  }
  70% {
    transform: scale(1.4);
    opacity: 0.95;
  }
  75% {
    transform: scale(0.85);
    opacity: 0.6;
  }
  80% {
    transform: scale(2.2);
    opacity: 1;
  }
  88% {
    transform: scale(1.1);
    opacity: 0.7;
  }
  100% {
    transform: scale(0.8);
    opacity: 0.55;
  }
}

/* ---------- shockwave ring fired outward on release ---------- */
.sp-shockwave {
  position: absolute;
  width: 16%;
  height: 16%;
  top: 40.3%;
  left: 42%;
  border-radius: 50%;
  z-index: 2;
  border: 2px solid rgba(160, 205, 255, 0.9);
  animation: sp-shock 6s ease-out infinite;
  opacity: 0;
}

@keyframes sp-shock {
  0%,
  78% {
    transform: scale(1);
    opacity: 0;
    border-width: 3px;
  }
  80% {
    transform: scale(1);
    opacity: 0.9;
    border-width: 3px;
  }
  95% {
    transform: scale(7);
    opacity: 0;
    border-width: 0.5px;
  }
  100% {
    opacity: 0;
  }
}

/* ---------- particle sparks, spawned by JS in sync with the release ---------- */
.sp-particles {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
}

.sp-spark {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff, rgba(140, 195, 255, 0.9) 40%, transparent 70%);
  top: 50%;
  left: 50%;
  animation: sp-spark-fly 1.1s ease-out forwards;
}

@keyframes sp-spark-fly {
  0% {
    transform: translate(-50%, -50%) translate(0, 0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) translate(var(--dx), var(--dy)) scale(0.2);
    opacity: 0;
  }
}

/* ---------- text shimmer sweep, bottom band only ---------- */
.sp-shimmer-mask {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 6%;
  height: 16%;
  z-index: 7;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(90deg, transparent 40%, rgba(255, 255, 255, 0.9) 50%, transparent 60%);
  mask-image: linear-gradient(90deg, transparent 40%, rgba(255, 255, 255, 0.9) 50%, transparent 60%);
  -webkit-mask-size: 250% 100%;
  mask-size: 250% 100%;
  animation: sp-shimmer-sweep 5s ease-in-out infinite;
  background: linear-gradient(90deg, transparent, rgba(210, 225, 255, 0.9), transparent);
  mix-blend-mode: screen;
}

@keyframes sp-shimmer-sweep {
  0% {
    mask-position: -80% 0;
    -webkit-mask-position: -80% 0;
    opacity: 0;
  }
  15% {
    opacity: 1;
  }
  50% {
    mask-position: 40% 0;
    -webkit-mask-position: 40% 0;
    opacity: 1;
  }
  70% {
    opacity: 0;
  }
  100% {
    mask-position: 180% 0;
    -webkit-mask-position: 180% 0;
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sp-logo-img,
  .sp-aura,
  .sp-stars,
  .sp-core-glow,
  .sp-shockwave,
  .sp-shimmer-mask {
    animation: none;
  }
}

/* ---------- the name, under the mark, in the flow so it never overlaps ---------- */
.sp-overlay { flex-direction: column; gap: 4px; }
.sp-stage { max-width: min(460px, 62vh); }
.sp-wordmark {
  position: relative;
  text-align: center;
  z-index: 8;
  opacity: 0;
  animation: sp-hint-in 1s var(--ease) 0.5s forwards;
}
.sp-name {
  font-size: clamp(28px, 5vw, 44px);
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  background: linear-gradient(180deg, #e8f3ff 0%, #6fb6ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 14px rgba(80, 150, 255, 0.45));
}
.sp-tagline { margin-top: 6px; font-size: 12px; letter-spacing: 0.32em; text-transform: uppercase; color: rgba(170, 200, 240, 0.75); }

/* ---------- the first paint, before any script (index.html #boot) ----------
   The same stage as the splash, so the hand-over is seamless: the logo sits
   where the splash's will, breathing gently until the splash replaces it. */
.boot {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.boot-logo {
  width: 100%;
  max-width: min(460px, 62vh);
  aspect-ratio: 1 / 1;
  object-fit: contain;
  animation: boot-breathe 2.4s ease-in-out infinite;
}
.boot-name {
  font-size: clamp(28px, 5vw, 44px);
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #cfe4ff;
}
@keyframes boot-breathe {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 18px rgba(80, 150, 255, 0.35)); }
  50% { transform: scale(1.03); filter: drop-shadow(0 0 34px rgba(80, 150, 255, 0.6)); }
}
@media (prefers-reduced-motion: reduce) { .boot-logo { animation: none; } }

/* ---------- The landing picture (2026-10-06) ----------
   The owner's wide picture replaces the square mark here: a latticed Mobius
   band round the star, with orbits about it. Its edges fade into the black
   so no frame shows. It is a still, so the turning is drawn over it:

   - two lights run round the band, on an ellipse laid along it;
   - sparks ride the picture's own orbits, bright in front, dim behind;
   - the whole picture sways a few degrees, as if seen from a slow orbit.

   An orbit is a square squashed and tilted to the ellipse in the picture; an
   arm turns inside it and carries the spark at its end. Positions are read
   off the picture (the star at 49% across, 49.5% down). */
.sp-stage, .boot-logo { width: min(920px, 94vw, calc(62vh * 16 / 9)); max-width: none; aspect-ratio: 16 / 9; }
.sp-stage { perspective: 1100px; }
.sp-logo-img, .boot-logo {
  height: auto;
  object-fit: cover;
  -webkit-mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 66%, transparent 100%);
  mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 66%, transparent 100%);
}
.sp-logo-img { animation: sp-sway 9s ease-in-out infinite alternate; }
@keyframes sp-sway {
  from { transform: rotateY(-6deg) rotateX(2.5deg) scale(1.02); filter: drop-shadow(0 0 26px rgba(70, 140, 255, 0.28)); }
  to { transform: rotateY(6deg) rotateX(-2.5deg) scale(1.04); filter: drop-shadow(0 0 40px rgba(90, 170, 255, 0.42)); }
}
/* Made for the square mark; the picture has its own glow and stars. */
.sp-aura, .sp-shimmer-mask, .sp-stars { display: none; }

/* The star's heartbeat and its shockwave, moved onto the picture's star. */
.sp-core-glow, .sp-shockwave { width: 9%; height: auto; aspect-ratio: 1; left: 44.5%; top: 41.5%; }

.sp-orbit { position: absolute; aspect-ratio: 1; z-index: 4; pointer-events: none; mix-blend-mode: screen; }
.sp-orbit-arm { position: absolute; inset: 0; animation: sp-turn var(--turn) linear infinite; animation-delay: calc(var(--turn) / var(--of) * var(--n) * -1); }
.sp-orbit-spark { position: absolute; left: 100%; top: 50%; border-radius: 50%; animation: sp-depth var(--turn) linear infinite; animation-delay: inherit; }
@keyframes sp-turn { to { transform: rotate(360deg); } }
/* The arm starts at the right and goes down first: the bottom of the ellipse is the near side. */
@keyframes sp-depth { 0%, 100% { opacity: 0.65; } 25% { opacity: 1; } 50% { opacity: 0.65; } 75% { opacity: 0.18; } }

/* Light running round the band. */
.sp-band { --turn: 5.5s; width: 44%; left: 29.4%; top: 7%; transform: rotate(-9deg) scaleY(0.62); }
.sp-band .sp-orbit-spark { width: 17%; height: 27%; margin: -13.5% 0 0 -8.5%; background: radial-gradient(closest-side, rgba(240, 252, 255, 0.9), rgba(110, 215, 255, 0.45) 50%, transparent 80%); filter: blur(4px); }

/* Sparks on the picture's orbits. */
.sp-ring-a { --turn: 11s; width: 83%; left: 10.5%; top: -27.5%; transform: rotate(-6deg) scaleY(0.4); }
.sp-ring-b { --turn: 16s; width: 70%; left: 17%; top: -13%; transform: rotate(-4deg) scaleY(0.38); }
.sp-ring-a .sp-orbit-spark, .sp-ring-b .sp-orbit-spark { width: 1.5%; height: 3.8%; margin: -1.9% 0 0 -0.75%; background: radial-gradient(closest-side, #fff 50%, rgba(170, 225, 255, 0.9) 78%, transparent 100%); filter: drop-shadow(0 0 5px rgba(140, 205, 255, 0.95)); }
.sp-ring-b .sp-orbit-arm { animation-direction: reverse; }

@media (prefers-reduced-motion: reduce) {
  .sp-logo-img, .sp-orbit-arm, .sp-orbit-spark { animation: none; }
  .sp-orbit { display: none; }
}
