/* ==========================================================================
   AI4QE — AI-Powered Trading Intelligence
   Dark-first visual system · restrained accent · sparse, premium layout
   ========================================================================== */

:root {
  --bg: #0a0a0d;
  --bg-2: #0f0f13;
  --surface: #141419;
  --surface-2: #1a1a21;

  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);

  --text: #f2f2f4;
  --text-dim: #a3a3b0;
  --text-faint: #6d6d7a;

  --accent: #7eb0ff;
  --accent-soft: rgba(126, 176, 255, 0.14);
  --glow: rgba(126, 176, 255, 0.35);

  --font-display: "Space Grotesk", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-body: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;

  --wrap: 1160px;
  --header-h: 64px;
  --radius: 14px;
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Subtle atmospheric glow at the top of the page */
body::before {
  content: "";
  position: fixed;
  inset: -20% -20% auto;
  height: 70vh;
  background: radial-gradient(ellipse at 50% 0%, rgba(126, 176, 255, 0.06), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

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

::selection { background: var(--accent); color: #0a0a0d; }

a { color: inherit; text-decoration: none; }

a:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip:not(:focus) {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0);
}
.skip:focus {
  position: fixed; top: 12px; left: 12px; z-index: 100;
  padding: 10px 16px; background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: 8px;
}

img, svg { max-width: 100%; display: block; }

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 24px;
}

/* ==========================================================================
   Typography helpers
   ========================================================================== */
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.02em; line-height: 1.08; text-wrap: balance; }

.accent { color: var(--accent); }

.eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 6px 14px;
  margin-bottom: 1.6rem;
}

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  z-index: 50;
  display: flex;
  align-items: center;
  background: rgba(10, 10, 13, 0.4);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: background 0.4s ease, border-color 0.4s ease;
}
.site-header.is-scrolled {
  background: rgba(10, 10, 13, 0.78);
  border-bottom-color: var(--border);
}

.header-inner {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: 0.02em;
}
.wm-dot { color: var(--accent); }

.site-nav {
  display: flex;
  gap: 1.75rem;
  margin-left: auto;
}
.site-nav a {
  font-size: 0.9rem;
  color: var(--text-dim);
  transition: color 0.25s ease;
}
.site-nav a:hover { color: var(--text); }

/* ==========================================================================
   Buttons
   ========================================================================== */
.cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1.9rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: transparent;
  transition: color 0.3s ease, border-color 0.3s ease, background 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}
.cta:hover {
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 24px rgba(126, 176, 255, 0.14);
  transform: translateY(-1px);
}
.cta:active { transform: translateY(0); }

.cta--small {
  padding: 0.5rem 1.2rem;
  font-size: 0.85rem;
}
.cta-arrow { opacity: 0.6; transition: transform 0.3s ease; }
.cta:hover .cta-arrow { transform: translateY(2px); }

/* ==========================================================================
   Sections
   ========================================================================== */
.section {
  padding: clamp(96px, 14vh, 160px) 0;
  scroll-margin-top: var(--header-h);
}

.sec-head h2 {
  font-size: clamp(2rem, 4vw, 3rem);
  margin-bottom: 1.4rem;
  max-width: 22ch;
}
.sec-head p {
  color: var(--text-dim);
  font-size: 1.06rem;
  max-width: 60ch;
}
.sec-head p + p { margin-top: 0.8rem; }
.sec-head.center { text-align: center; }
.sec-head.center h2 { margin-left: auto; margin-right: auto; }
.sec-head.center p { margin-left: auto; margin-right: auto; }

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding-top: calc(var(--header-h) + 32px);
  padding-bottom: 80px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 4rem;
  align-items: center;
  width: 100%;
}

.hero-copy h1 {
  font-size: clamp(2.7rem, 6vw, 4.4rem);
  line-height: 1.02;
  margin-bottom: 1.5rem;
}

.lede {
  font-size: 1.3rem;
  color: var(--text-dim);
  max-width: 32ch;
  margin-bottom: 2.4rem;
}

.hero-visual { display: flex; justify-content: center; }
.hero-visual svg { width: min(100%, 520px); height: auto; }

.hero-scrollhint {
  position: absolute;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-faint);
}
.hint-text { font-size: 0.7rem; letter-spacing: 0.22em; text-transform: uppercase; }
.hint-line {
  width: 1px; height: 44px;
  background: linear-gradient(to bottom, var(--accent), transparent);
  animation: hintDrop 2.2s ease-in-out infinite;
  transform-origin: top;
}
@keyframes hintDrop {
  0%   { transform: scaleY(0); opacity: 0; }
  30%  { transform: scaleY(1); opacity: 1; }
  70%  { opacity: 1; }
  100% { transform: scaleY(1); opacity: 0; }
}

