/* ==========================================================================
   Brain86 — brain86.com
   Palette: warm paper, deep ink, one signal-orange accent.
   Type: Newsreader (display), Instrument Sans (text), IBM Plex Mono (labels).
   ========================================================================== */

:root {
  --paper: #F4F0E6;
  --paper-raised: #FBF9F3;
  --paper-tint: #ECE6D8;
  --ink: #15191C;
  --ink-soft: #343A3E;
  --muted: #5E6366;
  --line: #D8D0BE;
  --line-strong: #BDB39E;

  --accent: #E2531F;        /* Signal orange: marks, fills, buttons with ink text */
  --accent-ink: #B13D0E;    /* Accent for text on paper (AA contrast) */

  --on-ink: #F4F0E6;
  --on-ink-muted: #ABAFAA;
  --ink-line: #2E3438;

  --font-display: "Newsreader", "Iowan Old Style", "Georgia", serif;
  --font-text: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --gutter: clamp(20px, 5vw, 40px);
  --max: 1200px;
  --section-y: clamp(72px, 10vw, 136px);
  --radius: 14px;
  --radius-sm: 10px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 84px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent-ink);
  outline-offset: 3px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 100;
  background: var(--ink); color: var(--on-ink);
  padding: 10px 16px; border-radius: 8px; text-decoration: none;
}
.skip-link:focus { top: 12px; }

.wrap {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ---------- Type ---------- */
.display {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.75rem, 1.4rem + 5.4vw, 5.25rem);
  line-height: 1.0;
  letter-spacing: -0.025em;
  font-variation-settings: "opsz" 72;
  text-wrap: balance;
}
.display em {
  font-style: italic;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 0.07em;
  text-underline-offset: 0.12em;
  text-decoration-skip-ink: none;
}
.h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2rem, 1.35rem + 2.6vw, 3.25rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  font-variation-settings: "opsz" 60;
  text-wrap: balance;
}
.h3 {
  font-family: var(--font-text);
  font-weight: 600;
  font-size: 1.1875rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.mono, .kicker, .eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.kicker { color: var(--accent-ink); margin-bottom: 18px; }
.muted { color: var(--muted); }
.lede {
  font-size: clamp(1.125rem, 1rem + 0.5vw, 1.3125rem);
  line-height: 1.5;
  color: var(--ink-soft);
  max-width: 34ch;
}
.body-lg {
  font-size: clamp(1.0625rem, 1rem + 0.3vw, 1.1875rem);
  line-height: 1.6;
  color: var(--ink-soft);
  max-width: 52ch;
}
.muted-copy { color: var(--muted); margin-top: 16px; max-width: 52ch; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px;
  padding: 0 24px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: var(--font-text);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -0.005em;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .18s ease, color .18s ease, border-color .18s ease, transform .18s ease;
}
.btn:active { transform: translateY(1px); }
.btn-sm { min-height: 40px; padding: 0 18px; font-size: 0.9375rem; }
.btn-block { width: 100%; }
.btn-ink { background: var(--ink); color: var(--on-ink); }
.btn-ink:hover { background: #000; }
.btn-line { border-color: var(--line-strong); color: var(--ink); background: transparent; }
.btn-line:hover { border-color: var(--ink); }
.btn-accent { background: var(--accent); color: var(--ink); }
.btn-accent:hover { background: #F0662F; }
.btn[aria-busy="true"] { opacity: .7; cursor: progress; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--paper);
  border-bottom: 1px solid transparent;
  transition: border-color .2s ease;
}
.site-header.is-scrolled { border-bottom-color: var(--line); }
.header-inner {
  display: flex; align-items: center; gap: 16px;
  height: 68px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--ink);
}
.brand-mark { width: 30px; height: 30px; flex: none; }
.bm-tile { fill: var(--ink); }
.bm-dot { fill: var(--accent); }
.bm-ring { fill: none; stroke: var(--paper); stroke-width: 2.6; stroke-linecap: round; }
.brand-word {
  font-family: var(--font-text);
  font-weight: 600;
  font-size: 1.1875rem;
  letter-spacing: -0.02em;
}

.site-nav { margin-left: auto; position: relative; }
.nav-links { display: flex; gap: 32px; }
.nav-links a {
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--ink-soft);
  padding: 8px 0;
}
.nav-links a:hover { color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 6px; text-decoration-thickness: 2px; }
.header-cta { margin-left: 16px; }
.cta-short { display: none; }

