/* Nexus Prime shared story/design layer. Loaded only by public marketing/docs pages. */
:root {
  --nx-bg: #000;
  --nx-panel: rgba(12, 13, 15, 0.82);
  --nx-panel-strong: rgba(16, 18, 21, 0.94);
  --nx-border: rgba(255, 255, 255, 0.12);
  --nx-border-strong: rgba(57, 217, 120, 0.28);
  --nx-text: #f4f4f5;
  --nx-muted: #a1a1aa;
  --nx-dim: #64646e;
  --nx-green: #39d978;
  --nx-cyan: #7dd3fc;
  --nx-gold: #ff8a3d;
  --nx-rose: #ff6b8a;
  --nx-font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  --nx-font-serif: "Instrument Serif", Georgia, serif;
  --nx-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

html.nx-story {
  background: var(--nx-bg);
  scroll-behavior: smooth;
}

html.nx-story body.nx-story-body {
  position: relative;
  background-color: var(--nx-bg);
}

html.nx-story *,
html.nx-story *::before,
html.nx-story *::after {
  box-sizing: border-box;
}

html.nx-story body.nx-story-body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.44;
  background:
    linear-gradient(115deg, transparent 0 21%, rgba(57, 217, 120, 0.07) 21.2% 21.5%, transparent 21.8% 100%),
    linear-gradient(150deg, transparent 0 64%, rgba(125, 211, 252, 0.05) 64.2% 64.45%, transparent 64.8% 100%),
    radial-gradient(circle at 20% 18%, rgba(57, 217, 120, 0.1), transparent 28%),
    radial-gradient(circle at 86% 70%, rgba(255, 138, 61, 0.08), transparent 30%);
  mask-image: linear-gradient(to bottom, #000 0, #000 78%, transparent 100%);
}

html.nx-story body.nx-story-body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.28;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 72px 72px;
  transform: translate3d(0, 0, 0);
  animation: nxGridDrift 24s linear infinite;
}

html.nx-story body.nx-story-body > :not(.noise):not(script):not(style) {
  position: relative;
  z-index: 1;
}

html.nx-story body.nx-story-body > .noise {
  position: fixed !important;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
}

html.nx-story nav,
html.nx-story .nav,
html.nx-story header {
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

html.nx-story .hero,
html.nx-story .page-hero {
  position: relative;
  isolation: isolate;
}

html.nx-story .hero::after,
html.nx-story .page-hero::after {
  content: "";
  position: absolute;
  inset: 10% 0 auto auto;
  width: min(44vw, 520px);
  height: min(44vw, 520px);
  z-index: -1;
  pointer-events: none;
  opacity: 0.34;
  background:
    repeating-conic-gradient(from 18deg, rgba(57, 217, 120, 0.16) 0 4deg, transparent 4deg 17deg),
    radial-gradient(circle, transparent 0 48%, rgba(57, 217, 120, 0.18) 48.4% 49%, transparent 49.4% 61%, rgba(255, 138, 61, 0.12) 61.4% 62%, transparent 62.4%);
  border-radius: 50%;
  filter: blur(0.2px);
  animation: nxInstrumentTurn 38s linear infinite;
}

html.nx-story .hero > *,
html.nx-story .page-hero > * {
  position: relative;
  z-index: 1;
}

html.nx-story-home .hero > .hero-canvas {
  position: absolute !important;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  z-index: 1;
}

html.nx-story-home .hero::after {
  display: none;
}

html.nx-story h1,
html.nx-story h2,
html.nx-story h3 {
  text-wrap: balance;
}

html.nx-story p,
html.nx-story li {
  text-wrap: pretty;
}

html.nx-story main,
html.nx-story section,
html.nx-story article,
html.nx-story .grid,
html.nx-story .hero-card,
html.nx-story .panel,
html.nx-story .card {
  min-width: 0;
}

html.nx-story .panel,
html.nx-story .card,
html.nx-story article,
html.nx-story details,
html.nx-story pre {
  max-width: 100%;
}

html.nx-story :not(pre) > code {
  overflow-wrap: anywhere;
}

html.nx-story pre {
  overflow-x: auto;
}

html.nx-story .quick-link,
html.nx-story .quick-link:visited {
  color: var(--nx-text);
}

html.nx-story .quick-link p,
html.nx-story .quick-link span {
  color: var(--nx-muted);
}

html.nx-story main a:not([class]),
html.nx-story footer a:not([class]) {
  color: var(--nx-green);
  text-underline-offset: 4px;
}

html.nx-story .panel,
html.nx-story .card,
html.nx-story .hero-card,
html.nx-story .stat,
html.nx-story .diagram-card,
html.nx-story .quick-link,
html.nx-story .pricing-card,
html.nx-story details,
html.nx-story article {
  border-color: color-mix(in srgb, var(--nx-border) 82%, var(--nx-green));
  box-shadow: 0 18px 70px rgba(0, 0, 0, 0.28);
}

html.nx-story .panel:hover,
html.nx-story .card:hover,
html.nx-story .hero-card:hover,
html.nx-story .stat:hover,
html.nx-story .diagram-card:hover,
html.nx-story .quick-link:hover,
html.nx-story .pricing-card:hover {
  border-color: var(--nx-border-strong);
  transform: translateY(-2px);
}

html.nx-story code,
html.nx-story pre,
html.nx-story .command,
html.nx-story .hero-install {
  box-shadow: inset 0 0 0 1px rgba(57, 217, 120, 0.08);
}

.nx-story-band {
  position: relative;
  width: min(100% - 48px, 1200px);
  margin: clamp(32px, 6vw, 72px) auto;
  display: grid;
  grid-template-columns: minmax(0, 0.86fr) minmax(280px, 1.14fr);
  gap: clamp(24px, 4vw, 52px);
  align-items: center;
  padding: clamp(22px, 4vw, 38px);
  border: 1px solid var(--nx-border);
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(57, 217, 120, 0.08), transparent 38%),
    linear-gradient(180deg, var(--nx-panel-strong), rgba(4, 5, 7, 0.92));
  overflow: hidden;
}

