/* The constellation of the home hero, in the visual language of the Shomahmudoff Account sign-in scene
   (saas/platform/auth static/css/scene.css, task P11-07): the account (a key) sits in the middle,
   InfraCanvas (a board block) is linked to it with a solid line, and the dashed rings are the products
   still to come. A crimson pulse travels between the account and InfraCanvas and, one after another, out
   to the coming products. The background behind it is the hero grid (grid.css).

   CSS and SVG only: no script, no inline style (CSP). Only opacity, transform and stroke-dashoffset
   animate. Decorative: aria-hidden, never focusable, sizes fixed by the viewBox so nothing shifts.
   Still under prefers-reduced-motion; hidden in forced-colors and print. Colours are mixed from the Qizil
   tokens, so both themes follow the theme switch; the two marks (static/scene/*.svg, copied from auth)
   use the Qizil crimson family. */

:root {
  --scene-accent: color-mix(in srgb, var(--q-accent) 70%, transparent);
  --scene-halo: color-mix(in srgb, var(--q-accent) 16%, transparent);
}
:root[data-theme="dark"] {
  --scene-halo: color-mix(in srgb, var(--q-accent) 26%, transparent);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --scene-halo: color-mix(in srgb, var(--q-accent) 26%, transparent);
  }
}

/* ---------- the constellation ---------- */

.constellation {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.constellation .link {
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
}
.constellation .link--live {
  stroke: var(--q-border-strong);
}
.constellation .link--soon {
  stroke: var(--q-border-strong);
  stroke-dasharray: 3 6;
  opacity: 0.8;
}
.constellation .link--faint {
  stroke: var(--q-border);
  stroke-dasharray: 2 7;
}
.constellation .node {
  fill: var(--q-bg);
  stroke: var(--q-border-strong);
  stroke-width: 1.5;
}
.constellation .node--hub-outer {
  fill: none;
  stroke: var(--q-border);
}
.constellation .node--soon {
  stroke-dasharray: 3 4;
  animation: node-arrive 8s ease-out infinite;
}
.constellation .node--s2 {
  animation-delay: -6s;
}
.constellation .node--s3 {
  animation-delay: -4s;
}
.constellation .node--s4 {
  animation-delay: -2s;
}
.constellation .halo {
  fill: var(--scene-halo);
  stroke: none;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
}
.constellation .halo--live {
  animation: halo-live 6.4s ease-in-out infinite;
}
.constellation .halo--hub {
  animation: halo-hub 6.4s ease-in-out infinite;
}
.constellation .pulse {
  fill: none;
  stroke: var(--q-accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 6 194;
  stroke-dashoffset: 6;
}
.constellation .pulse--live {
  animation: pulse-live 3.2s ease-in-out infinite alternate;
}
.constellation .pulse--soon {
  stroke-width: 2.5;
  opacity: 0;
  animation: pulse-soon 8s ease-in infinite;
}
.constellation .pulse--s2 {
  animation-delay: -6s;
}
.constellation .pulse--s3 {
  animation-delay: -4s;
}
.constellation .pulse--s4 {
  animation-delay: -2s;
}
.constellation .sparkle {
  fill: var(--scene-accent);
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  animation: sparkle 5s ease-in-out infinite;
}
.constellation .sparkle--2 {
  animation-delay: -1.8s;
}
.constellation .sparkle--3 {
  animation-delay: -3.4s;
}
.constellation .label {
  fill: var(--q-muted);
  font-family: var(--q-font-mono);
  font-size: 13px;
  letter-spacing: 0.06em;
  text-anchor: middle;
  text-transform: uppercase;
}

/* ---------- motion ---------- */

/* From the account (0) to InfraCanvas (100) and back (alternate): the dash is 6 units long. */
@keyframes pulse-live {
  from {
    stroke-dashoffset: 6;
  }
  to {
    stroke-dashoffset: -100;
  }
}
/* Arrival at InfraCanvas is at half of the 6.4s cycle, back at the account at its start and end. */
@keyframes halo-live {
  0%,
  35%,
  65%,
  100% {
    opacity: 0;
    transform: scale(0.9);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}
@keyframes halo-hub {
  0%,
  100% {
    opacity: 0.9;
    transform: scale(1);
  }
  15%,
  85% {
    opacity: 0;
    transform: scale(0.92);
  }
}
/* One pulse per coming service every 8s, staggered by 2s: out in the first 30%, then it fades. */
@keyframes pulse-soon {
  0% {
    stroke-dashoffset: 6;
    opacity: 0;
  }
  4% {
    opacity: 0.75;
  }
  28% {
    opacity: 0.75;
  }
  30% {
    stroke-dashoffset: -100;
    opacity: 0;
  }
  100% {
    stroke-dashoffset: -100;
    opacity: 0;
  }
}
@keyframes node-arrive {
  0%,
  26%,
  48%,
  100% {
    stroke: var(--q-border-strong);
  }
  32% {
    stroke: var(--q-accent);
  }
}
@keyframes sparkle {
  0%,
  100% {
    opacity: 0;
    transform: scale(0.4) rotate(0deg);
  }
  50% {
    opacity: 0.85;
    transform: scale(1) rotate(45deg);
  }
}

/* Still under reduced motion and under the footer's "Reduce motion" (data-motion="off" on <html>): the pulse
   rests halfway to InfraCanvas, both halos softly lit. */
@media (prefers-reduced-motion: reduce) {
  .constellation * {
    animation: none !important;
    transition: none !important;
  }
  .constellation .pulse--live {
    stroke-dashoffset: -47;
  }
  .constellation .halo--live,
  .constellation .halo--hub {
    opacity: 0.5;
  }
  .constellation .sparkle {
    opacity: 0.6;
  }
}
:root[data-motion="off"] .constellation * {
  animation: none !important;
  transition: none !important;
}
:root[data-motion="off"] .constellation .pulse--live {
  stroke-dashoffset: -47;
}
:root[data-motion="off"] .constellation .halo--live,
:root[data-motion="off"] .constellation .halo--hub {
  opacity: 0.5;
}
:root[data-motion="off"] .constellation .sparkle {
  opacity: 0.6;
}

@media (forced-colors: active) {
  .constellation .pulse,
  .constellation .halo,
  .constellation .sparkle {
    display: none;
  }
}
@media print {
  .hero__visual {
    display: none;
  }
}
