/* ============================================================
   Algoagent Core — "Ink & Tape" design system
   (impeccable polish pass: removed AI-slop tells, fixed contrast)
   ============================================================ */

:root {
  /* Palette */
  --ink:        #0B0E14;
  --surface-1:  #10151F;
  --surface-2:  #161D2A;
  --elevated:   #1D2534;
  --hairline:   #242D3F;
  --text-1:     #E7ECF4;
  --text-2:     #AEB7C6;  /* brightened for >=4.5:1 on ink */
  --text-3:     #828C9E;  /* brightened for >=4.5:1 on ink */
  --green:      #3ECF8E;
  --green-dim:  #2BA873;
  --amber:      #FFB454;
  --red:        #F87178;
  --blue:       #6CB6FF;

  /* Type */
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body:    "IBM Plex Sans", system-ui, sans-serif;
  --font-mono:    "IBM Plex Mono", ui-monospace, monospace;

  /* Layout */
  --maxw: 1140px;
  --radius: 6px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px; /* anchors land below the sticky nav */
  -webkit-text-size-adjust: 100%;
}

/* Scroll progress bar */
.progress {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 2px;
  transform-origin: 0 50%;
  transform: scaleX(0);
  background: linear-gradient(90deg, var(--green), var(--green-dim));
  z-index: 100;
  pointer-events: none;
}

body {
  background: var(--ink);
  color: var(--text-1);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  position: relative;
}

/* Ambient background: two soft radial glows only (no decorative grid overlay) */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(60vw 50vh at 50% -10%, rgba(62,207,142,.10), transparent 60%),
    radial-gradient(50vw 42vh at 88% 112%, rgba(108,182,255,.06), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

/* ---- Typography ---- */
.eyebrow {
  font-family: var(--font-mono);
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--amber);
}
.eyebrow.green { color: var(--green); }
/* One deliberate kicker (hero spec tag) is voice; repeating it on every
   section is AI scaffolding — hide the per-section kickers. */
.section-head .eyebrow,
.trust > .eyebrow,
.cta-band > .eyebrow { display: none; }

h1, h2, h3 {
  font-family: var(--font-display);
  line-height: 1.05;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.75rem, 6vw, 4.5rem);
  font-weight: 700;
}
h2 {
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  font-weight: 500;
}
h3 {
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.lead {
  font-size: 1.125rem;
  line-height: 1.7;
  color: var(--text-2);
  max-width: 60ch;
  text-wrap: pretty;
}

/* Long prose: pretty wrapping to reduce orphans */
.feature-text p, .step p, .trust p, .risk-banner p,
.audience-card li, .legal .doc p { text-wrap: pretty; }

.mono { font-family: var(--font-mono); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-family: var(--font-mono);
  font-size: .9rem;
  font-weight: 500;
  padding: .8rem 1.4rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
  white-space: nowrap;
}
.btn-primary {
  background: var(--green);
  color: #04120B;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35);
}
.btn-primary:hover { transform: translateY(-2px); background: #4fdd9c; }
.btn-secondary {
  background: transparent;
  color: var(--text-1);
  border-color: var(--hairline);
}
.btn-secondary:hover { transform: translateY(-2px); background: var(--surface-2); border-color: var(--text-3); }

/* ---- Nav ---- */
header.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11,14,20,.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--hairline);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}
.brand .dot {
  width: 10px; height: 10px; border-radius: 2px;
  background: var(--green);
  box-shadow: 0 0 12px rgba(62,207,142,.7);
}
.brand .core {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: .7rem;
  color: var(--amber);
  border: 1px solid var(--hairline);
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: .1em;
}
.nav-links { display: flex; align-items: center; gap: 1.75rem; }
.nav-links a.link {
  font-size: .9rem;
  color: var(--text-2);
  transition: color .15s ease;
  position: relative;
}
.nav-links a.link:hover { color: var(--text-1); }
.nav-links a.link.active { color: var(--green); }
.nav-links a.link.active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -6px;
  height: 2px;
  background: var(--green);
  border-radius: 2px;
}
.nav-cta { display: flex; align-items: center; gap: .75rem; }
@media (max-width: 760px) {
  .nav-links { display: none; }
}

/* ---- Hero ---- */
.hero { padding: 6rem 0 4rem; }
.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 3.5rem;
  align-items: center;
}
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 2.5rem; }
  .hero { padding: 4rem 0 3rem; }
}
.hero h1 { margin: 1.25rem 0 1.25rem; }
.hero h1 .accent { color: var(--green); }
.hero .lead { margin-bottom: 2rem; }
.hero-cta { display: flex; gap: 1rem; flex-wrap: wrap; }
.hero-meta {
  margin-top: 1.75rem;
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--text-3);
}
.hero-meta span { display: inline-flex; align-items: center; gap: .4rem; }
.hero-meta .tick { color: var(--green); }