/* ---------- Hero network ---------- */
#hero-net line {
  stroke: rgba(255, 255, 255, 0.13);
  stroke-width: 1;
  stroke-dasharray: 3 8;
}
#hero-net line.flow-up   { animation: dashflow 7s linear infinite; }
#hero-net line.flow-down { animation: dashflow 9s linear infinite reverse; }
#hero-net line.dim { stroke: rgba(255, 255, 255, 0.07); stroke-dasharray: none; animation: none; }

@keyframes dashflow { to { stroke-dashoffset: -44; } }

#hero-net .node-d circle {
  fill: #8a93a1;
  animation: nodePulse 5s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}
#hero-net .node-d:nth-child(odd) circle { animation-duration: 4.2s; }
@keyframes nodePulse { 50% { opacity: 0.45; transform: scale(1.25); } }

#hero-net .ai-core {
  fill: var(--accent);
  filter: drop-shadow(0 0 12px var(--glow));
  animation: aiPulse 3.6s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}
@keyframes aiPulse { 50% { transform: scale(1.18); opacity: 0.85; } }

#hero-net .ai-ring {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  animation: ripple 3.6s ease-out infinite;
}
@keyframes ripple {
  0%   { transform: scale(1);   opacity: 0.5; }
  100% { transform: scale(2.8); opacity: 0; }
}

#hero-net .p-up   { fill: rgba(230, 238, 255, 0.85); }
#hero-net .p-down { fill: var(--accent); filter: drop-shadow(0 0 4px var(--glow)); }

/* ==========================================================================
   Problem
   ========================================================================== */
.problem-copy {
  margin-top: 2rem;
  max-width: 58ch;
}
.problem-copy p {
  color: var(--text-dim);
  font-size: 1.28rem;
  line-height: 1.7;
}
.problem-copy p + p { margin-top: 0.9rem; }
.problem-copy .emph {
  margin-top: 1.8rem;
  color: var(--accent);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.6rem;
}

/* ---------- Data stream ---------- */
.stream {
  position: relative;
  height: 240px;
  margin-top: 4rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 26px;
  mask-image: linear-gradient(to right, transparent, #000 12%, #000 88%, transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, #000 12%, #000 88%, transparent);
}
.stream::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, var(--bg), transparent 18%, transparent 82%, var(--bg));
  pointer-events: none;
}

.stream-track {
  display: flex;
  width: max-content;
  will-change: transform;
  animation: marquee var(--dur, 60s) linear infinite;
}
.stream-track--slow { animation-duration: 96s; }

@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }

.set {
  display: flex;
  gap: 12px;
  padding-right: 12px;
}

.chip {
  flex: none;
  display: inline-flex;
  align-items: baseline;
  gap: 0.55rem;
  padding: 0.6rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-faint);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.chip b { color: var(--text-dim); font-weight: 600; }
.chip.hot {
  color: var(--accent);
  border-color: rgba(126, 176, 255, 0.55);
  box-shadow: 0 0 18px rgba(126, 176, 255, 0.18);
  transition: color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
.chip.hot b { color: var(--accent); }

.chip.fadey {
  animation: chipFade 5s ease-in-out infinite;
  animation-delay: var(--d, 0s);
}
@keyframes chipFade {
  0%, 100% { opacity: 0.35; }
  50%      { opacity: 0.95; }
}

/* ==========================================================================
   AI Trader — capabilities
   ========================================================================== */
.cap-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-top: 4rem;
}

.cap {
  background: linear-gradient(180deg, var(--surface), rgba(255,255,255,0.01));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.6rem;
  transition: border-color 0.35s ease, transform 0.35s ease, box-shadow 0.35s ease;
}
.cap:hover {
  border-color: rgba(126, 176, 255, 0.4);
  transform: translateY(-4px);
  box-shadow: 0 18px 40px -22px rgba(0, 0, 0, 0.8);
}

.cap-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px; height: 46px;
  margin-bottom: 1.3rem;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
}
.cap-icon svg { width: 22px; height: 22px; }

.cap h3 {
  font-size: 1.3rem;
  margin-bottom: 0.6rem;
}
.cap p { color: var(--text-dim); font-size: 0.95rem; }

/* ==========================================================================
   Agentic workflow
   ========================================================================== */
.wf-svg-wrap {
  display: flex;
  justify-content: center;
  margin-top: 3.5rem;
}
.wf-svg { width: min(100%, 700px); height: auto; }

.wf-ring {
  fill: none;
  stroke: rgba(255, 255, 255, 0.1);
  stroke-width: 1;
  stroke-dasharray: 2 7;
  animation: dashflow 40s linear infinite;
}

