/* Open Intelligence — public site. No external assets; system font stacks only. */

:root {
  --bg: #fff;
  --bg-soft: #fafaf9;
  --ink: #16181d;
  --ink-2: #3d424b;
  --ink-3: #6b707a;
  --rule: #e6e6e3;
  --accent: #1d3557;
  --accent-soft: #eef2f7;
  --serif: ui-serif, "Iowan Old Style", "Charter", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --wrap: 1120px;
  --prose: 68ch;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1.0625rem/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

h1, h2, h3 { font-family: var(--serif); font-weight: 500; color: var(--ink); letter-spacing: -0.01em; }
h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); line-height: 1.2; margin: 0 0 1.5rem; }
h3 { font-size: 1.2rem; line-height: 1.3; margin: 2rem 0 0.5rem; }
p { margin: 0 0 1.1em; }
code { font-family: var(--mono); font-size: 0.9em; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.prose { max-width: var(--prose); }
.muted { color: var(--ink-3); }
.eyebrow {
  font: 600 0.75rem/1 var(--sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 1rem;
}

/* Nav */
.nav {
  position: sticky; top: 0; z-index: 10;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--rule);
}
.nav .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; min-height: 3.75rem; }
.wordmark {
  display: inline-flex; align-items: center; gap: 0.55rem;
  font: 500 1.125rem/1 var(--serif); color: var(--ink); text-decoration: none; white-space: nowrap;
}
.wordmark svg { width: 20px; height: 20px; flex: none; }
.nav ul { display: flex; gap: 1.6rem; list-style: none; margin: 0; padding: 0; }
.nav ul a { color: var(--ink-2); text-decoration: none; font-size: 0.9375rem; }
.nav ul a:hover { color: var(--accent); }

/* Sections */
section { padding: clamp(4rem, 9vw, 7rem) 0; border-top: 1px solid var(--rule); }
section:first-of-type { border-top: 0; }
.split { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem 4rem; }
@media (min-width: 900px) {
  .split { grid-template-columns: 15rem minmax(0, 1fr); }
  .split > header h2 { position: sticky; top: 6rem; }
}

/* Readability, belt and braces: every text column sits on near-opaque white above the swarm
   canvas (z-index -1 < main/footer), whatever the canvas does on a given engine. */
main, footer { position: relative; z-index: 1; }
.hero .wrap > *, .split > *, .teaser > div, footer .wrap > * {
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 0 0 0.6rem rgba(255, 255, 255, 0.94);
}
/* Below the side layout the swarm fills the viewport: back whole content blocks instead, so
   it shows only in the bands between sections, not as strips between paragraphs. */
@media (max-width: 1099px) {
  .hero .wrap > *, .split > *, .teaser > div, footer .wrap > * { background: none; box-shadow: none; }
  main .wrap, footer .wrap { background: rgba(255, 255, 255, 0.94); }
}

