/* BraidMesh Neo layer — loaded last; uses theme variables from styles.css */
:root {
  --neo-radius-lg: 22px;
  --neo-radius-md: 14px;
  --neo-radius-sm: 10px;
  --neo-space-1: 8px;
  --neo-space-2: 16px;
  --neo-space-3: 24px;
  --neo-space-4: 40px;
  --neo-space-5: 72px;
  --neo-font-display: "Inter Tight", Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --neo-font-mono: ui-monospace, "SF Mono", SFMono-Regular, "JetBrains Mono", Consolas, monospace;
  --neo-ease: cubic-bezier(.2, .8, .2, 1);
  --neo-glass: color-mix(in srgb, var(--panel-strong, #0a0a14) 72%, transparent);
  --neo-edge: color-mix(in srgb, var(--cyan) 26%, transparent);
}
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }
body { background: var(--page); overflow-x: hidden; }

/* ---------- Aurora backdrop ---------- */
.neo-aurora { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.neo-aurora span {
  position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%;
  filter: blur(90px); opacity: .22; mix-blend-mode: screen;
  animation: neo-drift 26s var(--neo-ease) infinite alternate;
}
.neo-aurora span:nth-child(1) { top: -25vmax; left: -15vmax; background: var(--cyan); }
.neo-aurora span:nth-child(2) { top: 10vmax; right: -25vmax; background: var(--pink); animation-duration: 32s; animation-delay: -8s; opacity: .16; }
.neo-aurora span:nth-child(3) { bottom: -35vmax; left: 20vmax; background: var(--blue, var(--cyan)); animation-duration: 38s; opacity: .1; }
.neo-aurora::after {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse at 50% 20%, #000 10%, transparent 70%);
}
@keyframes neo-drift { to { transform: translate3d(8vmax, 6vmax, 0) scale(1.15); } }
.app-shell { position: relative; z-index: 1; }

/* ---------- Topbar: floating glass pill ---------- */
.topbar {
  position: sticky; top: 12px; z-index: 50;
  margin: 12px auto 0; max-width: 1240px;
  padding: 10px 14px 10px 18px;
  background: var(--neo-glass);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid var(--neo-edge);
  border-radius: 999px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .35);
}
.topbar .syntax-link {
  border-radius: 999px; border-color: transparent; background: transparent;
  font-family: var(--neo-font-mono); letter-spacing: .08em;
  transition: background .25s var(--neo-ease), color .25s var(--neo-ease);
}
.topbar .syntax-link:hover, .topbar .syntax-link:focus-visible {
  background: color-mix(in srgb, var(--cyan) 14%, transparent); color: var(--ink);
}
.topbar .theme-toggle { border-radius: 999px; }

/* ---------- Hero ---------- */
.neo-hero {
  position: relative;
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
  align-items: center; gap: var(--neo-space-4);
  min-height: min(88vh, 820px);
  padding: var(--neo-space-5) clamp(16px, 4vw, 48px) var(--neo-space-4);
  max-width: 1240px; margin: 0 auto;
}
.neo-kicker {
  display: inline-flex; align-items: center; gap: 10px; margin: 0 0 var(--neo-space-3);
  padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--neo-edge);
  background: color-mix(in srgb, var(--cyan) 7%, transparent);
  color: var(--cyan); font: 700 .68rem/1 var(--neo-font-mono); letter-spacing: .16em;
  animation: neo-rise .9s var(--neo-ease) both;
}
.neo-kicker-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 0 0 var(--cyan); animation: neo-ping 2s infinite; }
@keyframes neo-ping { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--cyan) 70%, transparent); } 100% { box-shadow: 0 0 0 12px transparent; } }

