:root {
  --bg: #0b0f17;
  --surface: #121826;
  --surface-2: #182033;
  --border: #263049;
  --text: #e6e9f2;
  --muted: #9aa4bd;
  --accent: #7c9cff;
  --accent-2: #4fd1c5;
  --warn: #f6ad55;
  --ok: #68d391;
  --bad: #fc8181;
  --radius: 12px;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img, canvas, svg { max-width: 100%; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(2rem, 5vw, 3.2rem); letter-spacing: -.02em; }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.1rem); letter-spacing: -.01em; }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
code, kbd, pre, .mono { font-family: var(--mono); font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.section { padding: 72px 0; }
.section-alt { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-head { max-width: 720px; margin-bottom: 40px; }
.eyebrow {
  display: inline-block;
  font-family: var(--mono);
  font-size: .8rem;
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: .12em;
  margin-bottom: 12px;
}

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(11, 15, 23, .88);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 24px; height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 1.1rem; }
.logo:hover { text-decoration: none; }
.logo-mark {
  display: grid; place-items: center;
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #0b0f17; font-family: var(--mono); font-weight: 700;
}
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a { color: var(--muted); padding: 8px 12px; border-radius: 8px; font-size: .95rem; }
.nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav a.active { color: var(--text); background: var(--surface-2); }
.nav-toggle {
  display: none; margin-left: auto;
  background: none; border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 6px 10px; font-size: 1.1rem; cursor: pointer;
}
@media (max-width: 900px) {
  .nav-toggle { display: block; }
  .nav {
    display: none; position: absolute; top: 64px; left: 0; right: 0;
    flex-direction: column; padding: 12px 16px;
    background: var(--surface); border-bottom: 1px solid var(--border);
  }
  .nav.open { display: flex; }
  .site-header .header-cta { display: none; }
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 10px; border: 1px solid transparent;
  background: var(--accent); color: #0b0f17; font-weight: 600; font-size: .95rem;
  cursor: pointer; font-family: inherit;
}
.btn:hover { filter: brightness(1.1); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 6px 12px; font-size: .85rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }

/* Hero */
.hero { padding: 96px 0 72px; position: relative; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(600px 300px at 80% 10%, rgba(124, 156, 255, .18), transparent 70%),
    radial-gradient(500px 300px at 10% 90%, rgba(79, 209, 197, .12), transparent 70%);
  pointer-events: none;
}
.hero .container { position: relative; }
.hero-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 48px; align-items: center; }
.hero p.lead { font-size: 1.15rem; color: var(--muted); max-width: 560px; }
@media (max-width: 860px) { .hero-grid { grid-template-columns: 1fr; } }
.page-hero { padding: 64px 0 40px; border-bottom: 1px solid var(--border); }
.page-hero p { color: var(--muted); max-width: 680px; font-size: 1.1rem; }

.equation-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; font-size: 1.05rem; overflow-x: auto;
}
.equation-card .label { font-family: var(--mono); font-size: .75rem; color: var(--muted); margin-bottom: 8px; }
.equation-card + .equation-card { margin-top: 12px; }

/* Grid + cards */
.grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-2 { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
@media (max-width: 400px) { .grid-2 { grid-template-columns: 1fr; } }
.grid > *, .grid-2 > *, .hero-grid > *, .solution-grid > *, .footer-grid > * { min-width: 0; }
.katex-display { overflow-x: auto; overflow-y: hidden; padding: 2px 0; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px;
}
.card h3 { margin-bottom: 8px; }
.card p:last-child { margin-bottom: 0; }
a.card { color: var(--text); display: block; transition: border-color .15s, transform .15s; }
a.card:hover { border-color: var(--accent); transform: translateY(-2px); text-decoration: none; }
.card-icon {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 10px;
  background: var(--surface-2); color: var(--accent-2); font-family: var(--mono); font-size: 1.2rem;
  margin-bottom: 16px;
}
.tag {
  display: inline-block; font-family: var(--mono); font-size: .72rem;
  padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted);
  margin: 0 6px 6px 0;
}
.tag-accent { color: var(--accent); border-color: rgba(124, 156, 255, .4); }

