/* ==========================================================
   CapChain Global — Design System
   ========================================================== */

:root {
  /* Palette — deep navy + electric accent */
  --bg: #07090E;
  --bg-1: #0B0E15;
  --bg-2: #10141D;
  --bg-3: #161B27;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.14);
  --fg: #F2F4F8;
  --fg-2: #AEB4C2;
  --fg-3: #6B7285;
  --accent: #9EFF5A;      /* electric lime */
  --accent-2: #5AE6FF;    /* cyan support */
  --amber: #F5C66E;
  --danger: #FF6B6B;

  /* Type */
  --font-display: "Instrument Serif", "Times New Roman", serif;
  --font-sans: "Inter Tight", "Inter", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, monospace;

  /* Radii */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 24px;

  /* Motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}
body {
  overflow-x: hidden;
  font-feature-settings: "ss01" on, "cv11" on;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
img, svg { display: block; max-width: 100%; }

::selection { background: var(--accent); color: #07090E; }

/* Typography */
.h-display {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 0.95;
}
.mono { font-family: var(--font-mono); letter-spacing: 0.02em; }
.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--fg-3);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.eyebrow::before {
  content: "";
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent);
}

/* Layout */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 32px;
}
@media (max-width: 720px) {
  .container { padding: 0 20px; }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.005em;
  transition: all 0.25s var(--ease);
  white-space: nowrap;
  border: 1px solid transparent;
}
.btn-primary {
  background: var(--accent);
  color: #07090E;
}
.btn-primary:hover {
  background: #B4FF7A;
  transform: translateY(-1px);
  box-shadow: 0 10px 30px -10px rgba(158, 255, 90, 0.5);
}
.btn-ghost {
  background: transparent;
  color: var(--fg);
  border-color: var(--line-strong);
}
.btn-ghost:hover {
  background: var(--bg-2);
  border-color: rgba(255, 255, 255, 0.25);
}
.btn svg { width: 14px; height: 14px; }

/* Cards / surfaces */
.card {
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg-1) 100%);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}

/* Grid-background decorative */
.grid-bg {
  background-image:
    linear-gradient(to right, var(--line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--line) 1px, transparent 1px);
  background-size: 56px 56px;
}

/* Reveal-on-scroll (opt-out pattern — default visible; JS adds .rh when below fold) */
.reveal, .reveal-stagger { transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); }
.reveal-stagger > * { transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.reveal.rh { opacity: 0; transform: translateY(24px); }
.reveal-stagger.rh > * { opacity: 0; transform: translateY(16px); }
.reveal-stagger > *:nth-child(1) { transition-delay: 0.05s; }
.reveal-stagger > *:nth-child(2) { transition-delay: 0.15s; }
.reveal-stagger > *:nth-child(3) { transition-delay: 0.25s; }
.reveal-stagger > *:nth-child(4) { transition-delay: 0.35s; }
.reveal-stagger > *:nth-child(5) { transition-delay: 0.45s; }
.reveal-stagger > *:nth-child(6) { transition-delay: 0.55s; }

/* =========================================
   NAV
   ========================================= */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  padding: 14px 0;
  transition: all 0.3s var(--ease);
}
.nav.scrolled {
  background: rgba(7, 9, 14, 0.75);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.logo-mark {
  width: 26px; height: 26px;
  position: relative;
  flex: 0 0 auto;
}
.logo-mark svg { width: 100%; height: 100%; }

.nav-links {
  display: flex;
  gap: 28px;
  font-size: 14px;
  color: var(--fg-2);
}
.nav-links a { transition: color 0.2s var(--ease); }
.nav-links a:hover { color: var(--fg); }

.nav-right {
  display: flex;
  align-items: center;
  gap: 14px;
}
@media (max-width: 860px) {
  .nav-links { display: none; }
}

.lang-switch {
  display: inline-flex;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
}
.lang-switch button {
  padding: 5px 10px;
  border-radius: 999px;
  color: var(--fg-3);
  transition: all 0.2s var(--ease);
}
.lang-switch button.active {
  background: var(--fg);
  color: var(--bg);
}

/* =========================================
   HERO
   ========================================= */
.hero {
  position: relative;
  padding: 140px 0 80px;
  overflow: hidden;
}
.hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 800px 400px at 50% 0%, rgba(158, 255, 90, 0.06), transparent 60%),
    radial-gradient(ellipse 600px 500px at 85% 30%, rgba(90, 230, 255, 0.05), transparent 60%);
  mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
}
.hero-bg::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, var(--line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--line) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(ellipse 900px 500px at 50% 50%, black 20%, transparent 80%);
}
.hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 56px;
  align-items: center;
}
@media (max-width: 980px) {
  .hero-inner { grid-template-columns: 1fr; gap: 40px; }
  .hero { padding-top: 110px; }
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(42px, 6vw, 82px);
  line-height: 0.97;
  letter-spacing: -0.025em;
  margin: 18px 0 24px;
}
.hero h1 em {
  font-style: italic;
  color: var(--accent);
}
.hero p.lede {
  font-size: 18px;
  line-height: 1.55;
  color: var(--fg-2);
  max-width: 520px;
  margin: 0 0 32px;
}
.hero-cta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.hero-trust {
  margin-top: 40px;
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--fg-3);
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
}
.hero-trust div { display: flex; align-items: center; gap: 8px; }
.hero-trust svg { width: 13px; height: 13px; color: var(--accent); }