.nx-story-band::before {
  content: "";
  position: absolute;
  inset: auto -12% -40% 38%;
  height: 220px;
  border: 1px solid rgba(255, 138, 61, 0.14);
  transform: rotate(-8deg);
  pointer-events: none;
}

.nx-story-copy {
  position: relative;
  z-index: 1;
}

.nx-story-kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  font-family: var(--nx-font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--nx-green);
}

.nx-story-kicker::before {
  content: "";
  width: 18px;
  height: 1px;
  background: currentColor;
}

.nx-story-headline {
  max-width: 15ch;
  margin: 0;
  color: var(--nx-text);
  font-family: var(--nx-font-serif);
  font-size: clamp(2.2rem, 5vw, 4rem);
  font-weight: 400;
  line-height: 0.95;
}

.nx-story-proof {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.nx-story-proof span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 8px 11px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--nx-muted);
  font-family: var(--nx-font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
}

.nx-story-proof span:nth-child(1)::before,
.nx-story-proof span:nth-child(2)::before,
.nx-story-proof span:nth-child(3)::before {
  content: "";
  width: 6px;
  height: 6px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--nx-green);
  box-shadow: 0 0 10px rgba(57, 217, 120, 0.62);
}

.nx-story-proof span:nth-child(2)::before {
  background: var(--nx-cyan);
  box-shadow: 0 0 10px rgba(125, 211, 252, 0.58);
}

.nx-story-proof span:nth-child(3)::before {
  background: var(--nx-gold);
  box-shadow: 0 0 10px rgba(255, 138, 61, 0.55);
}

.nx-story-map {
  position: relative;
  z-index: 1;
  min-height: 300px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    rgba(0, 0, 0, 0.28);
  background-size: 34px 34px;
  overflow: hidden;
}

.nx-story-map svg {
  width: 100%;
  height: 100%;
  min-height: 300px;
  display: block;
}

.nx-story-map text {
  font-family: var(--nx-font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nx-path {
  stroke-dasharray: 340;
  stroke-dashoffset: 340;
  animation: nxPathDraw 2.8s var(--nx-ease) forwards;
}

.nx-path:nth-of-type(2) { animation-delay: 0.12s; }
.nx-path:nth-of-type(3) { animation-delay: 0.24s; }
.nx-path:nth-of-type(4) { animation-delay: 0.36s; }

.nx-pulse-node {
  transform-box: fill-box;
  transform-origin: center;
  animation: nxPulse 2.4s ease-in-out infinite;
}

.nx-reveal {
  opacity: 0.001;
  transform: translateY(18px);
  transition: opacity 0.7s var(--nx-ease), transform 0.7s var(--nx-ease), border-color 0.25s ease, box-shadow 0.25s ease;
}

.nx-reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

html.nx-scroll-story-ready .nx-scroll-story {
  position: relative;
}

html.nx-scroll-story-ready .nx-scroll-story .nx-story-step {
  position: relative;
  min-width: 0;
}

.nx-site-footer {
  position: relative;
  z-index: 1;
  display: block;
  width: min(100% - 48px, 1200px);
  margin: clamp(56px, 8vw, 96px) auto 0;
  padding: clamp(30px, 5vw, 48px) 0 28px;
  border-top: 1px solid var(--nx-border);
  color: var(--nx-muted);
  font-family: var(--nx-font-mono);
  font-size: 0.78rem;
}

.nx-site-footer a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}

.nx-site-footer a:hover {
  color: var(--nx-green);
}

.nx-site-footer-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(22px, 4vw, 52px);
  margin-bottom: clamp(42px, 7vw, 88px);
}

