/* ========== TOKENS ========== */
:root {
  --bg: #0a1628;
  --surface-1: #0f1d33;
  --surface-2: #152944;
  --surface-3: #1d3554;
  --line: #25426b;
  --line-soft: rgba(255, 255, 255, 0.08);
  --text: #f4f6fb;
  --text-dim: #9bafd1;
  --text-mute: #6e83a8;
  --accent: #fbc116;
  --accent-warm: #ffd35a;
  --accent-soft: rgba(251, 193, 22, 0.14);
  --danger: #ff6b6b;
  --ok: #2bd9a3;
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --shadow-lift: 0 30px 60px -20px rgba(0,0,0,0.55), 0 8px 20px -10px rgba(0,0,0,0.4);
  --shadow-soft: 0 1px 0 rgba(255,255,255,0.04) inset, 0 8px 24px -10px rgba(0,0,0,0.5);
  --max: 1240px;
  --pad: clamp(20px, 4vw, 56px);
  --ease-out-cubic: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-snap: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1, h2, h3, h4 { font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; margin: 0 0 0.5em; }
h1 { font-size: clamp(2.4rem, 5vw, 4rem); font-weight: 800; letter-spacing: -0.035em; }
h2 { font-size: clamp(1.85rem, 3.5vw, 2.75rem); letter-spacing: -0.025em; }
h3 { font-size: clamp(1.25rem, 2vw, 1.6rem); }
h4 { font-size: 1rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-dim); font-weight: 600; }
p { margin: 0 0 1em; color: var(--text-dim); }
a { color: var(--accent); text-decoration: none; transition: opacity 0.15s; }
a:hover { opacity: 0.85; }
strong { color: var(--text); font-weight: 600; }
code, kbd { font-family: 'JetBrains Mono', monospace; font-size: 0.9em; background: var(--surface-2); padding: 0.15em 0.4em; border-radius: 4px; color: var(--accent-warm); }
.accent { color: var(--accent); }
.muted { color: var(--text-mute); }

/* ========== LAYOUT ========== */
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--pad); }
section { padding: clamp(64px, 9vw, 120px) 0; position: relative; }
section.tight { padding-block: clamp(48px, 6vw, 80px); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 100px;
  background: var(--accent-soft);
  border: 1px solid rgba(251, 193, 22, 0.28);
  color: var(--accent-warm);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 20px;
}
.eyebrow::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }

/* ========== NAV ========== */
.nav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px) saturate(180%);
  background: rgba(10, 22, 40, 0.78);
  border-bottom: 1px solid var(--line-soft);
}
.nav-inner {
  max-width: var(--max); margin: 0 auto;
  padding: 14px var(--pad);
  display: flex; align-items: center; gap: 32px;
}
.nav-logo { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 1.18rem; letter-spacing: -0.02em; }
.logo-mark { width: 32px; height: 32px; flex: 0 0 32px; }
.logo-word { letter-spacing: -0.02em; }
.nav-links { display: flex; gap: 6px; margin-left: auto; }
.nav-link {
  color: var(--text-dim); padding: 8px 14px; border-radius: var(--radius-sm);
  font-size: 0.94rem; font-weight: 500; transition: all 0.15s;
}
.nav-link:hover { color: var(--text); background: var(--surface-2); opacity: 1; }
.nav-link.is-current { color: var(--accent); background: var(--accent-soft); }
.nav-cta { margin-left: 4px; }

@media (max-width: 640px) {
  .nav-links { display: none; }
  .nav-inner { gap: 16px; }
}

/* ========== BUTTONS ========== */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px; border-radius: 100px;
  font-weight: 600; font-size: 0.95rem;
  border: 1px solid transparent;
  cursor: pointer; text-decoration: none;
  transition: all 0.18s var(--ease-out-cubic);
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: var(--bg); }
.btn-primary:hover { background: var(--accent-warm); opacity: 1; transform: translateY(-1px); box-shadow: 0 8px 22px -8px rgba(251, 193, 22, 0.6); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--accent); opacity: 1; }
.btn-lg { padding: 16px 28px; font-size: 1rem; }
.btn .arrow { transition: transform 0.18s; }
.btn:hover .arrow { transform: translateX(3px); }

