/* ─── Design tokens ─────────────────────────────────────────────── */
:root {
  color-scheme: light;
  --ink: #0c4a6e;
  --ink-2: #075985;
  --sky-50: #f0f9ff;
  --sky-100: #e0f2fe;
  --sky-200: #bae6fd;
  --sky-300: #7dd3fc;
  --sky-500: #0ea5e9;
  --sky-600: #0284c7;
  --sky-700: #0369a1;
  --bg: #ffffff;
  --bg-tint: #e0f2fe;
  --text: #0f172a;
  --text-soft: #64748b;
  --text-faint: #94a3b8;
  --border: #bae6fd;
  --border-soft: #e0f2fe;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 40px rgba(12, 74, 110, 0.08), 0 4px 12px rgba(12, 74, 110, 0.06);
  --max-w: 1080px;
}

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

html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; background: #ffffff; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: #ffffff;
  line-height: 1.6;
  overflow-x: hidden;
}

/* ─── Engineering background visuals ─────────────────────────────── */
.bg-fx-wrap {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.bg-fx-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 1;
  /* Promote to its own GPU layer so the mobile address-bar show/hide does not
     trigger a full repaint of the fixed background on every scroll frame. */
  transform: translateZ(0);
  will-change: transform;
  backface-visibility: hidden;
}
/* Keep content above the background */
.nav, .hero, .section, .cta, .footer { position: relative; z-index: 1; }

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
ul { list-style: none; }

/* ─── Wordmark ──────────────────────────────────────────────────── */
.wordmark {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-weight: 500;
  letter-spacing: 2px;
  color: var(--ink);
  font-size: 1.05rem;
  line-height: 1;
}
.wordmark strong { font-weight: 700; }
.wordmark .infinity { font-size: 1.38em; font-weight: 500; margin: 0 -0.05em; }
.wordmark--sm { font-size: 0.9rem; }

/* ─── Buttons ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 0.9rem;
  border-radius: var(--radius);
  padding: 0.6rem 1.1rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn--primary {
  background: var(--sky-600);
  color: #fff;
  box-shadow: 0 6px 16px rgba(2, 132, 199, 0.22);
}
.btn--primary:hover { background: var(--sky-700); box-shadow: 0 8px 22px rgba(2, 132, 199, 0.3); }
.btn--ghost {
  background: rgba(255, 255, 255, 0.6);
  color: var(--text);
  border-color: var(--border);
}
.btn--ghost:hover { border-color: var(--sky-300); background: #fff; }
.btn--sm { padding: 0.45rem 0.9rem; font-size: 0.85rem; }
.btn--lg { padding: 0.8rem 1.5rem; font-size: 0.95rem; }

/* ─── Layout ────────────────────────────────────────────────────── */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 1.5rem; }
.section { padding: 5rem 0; }
.section--tint { background: var(--bg-tint); border-top: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft); }
.section__head { max-width: 560px; margin: 0 auto 3rem; }
.section__eyebrow {
  display: inline-block;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 0.75rem;
}
.section__title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.section__lead {
  margin-top: 0.85rem;
  font-size: 1rem;
  color: var(--text-soft);
  line-height: 1.6;
}

/* ─── The design loop ───────────────────────────────────────────── */
.loop__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}
.loop__step {
  position: relative;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.25rem 1.5rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.loop__step:hover {
  border-color: var(--sky-300);
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}
.loop__num {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--sky-500);
}
.loop__viz {
  margin: 0.6rem 0 0.9rem;
  background:
    radial-gradient(ellipse 70% 60% at 50% 40%, var(--sky-50) 0%, transparent 70%),
    #fff;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 0.5rem;
}
.loop__viz svg { width: 100%; height: auto; display: block; }
.loop-t {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 8px;
  font-weight: 600;
  fill: var(--text-faint);
}
.loop__step h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.35rem;
}
.loop__step p {
  font-size: 0.86rem;
  color: var(--text-soft);
  line-height: 1.55;
}
/* connecting arrows between steps */
.loop__step:not(:last-child)::after {
  content: '→';
  position: absolute;
  top: 50%;
  right: -0.78rem;
  transform: translateY(-50%);
  font-size: 1rem;
  color: var(--sky-300);
  z-index: 2;
}