/* Hero */
.hero { padding: clamp(5rem, 13vw, 10rem) 0 clamp(4rem, 9vw, 7rem); }
.hero h1 {
  font-size: clamp(2.1rem, 5.2vw, 3.6rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  max-width: 20ch;
  margin: 0 0 1.75rem;
}
.hero .sub { font-size: clamp(1.05rem, 1.6vw, 1.25rem); color: var(--ink-2); max-width: 52ch; margin: 0 0 2.5rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem; align-items: center; }
.btn {
  display: inline-block; padding: 0.7rem 1.2rem;
  background: var(--accent); color: #fff; text-decoration: none;
  font: 500 0.9375rem/1 var(--sans); border-radius: 3px;
  transition: transform 0.15s ease, background-color 0.15s ease;
}
.btn:hover { background: #142640; }
.btn:active { transform: translateY(1px); }
.link-arrow { font-size: 0.9375rem; text-decoration: none; }
.link-arrow:hover { text-decoration: underline; }

.lede { font-size: 1.1875rem; color: var(--ink); }

/* Pull quote */
blockquote {
  margin: 2rem 0; padding: 0 0 0 1.25rem;
  border-left: 2px solid var(--accent);
  font: italic 400 1.2rem/1.5 var(--serif); color: var(--ink);
}
blockquote cite { display: block; margin-top: 0.6rem; font: normal 0.8125rem/1.4 var(--sans); color: var(--ink-3); }

/* How it works: numbered typographic list */
.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; max-width: 46rem; }
.steps li {
  counter-increment: step;
  display: grid; grid-template-columns: 3rem minmax(0, 1fr); gap: 0 1rem;
  padding: 1.25rem 0; border-top: 1px solid var(--rule);
}
.steps li:last-child { border-bottom: 1px solid var(--rule); }
.steps li::before {
  content: counter(step, decimal-leading-zero);
  font: 400 1rem/1.6 var(--mono); color: var(--accent);
}
.steps strong { display: block; font: 500 1.125rem/1.4 var(--serif); margin-bottom: 0.2rem; }
.steps span { color: var(--ink-2); font-size: 0.98rem; }

/* Live network */
.stats {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0 0 2.5rem; border-top: 1px solid var(--ink);
}
@media (min-width: 720px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { padding: 1.25rem 1.25rem 1.25rem 0; border-bottom: 1px solid var(--rule); }
.stat dt { font-size: 0.8125rem; color: var(--ink-3); margin-bottom: 0.4rem; }
.stat dd { margin: 0; font: 400 clamp(1.75rem, 3.5vw, 2.4rem)/1.1 var(--serif); font-variant-numeric: tabular-nums; min-height: 1.1em; }
.stat dd.small { font-size: 1.05rem; line-height: 1.5; font-family: var(--sans); }

.skeleton { display: inline-block; width: 3.5ch; height: 0.8em; background: #efefec; border-radius: 2px; vertical-align: middle; }
.net-state { font-size: 0.9375rem; color: var(--ink-3); margin: 0 0 1.5rem; }
.net-state .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #2f6b4f; margin-right: 0.5rem; vertical-align: 0.1em; }
.net-state.off .dot { background: #b5b5b0; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; font-variant-numeric: tabular-nums; }
caption { text-align: left; font: 500 1.1rem/1.4 var(--serif); padding-bottom: 0.75rem; }
th, td { text-align: left; padding: 0.7rem 1rem 0.7rem 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-weight: 600; font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); border-bottom-color: var(--ink); }
td.num, th.num { text-align: right; padding-right: 0; }
td.mono { font-family: var(--mono); font-size: 0.85rem; }
tbody tr.empty td { color: var(--ink-3); padding: 1.5rem 0; }

/* Join */
.cmds { margin: 0 0 2rem; padding: 0; list-style: none; counter-reset: cmd; max-width: 46rem; }
.cmds li { counter-increment: cmd; margin: 0 0 1.5rem; }
.cmds li > p { margin: 0 0 0.5rem; color: var(--ink-2); }
.cmds li > p::before { content: counter(cmd) ".  "; color: var(--accent); font-family: var(--mono); }
pre {
  margin: 0; padding: 1rem 1.15rem; overflow-x: auto;
  background: var(--bg-soft); border: 1px solid var(--rule); border-radius: 3px;
  font: 400 0.875rem/1.6 var(--mono); color: var(--ink);
}
.note { font-size: 0.9375rem; color: var(--ink-2); padding: 1rem 0 0; border-top: 1px solid var(--rule); max-width: 46rem; }

/* Waitlist (waitlist.js reveals the form once /api/waitlist reports it is open) */
.waitlist { display: grid; gap: 0.4rem; max-width: 30rem; margin: 1.5rem 0 0; }
.waitlist[hidden], .wl-fallback[hidden] { display: none; }
.waitlist label { font-size: 0.875rem; color: var(--ink-2); }
.waitlist input {
  font: 400 1rem/1.4 var(--sans); color: var(--ink);
  padding: 0.6rem 0.75rem; margin: 0 0 0.6rem;
  border: 1px solid #c9cbd0; border-radius: 3px; background: #fff;
}
.waitlist input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.waitlist .btn { justify-self: start; border: 0; cursor: pointer; }
.waitlist .btn[disabled] { opacity: 0.6; cursor: default; }
.waitlist .hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.consent, .wl-status { font-size: 0.8125rem; color: var(--ink-3); margin: 0.4rem 0 0; }
.wl-status:empty { display: none; }
.wl-status.ok { color: #2f6b4f; }
.wl-status.err { color: #9b2c2c; }
.wl-fallback { margin: 1.25rem 0 0; font-size: 0.9375rem; }
.wl-fallback .btn { margin-right: 0.75rem; }

/* Build it with us */
.cta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 0 2.5rem; }
.cta-grid h3 { margin-top: 1rem; }
.cta-grid .waitlist { max-width: none; }

/* Whitepaper teaser */
.teaser { display: grid; gap: 2rem; align-items: end; }
@media (min-width: 900px) { .teaser { grid-template-columns: minmax(0, 1fr) auto; } }
.teaser h2 { font-size: clamp(1.6rem, 3.4vw, 2.4rem); max-width: 26ch; }

.byline { font-size: 0.9375rem; color: var(--ink-2); margin: -0.5rem 0 1rem; }

/* Background swarm (swarm.js): fixed canvas behind content, no CSS mask. By default it covers
   the viewport at low opacity behind the text backdrops; on wide screens swarm.js adds
   .swarm-side and sets left/width so the canvas starts right of the text columns. */
.swarm {
  position: fixed; top: 0; left: 0; z-index: -1;
  width: 100%; height: 100vh; height: 100lvh;
  pointer-events: none;
  opacity: 0.35;
}
.swarm-side .swarm { opacity: 1; }
.swarm[hidden] { display: none; }

/* Footer */
footer { border-top: 1px solid var(--rule); padding: 2.5rem 0 3rem; font-size: 0.875rem; color: var(--ink-3); }
footer .wrap { display: flex; flex-wrap: wrap; gap: 0.5rem 2rem; justify-content: space-between; }
footer a { color: var(--ink-2); }

/* Wide screens: stack every heading above its content and cap each text column so it ends
   before ~58vw (left edge of .wrap content = max(0, 50vw - 560px) + 40px gutter). swarm.js
   then places the canvas right of the widest column, so no text ever sits over it.
   Kept after the component rules it overrides (.steps, .teaser, footer). */
@media (min-width: 1100px) {
  :root { --col: min(46rem, 58vw - 40px, 8vw + 520px); }
  .split { grid-template-columns: minmax(0, 1fr); }
  .split > header h2 { position: static; }
  .hero .wrap > *, .split > *, .teaser > * { max-width: var(--col); }
  .hero .wrap > h1 { max-width: min(20ch, var(--col)); }
  .teaser { grid-template-columns: minmax(0, 1fr); align-items: start; }
  .teaser > .btn { justify-self: start; }
  footer .wrap { justify-content: flex-start; }
}

/* Whitepaper document */
.paper { max-width: calc(var(--prose) + 2 * var(--gutter)); margin: 0 auto; padding: clamp(3rem, 8vw, 6rem) var(--gutter) 5rem; }
.paper header.title { margin-bottom: 3rem; padding-bottom: 2rem; border-bottom: 1px solid var(--rule); }
.paper h1 { font-size: clamp(1.9rem, 4.4vw, 2.8rem); line-height: 1.12; letter-spacing: -0.015em; margin: 0 0 1.25rem; }
.paper .meta { font-size: 0.9375rem; color: var(--ink-3); margin: 0.2rem 0; }
.paper h2 { font-size: 1.55rem; margin: 3.5rem 0 1rem; }
.paper h3 { font-size: 1.15rem; margin: 2rem 0 0.5rem; }
.paper p, .paper li { color: var(--ink); }
.paper ul, .paper ol { padding-left: 1.25rem; margin: 0 0 1.1em; }
.paper li { margin-bottom: 0.4em; }
.abstract { background: var(--bg-soft); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: 1.5rem 1.5rem 0.4rem; margin: 0 0 3rem; }
.abstract h2 { font: 600 0.75rem/1 var(--sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 0.9rem; }
.toc { margin: 0 0 3rem; }
.toc h2 { font: 600 0.75rem/1 var(--sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 0.9rem; }
.toc ol { list-style: none; padding: 0; margin: 0; columns: 2 16rem; column-gap: 2rem; }
.toc li { margin: 0 0 0.45rem; break-inside: avoid; }
.toc a { text-decoration: none; color: var(--ink-2); }
.toc a:hover { color: var(--accent); text-decoration: underline; }
.paper table { margin: 1rem 0 1.75rem; font-size: 0.9rem; }
.paper .refs li { font-size: 0.9375rem; }
.back { font-size: 0.875rem; text-decoration: none; }
.draft-flag { display: inline-block; font: 600 0.6875rem/1 var(--sans); letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); background: var(--accent-soft); padding: 0.35rem 0.5rem; border-radius: 2px; margin-bottom: 1.25rem; }

/* Mobile */
@media (max-width: 760px) {
  .nav .wrap { flex-wrap: wrap; padding-top: 0.75rem; padding-bottom: 0.65rem; gap: 0.6rem; }
  .nav ul { width: 100%; gap: 1.1rem; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .nav ul::-webkit-scrollbar { display: none; }
  html { scroll-padding-top: 7rem; }
  .steps li { grid-template-columns: 2.25rem minmax(0, 1fr); }
  .hide-sm { display: none; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Print (whitepaper → PDF) */
@media print {
  @page { margin: 20mm 18mm; }
  body { font: 10.5pt/1.5 var(--serif); color: #111; background: #fff; }
  .nav, footer, .back, .no-print, .swarm { display: none !important; }
  .paper { max-width: none; padding: 0; }
  .paper h1 { font-size: 22pt; }
  .paper h2 { font-size: 14pt; margin-top: 18pt; break-after: avoid; }
  .paper h3 { font-size: 11.5pt; break-after: avoid; }
  .abstract { background: none; padding: 8pt 0; }
  .toc ol { columns: 1; }
  p, li { orphans: 3; widows: 3; }
  table, pre, blockquote { break-inside: avoid; }
  a { color: #111; text-decoration: none; }
  .refs a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 9pt; color: #555; }
  .draft-flag { background: none; padding: 0; }
}