/* Stats */
.stats { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.stat { padding: 20px; border-left: 2px solid var(--accent); }
.stat-num { font-size: 2rem; font-weight: 700; font-family: var(--mono); }
.stat-label { color: var(--muted); font-size: .9rem; }

/* Logos strip */
.logos { display: flex; flex-wrap: wrap; gap: 12px 36px; align-items: center; justify-content: center; color: var(--muted); }
.logos span { font-weight: 700; letter-spacing: .04em; opacity: .75; }

/* Steps */
.steps { counter-reset: step; display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.step { position: relative; padding-top: 48px; }
.step::before {
  counter-increment: step; content: "0" counter(step);
  position: absolute; top: 0; left: 0; font-family: var(--mono); color: var(--accent); font-size: 1.6rem; font-weight: 700;
}

/* Quote */
.quote { font-size: 1.15rem; }
.quote footer { margin-top: 12px; color: var(--muted); font-size: .9rem; }
.avatar {
  display: grid; place-items: center; flex-shrink: 0;
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg, var(--surface-2), var(--border));
  color: var(--accent-2); font-weight: 700; font-family: var(--mono);
}
.avatar-lg { width: 88px; height: 88px; font-size: 1.4rem; margin-bottom: 16px; }

/* CTA */
.cta {
  background: linear-gradient(135deg, rgba(124, 156, 255, .15), rgba(79, 209, 197, .1));
  border: 1px solid var(--border); border-radius: 16px; padding: 48px 32px; text-align: center;
}
.cta p { color: var(--muted); max-width: 560px; margin: 0 auto 24px; }
.cta .btn-row { justify-content: center; }

/* Sub-nav chips */
.chips {
  position: sticky; top: 64px; z-index: 40;
  background: rgba(11, 15, 23, .92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.chips .container { display: flex; gap: 8px; overflow-x: auto; padding-top: 10px; padding-bottom: 10px; }
.chips a {
  flex-shrink: 0; font-size: .85rem; color: var(--muted);
  padding: 4px 12px; border: 1px solid var(--border); border-radius: 999px;
}
.chips a:hover { color: var(--text); border-color: var(--accent); text-decoration: none; }

/* Solution sections */
.solution { padding: 64px 0; border-bottom: 1px solid var(--border); scroll-margin-top: 120px; }
.solution-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: start; }
@media (max-width: 860px) { .solution-grid { grid-template-columns: 1fr; } }
.check-list { list-style: none; padding: 0; margin: 0 0 1em; }
.check-list li { padding-left: 24px; position: relative; margin-bottom: 6px; }
.check-list li::before { content: "✓"; position: absolute; left: 0; color: var(--ok); }

/* Demos */
.demo {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; margin-top: 24px;
}
.demo-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.demo-title h4 { margin: 0; font-size: 1rem; }
.live-badge {
  font-family: var(--mono); font-size: .7rem; color: var(--ok);
  border: 1px solid rgba(104, 211, 145, .4); border-radius: 999px; padding: 2px 8px;
}
.demo canvas { display: block; width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; }
.controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin: 12px 0; }
.controls label { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; color: var(--muted); }
.output {
  font-family: var(--mono); font-size: .85rem; background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px; white-space: pre-wrap; word-break: break-word; max-height: 260px; overflow: auto;
}
.output .ok { color: var(--ok); }
.output .bad { color: var(--bad); }
.warn-text { color: var(--warn); }
.table-wrap { overflow-x: auto; margin-top: 12px; }
.dp-table { border-collapse: collapse; font-family: var(--mono); font-size: .75rem; }
.dp-table th, .dp-table td { border: 1px solid var(--border); padding: 3px 6px; text-align: center; min-width: 28px; }
.dp-table th { background: var(--surface-2); color: var(--muted); font-weight: 500; }
.dp-table td.hl { background: rgba(124, 156, 255, .3); color: var(--text); font-weight: 700; }
.matrix-input { display: grid; grid-template-columns: repeat(3, minmax(0, 64px)) 16px minmax(0, 64px); gap: 6px; align-items: center; }
.matrix-input input { width: 100%; text-align: center; }
.queens { display: inline-grid; grid-template-columns: repeat(4, 32px); border: 1px solid var(--border); margin-top: 8px; }
.queens div { width: 32px; height: 32px; display: grid; place-items: center; font-size: 1.1rem; }
.queens div.dark { background: var(--surface-2); }

/* Forms */
input, select, textarea {
  font-family: inherit; font-size: .95rem; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { resize: vertical; width: 100%; }
textarea.mono { font-family: var(--mono); font-size: .8rem; }
input[type="range"] { padding: 0; accent-color: var(--accent); }
.form { display: grid; gap: 16px; }
.form-row { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: .875rem; color: var(--muted); }
.field input, .field select, .field textarea { width: 100%; }
.checkbox { display: flex; gap: 8px; align-items: flex-start; font-size: .875rem; color: var(--muted); }
.notice {
  border: 1px solid rgba(104, 211, 145, .4); background: rgba(104, 211, 145, .08);
  border-radius: var(--radius); padding: 20px;
}
.notice[hidden] { display: none; }

/* Pricing */
.billing-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; padding: 4px; margin-bottom: 32px; }
.billing-toggle button {
  background: none; border: 0; color: var(--muted); padding: 8px 16px; border-radius: 8px; cursor: pointer; font-family: inherit;
}
.billing-toggle button.active { background: var(--surface-2); color: var(--text); }
.price-card { display: flex; flex-direction: column; }
.price-card.featured { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.price { font-size: 2.4rem; font-weight: 700; font-family: var(--mono); margin: 8px 0 0; }
.price small { font-size: .9rem; color: var(--muted); font-weight: 400; }
.price-card .check-list { flex: 1; margin: 20px 0; }
.compare { width: 100%; border-collapse: collapse; font-size: .9rem; }
.compare th, .compare td { border-bottom: 1px solid var(--border); padding: 12px; text-align: left; }
.compare th { color: var(--muted); font-weight: 500; }
.compare td:not(:first-child), .compare th:not(:first-child) { text-align: center; }

/* FAQ / blog details */
details {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 20px; margin-bottom: 12px;
}
details summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
details summary::-webkit-details-marker { display: none; }
details summary::after { content: "+"; color: var(--accent); font-family: var(--mono); }
details[open] summary::after { content: "−"; }
details[open] summary { margin-bottom: 12px; }
.post-meta { font-family: var(--mono); font-size: .78rem; color: var(--muted); margin-bottom: 8px; }

/* Map placeholder */
.map {
  height: 220px; border-radius: var(--radius); border: 1px solid var(--border);
  background:
    linear-gradient(var(--border) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(90deg, var(--border) 1px, transparent 1px) 0 0 / 28px 28px,
    var(--surface);
  position: relative;
}
.map .pin {
  position: absolute; left: 58%; top: 42%;
  width: 18px; height: 18px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  background: var(--accent); box-shadow: 0 0 0 6px rgba(124, 156, 255, .25);
}

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 48px 0 32px; margin-top: 40px; color: var(--muted); font-size: .9rem; }
.footer-grid { display: grid; gap: 32px; grid-template-columns: 2fr repeat(3, 1fr); }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
.footer-grid h4 { color: var(--text); font-size: .9rem; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { margin-bottom: 6px; }
.footer-grid a { color: var(--muted); }
.footer-bottom {
  margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--border);
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between;
}
.disclaimer { color: var(--warn); }