.nav-toggle {
  display: none;
  width: 44px; height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  align-items: center; justify-content: center;
}
.nav-toggle-bars, .nav-toggle-bars::before {
  display: block; width: 16px; height: 1.5px; background: var(--ink);
  position: relative; transition: transform .2s ease;
}
.nav-toggle-bars::before { content: ""; position: absolute; top: 5px; left: 0; }
.nav-toggle-bars { transform: translateY(-2.5px); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars { transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::before { transform: translateY(-5px) rotate(-90deg); }

@media (max-width: 820px) {
  .header-inner { gap: 10px; }
  .nav-toggle { display: inline-flex; }
  .site-nav { order: 3; margin-left: 0; }
  .header-cta { margin-left: auto; }
  .nav-links {
    display: none;
    position: absolute; right: 0; top: calc(100% + 12px);
    flex-direction: column; gap: 0;
    min-width: 220px;
    background: var(--paper-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 8px;
    box-shadow: 0 18px 40px -20px rgba(21, 25, 28, .28);
  }
  .nav-links.is-open { display: flex; }
  .nav-links a { display: block; padding: 12px 14px; border-radius: 8px; font-size: 1rem; }
  .nav-links a:hover { background: var(--paper-tint); text-decoration: none; }
}
@media (max-width: 480px) {
  .cta-long { display: none; }
  .cta-short { display: inline; }
}

/* ---------- Hero ---------- */
.hero { padding-block: clamp(40px, 7vw, 96px) clamp(16px, 3vw, 32px); }
.hero-grid {
  display: grid;
  gap: clamp(48px, 6vw, 80px);
  align-items: center;
}
@media (min-width: 960px) {
  .hero-grid { grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); }
}
.eyebrow {
  display: inline-flex; align-items: flex-start; gap: 10px;
  line-height: 1.5;
  color: var(--ink-soft);
  margin-bottom: 28px;
}
.dot {
  flex: none;
  width: 8px; height: 8px; border-radius: 50%;
  margin-top: 5px;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(226, 83, 31, .16);
}
.hero .display { max-width: 14ch; font-size: clamp(2.6rem, 1.3rem + 4.8vw, 4.75rem); }
.hero .display em { display: block; }
.hero .lede { margin-top: 28px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }
@media (max-width: 480px) { .actions .btn { flex: 1 1 100%; } }

/* Call card (hero diagram) */
.call-card {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 22px 22px 18px;
  box-shadow: 0 1px 0 rgba(21,25,28,.04), 0 30px 60px -36px rgba(21, 25, 28, .35);
  max-width: 460px;
  width: 100%;
  justify-self: center;
}
@media (min-width: 960px) { .call-card { justify-self: end; } }
.call-card-head {
  display: flex; justify-content: space-between; align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
}
.channels { display: flex; flex-wrap: wrap; gap: 6px; padding: 14px 0 4px; }
.channels li {
  font-size: 0.8125rem; font-weight: 500;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
}
.channels li.is-active { border-color: var(--ink); color: var(--ink); background: var(--paper); }
.channels li.is-active::before {
  content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); margin-right: 7px; vertical-align: 1px;
}
.call-steps { position: relative; }
.call-step {
  position: relative;
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 14px;
  padding: 14px 0;
}
.call-step:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 19.5px; top: 56px; bottom: -14px;
  width: 1px;
  background: var(--line-strong);
}
.call-icon {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--paper);
  display: grid; place-items: center;
}
.call-icon svg {
  width: 18px; height: 18px;
  fill: none; stroke: var(--ink); stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
}
.call-step.is-final .call-icon { background: var(--accent); border-color: var(--accent); }
.call-title { font-weight: 600; font-size: 0.9875rem; line-height: 1.35; }
.call-meta { font-size: 0.9rem; color: var(--muted); line-height: 1.4; margin-top: 3px; }
.call-card-foot {
  border-top: 1px solid var(--line);
  padding-top: 14px; margin-top: 6px;
  font-size: 0.6875rem;
}