.neo-title {
  margin: 0; font-family: var(--neo-font-display);
  font-size: clamp(2.8rem, 8.2vw, 6.6rem); line-height: .92; letter-spacing: -.055em; font-weight: 800;
  color: var(--ink);
}
.neo-title-line { display: block; animation: neo-rise 1s var(--neo-ease) both; }
.neo-title-line:nth-child(2) { animation-delay: .12s; }
.neo-title-glow {
  background: linear-gradient(100deg, var(--cyan) 0%, var(--ink) 45%, var(--pink) 90%);
  background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: neo-rise 1s .12s var(--neo-ease) both, neo-sheen 8s linear infinite;
}
@keyframes neo-sheen { to { background-position: -200% 0; } }
@keyframes neo-rise { from { opacity: 0; transform: translateY(24px); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }

.neo-lede {
  max-width: 560px; margin: var(--neo-space-3) 0 0;
  color: var(--muted); font-size: clamp(1rem, 1.4vw, 1.15rem); line-height: 1.65;
  animation: neo-rise 1s .24s var(--neo-ease) both;
}
.neo-cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: var(--neo-space-4); animation: neo-rise 1s .36s var(--neo-ease) both; }
.neo-cta {
  position: relative; display: inline-flex; align-items: center; gap: 12px;
  min-height: 52px; padding: 0 22px; border-radius: 999px;
  font: 800 .74rem/1 var(--neo-font-mono); letter-spacing: .12em; text-decoration: none;
  transition: transform .3s var(--neo-ease), box-shadow .3s var(--neo-ease), background .3s var(--neo-ease);
}
.neo-cta b { font-size: 1rem; transition: transform .3s var(--neo-ease); }
.neo-cta:hover b, .neo-cta:focus-visible b { transform: translateX(4px); }
.neo-cta-ghost:hover b, .neo-cta-ghost:focus-visible b { transform: translateY(3px); }
.neo-cta-primary {
  color: var(--button-ink, #06060c);
  background: linear-gradient(110deg, var(--cyan), color-mix(in srgb, var(--cyan) 55%, var(--pink)));
  box-shadow: 0 10px 34px color-mix(in srgb, var(--cyan) 35%, transparent), inset 0 1px 0 rgba(255, 255, 255, .35);
}
.neo-cta-primary:hover, .neo-cta-primary:focus-visible { transform: translateY(-2px); box-shadow: 0 16px 48px color-mix(in srgb, var(--cyan) 50%, transparent); }
.neo-cta-ghost { color: var(--ink); border: 1px solid var(--neo-edge); background: color-mix(in srgb, var(--ink) 4%, transparent); }
.neo-cta-ghost:hover, .neo-cta-ghost:focus-visible { background: color-mix(in srgb, var(--ink) 9%, transparent); transform: translateY(-2px); }
.neo-cta:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }

.neo-stats {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px;
  margin: var(--neo-space-4) 0 0; max-width: 620px;
  border: 1px solid var(--neo-edge); border-radius: var(--neo-radius-md); overflow: hidden;
  background: var(--neo-edge);
  animation: neo-rise 1s .48s var(--neo-ease) both;
}
.neo-stat { padding: 14px 16px; background: var(--neo-glass); }
.neo-stat dt { color: var(--dim, var(--muted)); font: 700 .58rem/1.2 var(--neo-font-mono); letter-spacing: .14em; }
.neo-stat dd { margin: 6px 0 0; color: var(--ink); font: 800 1.35rem/1 var(--neo-font-display); letter-spacing: -.03em; }
.neo-stat dd small { margin-left: 3px; color: var(--cyan); font: 700 .7rem var(--neo-font-mono); }

/* Hero visual */
.neo-hero-visual {
  position: relative; aspect-ratio: 1; width: 100%; max-width: 520px; justify-self: center;
  animation: neo-rise 1.2s .2s var(--neo-ease) both;
}
.neo-orbit { position: absolute; inset: 6%; border-radius: 50%; border: 1px dashed var(--neo-edge); animation: neo-spin 40s linear infinite; }
.neo-orbit-b { inset: 18%; border-style: solid; border-color: color-mix(in srgb, var(--pink) 22%, transparent); animation-duration: 28s; animation-direction: reverse; }
.neo-orbit::before { content: ""; position: absolute; top: -4px; left: 50%; width: 8px; height: 8px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 16px var(--cyan); }
.neo-orbit-b::before { background: var(--pink); box-shadow: 0 0 16px var(--pink); }
@keyframes neo-spin { to { transform: rotate(360deg); } }
.neo-hero-visual::before {
  content: ""; position: absolute; inset: 22%; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--cyan) 28%, transparent), transparent 70%);
  filter: blur(20px); animation: neo-breathe 5s ease-in-out infinite;
}
@keyframes neo-breathe { 50% { transform: scale(1.12); opacity: .7; } }
.neo-braid { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.neo-strand { fill: none; stroke-width: 3.5; stroke-linecap: round; stroke-dasharray: 600; stroke-dashoffset: 600; animation: neo-draw 2.4s .4s var(--neo-ease) forwards, neo-flow 6s 2.8s linear infinite; }
.neo-strand.s1 { stroke: var(--cyan); filter: drop-shadow(0 0 8px var(--cyan)); }
.neo-strand.s2 { stroke: var(--pink); filter: drop-shadow(0 0 8px var(--pink)); animation-delay: .6s, 3s; }
.neo-strand.s3 { stroke: var(--ink); opacity: .45; stroke-width: 1.5; stroke-dasharray: 4 10; stroke-dashoffset: 0; animation: neo-march 3s linear infinite; }
@keyframes neo-draw { to { stroke-dashoffset: 0; } }
@keyframes neo-flow { 0% { stroke-dasharray: 600; stroke-dashoffset: 0; } 50% { stroke-dasharray: 120 30; } 100% { stroke-dasharray: 120 30; stroke-dashoffset: -600; } }
@keyframes neo-march { to { stroke-dashoffset: -140; } }
.neo-node { fill: var(--ink); filter: drop-shadow(0 0 10px var(--cyan)); animation: neo-breathe 2.4s ease-in-out infinite; transform-origin: center; transform-box: fill-box; }
.neo-node.n2, .neo-node.n3 { fill: var(--cyan); }
.neo-visual-tag {
  position: absolute; padding: 7px 11px; border-radius: 999px;
  background: var(--neo-glass); border: 1px solid var(--neo-edge);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  color: var(--ink); font: 700 .66rem/1 var(--neo-font-mono); letter-spacing: .06em; white-space: nowrap;
  animation: neo-float 6s ease-in-out infinite;
}
.tag-a { top: 12%; left: 0; }
.tag-b { bottom: 18%; right: 0; color: var(--pink); animation-delay: -2s; }
.tag-c { bottom: 4%; left: 14%; color: var(--cyan); animation-delay: -4s; }
@keyframes neo-float { 50% { transform: translateY(-10px); } }

.neo-scroll {
  position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%);
  display: inline-flex; flex-direction: column; align-items: center; gap: 10px; min-height: 44px; padding: 6px;
  color: var(--dim, var(--muted)); font: 700 .6rem var(--neo-font-mono); letter-spacing: .2em; text-decoration: none;
}
.neo-scroll i { width: 1px; height: 34px; background: linear-gradient(var(--cyan), transparent); animation: neo-scrollcue 2s ease-in-out infinite; transform-origin: top; }
@keyframes neo-scrollcue { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }
.neo-scroll:hover, .neo-scroll:focus-visible { color: var(--cyan); }