/* ========== HERO ========== */
.hero {
  padding-top: clamp(40px, 7vw, 96px);
  padding-bottom: clamp(60px, 9vw, 120px);
  background:
    radial-gradient(ellipse 80% 60% at 70% 20%, rgba(251, 193, 22, 0.10), transparent 60%),
    radial-gradient(ellipse 60% 60% at 10% 80%, rgba(43, 217, 163, 0.06), transparent 60%);
  position: relative;
  overflow: hidden;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: clamp(32px, 6vw, 80px);
  align-items: center;
}
.hero-copy h1 { margin-bottom: 24px; }
.hero-sub { font-size: clamp(1.05rem, 1.5vw, 1.2rem); color: var(--text-dim); max-width: 540px; margin-bottom: 32px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 36px; }
.hero-foot { display: flex; align-items: center; gap: 14px; color: var(--text-mute); font-size: 0.88rem; }
.hero-foot-bar { display: inline-flex; gap: 4px; }
.hero-foot-bar span { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); animation: pulse 2s ease-in-out infinite; }
.hero-foot-bar span:nth-child(2) { animation-delay: 0.4s; }
.hero-foot-bar span:nth-child(3) { animation-delay: 0.8s; }
@keyframes pulse { 0%, 100% { opacity: 0.4; transform: scale(0.9); } 50% { opacity: 1; transform: scale(1.1); } }

@media (max-width: 920px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-visual { order: -1; min-height: 360px; }
}

/* ========== HERO ANIMATION — messy → automated ========== */
.hero-visual {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: 540px;
  perspective: 1200px;
}
.hero-stage {
  position: absolute; inset: 0;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--surface-1) 0%, var(--surface-2) 100%);
  border: 1px solid var(--line-soft);
  overflow: hidden;
  box-shadow: var(--shadow-lift);
}
.hero-stage::before {
  content: ''; position: absolute; inset: 0;
  background:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px) 0 0 / 24px 24px;
  opacity: 0.6;
  pointer-events: none;
}