@media (prefers-reduced-motion: no-preference) {
  .js .call-step { opacity: 0; transform: translateY(6px); animation: step-in .5s ease forwards; }
  .js .call-step:nth-child(1) { animation-delay: .15s; }
  .js .call-step:nth-child(2) { animation-delay: .45s; }
  .js .call-step:nth-child(3) { animation-delay: .75s; }
  .js .call-step:nth-child(4) { animation-delay: 1.05s; }
  @keyframes step-in { to { opacity: 1; transform: none; } }
}

/* ---------- Sections ---------- */
.section { padding-block: var(--section-y); }
.section-rule { border-top: 1px solid var(--line); }
.section-tint { background: var(--paper-tint); }
.section-head { max-width: 760px; margin-bottom: clamp(40px, 6vw, 64px); }
.section-lede { margin-top: 20px; color: var(--ink-soft); font-size: clamp(1.0625rem, 1rem + 0.3vw, 1.1875rem); max-width: 56ch; }
.section-head-split {
  max-width: none;
  display: grid; gap: 20px;
  align-items: end;
}
@media (min-width: 900px) {
  .section-head-split { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 64px; }
}
.section-head-split .h2 { max-width: 20ch; }
.section-note { color: var(--muted); max-width: 36ch; font-size: 0.9875rem; }

/* Problem / solution */
.contrast {
  display: grid;
  gap: 16px;
}
@media (min-width: 820px) { .contrast { grid-template-columns: 1fr 1fr; gap: 24px; } }
.contrast-col {
  border-radius: var(--radius);
  padding: clamp(24px, 4vw, 40px);
}
.contrast-before { border: 1px solid var(--line); }
.contrast-after { background: var(--ink); color: var(--on-ink); }
.contrast-label { margin-bottom: 22px; color: var(--muted); }
.contrast-after .contrast-label { color: var(--accent); }
.contrast-list li {
  position: relative;
  padding: 14px 0 14px 34px;
  border-top: 1px solid var(--line);
  font-size: 1.0625rem;
  line-height: 1.5;
}
.contrast-after .contrast-list li { border-top-color: var(--ink-line); }
.contrast-list li::before {
  content: "";
  position: absolute; left: 0; top: 17px;
  width: 20px; height: 20px; border-radius: 50%;
}
.contrast-before .contrast-list li { color: var(--ink-soft); }
.contrast-before .contrast-list li::before {
  border: 1px solid var(--line-strong);
  background: linear-gradient(var(--muted), var(--muted)) center / 8px 1.5px no-repeat;
}
.contrast-after .contrast-list li::before {
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='m6 10.2 2.6 2.6L14 7.4' fill='none' stroke='%2315191C' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 20px no-repeat;
}