/* ---------- Ticker ---------- */
.neo-ticker {
  position: relative; overflow: hidden; margin: 0 0 var(--neo-space-4);
  border-block: 1px solid var(--neo-edge);
  background: color-mix(in srgb, var(--cyan) 4%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}
.neo-ticker-track { display: flex; width: max-content; animation: neo-marquee 36s linear infinite; }
.neo-ticker:hover .neo-ticker-track { animation-play-state: paused; }
.neo-ticker-track span {
  display: inline-flex; align-items: center; gap: 28px; padding: 16px 28px 16px 0;
  color: var(--ink); font: 800 .78rem/1 var(--neo-font-mono); letter-spacing: .18em; white-space: nowrap;
}
.neo-ticker-track span::after { content: "✦"; color: var(--pink); font-size: .7rem; }
@keyframes neo-marquee { to { transform: translateX(-50%); } }

/* ---------- Panels: glass cards with gradient edge ---------- */
main > .panel {
  position: relative; isolation: isolate;
  max-width: 1240px; margin-inline: auto;
  border-radius: var(--neo-radius-lg) !important;
  border: 1px solid var(--neo-edge) !important;
  background-color: var(--neo-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .35), inset 0 1px 0 color-mix(in srgb, var(--ink) 8%, transparent);
  overflow: hidden;
  transition: border-color .4s var(--neo-ease), box-shadow .4s var(--neo-ease);
}
main > .panel::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(600px circle at 0% 0%, color-mix(in srgb, var(--cyan) 10%, transparent), transparent 45%);
}
main > .panel:hover { border-color: color-mix(in srgb, var(--cyan) 45%, transparent) !important; }
main > .panel .eyebrow { font-family: var(--neo-font-mono); letter-spacing: .18em; color: var(--cyan); }
main > .panel h2 { font-family: var(--neo-font-display); letter-spacing: -.04em; line-height: 1.02; }

/* Cards & controls inside panels: softer geometry */
.hardware-card, .hardware-cockpit, .hardware-readout, .hardware-tab-panel, .hardware-benchmark-wrap,
.terminal-upgrade-card, .vector-rag-card, .vector-rag-chart-card, .vector-rag-ablation, .vector-rag-flow,
.vector-rag-flow-node, .social-link, .essay-card, .tactical-readout, .tactical-field-wrap, .tactical-rail {
  border-radius: var(--neo-radius-md) !important;
}
.hardware-tab, .tactical-view, .tactical-action, .vector-rag-link, .vector-rag-action, .terminal-launch-button, .terminal-command-link {
  border-radius: 999px !important;
  transition: transform .25s var(--neo-ease), background .25s var(--neo-ease), box-shadow .25s var(--neo-ease);
}
.hardware-tab:hover, .tactical-action:hover, .vector-rag-link:hover, .vector-rag-action:hover, .terminal-launch-button:hover { transform: translateY(-2px); }
.hardware-card, .terminal-upgrade-card, .vector-rag-card, .social-link {
  transition: transform .35s var(--neo-ease), border-color .35s var(--neo-ease), box-shadow .35s var(--neo-ease);
}
.hardware-card:hover, .terminal-upgrade-card:hover, .vector-rag-card:hover, .social-link:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 40px color-mix(in srgb, var(--cyan) 14%, transparent);
}
.video-responsive { border-radius: var(--neo-radius-md); overflow: hidden; }