/* ---- The Live Window (signature element) ---- */
.window {
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 30px 80px -30px rgba(0,0,0,.7), 0 0 0 1px rgba(62,207,142,.04);
  font-family: var(--font-mono);
}
.window-bar {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .7rem .9rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--hairline);
}
.window-bar .lights { display: flex; gap: .4rem; }
.window-bar .lights i {
  width: 11px; height: 11px; border-radius: 50%; display: block;
}
.window-bar .lights i:nth-child(1) { background: #F87178; }
.window-bar .lights i:nth-child(2) { background: #FFB454; }
.window-bar .lights i:nth-child(3) { background: #3ECF8E; }
.window-bar .title {
  margin-left: .5rem;
  font-size: .72rem;
  color: var(--text-3);
  letter-spacing: .05em;
}
.window-body {
  display: grid;
  grid-template-columns: 1fr 150px;
  min-height: 280px;
}
@media (max-width: 480px) {
  .window-body { grid-template-columns: 1fr; }
  .orderbook { display: none; }
}
/* Chart pane is a real data canvas — a faint vertical grid is legitimate here */
.chart-pane {
  padding: 1rem;
  border-right: 1px solid var(--hairline);
  background-image: linear-gradient(to right, rgba(36,45,63,.55) 1px, transparent 1px);
  background-size: 28px 100%;
}
.chart-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: .5rem;
}
.chart-head .sym { font-size: .8rem; color: var(--text-2); }
.chart-head .price { font-size: 1.05rem; font-weight: 600; color: var(--text-1); }
.chart-head .chg { font-size: .78rem; color: var(--green); }
.chart-head .chg.down { color: var(--red); }
#candles { width: 100%; height: 190px; }

.orderbook { padding: 1rem .8rem; font-size: .68rem; }
.orderbook .ob-head {
  display: flex; justify-content: space-between;
  color: var(--text-3); margin-bottom: .5rem; letter-spacing: .05em;
}
.ob-row {
  display: flex; justify-content: space-between;
  padding: 2px 4px; border-radius: 3px;
  transition: background .4s ease;
}
.ob-row .p { font-weight: 500; }
.ob-row.ask .p { color: var(--red); }
.ob-row.bid .p { color: var(--green); }
.ob-row .s { color: var(--text-3); }
.ob-row.flash-ask { background: rgba(248,113,120,.14); }
.ob-row.flash-bid { background: rgba(62,207,142,.14); }

.cmd-bar {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: .5rem;
  padding: .7rem 1rem;
  border-top: 1px solid var(--hairline);
  background: var(--surface-2);
  font-size: .78rem;
}
.cmd-bar .prompt { color: var(--green); }
.cmd-bar .cmd-text { color: var(--text-2); }
.cmd-bar .caret {
  display: inline-block; width: 8px; height: 1.05em;
  background: var(--green); vertical-align: text-bottom;
  animation: blink 1s steps(2, start) infinite;
}
@keyframes blink { to { visibility: hidden; } }

/* ---- Ticker tape ---- */
.tape {
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  background: var(--surface-1);
  overflow: hidden;
  padding: .7rem 0;
  position: relative;
  z-index: 1;
  mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}
.tape-track {
  display: flex;
  gap: 2.5rem;
  width: max-content;
  animation: scroll-tape 40s linear infinite;
  font-family: var(--font-mono);
  font-size: .8rem;
}
.tape:hover .tape-track { animation-play-state: paused; }
.tape-item { display: inline-flex; gap: .5rem; align-items: baseline; white-space: nowrap; }
.tape-item .t-sym { color: var(--text-2); }
.tape-item .t-price { color: var(--text-1); }
.tape-item .t-chg { font-weight: 500; }
.tape-item .t-chg.up { color: var(--green); }
.tape-item .t-chg.down { color: var(--red); }
@keyframes scroll-tape {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ---- Sections ---- */
section.block { padding: 7rem 0; position: relative; z-index: 1; }
@media (max-width: 760px) { section.block { padding: 4.5rem 0; } }
.section-head { max-width: 640px; margin-bottom: 3.5rem; }
.section-head h2 { margin: 1rem 0 1rem; }
.section-head .lead { font-size: 1.05rem; }

/* Features */
.feature {
  display: grid;
  grid-template-columns: 5fr 7fr;
  gap: 3rem;
  align-items: center;
  padding: 2.5rem 0;
  border-top: 1px solid var(--hairline);
}
.feature:nth-child(even) { grid-template-columns: 7fr 5fr; }
.feature:nth-child(even) .feature-text { order: 2; }
.feature:nth-child(even) .feature-visual { order: 1; }
@media (max-width: 820px) {
  .feature, .feature:nth-child(even) { grid-template-columns: 1fr; gap: 1.5rem; }
  .feature:nth-child(even) .feature-text { order: 1; }
  .feature:nth-child(even) .feature-visual { order: 2; }
}
.feature-text .num { display: none; } /* not a sequence — numbered markers are scaffolding */
.feature-text h3 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 500;
  margin: .25rem 0 .75rem;
}
.feature-text p { color: var(--text-2); }

/* Feature visuals render as mini terminal windows (no nested cards) */
.feature-visual {
  position: relative;
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 1.4rem 1.5rem;
  overflow: hidden;
  transition: border-color .2s ease, transform .2s ease;
}
.feature-visual::before {
  content: "";
  display: block;
  height: 28px;
  margin: -1.4rem -1.5rem 1.1rem;
  background-color: var(--surface-2);
  background-image:
    radial-gradient(circle, #F87178 0 3.5px, transparent 4.5px),
    radial-gradient(circle, #FFB454 0 3.5px, transparent 4.5px),
    radial-gradient(circle, #3ECF8E 0 3.5px, transparent 4.5px);
  background-repeat: no-repeat;
  background-position: 12px center, 26px center, 40px center;
  background-size: 9px 9px, 9px 9px, 9px 9px;
  border-bottom: 1px solid var(--hairline);
}
.feature-visual:hover { border-color: var(--green); transform: translateY(-2px); }

/* Order/approval rows live inside the window — borderless, no card-in-card */
.approval-card {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: .75rem 0;
  font-family: var(--font-mono);
  font-size: .8rem;
}
.approval-card + .approval-card { margin-top: 0; border-top: 1px solid var(--hairline); }
.approval-card .row { display: flex; justify-content: space-between; margin-bottom: .35rem; }
.approval-card .side-buy { color: var(--green); font-weight: 600; }
.approval-card .side-sell { color: var(--red); font-weight: 600; }
.approval-card .muted { color: var(--text-3); }
.approval-actions { display: flex; gap: .5rem; margin-top: .6rem; }
.chip {
  font-family: var(--font-mono); font-size: .7rem; padding: .3rem .7rem;
  border-radius: 4px; border: 1px solid var(--hairline);
}
.chip.approve { background: rgba(62,207,142,.12); color: var(--green); border-color: rgba(62,207,142,.3); }
.chip.reject { color: var(--text-3); }

/* Key vault rows */
.vault-line {
  display: flex; align-items: center; gap: .6rem;
  font-family: var(--font-mono); font-size: .78rem;
  padding: .6rem 0; border-bottom: 1px solid var(--hairline);
}
.vault-line:last-child { border-bottom: none; }
.vault-line .k-name { color: var(--text-2); width: 130px; }
.vault-line .k-val { color: var(--text-3); letter-spacing: .05em; }
.vault-line .k-lock { margin-left: auto; color: var(--green); font-size: .7rem; }

/* Sparkline */
.spark { width: 100%; height: 60px; margin-bottom: .25rem; }

/* Stats — a terminal status line, NOT a hero-metric card grid */
.stats {
  display: flex;
  flex-wrap: wrap;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface-1);
}
.stat {
  display: flex;
  align-items: baseline;
  gap: .55rem;
  padding: 1rem 1.4rem;
  border-right: 1px solid var(--hairline);
  transition: background .2s ease;
}
.stat:last-child { border-right: none; }
.stat:hover { background: var(--surface-2); }
.stat .count {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  color: var(--green);
  line-height: 1;
}
.stat .count.amber { color: var(--amber); }
.stat .stat-label {
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-2);
  margin: 0;
}
@media (max-width: 820px) {
  .stat { flex: 1 1 50%; border-bottom: 1px solid var(--hairline); }
  .stat:nth-child(2) { border-right: none; }
}

/* How it works */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
@media (max-width: 820px) { .steps { grid-template-columns: 1fr; } }
.step {
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 1.75rem;
}
.step .step-num {
  font-family: var(--font-mono);
  font-size: .8rem;
  color: var(--green);
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  margin-bottom: 1rem;
}
.step h3 { font-family: var(--font-display); font-weight: 500; margin-bottom: .5rem; }
.step p { color: var(--text-2); font-size: .95rem; }

/* Audience split */
.audience { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 700px) { .audience { grid-template-columns: 1fr; } }
.audience-card {
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 1.75rem;
  background: var(--surface-1);
}
.audience-card h3 { font-family: var(--font-mono); font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 1rem; }
.audience-card.for h3 { color: var(--green); }
.audience-card.notfor h3 { color: var(--amber); }
.audience-card ul { list-style: none; }
.audience-card li {
  padding: .5rem 0 .5rem 1.5rem;
  position: relative;
  color: var(--text-2);
  font-size: .95rem;
  border-bottom: 1px solid var(--hairline);
}
.audience-card li:last-child { border-bottom: none; }
.audience-card li::before {
  position: absolute; left: 0; top: .5rem;
  font-family: var(--font-mono);
}
.audience-card.for li::before { content: "+"; color: var(--green); }
.audience-card.notfor li::before { content: "×"; color: var(--amber); }

/* Trust / positioning */
.trust {
  text-align: center;
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 4rem 2rem;
  background:
    radial-gradient(ellipse at center, rgba(62,207,142,.06) 0%, transparent 70%),
    var(--surface-1);
}
.trust .quote {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.02em;
  max-width: 22ch;
  margin: 0 auto 1.5rem;
}
.trust .quote .accent { color: var(--green); }
.trust p { color: var(--text-2); max-width: 56ch; margin: 0 auto; }

/* Risk banner */
.risk-banner {
  border: 1px solid rgba(255,180,84,.3);
  background: rgba(255,180,84,.05);
  border-radius: 10px;
  padding: 1.75rem 2rem;
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}
.risk-banner .icon {
  font-family: var(--font-mono);
  color: var(--amber);
  font-size: 1.2rem;
  line-height: 1;
}
.risk-banner h3 { font-family: var(--font-display); font-weight: 500; color: var(--amber); margin-bottom: .5rem; }
.risk-banner p { color: var(--text-2); font-size: .92rem; }
.risk-banner a { color: var(--amber); text-decoration: underline; text-underline-offset: 3px; }

/* Download CTA band */
.cta-band {
  text-align: center;
  padding: 6rem 0;
}
.cta-band h2 { margin: 1rem 0 1.25rem; }
.cta-band .lead { margin: 0 auto 2rem; }
.cta-band .hero-cta { justify-content: center; }

/* Footer */
footer {
  border-top: 1px solid var(--hairline);
  padding: 3.5rem 0 2.5rem;
  position: relative;
  z-index: 1;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2.5rem;
}
@media (max-width: 700px) { .footer-grid { grid-template-columns: 1fr; gap: 1.5rem; } }
.footer-brand p { color: var(--text-3); font-size: .9rem; max-width: 36ch; margin-top: 1rem; }
.footer-col h4 {
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 1rem;
}
.footer-col a {
  display: block;
  color: var(--text-2);
  font-size: .9rem;
  padding: .3rem 0;
  transition: color .15s ease;
}
.footer-col a:hover { color: var(--text-1); }
.footer-bottom {
  border-top: 1px solid var(--hairline);
  padding-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  font-family: var(--font-mono);
  font-size: .75rem;
  color: var(--text-3);
}
.footer-bottom .disclaimer { max-width: 70ch; line-height: 1.6; }

/* ---- Legal pages ---- */
.legal { padding: 5rem 0 6rem; }
.legal .doc {
  max-width: 760px;
  margin: 0 auto;
}
.legal h1 { font-size: clamp(2rem, 4vw, 3rem); margin: 1rem 0 1.5rem; }
.legal .doc h2 {
  font-size: 1.35rem;
  margin: 2.5rem 0 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--hairline);
}
.legal .doc h3 { margin: 1.5rem 0 .5rem; }
.legal .doc p { color: var(--text-2); margin-bottom: 1rem; }
.legal .doc strong { color: var(--text-1); font-weight: 600; }
.legal .doc ul, .legal .doc ol { color: var(--text-2); margin: 0 0 1rem 1.25rem; }
.legal .doc li { margin-bottom: .5rem; }
.legal .doc a { color: var(--green); text-decoration: underline; text-underline-offset: 3px; }
.legal .doc hr { border: none; border-top: 1px solid var(--hairline); margin: 2rem 0; }
.legal .doc em { color: var(--text-3); }
.legal-back {
  font-family: var(--font-mono);
  font-size: .8rem;
  color: var(--text-3);
  display: inline-flex;
  gap: .4rem;
  margin-bottom: 1rem;
}
.legal-back:hover { color: var(--text-1); }

/* ---- Scroll reveal ---- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .7s cubic-bezier(.16,1,.3,1), transform .7s cubic-bezier(.16,1,.3,1);
  will-change: opacity, transform;
}
.reveal.in { opacity: 1; transform: none; }
.reveal[data-delay="1"] { transition-delay: .08s; }
.reveal[data-delay="2"] { transition-delay: .16s; }
.reveal[data-delay="3"] { transition-delay: .24s; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
  .tape-track { animation: none !important; }
  .cmd-bar .caret { animation: none !important; }
  * { scroll-behavior: auto !important; }
}
