/* Manhattan Reasoning — site v2
   Off-white, Helvetica, single scrolling page. */

:root {
  --bg: #fefdfb;
  --bg-translucent: rgba(250, 249, 246, 0.86);
  --ink: #17181c;
  --ink-2: #565e6b;
  --ink-3: #8b93a1;
  --line: #e7e4dc;
  --accent: #0072ff;
  --accent-ink: #005fd6;

  /* dark surfaces (die panel, code, terminal) */
  --die: #05070d;
  --code-bg: #0e1218;
  --code-line: #1c2330;
  --code-ink: #d7dee9;
  --code-dim: #6b7c96;

  /* wire classes — validated categorical palette on var(--die) */
  --span1: #2f7fb8;
  --span2: #1f9e89;
  --span6: #e8681f;

  --font: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
  --maxw: 1120px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ---------------- nav ---------------- */

.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  height: 64px;
  /* transparent at the top so the nav reads as part of the page and the circuit
     flows off the top edge; the backdrop only appears once you scroll */
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background 0.25s ease, border-color 0.25s ease, backdrop-filter 0.25s ease;
}
.nav.scrolled {
  background: var(--bg-translucent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom-color: var(--line);
}

.nav-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 0 24px;
  height: 100%; display: flex; align-items: center; justify-content: space-between;
  position: relative;
}

/* brand: live text logo. Two lines; the top line collapses on scroll, leaving
   the blue line — flex-centered so the collapsed line sits at the nav's middle.
   Pure CSS, fully reversible. */
.brand { position: relative; display: flex; align-items: center; height: 100%; }
.logo {
  position: relative; height: 42px; width: 13.5em;
  font-family: var(--font); font-weight: 700;
  font-size: 17px; letter-spacing: -0.012em; white-space: nowrap;
}
.logo-l1, .logo-l2 {
  position: absolute; left: 0;
  transition: opacity 0.3s ease, top 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    left 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), color 0.3s ease;
}
.logo-l1 { top: 2px; color: var(--ink); }
.logo-l2 { top: 21px; left: 1.55em; color: var(--accent); }
.logo-l2 .op { color: var(--accent); transition: color 0.3s ease; }  /* blue at top */
/* collapsed: top line fades up & out, blue line rises to the nav's center,
   turnstile turns black */
.nav.scrolled .logo-l1 { opacity: 0; transform: translateY(-6px); }
.nav.scrolled .logo-l2 { top: 50%; left: 50%; transform: translate(-50%, -50%); }
.nav.scrolled .logo-l2 .op { color: var(--ink); }

.nav-links { display: flex; align-items: center; gap: 28px; }
.nav-links a {
  color: var(--ink); font-size: 0.95rem; font-weight: 600;
  /* off-white halo so links stay legible over the circuit while the nav is
     transparent; invisible once the nav gains its background on scroll */
  text-shadow: 0 0 9px var(--bg), 0 0 9px var(--bg), 0 0 9px var(--bg), 0 0 3px var(--bg);
}
.nav.scrolled .nav-links a { text-shadow: none; }
.nav-links a:hover { color: var(--accent-ink); text-decoration: none; }

.nav-toggle {
  display: none;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
}
.nav-toggle span {
  width: 16px;
  height: 1.5px;
  background: var(--ink);
  border-radius: 1px;
}

.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff; font-weight: 600; font-size: 0.95rem;
  padding: 9px 18px; border-radius: 999px;
  border: none; cursor: pointer;
  transition: background 0.15s ease;
}
.btn:hover { background: var(--accent-ink); text-decoration: none; }
.btn.ghost {
  background: transparent; color: var(--ink);
  border: 1px solid var(--line);
}
.btn.ghost:hover { border-color: var(--ink-3); background: transparent; }

.btn.btn-outline {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 0 0 rgba(47, 127, 184, 0);
  animation: cta-outline-glow 8s ease-in-out infinite;
}
.btn.btn-outline:hover {
  background: transparent;
  border-color: var(--ink-3);
  color: var(--ink);
}

@keyframes cta-outline-glow {
  0% {
    border-color: rgba(47, 127, 184, 0.35);
    box-shadow: 0 0 8px rgba(47, 127, 184, 0.12);
  }
  33% {
    border-color: rgba(31, 158, 137, 0.35);
    box-shadow: 0 0 9px rgba(31, 158, 137, 0.12);
  }
  66% {
    border-color: rgba(232, 104, 31, 0.35);
    box-shadow: 0 0 9px rgba(232, 104, 31, 0.11);
  }
  100% {
    border-color: rgba(47, 127, 184, 0.35);
    box-shadow: 0 0 8px rgba(47, 127, 184, 0.12);
  }
}

@media (prefers-reduced-motion: reduce) {
  .btn.btn-outline { animation: none; }
}

/* ---------------- hero ---------------- */