/* Footer */
.site-footer {
  max-width: 1240px; margin: var(--neo-space-4) auto var(--neo-space-3);
  padding: var(--neo-space-3) clamp(16px, 4vw, 32px);
  border-top: 1px solid var(--neo-edge);
  font-family: var(--neo-font-mono); letter-spacing: .14em;
}

/* ---------- Scroll-driven reveal (progressive) ---------- */
@supports (animation-timeline: view()) {
  main > .panel {
    animation: neo-reveal linear both;
    animation-timeline: view();
    animation-range: entry 0% cover 22%;
  }
  @keyframes neo-reveal { from { opacity: 0; transform: translateY(48px) scale(.97); } to { opacity: 1; transform: none; } }
}

/* ---------- Light theme tuning ---------- */
[data-theme="slate"] .neo-aurora span { mix-blend-mode: multiply; opacity: .12; }
[data-theme="slate"] main > .panel, [data-theme="slate"] .topbar { box-shadow: 0 20px 50px rgba(15, 23, 42, .1); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .neo-hero { grid-template-columns: 1fr; min-height: auto; padding-top: var(--neo-space-4); padding-bottom: var(--neo-space-5); gap: var(--neo-space-3); }
  .neo-hero-visual { max-width: 340px; order: -1; }
  .topbar { border-radius: var(--neo-radius-lg); margin-inline: 10px; }
}
@media (max-width: 560px) {
  .neo-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .neo-cta { width: 100%; justify-content: space-between; }
  .neo-visual-tag { font-size: .58rem; }
  .neo-scroll { display: none; }
  main > .panel { border-radius: var(--neo-radius-md) !important; }
}

/* ---------- Count-up stats ---------- */
.neo-stat dd { font-variant-numeric: tabular-nums; }

/* ---------- Mobile menu ---------- */
.neo-menu-toggle { display: none; }
@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; row-gap: 0; }
  .neo-menu-toggle {
    display: inline-flex; flex-direction: column; justify-content: center; align-items: center; gap: 5px;
    width: 46px; height: 46px; margin-left: auto; padding: 0; cursor: pointer;
    border: 1px solid var(--neo-edge); border-radius: 50%;
    background: color-mix(in srgb, var(--cyan) 8%, transparent); color: var(--ink);
    transition: background .25s var(--neo-ease);
  }
  .neo-menu-toggle:hover, .neo-menu-toggle:focus-visible { background: color-mix(in srgb, var(--cyan) 18%, transparent); outline: none; box-shadow: 0 0 0 2px var(--cyan); }
  .neo-menu-toggle span { display: block; width: 18px; height: 2px; border-radius: 2px; background: currentColor; transition: transform .3s var(--neo-ease), opacity .2s; }
  .topbar.is-menu-open .neo-menu-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .topbar.is-menu-open .neo-menu-toggle span:nth-child(2) { opacity: 0; }
  .topbar.is-menu-open .neo-menu-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .topbar .topbar-actions { display: none !important; }
  .topbar.is-menu-open .topbar-actions {
    display: flex !important; flex-direction: column; align-items: stretch; gap: 6px;
    flex-basis: 100%; width: 100%; max-width: none !important; overflow: visible !important; padding: 14px 0 6px; margin-top: 10px;
    border-top: 1px solid var(--neo-edge);
    animation: neo-menu-in .35s var(--neo-ease) both;
  }
  .topbar.is-menu-open .syntax-link, .topbar.is-menu-open .theme-toggle { display: flex; align-items: center; min-height: 46px; justify-content: flex-start; padding-inline: 16px; font-size: 12px; }
  .topbar.is-menu-open .topbar-meta { justify-content: center; padding-top: 6px; font-size: 11px; }
}
@keyframes neo-menu-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .neo-aurora span, .neo-orbit, .neo-ticker-track, .neo-strand, .neo-node, .neo-visual-tag,
  .neo-title-glow, .neo-kicker-dot, .neo-hero-visual::before, .neo-scroll i { animation: none !important; }
  .neo-strand { stroke-dashoffset: 0; }
  .neo-kicker, .neo-title-line, .neo-lede, .neo-cta-row, .neo-stats, .neo-hero-visual { animation: none !important; }
  main > .panel { animation: none !important; }
  html { scroll-behavior: auto; }
}