/* Sticky notes — phase 1 (messy) */
.sticky {
  position: absolute;
  width: 96px; height: 80px;
  padding: 10px 12px;
  font-size: 0.72rem; line-height: 1.25;
  color: #2a1d04;
  background: var(--accent);
  border-radius: 3px;
  box-shadow: 0 6px 14px rgba(0,0,0,0.35), 0 1px 0 rgba(0,0,0,0.1) inset;
  font-weight: 600;
  transform-origin: center;
  animation: snap-to-grid 8s var(--ease-out-cubic) infinite;
}
.sticky.alt { background: #ff9b6b; color: #2b1308; }
.sticky.alt2 { background: #6bd5ff; color: #062a3a; }
.sticky.alt3 { background: #b8ff6b; color: #163005; }

.sticky:nth-child(1) { top: 8%;  left: 10%; transform: rotate(-9deg);  animation-delay: 0s; }
.sticky:nth-child(2) { top: 14%; left: 60%; transform: rotate(6deg);   animation-delay: 0.1s; }
.sticky:nth-child(3) { top: 40%; left: 8%;  transform: rotate(4deg);   animation-delay: 0.2s; }
.sticky:nth-child(4) { top: 55%; left: 68%; transform: rotate(-7deg);  animation-delay: 0.3s; }
.sticky:nth-child(5) { top: 72%; left: 22%; transform: rotate(11deg);  animation-delay: 0.4s; }
.sticky:nth-child(6) { top: 30%; left: 38%; transform: rotate(-3deg);  animation-delay: 0.15s; }
.sticky:nth-child(7) { top: 78%; left: 56%; transform: rotate(8deg);   animation-delay: 0.25s; }

@keyframes snap-to-grid {
  /* messy → */
  0%, 18% { opacity: 1; }
  /* fade out as nodes appear */
  28% { opacity: 0; transform: scale(0.6) rotate(0deg); }
  /* stay hidden through automated phase */
  28.01%, 88% { opacity: 0; }
  /* fade back in messy */
  100% { opacity: 1; }
}

/* Nodes — phase 2 (automated). All nodes anchored by center via translate(-50%,-50%). */
.node {
  position: absolute;
  display: flex; align-items: center; gap: 8px;
  padding: 9px 13px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.78rem; font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  box-shadow: 0 8px 20px -8px rgba(0,0,0,0.5);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.85);
  animation: node-appear 8s var(--ease-out-cubic) infinite;
}
.node .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.node.center { background: var(--accent); color: var(--bg); border-color: var(--accent-warm); padding: 11px 16px; font-size: 0.82rem; }
.node.center .dot { background: var(--bg); box-shadow: none; }

/* Positions: the [left, top] pairs match the SVG path endpoints exactly */
.node-tl { left: 16%; top: 22%; animation-delay: 0s; }
.node-tr { left: 84%; top: 22%; animation-delay: 0.12s; }
.node-c  { left: 50%; top: 50%; animation-delay: 0.28s; }
.node-bl { left: 18%; top: 78%; animation-delay: 0.4s; }
.node-br { left: 82%; top: 78%; animation-delay: 0.52s; }

@keyframes node-appear {
  0%, 25% { opacity: 0; transform: translate(-50%, -50%) scale(0.85); }
  35%, 85% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  92%, 100% { opacity: 0; transform: translate(-50%, -50%) scale(0.85); }
}

/* Connecting edges */
.edges {
  position: absolute; inset: 0;
  pointer-events: none;
  opacity: 0;
  animation: edges-appear 8s var(--ease-out-cubic) infinite;
}
.edges path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-dasharray: 4 6;
  animation: edge-flow 1.5s linear infinite;
}
@keyframes edges-appear { 0%, 32% { opacity: 0; } 42%, 84% { opacity: 0.6; } 92%, 100% { opacity: 0; } }
@keyframes edge-flow { to { stroke-dashoffset: -20; } }

/* Phase label */
.hero-phase {
  position: absolute; left: 16px; bottom: 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem; color: var(--text-mute);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.hero-phase::before { content: '// '; color: var(--accent); }

/* Floating chips */
.float-chip {
  position: absolute;
  padding: 8px 12px;
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: 100px;
  font-size: 0.78rem; font-weight: 600;
  display: inline-flex; align-items: center; gap: 8px;
  box-shadow: 0 10px 24px -10px rgba(0,0,0,0.55);
  animation: float 6s ease-in-out infinite;
}
.float-chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.float-1 { top: -14px; right: 6%; animation-delay: 0s; }
.float-1 .dot { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.float-2 { bottom: -16px; left: 8%; animation-delay: 2s; }
.float-2 .dot { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@media (prefers-reduced-motion: reduce) {
  .sticky, .node, .edges, .float-chip { animation: none !important; opacity: 1 !important; }
  .sticky { display: none; }
}

/* ========== CLIENT STRIP ========== */
.clients {
  padding: 32px 0;
  border-block: 1px solid var(--line-soft);
  background: var(--surface-1);
}
.clients-inner {
  max-width: var(--max); margin: 0 auto;
  padding: 0 var(--pad);
  display: flex; align-items: center; gap: clamp(20px, 4vw, 56px);
  flex-wrap: wrap; justify-content: center;
}
.clients-label { color: var(--text-mute); font-size: 0.85rem; font-weight: 500; }
.clients-logos { display: flex; align-items: center; gap: clamp(20px, 4vw, 48px); flex-wrap: wrap; justify-content: center; }
.clients-logos img {
  height: 30px; width: auto;
  filter: brightness(0) invert(1);
  opacity: 0.5;
  transition: opacity 0.2s;
}
.clients-logos img:hover { opacity: 0.95; }

/* ========== FEATURES ========== */
.features-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 20px;
  margin-top: 40px;
}
.feature {
  background: var(--surface-1);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 32px;
  display: flex; flex-direction: column;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
}
.feature:hover { border-color: var(--line); transform: translateY(-2px); }
.feature-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 20px;
}
.feature-icon svg { width: 22px; height: 22px; }
.feature h3 { margin-bottom: 10px; }
.feature p { margin-bottom: 0; font-size: 0.94rem; }
.feature.wide { grid-column: span 8; }
.feature.narrow { grid-column: span 4; }
.feature.full { grid-column: span 12; }
.feature.accent { background: var(--accent); color: var(--bg); border-color: var(--accent-warm); }
.feature.accent .feature-icon { background: rgba(10, 22, 40, 0.15); color: var(--bg); }
.feature.accent h3, .feature.accent p { color: var(--bg); }

@media (max-width: 920px) {
  .feature.wide, .feature.narrow { grid-column: span 12; }
}

/* ========== USE CASES ========== */
.usecases {
  background: var(--surface-1);
  border-block: 1px solid var(--line-soft);
}
.chip-grid {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-top: 32px;
}
.chip {
  padding: 10px 18px;
  border-radius: 100px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-dim);
  transition: all 0.15s;
}
.chip.featured { background: var(--accent); color: var(--bg); border-color: var(--accent-warm); font-weight: 700; }
.chip:hover { color: var(--text); border-color: var(--line); }

/* ========== PROCESS ========== */
.process {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 48px;
  counter-reset: stepnum;
}
.step {
  background: var(--surface-1);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 32px;
  position: relative;
  counter-increment: stepnum;
}
.step::before {
  content: counter(stepnum, decimal-leading-zero);
  position: absolute; top: 20px; right: 26px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 3rem; font-weight: 700;
  color: rgba(251, 193, 22, 0.12);
  letter-spacing: -0.05em;
  line-height: 1;
}
.step-icon {
  width: 38px; height: 38px;
  color: var(--accent);
  margin-bottom: 20px;
}
.step h3 { font-size: 1.15rem; margin-bottom: 10px; }
.step p { font-size: 0.92rem; margin-bottom: 0; }

@media (max-width: 920px) { .process { grid-template-columns: 1fr; } }

/* ========== STATS ========== */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
  padding: 48px;
  background: var(--surface-1);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  margin-top: 48px;
}
.stat-num {
  display: block;
  font-size: clamp(2rem, 4vw, 2.8rem);
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.04em;
  line-height: 1;
}
.stat-lbl { color: var(--text-dim); font-size: 0.88rem; margin-top: 8px; }
@media (max-width: 720px) { .stats { grid-template-columns: repeat(2, 1fr); padding: 32px; } }