/* ─── Nav ───────────────────────────────────────────────────────── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease;
}
.nav--scrolled { border-bottom-color: var(--border-soft); }
.nav__inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0.8rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.nav__brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.nav__links {
  display: flex;
  gap: 1.5rem;
  margin-left: auto;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-soft);
}
.nav__links a { transition: color 0.15s ease; }
.nav__links a:hover { color: var(--text); }
.nav__cta { margin-left: 0.5rem; }
.nav__burger {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0.25rem;
  margin-left: auto;
}
.nav__burger span {
  width: 20px;
  height: 1.5px;
  background: var(--text);
  border-radius: 2px;
}
.nav__mobile {
  display: none;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem 1.5rem 1.5rem;
  border-top: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(12px);
}
.nav__mobile a { font-weight: 500; color: var(--text-soft); }
.nav__mobile .btn { margin-top: 0.5rem; }

/* ─── Hero ──────────────────────────────────────────────────────── */
.hero {
  position: relative;
  padding: 8rem 0 5rem;
  background:
    radial-gradient(ellipse 70% 50% at 50% 0%, var(--sky-50) 0%, transparent 60%),
    var(--bg);
  overflow: hidden;
}
.hero__bg {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-soft) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 60% 50% at 50% 30%, #000 0%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 60% 50% at 50% 30%, #000 0%, transparent 70%);
  opacity: 0.6;
}
.hero__inner {
  position: relative;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 4rem;
  align-items: center;
}
.hero__eyebrow {
  display: inline-block;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 1.25rem;
}
.hero__title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--text);
}
.hero__sub {
  margin-top: 1.25rem;
  font-size: 1.05rem;
  color: var(--text-soft);
  max-width: 28rem;
  line-height: 1.65;
}
.hero__cta {
  margin-top: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

/* Hero visual — engineer's canvas */
.hero__visual {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero__canvas {
  position: relative;
  width: 100%;
  max-width: 420px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  background: #fff;
  overflow: hidden;
}
.hero__canvas-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-tint);
}
.hero__canvas-tabs { display: flex; gap: 0.35rem; }
.hero__canvas-tab {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-faint);
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
}
.hero__canvas-tab.is-active {
  color: var(--ink);
  background: var(--sky-100);
}
.hero__canvas-tab.is-soon { opacity: 0.55; }
.hero__canvas-tag {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-faint);
}
.hero__canvas-svg { width: 100%; height: auto; display: block; }

.bp-label {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 9px;
  font-weight: 600;
  fill: var(--text-soft);
}
.bp-dim-text {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 8.5px;
  font-weight: 600;
  fill: var(--text-faint);
}
.bp-iter-text {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 9px;
  font-weight: 600;
  fill: var(--ink);
}

