/* Scroll-linked decorative shapes (pairs with assets/js/scroll.js). Every value is driven by --p (0..1);
   the default --p: 1 is the finished picture, used without JS and under reduced motion. */
[data-sfx] { --p: 1; }
/* Per piece: its own progress after a stagger delay (--d), eased out. */
[data-sfx] [data-d], .ob-ring, .ry {
  --q: clamp(0, (var(--p) - var(--d, 0)) / (1 - var(--d, 0)), 1);
  --e: calc(1 - (1 - var(--q)) * (1 - var(--q)));
}
.sfx-art { display: block; overflow: visible; pointer-events: none; }
.sfx-art * { transform-box: fill-box; transform-origin: center; }

/* Placement: to the right of the section heading on wide screens, under it on narrow ones. */
#platform > .container, #how > .container, #capabilities > .container { position: relative; }
.sfx-hex, .sfx-noise, .sfx-orbit { position: absolute; right: var(--gutter); top: -28px; width: clamp(200px, 16vw, 260px); height: auto; }
.sfx-noise { width: clamp(240px, 22vw, 340px); top: -16px; }
@media (max-width: 1100px) {
  .sfx-hex, .sfx-noise, .sfx-orbit { position: static; width: min(220px, 62vw); margin: -8px 0 28px auto; }
  .sfx-noise { width: min(300px, 80vw); }
}

/* Hex core and shield art: see art.css. */
@keyframes sfxPulse { 50% { stroke-opacity: .35; fill-opacity: .5; } }

/* ---------- Noise to signal: scattered alerts merge into one, then a check draws ---------- */
.ns-funnel { fill: none; stroke: rgba(91, 124, 255, .28); stroke-width: 1; stroke-dasharray: 3 5; }
.ns-dot {
  --tone: var(--med);
  fill: var(--tone); fill: color-mix(in srgb, var(--brand) calc(var(--q) * 100%), var(--tone));
  transform: translate(calc(var(--dx, 0) * (1 - var(--q)) * 1px), calc(var(--dy, 0) * (1 - var(--q)) * 1px));
  opacity: calc(.95 - var(--q) * .55);
}
.ns-dot.n-c { --tone: var(--crit); } .ns-dot.n-h { --tone: var(--high); } .ns-dot.n-l { --tone: var(--low); }
.ns-ring, .ns-check { fill: none; stroke: var(--brand); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; }
.ns-ring { stroke-width: 1.4; stroke-dashoffset: calc(1 - clamp(0, (var(--p) - .72) * 4, 1)); transform: rotate(-90deg); }
.ns-check { stroke: #3ddc97; stroke-width: 2.6; stroke-dashoffset: calc(1 - clamp(0, (var(--p) - .86) * 7.2, 1)); }

/* Steps: an underline sweeps across each step in turn. */
.steps li::before {
  content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2)); transform-origin: left;
  transform: scaleX(clamp(0, var(--p) * 4.4 - var(--i, 0) * 1.1, 1));
}
.steps li:nth-child(2) { --i: 1; } .steps li:nth-child(3) { --i: 2; } .steps li:nth-child(4) { --i: 3; }