/* Hero visual — invoice flow card */
.hero-visual {
  position: relative;
  aspect-ratio: 5 / 6;
  max-height: 620px;
}

/* =========================================
   SECTIONS
   ========================================= */
section { position: relative; }

.sec {
  padding: 100px 0;
}
@media (max-width: 720px) { .sec { padding: 72px 0; } }

.sec-head {
  max-width: 760px;
  margin: 0 auto 64px;
  text-align: center;
}
.sec-head.left {
  margin-left: 0;
  text-align: left;
}
.sec-head h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(34px, 4.5vw, 58px);
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin: 16px 0 18px;
}
.sec-head p {
  font-size: 17px;
  color: var(--fg-2);
  line-height: 1.55;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}
.sec-head.left p { margin-left: 0; margin-right: 0; }

/* Problem section */
.problem-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}
@media (max-width: 860px) { .problem-grid { grid-template-columns: 1fr; } }
.problem-cell {
  background: var(--bg-1);
  padding: 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 260px;
}
.problem-cell .stat {
  font-family: var(--font-display);
  font-size: 72px;
  line-height: 1;
  color: var(--accent);
  letter-spacing: -0.03em;
}
.problem-cell .label {
  font-size: 15px;
  color: var(--fg-2);
  line-height: 1.45;
}

/* How-it-works */
.how {
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-1) 100%);
}
.how-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 40px;
  counter-reset: step;
}
@media (max-width: 860px) { .how-steps { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .how-steps { grid-template-columns: 1fr; } }

.how-step {
  padding: 28px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  position: relative;
  overflow: hidden;
  transition: all 0.3s var(--ease);
}
.how-step:hover {
  border-color: var(--line-strong);
  transform: translateY(-2px);
}
.how-step-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-3);
  letter-spacing: 0.1em;
  margin-bottom: 32px;
}
.how-step-icon {
  width: 42px; height: 42px;
  border-radius: var(--r-md);
  background: rgba(158, 255, 90, 0.08);
  border: 1px solid rgba(158, 255, 90, 0.2);
  display: grid;
  place-items: center;
  margin-bottom: 20px;
  color: var(--accent);
}
.how-step-icon svg { width: 18px; height: 18px; }
.how-step h4 {
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
}
.how-step p {
  font-size: 14px;
  color: var(--fg-2);
  line-height: 1.55;
  margin: 0;
}