/* candidate cross-sections (the search space) */
.bp-cand rect {
  fill: #f0f9ff;
  stroke: #0369a1;
  stroke-width: 1.4;
  opacity: 0.4;
  transition: opacity 0.3s ease;
}
.bp-cand .bp-bars circle { r: 2; fill: #0ea5e9; opacity: 0.4; }
.bp-cand.is-opt rect {
  opacity: 1;
  stroke: #0ea5e9;
  stroke-width: 2.4;
  animation: optGlow 7s ease-in-out infinite;
}
.bp-cand.is-opt .bp-bars circle { opacity: 1; }
@keyframes optGlow {
  0%, 45% { stroke: #0369a1; stroke-width: 1.4; }
  60%, 90% { stroke: #0ea5e9; stroke-width: 2.4; }
  100% { stroke: #0369a1; stroke-width: 1.4; }
}

/* scan box sweeping the candidate grid */
.bp-scan-box {
  fill: rgba(14, 165, 233, 0.1);
  stroke: #0ea5e9;
  stroke-width: 1.4;
  animation: scanMove 7s ease-in-out infinite;
}
@keyframes scanMove {
  0%   { transform: translate(0, 0); opacity: 0; }
  6%   { opacity: 1; }
  /* row 1 */
  6%, 12%  { transform: translate(0, 0); }
  18%, 24% { transform: translate(50px, 0); }
  30%, 36% { transform: translate(98px, 0); }
  /* row 2 */
  42%, 48% { transform: translate(0, 58px); }
  54%, 62% { transform: translate(50px, 60px); }
  68%, 74% { transform: translate(98px, 58px); }
  /* settle on optimum (row2 col2) */
  80%, 94% { transform: translate(50px, 60px); opacity: 1; }
  100% { transform: translate(50px, 60px); opacity: 0; }
}

/* optimum tick pops at the end */
.bp-opt-tick { opacity: 0; transform-origin: 116px 108px; animation: tickPop 7s ease-in-out infinite; }
@keyframes tickPop {
  0%, 74% { opacity: 0; transform: scale(0.5); }
  82%, 94% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.5); }
}

/* convergence curve draws toward the limit */
.bp-conv {
  stroke-dasharray: 240;
  stroke-dashoffset: 240;
  animation: convDraw 7s ease-in-out infinite;
}
@keyframes convDraw {
  0%, 8% { stroke-dashoffset: 240; }
  60%, 92% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 240; }
}
.bp-conv-dots circle { opacity: 0; animation: dotsIn 7s ease-in-out infinite; }
.bp-conv-dots circle:nth-child(1) { animation-delay: 0.5s; }
.bp-conv-dots circle:nth-child(2) { animation-delay: 0.9s; }
.bp-conv-dots circle:nth-child(3) { animation-delay: 1.3s; }
.bp-conv-dots circle:nth-child(4) { animation-delay: 1.7s; }
.bp-conv-dots circle:nth-child(5) { animation-delay: 2.1s; }
.bp-conv-dots circle:nth-child(6) { animation-delay: 2.5s; }
.bp-conv-dots circle:nth-child(7) { animation-delay: 2.9s; }
.bp-conv-dots circle:nth-child(8) { animation-delay: 3.3s; }
@keyframes dotsIn {
  0% { opacity: 0; }
  10% { opacity: 1; }
  88% { opacity: 1; }
  96%, 100% { opacity: 0; }
}
.bp-conv-core { opacity: 0; animation: coreIn 7s ease-in-out infinite; }
.bp-conv-ring { opacity: 0; transform-origin: 398px 70px; animation: ringIn 7s ease-in-out infinite; }
@keyframes coreIn {
  0%, 58% { opacity: 0; }
  66%, 92% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes ringIn {
  0%, 58% { opacity: 0; transform: scale(0.4); }
  68% { opacity: 0.8; transform: scale(1); }
  80% { opacity: 0.3; transform: scale(1.5); }
  92%, 100% { opacity: 0; transform: scale(1.8); }
}

@media (prefers-reduced-motion: reduce) {
  .bp-scan-box { transform: translate(50px, 60px); opacity: 1; animation: none; }
  .bp-cand.is-opt rect { animation: none; }
  .bp-opt-tick { opacity: 1; transform: scale(1); animation: none; }
  .bp-conv { stroke-dashoffset: 0; animation: none; }
  .bp-conv-dots circle, .bp-conv-core { opacity: 1; animation: none; }
  .bp-conv-ring { display: none; }
}

.hero__readout {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--border-soft);
}
.hero__readout-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.7rem 0.85rem;
  border-right: 1px solid var(--border-soft);
}
.hero__readout-item:last-child { border-right: none; }
.hero__readout-k {
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.hero__readout-v {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink);
  /* Stable digit widths so the live readout doesn't wobble as numbers change. */
  font-variant-numeric: tabular-nums;
}
.hero__readout-v--ok { color: #16a34a; }

.hero__wave {
  position: absolute;
  bottom: -1px; left: 0; right: 0;
  line-height: 0;
}
.hero__wave svg { width: 100%; height: 60px; display: block; }

/* ─── Features ──────────────────────────────────────────────────── */
.features {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
}
.feature {
  display: flex;
  gap: 1rem;
  padding: 1.75rem;
  border-bottom: 1px solid var(--border-soft);
}
.feature:nth-child(odd) { border-right: 1px solid var(--border-soft); }
.feature:nth-last-child(-n+2) { border-bottom: none; }
.feature__icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  color: var(--sky-600);
  margin-top: 2px;
}
.feature h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.3rem;
}
.feature p { font-size: 0.9rem; color: var(--text-soft); line-height: 1.55; }