.wf-seg {
  fill: none;
  stroke: transparent;
  stroke-width: 1.8;
  stroke-linecap: round;
  transition: stroke 0.35s ease, filter 0.35s ease;
}
.wf-seg.lit { stroke: var(--accent); filter: drop-shadow(0 0 6px var(--glow)); }

.wf-node { opacity: 0; transform: scale(0.4); transition: opacity 0.7s ease var(--nd, 0s), transform 0.7s cubic-bezier(0.22, 1, 0.36, 1) var(--nd, 0s); transform-box: fill-box; transform-origin: center; }
.wf-svg-wrap.is-in .wf-node, .wf-node.is-in { opacity: 1; transform: scale(1); }
.wf-node:nth-child(1) { --nd: 0.05s; }
.wf-node:nth-child(2) { --nd: 0.14s; }
.wf-node:nth-child(3) { --nd: 0.23s; }
.wf-node:nth-child(4) { --nd: 0.32s; }
.wf-node:nth-child(5) { --nd: 0.41s; }
.wf-node:nth-child(6) { --nd: 0.50s; }
.wf-node:nth-child(7) { --nd: 0.59s; }

.wf-node circle {
  fill: #6b7180;
  transition: fill 0.35s ease, filter 0.35s ease;
}
.wf-node.active circle { fill: var(--accent); filter: drop-shadow(0 0 7px var(--glow)); }

.wf-node text {
  font-family: var(--font-display);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  fill: var(--text-faint);
  transition: fill 0.35s ease;
}
.wf-node.active text { fill: var(--accent); }

.wf-center { font-family: var(--font-display); text-anchor: middle; }
.wf-center--title { font-size: 15px; font-weight: 700; letter-spacing: 0.1em; fill: var(--text-dim); }
.wf-center--sub { font-size: 9.5px; letter-spacing: 0.3em; fill: var(--text-faint); }

.wf-particle {
  fill: var(--accent);
  filter: drop-shadow(0 0 7px var(--glow));
}

/* Mobile workflow list */
.wf-list {
  display: none;
  list-style: none;
  position: relative;
  margin: 3rem auto 0;
  max-width: 340px;
}
.wf-list::before {
  content: "";
  position: absolute;
  left: 11px; top: 12px; bottom: 12px;
  width: 1px;
  background: linear-gradient(to bottom, var(--accent), transparent);
}
.wf-list li {
  position: relative;
  padding: 0.85rem 0 0.85rem 2.6rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.16em;
  color: var(--text-dim);
}
.wf-list .dot {
  position: absolute;
  left: 8px; top: 1.1rem;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--glow);
  animation: listPulse 2.8s ease-in-out infinite;
}
.wf-list li:nth-child(2) .dot { animation-delay: 0.4s; }
.wf-list li:nth-child(3) .dot { animation-delay: 0.8s; }
.wf-list li:nth-child(4) .dot { animation-delay: 1.2s; }
.wf-list li:nth-child(5) .dot { animation-delay: 1.6s; }
.wf-list li:nth-child(6) .dot { animation-delay: 2.0s; }
.wf-list li:nth-child(7) .dot { animation-delay: 2.4s; }
@keyframes listPulse { 0%, 100% { opacity: 0.35; transform: scale(0.8); } 50% { opacity: 1; transform: scale(1.3); } }

/* ==========================================================================
   Intelligence layer
   ========================================================================== */
.iq-wrap {
  display: flex;
  justify-content: center;
  margin-top: 3.5rem;
}
.iq-svg { width: min(100%, 720px); height: auto; }

.iq-links line {
  stroke: rgba(255, 255, 255, 0.14);
  stroke-width: 1;
  stroke-dasharray: 2 6;
  animation: dashflow 6s linear infinite;
}

.iq-dot {
  fill: url(#iq-dot-grad);
  opacity: 0;
  animation-duration: 4.4s;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}
.iq-dot.up { animation-name: flowUp; }
.iq-dot.down { animation-name: flowDown; }

@keyframes flowUp {
  0%   { transform: translate(0, 0); opacity: 0; }
  15%  { opacity: 0.9; }
  85%  { opacity: 0.9; }
  100% { transform: translate(var(--tx, 0px), var(--ty, -130px)); opacity: 0; }
}
@keyframes flowDown {
  0%   { transform: translate(0, 0); opacity: 0; }
  15%  { opacity: 0.95; }
  85%  { opacity: 0.95; }
  100% { transform: translate(var(--tx, 0px), var(--ty, 120px)); opacity: 0; }
}

.iq-node rect {
  fill: rgba(20, 20, 25, 0.9);
  stroke: var(--border-strong);
  stroke-width: 1;
  transition: stroke 0.35s ease;
}
.iq-node--top rect { stroke: rgba(126, 176, 255, 0.45); fill: rgba(126, 176, 255, 0.06); }
.iq-node--platform rect { stroke: rgba(126, 176, 255, 0.35); }

.iq-node text {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  fill: var(--text-dim);
}
.iq-node--top text { fill: var(--text); }
.iq-node--platform text { fill: var(--text-dim); }

/* ==========================================================================
   Future
   ========================================================================== */
.future-visual {
  display: flex;
  justify-content: center;
  margin-top: 3.5rem;
}
.future-svg { width: min(100%, 560px); height: auto; }

.future-halo {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1;
  opacity: 0.1;
}
.future-ring--bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 1;
}