/* Comparison table */
.compare {
  margin-top: 48px;
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg-1);
}
.compare-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  border-bottom: 1px solid var(--line);
}
.compare-row:last-child { border-bottom: 0; }
.compare-row > div {
  padding: 18px 20px;
  font-size: 14px;
}
.compare-row.head > div {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-3);
  background: var(--bg-2);
}
.compare-row > div:first-child {
  color: var(--fg-2);
  border-right: 1px solid var(--line);
}
.compare-row .us {
  background: rgba(158, 255, 90, 0.04);
  color: var(--fg);
  font-weight: 500;
  position: relative;
}
.compare-row.head .us {
  background: rgba(158, 255, 90, 0.08);
  color: var(--accent);
}
.compare-row .us::before {
  content: "";
  position: absolute;
  inset: 0;
  border-left: 1px solid rgba(158, 255, 90, 0.3);
  border-right: 1px solid rgba(158, 255, 90, 0.3);
  pointer-events: none;
}
.compare-row:first-child .us::before { border-top: 1px solid rgba(158, 255, 90, 0.3); }
.compare-row:last-child .us::before { border-bottom: 1px solid rgba(158, 255, 90, 0.3); }
@media (max-width: 720px) {
  .compare-row { grid-template-columns: 1fr 1fr; }
  .compare-row > div:nth-child(3),
  .compare-row > div:nth-child(4) { display: none; }
}

/* Dashboard preview */
.dash-wrap {
  position: relative;
  margin-top: 48px;
  border-radius: var(--r-xl);
  background: linear-gradient(180deg, #0E1320 0%, #080A11 100%);
  border: 1px solid var(--line);
  padding: 14px;
  overflow: hidden;
  box-shadow:
    0 40px 80px -30px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255,255,255,0.04);
}
.dash-wrap::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: var(--r-xl);
  background: radial-gradient(ellipse 600px 200px at 50% 0%, rgba(158, 255, 90, 0.14), transparent 70%);
  pointer-events: none;
}
.dash {
  background: var(--bg-1);
  border-radius: calc(var(--r-xl) - 8px);
  border: 1px solid var(--line);
  min-height: 520px;
  display: grid;
  grid-template-columns: 220px 1fr;
  overflow: hidden;
}
@media (max-width: 720px) { .dash { grid-template-columns: 1fr; } .dash-side { display:none; }}
.dash-side {
  border-right: 1px solid var(--line);
  padding: 18px 12px;
  background: var(--bg);
}
.dash-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 18px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.dash-brand .logo-mark { width: 18px; height: 18px; }
.dash-side-section {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--fg-3);
  padding: 16px 8px 6px;
  text-transform: uppercase;
}
.dash-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dash-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--fg-2);
  transition: all 0.2s;
}
.dash-nav a.active {
  background: var(--bg-2);
  color: var(--fg);
}
.dash-nav a:hover { background: var(--bg-2); }
.dash-nav svg { width: 14px; height: 14px; opacity: 0.7; }

.dash-main {
  padding: 22px 26px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.dash-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.dash-top h3 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 400;
  margin: 0;
  letter-spacing: -0.01em;
}
.dash-top .status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-2);
  padding: 6px 10px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.dash-top .status::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }

.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
@media (max-width: 720px) { .kpi-row { grid-template-columns: repeat(2, 1fr); } }
.kpi {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px;
}
.kpi-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--fg-3);
  text-transform: uppercase;
  margin-bottom: 10px;
}
.kpi-val {
  font-family: var(--font-display);
  font-size: 26px;
  line-height: 1;
  letter-spacing: -0.01em;
}
.kpi-delta {
  font-family: var(--font-mono);
  font-size: 10px;
  margin-top: 6px;
  color: var(--accent);
}
.kpi-delta.down { color: var(--danger); }

.dash-body {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 14px;
}
@media (max-width: 720px) { .dash-body { grid-template-columns: 1fr; } }