/* ─── Roadmap ───────────────────────────────────────────────────── */
.roadmap {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
.roadmap__item {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: border-color 0.2s ease;
}
.roadmap__item:hover { border-color: var(--text-faint); }
.roadmap__item--live {
  border-color: #86efac;
  background: linear-gradient(180deg, #f0fdf4 0%, #fff 40%);
}
.roadmap__item--next {
  border-color: var(--sky-300);
  background: linear-gradient(180deg, var(--sky-50) 0%, #fff 40%);
}
.roadmap__status {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  margin-bottom: 0.75rem;
}
.roadmap__item--live .roadmap__status { color: #15803d; }
.roadmap__item--next .roadmap__status { color: var(--sky-700); }
.roadmap__item:not(.roadmap__item--live):not(.roadmap__item--next) .roadmap__status { color: var(--text-faint); }
.roadmap__item h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.35rem;
}
.roadmap__item--live h3 { color: #166534; }
.roadmap__item:not(.roadmap__item--live):not(.roadmap__item--next) h3 { color: var(--text-soft); }
.roadmap__item p { font-size: 0.85rem; color: var(--text-soft); line-height: 1.5; }

/* ─── CTA ───────────────────────────────────────────────────────── */
.cta {
  background: var(--bg-tint);
  border-top: 1px solid var(--border-soft);
  padding: 5rem 0;
  text-align: center;
}
.cta__title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
}

/* ─── Footer ────────────────────────────────────────────────────── */
.footer {
  background: #0f172a;
  color: #94a3b8;
  padding: 2rem 0;
}
.footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.5rem;
}
.footer__brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-right: auto;
}
.footer__brand .wordmark { color: #fff; }
.footer__links {
  display: flex;
  gap: 1.5rem;
  font-size: 0.85rem;
  font-weight: 500;
}
.footer__links a { transition: color 0.15s ease; }
.footer__links a:hover { color: #fff; }
.footer__copy {
  width: 100%;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.78rem;
  color: #64748b;
}

/* ─── Responsive ────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .features { grid-template-columns: 1fr; }
  .feature:nth-child(odd) { border-right: none; }
  .feature { border-bottom: 1px solid var(--border-soft); }
  .feature:last-child { border-bottom: none; }
  .hero__inner { grid-template-columns: 1fr; gap: 3rem; }
  .hero__visual { order: -1; max-width: 420px; margin: 0 auto; }
  .hero { padding: 6rem 0 3rem; }
  .roadmap { grid-template-columns: repeat(2, 1fr); }
  .loop__grid { grid-template-columns: repeat(2, 1fr); }
  .loop__step:not(:last-child)::after { display: none; }
  .loop__step:nth-child(odd)::after { display: none; }
}

@media (max-width: 640px) {
  .section { padding: 3.5rem 0; }
  .roadmap { grid-template-columns: 1fr; }
  .loop__grid { grid-template-columns: 1fr; }
  .nav__links, .nav__cta { display: none; }
  .nav__burger { display: flex; }
  .nav__mobile--open { display: flex; }
  .hero__cta .btn { flex: 1; }
}