/* ---------- Orbit: three rings turn until their lead nodes line up ---------- */
.ob-ring { transform-box: view-box; transform-origin: 140px 140px; transform: rotate(calc(var(--rot, 0) * (1 - var(--e)) * 1deg)); }
.ob-ring * { transform-box: view-box; }
.ob-path { fill: none; stroke: rgba(91, 124, 255, .3); stroke-width: 1; stroke-dasharray: 2 4; }
.ob-node { fill: #0f141d; stroke: var(--brand); stroke-width: 1.4; }
.ob-ring .ob-node:first-of-type { fill: var(--brand); }
.ob-link { fill: none; stroke: var(--brand); stroke-width: 1.6; stroke-dasharray: 1; stroke-dashoffset: calc(1 - clamp(0, (var(--p) - .84) * 6.3, 1)); }
.ob-core { fill: rgba(0, 174, 239, .2); stroke: var(--brand); stroke-width: 1.4; }
.sfx-on .ob-core { animation: sfxPulse 2.6s ease-in-out infinite; }

/* ---------- Final call to action: rays open around the button ---------- */
.final-cta > .container { position: relative; z-index: 1; }
.sfx-rays { position: absolute; left: 50%; top: 50%; width: min(900px, 140vw); height: auto; translate: -50% -50%; z-index: 0; pointer-events: none;
  transform: rotate(calc(var(--p) * 40deg)); opacity: .9; }
.ry { fill: none; stroke: rgba(0, 174, 239, .42); stroke-width: 1.2; stroke-linecap: round; stroke-dasharray: 2 7;
  transform-box: view-box; transform-origin: 0 0; transform: scaleX(var(--e)); }
.ry-ring { fill: none; stroke: rgba(91, 124, 255, .25); stroke-width: 1; transform-box: view-box; transform-origin: 0 0; transform: scale(calc(.3 + var(--p) * .7)); }
.ry-ring2 { stroke-dasharray: 3 9; transform: scale(calc(.2 + var(--p) * .8)) rotate(calc(var(--p) * -90deg)); }

/* ---------- Hero: copy and console drift up at different speeds as you leave; the logo mark lingers ---------- */
.hero { --p: 0; }
.sfx-on .hero-copy { translate: 0 calc(var(--p) * -60px); opacity: calc(1 - var(--p) * .7); }
.sfx-on .hero .console { translate: 0 calc(var(--p) * -130px); }
.sfx-on .page-watermark { translate: 0 calc(var(--hero-p, 0) * 30vh); }
.sfx-on .page-watermark .logo-stage { scale: calc(1 + var(--hero-p, 0) * .08); rotate: calc(var(--hero-p, 0) * -6deg); }

/* ---------- Floating outline shapes (parallax + turn) ---------- */
.fx-host { position: relative; overflow-x: clip; }
.fx-host > :not(.fl-layer) { position: relative; z-index: 1; }
.fl-layer { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.fl { position: absolute; width: var(--sz, 56px); height: var(--sz, 56px); fill: none; stroke: rgba(0, 174, 239, .2); stroke-width: 1.3; stroke-linejoin: round;
  transform: translateY(calc((var(--p) - .5) * var(--sp, 120px))) rotate(calc(var(--p) * var(--rt, 90deg))); }
.fl-ci circle:last-child { fill: rgba(0, 174, 239, .35); stroke: none; }
.fl-layer .fl:nth-child(1) { --sz: 64px; --sp: -160px; --rt: 120deg; }
.fl-layer .fl:nth-child(2) { --sz: 44px; --sp: 220px; --rt: -180deg; stroke: rgba(91, 124, 255, .24); }
.fl-layer .fl:nth-child(3) { --sz: 84px; --sp: -110px; --rt: 90deg; stroke: rgba(91, 124, 255, .16); }
.fl-layer .fl:nth-child(4) { --sz: 36px; --sp: 260px; --rt: -240deg; }
.v1 .fl:nth-child(1) { left: 1.5%; top: 4%; } .v1 .fl:nth-child(2) { right: 3%; top: 10%; }
.v1 .fl:nth-child(3) { left: 46%; bottom: 6%; } .v1 .fl:nth-child(4) { right: 22%; bottom: 18%; }
.v2 .fl:nth-child(1) { right: 2%; top: 46%; } .v2 .fl:nth-child(2) { left: 3%; top: 30%; }
.v2 .fl:nth-child(3) { left: 30%; top: 6%; } .v2 .fl:nth-child(4) { left: 6%; bottom: 8%; }
@media (max-width: 700px) { .fl { --sz: 34px !important; opacity: .7; } }

@media (forced-colors: active) { .sfx-art, .sfx-rays, .fl-layer { display: none; } }
@media print { .sfx-art, .sfx-rays, .fl-layer { display: none; } }

/* ---------- Platform tabs pinned while the page scrolls through them (tabscroll.js) ---------- */
.tab-track-on { height: var(--track-h, auto); }
.tab-track-on > [data-tabs] { position: sticky; top: var(--pin-top, 0px); }
/* Short screens: the scene shrinks (keeping its 420x300 shape) so the whole block fits under the header. */
.tab-track-on .scene { max-height: var(--scene-max, none); max-width: calc(var(--scene-max, 100vw) * 1.4); justify-self: center; }
@media print { .tab-track-on { height: auto; } .tab-track-on > [data-tabs] { position: static; } }