.hero {
  position: relative;
  overflow: hidden;
  padding-top: 64px;
  min-height: 94vh;
  /* column so the container stays full-width (a flex row would shrink-wrap it
     and margin:auto would center the copy) — copy left-aligns with the nav */
  display: flex; flex-direction: column; justify-content: center;
}
.hero .container {
  position: relative; z-index: 2;
  /* full-width with a left gutter matching the centered 1120 grid (and the nav
     logo), so the copy is left-aligned instead of centered on wide screens */
  max-width: none; width: 100%; margin: 0;
  padding-left: max(24px, calc((100vw - 1072px) / 2));
  padding-right: 24px;
}
/* off-white scrim keeps the copy column clean while the field stays vibrant right */
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(100deg,
    var(--bg) 36%, rgba(250, 249, 246, 0.88) 52%, rgba(250, 249, 246, 0) 72%);
}
.hero-copy { max-width: min(50vw, 46rem); }
.hero h1 {
  font-size: clamp(2.2rem, 3.6vw, 3.1rem);   /* fallback; JS fits it to one line */
  line-height: 1.04;
  letter-spacing: -0.022em;
  font-weight: 700;
  white-space: nowrap;         /* one line — JS scales font-size to fit the width */
  /* soft off-white halo so the line reads cleanly over the circuit */
  text-shadow: 0 0 18px var(--bg), 0 0 18px var(--bg), 0 0 8px var(--bg), 0 0 3px var(--bg);
}
.hero .bio {
  margin-top: 20px;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink-2);
  max-width: min(46vw, 42rem); /* static — mostly matches the one-line header */
  text-shadow: 0 0 12px var(--bg), 0 0 12px var(--bg), 0 0 5px var(--bg);
}
.hero-ctas { margin-top: 28px; display: flex; gap: 12px; flex-wrap: wrap; }
.read-more {
  font-size: 1.02rem; font-weight: 600; color: var(--accent-ink);
  display: inline-flex; align-items: center;
  border-bottom: 1.5px solid transparent;
  transition: border-color 0.15s ease, color 0.15s ease;
  text-shadow: 0 0 12px var(--bg), 0 0 12px var(--bg), 0 0 5px var(--bg);
}
.read-more:hover { border-bottom-color: currentColor; text-decoration: none; }