.panel {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 16px;
}
.panel h4 {
  font-size: 13px;
  font-weight: 500;
  margin: 0 0 12px;
  letter-spacing: -0.005em;
}
.panel .sub {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.inv-row {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 0.7fr 0.6fr;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 12.5px;
  align-items: center;
}
.inv-row:last-child { border: 0; }
.inv-row.head {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.inv-row .amt { font-family: var(--font-mono); color: var(--fg); }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  background: var(--bg-3);
  border: 1px solid var(--line-strong);
  color: var(--fg-2);
}
.badge.ok { color: var(--accent); border-color: rgba(158, 255, 90, 0.3); background: rgba(158, 255, 90, 0.06); }
.badge.wait { color: var(--amber); border-color: rgba(245, 198, 110, 0.3); background: rgba(245, 198, 110, 0.06); }
.badge.proc { color: var(--accent-2); border-color: rgba(90, 230, 255, 0.3); background: rgba(90, 230, 255, 0.06); }

.mini-chart {
  height: 110px;
  position: relative;
}

/* Investor / Logos */
.logos-row {
  display: flex;
  flex-wrap: wrap;
  gap: 36px 56px;
  justify-content: center;
  align-items: center;
  margin-top: 40px;
  opacity: 0.6;
}
.logos-row > div {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--fg-2);
  letter-spacing: -0.01em;
}

/* FAQ */
.faq {
  max-width: 820px;
  margin: 0 auto;
}
.faq-item {
  border-top: 1px solid var(--line);
  padding: 24px 0;
  cursor: pointer;
}
.faq-item:last-child { border-bottom: 1px solid var(--line); }
.faq-q {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  font-size: 18px;
  letter-spacing: -0.01em;
}
.faq-plus {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  transition: all 0.3s var(--ease);
}
.faq-plus svg { width: 10px; height: 10px; transition: transform 0.3s var(--ease); }
.faq-a {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s var(--ease), margin 0.4s var(--ease);
  color: var(--fg-2);
  font-size: 15.5px;
  line-height: 1.6;
}
.faq-item.open .faq-a { max-height: 320px; margin-top: 16px; }
.faq-item.open .faq-plus { background: var(--accent); border-color: var(--accent); color: #07090E; }
.faq-item.open .faq-plus svg { transform: rotate(45deg); }

/* CTA */
.cta {
  padding: 120px 0;
  position: relative;
  overflow: hidden;
}
.cta-inner {
  border-radius: var(--r-xl);
  padding: 72px 56px;
  background:
    radial-gradient(ellipse 600px 300px at 80% 20%, rgba(158, 255, 90, 0.14), transparent 60%),
    linear-gradient(180deg, #0E1320, #0A0D15);
  border: 1px solid var(--line-strong);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.cta-inner::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, var(--line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--line) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at center, black 20%, transparent 70%);
  opacity: 0.5;
}
.cta-inner > * { position: relative; }
.cta h2 {
  font-family: var(--font-display);
  font-size: clamp(36px, 5vw, 64px);
  line-height: 1;
  letter-spacing: -0.02em;
  margin: 14px 0 18px;
  font-weight: 400;
}
.cta p {
  color: var(--fg-2);
  font-size: 17px;
  max-width: 520px;
  margin: 0 auto 28px;
}

/* Footer */
footer {
  border-top: 1px solid var(--line);
  padding: 56px 0 40px;
  background: var(--bg-1);
}
.footer-top {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr 1fr;
  gap: 32px;
}
@media (max-width: 720px) { .footer-top { grid-template-columns: 1fr 1fr; } }
.footer-top h5 {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin: 0 0 14px;
  font-weight: 500;
}
.footer-top a {
  display: block;
  font-size: 14px;
  color: var(--fg-2);
  padding: 4px 0;
  transition: color 0.2s;
}
.footer-top a:hover { color: var(--fg); }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--fg-3);
  font-family: var(--font-mono);
  letter-spacing: 0.03em;
  flex-wrap: wrap;
  gap: 16px;
}

/* Utility */
.only-mobile { display: none; }
@media (max-width: 720px) {
  .only-desktop { display: none; }
  .only-mobile { display: initial; }
}
