/* Sci-fi atmosphere: starfield canvas, perspective grid, aurora, scanlines, reveals. */
.starfield { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; opacity: 0.9; }
.grid-horizon { position: fixed; left: 50%; bottom: -12vh; width: 180vw; height: 55vh; transform: translateX(-50%) perspective(600px) rotateX(64deg); background-image: linear-gradient(rgba(91, 140, 255, 0.16) 1px, transparent 1px), linear-gradient(90deg, rgba(91, 140, 255, 0.16) 1px, transparent 1px); background-size: 64px 64px; mask-image: linear-gradient(180deg, transparent, #000 45%, #000 70%, transparent); -webkit-mask-image: linear-gradient(180deg, transparent, #000 45%, #000 70%, transparent); z-index: 0; pointer-events: none; animation: grid-drift 9s linear infinite; opacity: 0.7; }
@keyframes grid-drift { from { background-position: 0 0, 0 0; } to { background-position: 0 64px, 0 0; } }

main, .site-header { position: relative; z-index: 1; }

/* Aurora blobs behind hero sections */
.aurora { position: absolute; inset: 0; overflow: hidden; z-index: -1; pointer-events: none; }
.aurora::before, .aurora::after { content: ""; position: absolute; width: 60vw; height: 60vw; max-width: 900px; max-height: 900px; border-radius: 50%; filter: blur(90px); opacity: 0.35; animation: aurora-float 18s ease-in-out infinite alternate; }
.aurora::before { background: radial-gradient(circle, rgba(47, 107, 255, 0.8), transparent 60%); top: -20%; left: -10%; }
.aurora::after { background: radial-gradient(circle, rgba(233, 201, 123, 0.55), transparent 60%); bottom: -25%; right: -10%; animation-delay: -9s; }
@keyframes aurora-float { from { transform: translate3d(0, 0, 0) scale(1); } to { transform: translate3d(6vw, 4vh, 0) scale(1.15); } }

/* Scanline sheen on hero visuals */
.scanlines { position: relative; }
.scanlines::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 3px); pointer-events: none; mix-blend-mode: overlay; border-radius: inherit; }

/* Sweep line across a panel */
.sweep { position: relative; overflow: hidden; }
.sweep::before { content: ""; position: absolute; top: 0; bottom: 0; width: 40%; left: -40%; background: linear-gradient(90deg, transparent, rgba(79, 209, 255, 0.10), transparent); animation: sweep 5s linear infinite; pointer-events: none; }
@keyframes sweep { to { left: 120%; } }

/* Blinking cursor / status dot */
.blink { animation: blink 1.2s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px var(--ok); margin-right: 0.45rem; vertical-align: middle; animation: pulse 2s ease-in-out infinite; }
.dot--sand { background: var(--sand); box-shadow: 0 0 10px var(--sand); }
.dot--blue { background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }
@keyframes pulse { 50% { transform: scale(0.75); opacity: 0.6; } }

/* Scroll reveals */
.js .reveal { opacity: 0; transform: translateY(22px); transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease); }
.reveal.is-visible { opacity: 1; transform: none; }
.js .reveal-stagger > * { opacity: 0; transform: translateY(18px); transition: opacity 0.6s var(--ease), transform 0.6s var(--ease); }
.reveal-stagger.is-visible > * { opacity: 1; transform: none; }
.reveal-stagger.is-visible > *:nth-child(2) { transition-delay: 0.08s; }
.reveal-stagger.is-visible > *:nth-child(3) { transition-delay: 0.16s; }
.reveal-stagger.is-visible > *:nth-child(4) { transition-delay: 0.24s; }
.reveal-stagger.is-visible > *:nth-child(5) { transition-delay: 0.32s; }
.reveal-stagger.is-visible > *:nth-child(6) { transition-delay: 0.40s; }
.reveal-stagger.is-visible > *:nth-child(n+7) { transition-delay: 0.48s; }

/* Orbit ring decoration */
.orbit { position: relative; }
.orbit::before { content: ""; position: absolute; inset: -14%; border: 1px dashed rgba(91, 140, 255, 0.35); border-radius: 50%; animation: spin 40s linear infinite; pointer-events: none; }
.orbit::after { content: ""; position: absolute; inset: -6%; border: 1px solid rgba(233, 201, 123, 0.25); border-radius: 50%; animation: spin 26s linear infinite reverse; pointer-events: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Signal wire in SVG diagrams */
.wire { stroke-dasharray: 6 8; animation: flow 1.6s linear infinite; }
@keyframes flow { to { stroke-dashoffset: -28; } }
.wire--slow { animation-duration: 3s; }

/* Typed counter */
.count { font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
  .grid-horizon, .aurora::before, .aurora::after, .sweep::before, .orbit::before, .orbit::after, .wire, .dot, .blink { animation: none !important; }
  .reveal, .reveal-stagger > * { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}