/* ========== CTA BAND ========== */
.cta-band {
  position: relative;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-warm) 100%);
  color: var(--bg);
  border-radius: var(--radius-lg);
  padding: clamp(40px, 6vw, 72px);
  display: grid;
  grid-template-columns: 1.4fr auto;
  gap: 32px;
  align-items: center;
  overflow: hidden;
  margin-top: 64px;
}
.cta-band::after {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(circle at 80% 30%, rgba(255,255,255,0.18), transparent 50%),
    radial-gradient(circle at 20% 80%, rgba(255,255,255,0.10), transparent 50%);
  pointer-events: none;
}
.cta-band h2 { color: var(--bg); margin-bottom: 8px; }
.cta-band p { color: rgba(10, 22, 40, 0.78); margin-bottom: 0; max-width: 520px; }
.cta-band .btn-primary { background: var(--bg); color: var(--text); border: none; z-index: 1; position: relative; }
.cta-band .btn-primary:hover { background: #142139; box-shadow: 0 12px 28px -10px rgba(0,0,0,0.5); }
@media (max-width: 720px) {
  .cta-band { grid-template-columns: 1fr; text-align: center; }
}

/* ========== PAGE HEADERS (non-home) ========== */
.page-head {
  padding: clamp(64px, 9vw, 120px) 0 clamp(32px, 5vw, 56px);
  background:
    radial-gradient(ellipse 60% 50% at 50% 0%, rgba(251, 193, 22, 0.08), transparent 60%);
}
.page-head-grid { max-width: 780px; }
.page-head h1 { font-size: clamp(2.2rem, 4.5vw, 3.4rem); margin-bottom: 16px; }
.page-head p { font-size: clamp(1.05rem, 1.6vw, 1.18rem); max-width: 680px; }

/* ========== PROSE (legal pages, about, etc.) ========== */
.prose { max-width: 720px; font-size: 1rem; }
.prose h2 { margin-top: 2.5em; }
.prose h3 { margin-top: 2em; font-size: 1.18rem; }
.prose p, .prose li { color: var(--text-dim); }
.prose ul { padding-left: 22px; }
.prose li { margin-bottom: 0.5em; }
.prose a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(251, 193, 22, 0.4); }

/* ========== CONTACT ========== */
.contact-card {
  background: var(--surface-1);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  padding: clamp(32px, 5vw, 56px);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(24px, 4vw, 48px);
  margin-top: 32px;
}
.contact-card h3 { font-size: 1.15rem; margin-bottom: 8px; }
.contact-card a.btn { margin-top: 16px; }
@media (max-width: 720px) { .contact-card { grid-template-columns: 1fr; } }

/* ========== FOOTER ========== */
.ft {
  border-top: 1px solid var(--line-soft);
  background: var(--surface-1);
  padding: 56px var(--pad) 32px;
}
.ft-grid {
  max-width: var(--max); margin: 0 auto;
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr;
  gap: 48px;
}
.ft-logo { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 1.12rem; margin-bottom: 14px; }
.ft-tagline { color: var(--text-dim); max-width: 360px; font-size: 0.94rem; }
.ft-meta { color: var(--text-mute); font-size: 0.88rem; margin-top: 12px; }
.ft-col h4 { margin-bottom: 14px; }
.ft-col ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.ft-col a { color: var(--text-dim); font-size: 0.94rem; }
.ft-col a:hover { color: var(--accent); opacity: 1; }
.ft-base {
  max-width: var(--max); margin: 40px auto 0;
  padding-top: 24px;
  border-top: 1px solid var(--line-soft);
  display: flex; gap: 12px; flex-wrap: wrap;
  color: var(--text-mute); font-size: 0.85rem;
}
@media (max-width: 720px) { .ft-grid { grid-template-columns: 1fr; gap: 32px; } }

/* ========== SCROLL REVEAL ========== */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s var(--ease-out-cubic), transform 0.7s var(--ease-out-cubic);
}
.reveal.in {
  opacity: 1;
  transform: translateY(0);
}
.reveal[data-delay="1"] { transition-delay: 0.08s; }
.reveal[data-delay="2"] { transition-delay: 0.16s; }
.reveal[data-delay="3"] { transition-delay: 0.24s; }
.reveal[data-delay="4"] { transition-delay: 0.32s; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