.nx-site-footer-kicker {
  display: block;
  margin-bottom: 16px;
  color: var(--nx-text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0;
}

.nx-site-footer ul {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nx-site-footer-mark {
  margin: 0 0 24px;
  color: rgba(255, 255, 255, 0.04);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: clamp(4rem, 16vw, 9rem);
  font-weight: 800;
  line-height: 0.82;
  letter-spacing: 0;
}

.nx-site-footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-top: 22px;
  border-top: 1px solid var(--nx-border);
  flex-wrap: wrap;
}

.nx-site-footer-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.nx-site-footer-labs {
  color: color-mix(in srgb, var(--nx-green) 76%, var(--nx-text));
}

.nx-site-footer-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.nx-site-footer-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--nx-green);
  box-shadow: 0 0 12px rgba(57, 217, 120, 0.75);
}

@media (min-width: 768px) and (prefers-reduced-motion: no-preference) {
  html.nx-scroll-story-ready .nx-scroll-story .nx-story-step {
    transition:
      opacity 0.45s var(--nx-ease),
      transform 0.45s var(--nx-ease),
      filter 0.45s var(--nx-ease),
      border-color 0.28s ease,
      box-shadow 0.28s ease;
  }

  html.nx-scroll-story-ready .nx-scroll-story .nx-story-step:not(.is-current) {
    opacity: 0.58;
    transform: translateY(8px) scale(0.985);
    filter: saturate(0.72);
  }

  html.nx-scroll-story-ready .nx-scroll-story .nx-story-step.is-current {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: saturate(1);
    border-color: color-mix(in srgb, var(--nx-border-strong) 72%, var(--nx-green));
    box-shadow:
      0 22px 72px rgba(0, 0, 0, 0.34),
      0 0 24px rgba(57, 217, 120, 0.08);
  }

  html.nx-scroll-story-ready .nx-scroll-story .nx-story-step.is-current::after {
    content: "";
    position: absolute;
    inset: auto 16px 12px 16px;
    height: 1px;
    border-radius: 0;
    pointer-events: none;
    background: linear-gradient(90deg, transparent, rgba(57, 217, 120, 0.42), rgba(255, 138, 61, 0.26), transparent);
    opacity: 0.82;
  }
}

@keyframes nxGridDrift {
  from { background-position: 0 0, 0 0; }
  to { background-position: 72px 72px, 72px 72px; }
}

@keyframes nxInstrumentTurn {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes nxPathDraw {
  to { stroke-dashoffset: 0; }
}

@keyframes nxPulse {
  0%, 100% { opacity: 0.72; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.22); }
}

@media (max-width: 760px) {
  html.nx-story body.nx-story-body::before {
    opacity: 0.32;
  }

  html.nx-story-home .hero {
    min-height: auto !important;
    padding-top: 82px !important;
    padding-bottom: 30px !important;
  }

  html.nx-story-home .hero .hero-grid {
    padding-top: 0 !important;
  }

  .nx-story-band {
    width: min(100% - 32px, 680px);
    grid-template-columns: 1fr;
    padding: 20px;
  }

  .nx-story-map,
  .nx-story-map svg {
    min-height: 240px;
  }

  .nx-story-headline {
    max-width: 11ch;
    font-size: clamp(2rem, 13vw, 3.25rem);
  }

  .nx-site-footer {
    width: min(100% - 32px, 680px);
  }

  .nx-site-footer-grid {
    grid-template-columns: 1fr 1fr;
  }

  .nx-site-footer-mark {
    font-size: clamp(3.2rem, 22vw, 6rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  html.nx-story body.nx-story-body::after,
  html.nx-story .hero::after,
  html.nx-story .page-hero::after,
  .nx-path,
  .nx-pulse-node,
  .nx-reveal,
  .nx-story-step {
    animation: none !important;
    transition: none !important;
  }

  .nx-path {
    stroke-dashoffset: 0;
  }

  .nx-reveal {
    opacity: 1;
    transform: none;
  }

  .nx-story-step {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }
}