/* How it works */
.steps {
  display: grid;
  gap: 0;
  counter-reset: step;
}
@media (min-width: 860px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.step {
  padding: 32px 0;
  border-top: 1px solid var(--line);
}
.step:first-child { border-top: 0; padding-top: 0; }
@media (min-width: 860px) {
  .step { border-top: 0; padding: 0 clamp(24px, 3vw, 40px); border-left: 1px solid var(--line); }
  .step:first-child { padding-left: 0; border-left: 0; }
  .step:last-child { padding-right: 0; }
}
.step-art { width: 120px; height: 72px; margin-bottom: 28px; }
.ln { fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ln.ac { stroke: var(--accent); }
.ln.soft { opacity: .45; }
.ln.dash { stroke-dasharray: 2 5; }
.fill-ac { fill: var(--accent); }
.step-num { color: var(--accent-ink); margin-bottom: 10px; }
.step .h3 { margin-bottom: 10px; }
.step p:last-child { color: var(--ink-soft); max-width: 34ch; }

/* Features (suite) */
.suite { display: grid; gap: 40px; }
@media (min-width: 900px) { .suite { grid-template-columns: repeat(3, 1fr); gap: clamp(28px, 4vw, 56px); } }
.suite-label {
  color: var(--accent-ink);
  padding-bottom: 16px;
  border-bottom: 1px solid var(--ink);
}
.suite-list li {
  display: grid; gap: 4px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.feature-title { font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1.35; }
.suite-list p { color: var(--ink-soft); font-size: 0.98rem; }

/* Integrations flow */
.flow {
  display: grid;
  gap: 48px;
  align-items: center;
  padding: clamp(28px, 4vw, 48px);
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--paper-raised);
}
.flow-label { color: var(--muted); margin-bottom: 14px; }
.flow-col { display: flex; flex-wrap: wrap; gap: 8px; }
.flow-col li {
  position: relative;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--paper);
  padding: 8px 16px;
  font-size: 0.9375rem;
  font-weight: 500;
  white-space: nowrap;
}
.flow-hub {
  position: relative;
  background: var(--ink);
  color: var(--on-ink);
  border-radius: var(--radius);
  padding: 24px;
  display: grid; justify-items: center; gap: 6px;
  text-align: center;
}
.flow-mark { width: 40px; height: 40px; margin-bottom: 6px; }
.bm-tile-on-ink { fill: var(--paper); }
.bm-ring-on-ink { stroke: var(--ink); }
.flow-hub-name { font-weight: 600; font-size: 1.125rem; letter-spacing: -0.01em; }
.flow-hub-sub { color: var(--on-ink-muted); font-size: 0.6875rem; }
/* Mobile: vertical connectors above and below the hub */
.flow-hub::before, .flow-hub::after {
  content: ""; position: absolute; left: 50%;
  width: 1px; height: 48px; background: var(--line-strong);
}
.flow-hub::before { bottom: 100%; }
.flow-hub::after { top: 100%; }
@media (min-width: 820px) {
  .flow { grid-template-columns: 1fr 200px 1fr; gap: 0; }
  .flow-hub { align-self: stretch; align-content: center; }
  .flow-hub::before, .flow-hub::after { display: none; }
  .flow-col { flex-direction: column; flex-wrap: nowrap; gap: 10px; }
  .flow-in { display: grid; justify-items: end; padding-right: 56px; }
  .flow-out { display: grid; justify-items: start; padding-left: 56px; }
  .flow-in .flow-col { align-items: flex-end; }
  .flow-out .flow-col { align-items: flex-start; }
  .flow-in .flow-col li::after,
  .flow-out .flow-col li::before {
    content: ""; position: absolute; top: 50%;
    width: 56px; height: 1px; background: var(--line-strong);
  }
  .flow-in .flow-col li::after { left: 100%; }
  .flow-out .flow-col li::before { right: 100%; }
  .flow-in .flow-col li:nth-child(2)::after,
  .flow-out .flow-col li:nth-child(1)::before { background: var(--accent); }
}

/* Who it's for */
.who-grid { display: grid; gap: 24px; align-items: end; }
@media (min-width: 900px) { .who-grid { grid-template-columns: 1.1fr .9fr; gap: 80px; } }
.who-copy { display: grid; gap: 12px; }
.who-strong { color: var(--ink); font-weight: 600; }

/* Narrative */
.narrative-title { max-width: 18ch; }
.narrative-title { font-size: clamp(2rem, 1.2rem + 3.2vw, 3.5rem); margin-bottom: clamp(28px, 4vw, 44px); }
.narrative-body {
  font-family: var(--font-display);
  font-size: clamp(1.1875rem, 1.05rem + 0.5vw, 1.375rem);
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 58ch;
  font-variation-settings: "opsz" 16;
}


/* Early access */
.section-ink { background: var(--ink); color: var(--on-ink); }
.kicker-on-ink { color: var(--accent); }
.section-ink .body-lg { color: var(--on-ink-muted); margin-top: 20px; }
.access-grid { display: grid; gap: 48px; align-items: start; }
@media (min-width: 960px) { .access-grid { grid-template-columns: 1fr 1fr; gap: 80px; } }
.access-direct { margin-top: 28px; color: var(--on-ink-muted); }
.access-direct a { color: var(--on-ink); text-decoration-color: var(--accent); text-underline-offset: 4px; text-decoration-thickness: 1.5px; }

.access-form {
  background: var(--paper-raised);
  color: var(--ink);
  border-radius: 20px;
  padding: clamp(22px, 4vw, 36px);
  display: grid;
  gap: 16px;
}
.field { display: grid; gap: 6px; }
.field-row { display: grid; gap: 16px; }
@media (min-width: 560px) { .field-row { grid-template-columns: 1fr 1fr; } }
.field label { font-size: 0.9375rem; font-weight: 500; }
.optional { color: var(--muted); font-weight: 400; }
.field input, .field textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 12px 14px;
  font-size: 1rem;
  line-height: 1.4;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field textarea { resize: vertical; min-height: 92px; }
.field input::placeholder { color: #8A8E8E; }
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(226, 83, 31, .25);
}
.field input[aria-invalid="true"] { border-color: var(--accent-ink); }
.access-form .btn { margin-top: 6px; min-height: 54px; }
.form-note { font-size: 0.875rem; color: var(--muted); }
.form-note.is-error { color: var(--accent-ink); }
.form-note.is-success { color: var(--ink); font-weight: 500; }

/* FAQ */
.faq-grid { display: grid; gap: 32px; }
@media (min-width: 900px) { .faq-grid { grid-template-columns: .8fr 1.2fr; gap: 80px; } }
.faq { border-top: 1px solid var(--ink); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  list-style: none;
  cursor: pointer;
  display: flex; justify-content: space-between; align-items: center; gap: 24px;
  padding: 22px 0;
  font-weight: 600;
  font-size: 1.125rem;
  letter-spacing: -0.01em;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "";
  flex: none;
  width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid var(--line-strong);
  background:
    linear-gradient(var(--ink), var(--ink)) center / 10px 1.5px no-repeat,
    linear-gradient(var(--ink), var(--ink)) center / 1.5px 10px no-repeat;
  transition: transform .2s ease, background-color .2s ease;
}
.faq details[open] summary::after {
  background:
    linear-gradient(var(--ink), var(--ink)) center / 10px 1.5px no-repeat,
    var(--accent);
  border-color: var(--accent);
}
.faq details p { padding: 0 48px 24px 0; color: var(--ink-soft); max-width: 62ch; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding-block: 48px 40px; }
.footer-grid { display: grid; gap: 28px; }
@media (min-width: 820px) {
  .footer-grid { grid-template-columns: 1fr auto; align-items: center; row-gap: 32px; }
}
.footer-tag { margin-top: 10px; color: var(--muted); font-size: 0.9375rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 12px 28px; font-size: 0.9375rem; }
.footer-links a { color: var(--ink-soft); text-decoration: none; }
.footer-links a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }
.footer-legal {
  grid-column: 1 / -1;
  border-top: 1px solid var(--line);
  padding-top: 24px;
  font-size: 0.875rem;
  color: var(--muted);
}

/* 404 */
.notfound { min-height: 70vh; display: grid; align-content: center; gap: 24px; padding-block: 80px; }
.notfound .display { max-width: 14ch; }