.orbit {
  transform-box: view-box;
  transform-origin: 320px 320px;
  animation: spin var(--dur, 22s) linear infinite;
}
.o1 { --dur: 22s; }
.o2 { --dur: 29s; animation-direction: reverse; }
.o3 { --dur: 40s; }

@keyframes spin { to { transform: rotate(360deg); } }

.or-dot { fill: var(--text-faint); opacity: 0.75; }
.or-dot--acc { fill: var(--accent); opacity: 0.9; }

.future-core {
  fill: var(--accent);
  filter: drop-shadow(0 0 12px var(--glow));
  transform-box: fill-box;
  transform-origin: center;
  animation: corePulse 4s ease-in-out infinite;
}
@keyframes corePulse { 50% { transform: scale(1.18); opacity: 0.85; } }

.future-ring {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  transform-box: fill-box;
  transform-origin: center;
  animation: ringPulse 4.6s ease-out infinite;
}
@keyframes ringPulse {
  0%   { transform: scale(1);   opacity: 0.6; }
  100% { transform: scale(6);   opacity: 0; }
}

.stray {
  fill: var(--text-dim);
  opacity: 0;
  transform: translate(0, 0) rotate(0);
  transition: opacity 2.4s ease 0.2s, transform 2.6s cubic-bezier(0.22, 1, 0.36, 1) 0.2s;
}
.stray.s1 { transform: translate(64px, -52px) rotate(24deg); }
.stray.s2 { transform: translate(-58px, 44px) rotate(-18deg); }
.stray.s3 { transform: translate(48px, 66px) rotate(12deg); }
.stray.s4 { transform: translate(-70px, -34px) rotate(-28deg); }
.is-in .stray { opacity: 0.8; transform: translate(0, 0) rotate(0); }

/* ==========================================================================
   Final CTA
   ========================================================================== */
.cta-sec { text-align: center; }
.cta-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
}
.cta-inner h2 { font-size: clamp(2.4rem, 5.5vw, 4rem); }
.cta-sub { color: var(--text-dim); font-size: 1.2rem; margin-bottom: 1rem; }

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 3rem 0;
  background: var(--bg-2);
}
.footer-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}
.foot-brand p {
  color: var(--text-faint);
  font-size: 0.9rem;
  margin-top: 0.4rem;
}
.foot-copy { color: var(--text-faint); font-size: 0.85rem; }

/* ==========================================================================
   Scroll reveal
   ========================================================================== */
[data-reveal] {
  opacity: 0;
  transform: translateY(28px);
  filter: blur(6px);
  transition:
    opacity 0.9s ease var(--d, 0s),
    transform 0.9s cubic-bezier(0.22, 1, 0.36, 1) var(--d, 0s),
    filter 0.9s ease var(--d, 0s);
  will-change: opacity, transform, filter;
}
[data-reveal].is-in {
  opacity: 1;
  transform: none;
  filter: none;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1024px) {
  .cap-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  .hero { min-height: auto; padding-top: calc(var(--header-h) + 56px); }
  .hero-grid { grid-template-columns: 1fr; gap: 3rem; }
  .hero-visual svg { width: min(100%, 420px); }
  .hero-scrollhint { display: none; }
  .site-nav { display: none; }
  .header-inner { gap: 0; }
  .site-header .cta { margin-left: auto; }
}

@media (max-width: 640px) {
  .cap-grid { grid-template-columns: 1fr; }
  .wf-svg-wrap { display: none; }
  .wf-list { display: block; }
  .stream { height: 200px; gap: 18px; }
  .problem-copy p { font-size: 1.12rem; }
  .section { padding: 84px 0; }
}

/* ==========================================================================
   Reduced motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .wf-seg { stroke: var(--accent-soft); }

  [data-reveal] {
    opacity: 1;
    transform: none;
    filter: none;
  }

  .stray { opacity: 0.8; transform: none; }
}