/* living routing field — bleeds off the right edge, dissolves into the page */
#routing-canvas {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 82%;
  z-index: 0;
  display: block;
  cursor: crosshair;
  /* two masks intersected: a radial that dissolves the left/right edges into
     the page, and a vertical fade so the TOP dissolves slowly (like the bottom)
     — the field fades out before it reaches the nav, no flat cut */
  -webkit-mask-image:
    radial-gradient(135% 130% at 68% 46%, #000 58%, rgba(0,0,0,0.5) 76%, transparent 95%),
    linear-gradient(to bottom, #000 0%, #000 88%, transparent 100%);
  -webkit-mask-composite: source-in;
          mask-image:
    radial-gradient(135% 130% at 68% 46%, #000 58%, rgba(0,0,0,0.5) 76%, transparent 95%),
    linear-gradient(to bottom, #000 0%, #000 88%, transparent 100%);
          mask-composite: intersect;
}

.hero-routing-canvas { cursor: crosshair; }

#beta {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
#beta > .container { position: relative; z-index: 2; }
.beta-routing-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 0.5;
  pointer-events: none;
  -webkit-mask-image:
    radial-gradient(120% 92% at 50% 100%, #000 44%, rgba(0,0,0,0.48) 70%, transparent 100%),
    linear-gradient(to top, #000 0%, #000 86%, transparent 100%);
  -webkit-mask-composite: source-in;
          mask-image:
    radial-gradient(120% 92% at 50% 100%, #000 44%, rgba(0,0,0,0.48) 70%, transparent 100%),
    linear-gradient(to top, #000 0%, #000 86%, transparent 100%);
          mask-composite: intersect;
}
.hero-caption {
  position: absolute; right: 26px; bottom: 24px; z-index: 2;
  font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.02em;
  color: var(--ink-3);
}

/* ---------------- sections ---------------- */

.section { padding: 108px 0; border-top: 1px solid var(--line); }
.section:first-of-type { border-top: none; }

.kicker {
  font-family: var(--mono); font-size: 0.78rem; font-weight: 500;
  color: var(--accent-ink); letter-spacing: 0.08em; text-transform: uppercase;
}
.section h2 {
  margin-top: 10px;
  font-size: clamp(1.7rem, 3vw, 2.35rem);
  letter-spacing: -0.015em; line-height: 1.15;
  font-weight: 700;
  max-width: 24ch;
}
.section .lede {
  margin-top: 14px; font-size: 1.05rem; color: var(--ink-2);
  max-width: 62ch;
}
/* the open-hardware-stack credit line under the lede */
.built-on {
  margin-top: 14px; max-width: 52ch;
  font-family: var(--mono); font-size: 0.8rem; line-height: 1.5;
  color: var(--ink-3);
}
.built-on span { color: var(--ink-2); font-weight: 600; }

.duo {
  margin-top: 44px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 24px;
  align-items: start;
}

/* Cloud: two-column split — text left, code + terminal stacked on the right
   (Vercel-style; Sandbox mirrors it with code left / text right) */
#cloud .container {
  display: grid; grid-template-columns: 0.9fr 1fr; gap: 56px; align-items: center;
}
#cloud .container > .reveal { margin: 0; }         /* the text column */
#cloud h2 { max-width: 15ch; }
#cloud .duo {
  margin-top: 0;                                    /* it's a column now, not below */
  grid-template-columns: 1fr; gap: 16px;
}

/* Sandbox: mirrored split — code left, text right */
#sandbox .container {
  display: grid; grid-template-columns: 1fr 0.9fr; gap: 56px; align-items: center;
}
#sandbox .container > .reveal { margin: 0; }       /* the text column */
#sandbox h2 { max-width: 18ch; }

/* fade-up on scroll */
.reveal { opacity: 0; transform: translateY(18px);
  transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------------- code cards ---------------- */

/* light "Geist"-style card: white, hairline border, soft shadow, no chrome dots */
.code-card {
  position: relative;
  background: #ffffff;
  border: 1px solid #eceae2;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(20, 24, 40, 0.04), 0 12px 32px -18px rgba(20, 24, 40, 0.14);
}
.code-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 12px 9px 15px;
  border-bottom: 1px solid #f1f0ea;
  font-family: var(--mono); font-size: 0.73rem; color: var(--ink-3);
}
.code-head .fname { color: var(--ink-2); font-weight: 600; }
.copy-btn {
  font-family: var(--mono); font-size: 0.67rem; color: var(--ink-3);
  background: transparent; border: 1px solid var(--line); border-radius: 6px;
  padding: 3px 9px; cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.copy-btn:hover { color: var(--ink); border-color: var(--ink-3); }
.copy-btn.copied { color: #0a7d5a; border-color: #bfe3d0; }
.code-card pre {
  padding: 16px 18px;
  overflow-x: auto;
  font-family: var(--mono); font-size: 0.82rem; line-height: 1.62;
  color: #2b2f38;
}
.code-card code { font-family: inherit; }

/* python token colors (light, restrained) */
.tok-kw  { color: #a626a4; }
.tok-str { color: #0a7d5a; }
.tok-num { color: #b25000; }
.tok-fn  { color: #0060d1; }
.tok-cm  { color: #9aa3b0; font-style: italic; }
.tok-dec { color: #7c3aed; }

/* terminal stays dark — a terminal should look like a terminal */
.code-card.terminal {
  background: var(--code-bg); border-color: var(--code-line);
  box-shadow: 0 1px 2px rgba(6, 18, 40, 0.08), 0 16px 36px -20px rgba(6, 18, 40, 0.45);
}
.terminal .code-head { border-bottom-color: #1a2130; color: var(--code-dim); }
.terminal .code-head .fname { color: #aebacc; }
.terminal pre { color: var(--code-ink); min-height: 132px; }
.term-dim  { color: var(--code-dim); }
.term-ok   { color: #58d68d; font-weight: 600; }
.term-run  { color: #c6ff6e; font-weight: 600; }
.term-cursor { display: inline-block; width: 8px; height: 15px;
  background: #d7dee9; vertical-align: -2px;
  animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* feature bullets */
.feature-list { margin-top: 26px; display: grid; gap: 14px; }
.feature-list li {
  list-style: none; padding-left: 26px; position: relative;
  color: var(--ink-2); font-size: 0.97rem;
}
.feature-list li::before {
  content: "—"; position: absolute; left: 0; top: 0;
  color: var(--accent); font-weight: 600;
}
.feature-list li b { color: var(--ink); font-weight: 600; }

/* ---------------- beta ---------------- */

.beta-wrap { max-width: 720px; margin: 0 auto; text-align: center; }
.beta-wrap h2 { margin-left: auto; margin-right: auto; }
.beta-wrap .lede { margin-left: auto; margin-right: auto; }
.beta-install { margin: 36px auto 0; text-align: left; }

.beta-form-card {
  margin: 48px auto 0; text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 30px;
}
.beta-form-card h3 { font-size: 1.15rem; letter-spacing: -0.01em; }
.beta-form-card p { color: var(--ink-2); font-size: 0.93rem; margin-top: 6px; }
.form-grid { margin-top: 22px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.field label {
  display: block; font-size: 0.8rem; font-weight: 600;
  color: var(--ink-2); margin-bottom: 6px;
}
.field input, .field textarea {
  width: 100%; font-family: var(--font); font-size: 0.95rem;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px;
}
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 114, 255, 0.12);
}
.form-foot { margin-top: 20px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.form-note { font-size: 0.82rem; color: var(--ink-3); }
.form-status { font-size: 0.88rem; font-weight: 600; }
.form-status.ok { color: #1a7f4e; }
.form-status.err { color: #c0392b; }

/* ---------------- footer ---------------- */

.footer { border-top: 1px solid var(--line); padding: 44px 0 56px; }
.footer-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; flex-wrap: wrap;
}
.footer-brand { display: flex; align-items: center; gap: 12px; }
.footer-brand img { height: 20px; }
.footer-brand span { font-size: 0.88rem; color: var(--ink-3); }
.footer-links { display: flex; gap: 24px; font-size: 0.9rem; }
.footer-links a { color: var(--ink-2); }
.footer-links a:hover { color: var(--accent-ink); }

/* screenshot/test mode (?nofx): fixed height so the field is visible, instant reveals */
.nofx .hero { min-height: 640px; padding-top: 120px; padding-bottom: 40px; }
.nofx .reveal { opacity: 1; transform: none; transition: none; }
.nofx .logo-l1, .nofx .logo-l2, .nofx .logo-l2 .op { transition: none; }  /* capture end state */

/* ---------------- responsive ---------------- */

@media (max-width: 960px) {
  html, body { overflow-x: hidden; }
  .container, .nav-inner { padding-left: 16px; padding-right: 16px; }
  .nav { height: 56px; }
  .hero { min-height: 100svh; min-height: 100dvh; padding-top: 92px; padding-bottom: 24px; }
  /* field becomes a full-bleed backdrop behind the copy, faded top-down */
  #routing-canvas {
    width: 100%; opacity: 0.55;
    -webkit-mask-image:
      radial-gradient(135% 85% at 70% 42%, #000 34%, transparent 80%),
      linear-gradient(to bottom, transparent 3%, #000 26%, #000 88%, transparent 100%);
    -webkit-mask-composite: source-in;
            mask-image:
      radial-gradient(135% 85% at 70% 42%, #000 34%, transparent 80%),
      linear-gradient(to bottom, transparent 3%, #000 26%, #000 88%, transparent 100%);
            mask-composite: intersect;
    pointer-events: none;
  }
  .beta-routing-canvas { opacity: 0.42; }
  .hero-copy { max-width: 100%; }
  .hero h1 {
    font-size: clamp(1.75rem, 7.2vw, 2.3rem);
    line-height: 1.1;
    letter-spacing: -0.015em;
    white-space: normal;
    text-shadow: 0 0 8px var(--bg), 0 0 8px var(--bg), 0 0 3px var(--bg);
  }  /* wrap on mobile */
  .hero .bio { max-width: 34ch; font-size: 0.98rem; line-height: 1.55; }
  .hero-ctas { margin-top: 20px; }
  .read-more { font-size: 0.98rem; }
  .hero-caption { display: none; }
  .duo { grid-template-columns: 1fr; }
  #cloud .container, #sandbox .container { grid-template-columns: 1fr; gap: 28px; }
  .form-grid { grid-template-columns: 1fr; }
  .code-head { padding: 8px 10px 8px 12px; }
  .code-card pre { padding: 14px 14px; font-size: 0.75rem; line-height: 1.5; }
  .beta-form-card { padding: 20px; }
  .form-foot { gap: 12px; }
  .nav-toggle { display: inline-flex; }
  .nav-links {
    display: flex;
    position: absolute;
    top: calc(100% + 8px);
    left: 16px;
    right: 16px;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--bg-translucent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 10px 24px -18px rgba(15, 24, 40, 0.42);
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
    transform-origin: top right;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.24s ease, visibility 0.24s step-end;
  }
  .nav-links.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    visibility: visible;
    pointer-events: auto;
    transition: opacity 0.22s ease, transform 0.26s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s step-start;
  }
  .nav-links a {
    display: block;
    padding: 10px 12px;
    border-radius: 8px;
    text-shadow: none;
  }
  .nav-links a:hover { background: rgba(0, 114, 255, 0.08); }
  .section { padding: 56px 0; }

  body:not(.careers-page) main#top .hero {
    justify-content: flex-start;
  }
  body:not(.careers-page) main#top .hero .container {
    padding-top: clamp(36px, 9vh, 84px);
  }

  body.careers-page {
    min-height: 100svh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
  }
  body.careers-page main#top {
    flex: 1;
    display: flex;
  }
  body.careers-page main#top .hero {
    flex: 1;
    min-height: 100%;
    width: 100%;
    padding-bottom: 36px;
  }
}

@media (max-width: 520px) {
  .hero { padding-top: 84px; }
  .hero .bio { max-width: 32ch; font-size: 0.95rem; }
}
