/* Silk design system: near-black monochrome, hairline depth, mono numerals.
   No gradients, no glow. The home page carries its own inline copy of the
   tokens; subpages and blog pages read them from here. */

@font-face {
  font-family: "IBM Plex Sans";
  src: url("/fonts/ibm-plex-sans-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/fonts/ibm-plex-sans-600.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/ibm-plex-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  --bg: #070708;
  --surface: #101011;
  --panel: #0b0b0c;
  --line: #232323;
  --text: #e7e7e3;
  --text-dim: #8f9089;
  --faint: #56564f;
  --accent: #e7e7e3;
  --up: #3fb26f;
  --down: #d05656;
  --radius: 2px;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  color-scheme: dark;
}

/* Light palette (same values as the web app's light theme) for pages that
   opt into the theme switcher - the docs shell sets data-theme via JS. The
   marketing site never sets it and stays permanently dark (the brand). */
html[data-theme="light"] {
  --bg: #f2f1ec;
  --surface: #faf9f5;
  --panel: #e9e7e0;
  --line: #d6d4ca;
  --text: #1c1c19;
  --text-dim: #62625a;
  --faint: #a3a29a;
  --accent: #1c1c19;
  --up: #2e7d4e;
  --down: #a84343;
  color-scheme: light;
}

/* Docs host (shell() stamps data-site="docs"): the same hairline-monochrome
   system tinted cool, with the level-1 slate as the one accent, so a reader
   can tell the reference apart from the warm app and the marketing site. */
html[data-site="docs"] {
  --bg: #08090c;
  --surface: #0f1115;
  --panel: #0b0c10;
  --line: #23272e;
  --text: #e4e7ec;
  --text-dim: #8b929c;
  --faint: #7c8492;
  --accent: #7eace8;
}
html[data-site="docs"][data-theme="light"] {
  --bg: #eef0f3;
  --surface: #f7f8fa;
  --panel: #e4e7ec;
  --line: #cfd4db;
  --text: #191c21;
  --text-dim: #5b6270;
  --faint: #606773;
  --accent: #2f5f9e;
}
/* The accent replaces the hairline at rest; hover still darkens to the text
   color (these outrank the base a:hover / .nav rules on specificity). */
html[data-site="docs"] a {
  text-decoration-color: var(--accent);
}
html[data-site="docs"] a:hover {
  text-decoration-color: var(--text);
}
html[data-site="docs"] .nav nav a.app,
html[data-site="docs"] .tab.on {
  border-bottom-color: var(--accent);
}
html[data-site="docs"] .nav nav a.app:hover {
  border-bottom-color: var(--text);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* A column that fills the viewport so the footer sits at the bottom of a
   short page (Questions, a young blog index) and follows a long one. */
body {
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 3px;
}
a:hover {
  text-decoration-color: var(--text);
}

.num,
time,
.readout {
  font-variant-numeric: tabular-nums;
}

/* Full-bleed sticky header, matching the home page's chrome exactly: same
   height, same wordmark scale, same mono links in the same order, same edge
   padding, so the bar holds still from page to page and host to host. */
:root {
  --nav-h: 60px;
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  height: var(--nav-h);
  padding: 0 3.2vw;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}
.wordmark {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 0.85rem;
  letter-spacing: 0.22em;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.wordmark svg {
  vertical-align: -0.34em;
  margin-right: 0.55em;
}
.nav nav {
  display: flex;
  align-items: center;
  gap: 1.6rem;
}
.nav nav a {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-dim);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
}
.nav nav a:hover {
  color: var(--text);
  text-decoration: none;
  border-bottom-color: var(--text);
}
.nav nav a.app {
  color: var(--text);
  border-bottom-color: var(--line);
}
.nav nav a[aria-current="page"] {
  color: var(--text);
  border-bottom-color: var(--accent);
}
/* Docs theme switcher and menu button: same chip as the web app's toggle. */
.theme-toggle,
.menu-toggle {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 3px 10px;
  cursor: pointer;
}
.theme-toggle:hover,
.menu-toggle:hover {
  color: var(--text);
  border-color: var(--text-dim);
}
.menu-toggle {
  display: none;
}

.page {
  flex: 1 0 auto;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 48px 24px 96px;
}
.page-wide {
  max-width: 1400px;
}

/* Landing hero: asymmetric, copy left, readout right. */
.hero {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 48px;
  align-items: start;
  padding: 48px 0 72px;
}
.hero h1 {
  font-size: 44px;
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.01em;
  max-width: 18ch;
}
.hero .sub {
  color: var(--text-dim);
  margin-top: 20px;
  max-width: 52ch;
}
.hero .disclaimer {
  color: var(--text-dim);
  font-size: 13px;
  margin-top: 16px;
  max-width: 52ch;
}
.cta {
  display: inline-block;
  margin-top: 28px;
  font-family: var(--mono);
  color: var(--text);
  border: 1px solid var(--text);
  padding: 12px 20px;
  border-radius: var(--radius);
  text-decoration: none;
}
.cta:hover {
  text-decoration: none;
  background: var(--text);
  color: var(--bg);
}
.cta-secondary {
  display: inline-block;
  margin-top: 28px;
  margin-left: 12px;
  color: var(--text);
  border: 1px solid var(--line);
  padding: 12px 20px;
  border-radius: var(--radius);
}
.cta-secondary:hover {
  text-decoration: none;
  border-color: var(--text-dim);
}

/* Instrument readout: hairlines + monospace, no chrome. */
.readout {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 14px;
  padding: 20px;
}
.readout .label {
  color: var(--text-dim);
  font-size: 11px;
  letter-spacing: 0.14em;
}
.readout .row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.readout .row:last-child {
  border-bottom: 0;
}
.readout .big {
  font-size: 34px;
  color: var(--text);
}
.readout .accent {
  color: var(--accent);
}
.readout .up {
  color: var(--up);
}
.readout .down {
  color: var(--down);
}
.readout .note {
  color: var(--text-dim);
  font-size: 11px;
  padding-top: 10px;
}

section.block {
  border-top: 1px solid var(--line);
  padding: 56px 0;
}
section.block h2 {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 24px;
}
.cols {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.cols h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}
.cols p {
  color: var(--text-dim);
  font-size: 15px;
}
.step {
  border-left: 2px solid var(--line);
  padding-left: 16px;
}

.faq dt {
  font-weight: 600;
  margin-top: 20px;
}
.faq dd {
  color: var(--text-dim);
  margin-top: 6px;
  max-width: 70ch;
}

.footer {
  border-top: 1px solid var(--line);
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px;
  color: var(--text-dim);
  font-size: 13px;
}
.footer a {
  color: var(--text-dim);
}

/* Blog */
.post,
.post-list {
  max-width: 720px;
}
.post h1 {
  font-size: 34px;
  line-height: 1.2;
  font-weight: 600;
}
.byline {
  color: var(--text-dim);
  font-size: 14px;
  margin: 12px 0 32px;
}
.post h2 {
  font-size: 22px;
  margin: 32px 0 12px;
}
.post p,
.post li {
  margin-bottom: 14px;
  color: var(--text);
}
.post code {
  font-family: var(--mono);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 14px;
}
.post pre {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  overflow-x: auto;
  margin-bottom: 14px;
}
.post pre code {
  border: 0;
  background: transparent;
  padding: 0;
}
.post blockquote {
  border-left: 2px solid var(--line);
  padding-left: 16px;
  color: var(--text-dim);
  margin-bottom: 14px;
}
.post table {
  border-collapse: collapse;
  margin-bottom: 14px;
}
.post th,
.post td {
  border: 1px solid var(--line);
  padding: 6px 12px;
  font-size: 15px;
}

/* Landing latest-posts section (LATEST_POSTS landing token) */
.latest-posts {
  list-style: none;
  max-width: 720px;
  margin-bottom: 20px;
}
.latest-posts-item {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 0 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.latest-posts-item time {
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 13px;
  padding-top: 3px;
  grid-row: span 2;
}
.latest-posts-item p {
  color: var(--text-dim);
  font-size: 15px;
  margin-top: 4px;
  grid-column: 2;
}

.rss-note {
  color: var(--text-dim);
  font-size: 14px;
  margin-top: 8px;
}

.post-list {
  list-style: none;
  margin-top: 24px;
}
.post-list li {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.post-list time {
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 13px;
  padding-top: 3px;
}
.post-list p {
  color: var(--text-dim);
  font-size: 15px;
  margin-top: 4px;
}

/* Subpages (content/pages/*.html fragments wrapped by the shell) */
.doc {
  max-width: 760px;
}
.doc h1 {
  font-size: 34px;
  line-height: 1.2;
  font-weight: 600;
  margin-bottom: 12px;
}
.doc h2 {
  font-size: 22px;
  font-weight: 600;
  margin: 44px 0 12px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.doc h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 22px 0 6px;
}
.doc p,
.doc li {
  color: var(--text-dim);
  margin-bottom: 12px;
  max-width: 70ch;
}
.doc li {
  margin-left: 20px;
  margin-bottom: 6px;
}
.doc strong {
  color: var(--text);
  font-weight: 600;
}
.doc code {
  font-family: var(--mono);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1px 5px;
  font-size: 14px;
  color: var(--text);
}
.doc table {
  border-collapse: collapse;
  margin: 14px 0;
  width: 100%;
}
.doc th {
  text-align: left;
  font-family: var(--mono);
  font-weight: 400;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.doc th,
.doc td {
  border-bottom: 1px solid var(--line);
  padding: 10px 16px 10px 0;
  font-size: 15px;
  vertical-align: top;
}
.doc td:first-child {
  font-family: var(--mono);
  font-size: 14px;
  white-space: nowrap;
  color: var(--text);
}
/* A metric's explanation is a prose row under the metric's own row. */
.doc tr.has-about td {
  border-bottom: 0;
  padding-bottom: 2px;
}
.doc tr.about-row td {
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  white-space: normal;
  color: var(--text-dim);
  padding-top: 0;
}

/* Tier comparison (Pro page): row headings read as prose, values in mono. */
.doc .compare th[scope="row"] {
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  font-size: 15px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text);
  white-space: normal;
}
.doc .compare th[scope="col"]:first-child {
  width: 46%;
}
.doc .compare td {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--text-dim);
}
.doc .compare td:last-child {
  color: var(--text);
}
/* A bordered CTA inside a doc page keeps its own air below, so the quiet
   follow-up link never hugs the button. */
.doc .cta {
  margin-bottom: 16px;
}

/* Reference sections: prose beside a code rail (Stripe pattern, static). */
.sec {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 460px);
  gap: 44px;
  border-top: 1px solid var(--line);
  padding: 44px 0;
  scroll-margin-top: calc(var(--nav-h, 72px) + 12px);
}
.sec:first-of-type {
  border-top: 0;
  padding-top: 8px;
}
.sec-prose h2 {
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
}
/* The whole code column sticks as one unit; two panels scroll together
   instead of the first sliding over the second. */
.sec-code {
  min-width: 0;
  position: sticky;
  top: calc(var(--nav-h, 72px) + 16px);
  align-self: start;
}
.sec-code .panel + .panel {
  margin-top: 16px;
}

/* Code panel: recessed surface, title bar with verb chip and copy button. */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 0 0 16px;
}
.doc .panel {
  margin-top: 14px;
}
.panel-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}
.panel-bar .p-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  flex: 1;
}
.chip {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 1px solid var(--text-dim);
  border-radius: var(--radius);
  padding: 2px 7px;
  color: var(--text);
  white-space: nowrap;
}
.copy-btn {
  font-family: var(--mono);
  font-size: 11px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text-dim);
  padding: 3px 9px;
  cursor: pointer;
}
.copy-btn:hover {
  color: var(--text);
  border-color: var(--text-dim);
}
.panel pre {
  padding: 14px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
}
.panel pre .ps {
  color: var(--text-dim);
  user-select: none;
}

/* A section whose code blocks sit inline in the prose, in step order
   (the connect walkthrough), instead of in the sticky rail. */
.sec.sec-inline {
  grid-template-columns: 1fr;
}
.sec-inline .sec-prose {
  max-width: 760px;
}
.sec-inline .sec-prose h3 {
  margin-top: 28px;
}

/* Config blocks: a faint line-number gutter (the docs script wraps each
   line in .l). Numbers are pseudo-content, so copy never picks them up. */
.panel pre[data-lines] {
  counter-reset: ln;
}
.panel pre[data-lines] .l {
  display: block;
  counter-increment: ln;
}
.panel pre[data-lines] .l::before {
  content: counter(ln);
  display: inline-block;
  width: 2ch;
  margin-right: 1.5ch;
  text-align: right;
  color: var(--faint);
  user-select: none;
}

/* One-click install button inside a client panel: the site CTA at docs
   scale, sitting between the tabs and the steps. */
.doc .cta.install {
  margin: 0 0 14px;
  padding: 8px 14px;
  font-size: 13px;
}

/* Client switcher tabs (choice persists via localStorage). */
.tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  margin: 14px 0 18px;
}
.tab {
  font-family: var(--mono);
  font-size: 13px;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  padding: 8px 12px;
  cursor: pointer;
}
.tab:hover {
  color: var(--text);
}
.tab.on {
  color: var(--text);
  border-bottom-color: var(--text);
}

/* Docs host: fixed-height bar, full-height sidebar with its own scroll, and
   a left-aligned content column (Stripe pattern). Scoped to data-site so the
   marketing shell and the shared .doc rules stay as they are. */
.docs-layout {
  flex: 1 0 auto;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: calc(100dvh - var(--nav-h));
}
.docs-side {
  position: sticky;
  top: var(--nav-h);
  align-self: start;
  display: flex;
  flex-direction: column;
  height: calc(100dvh - var(--nav-h));
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  border-right: 1px solid var(--line);
  padding: 24px 20px 40px 3.2vw;
  background: var(--bg);
}
/* The theme chip lives at the foot of the sidebar, not in the bar, so the
   bar's links sit where they do on every other host. */
.docs-side-foot {
  margin-top: auto;
  padding-top: 24px;
}
.docs-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.docs-main .page {
  max-width: 1320px;
  margin: 0;
  padding: 36px 40px 80px;
}
.docs-main .footer {
  max-width: none;
  margin: 0;
  padding: 24px 40px;
}

/* Sidebar tree: mono throughout; the page link doubles as the group label. */
.docs-nav {
  display: flex;
  flex-direction: column;
}
.docs-nav-group {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
  text-decoration: none;
  margin: 18px 0 4px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.docs-nav > .docs-nav-group:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
.docs-nav-group[aria-current="page"],
a.docs-nav-group:hover {
  color: var(--text);
}
.docs-nav-item {
  display: block;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-dim);
  text-decoration: none;
  padding: 4px 0 4px 12px;
  border-left: 1px solid transparent;
}
.docs-nav-item:hover {
  color: var(--text);
}
.docs-nav-item[aria-current] {
  color: var(--text);
  border-left-color: var(--accent);
}
.docs-nav-site {
  display: none;
}

/* Content column: full ink for prose, a mono kicker over the title, and a
   self-link on every reference heading (shown on hover or focus). */
.docs-main .doc {
  max-width: none;
  min-width: 0;
}
.docs-kicker {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 14px;
}
.docs-main .doc h1 {
  font-size: 36px;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin-bottom: 14px;
}
.docs-main .doc h2 {
  font-size: 21px;
}
.docs-main .doc p,
.docs-main .doc li {
  color: var(--text);
  font-size: 15px;
  line-height: 1.65;
}
.sec-prose {
  min-width: 0;
  max-width: 660px;
}
.h-anchor {
  margin-left: 0.4em;
  font-family: var(--mono);
  font-weight: 400;
  font-size: 0.8em;
  color: var(--faint);
  text-decoration: none;
  opacity: 0;
}
.sec-prose h2:hover .h-anchor,
.h-anchor:focus-visible {
  opacity: 1;
}
.doc h2 {
  scroll-margin-top: 24px;
}

@media (max-width: 1120px) {
  .sec {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .sec-code {
    position: static;
  }
}

/* The sidebar becomes a drawer behind the Menu chip; shown and hidden
   instantly, no transition. */
@media (max-width: 1000px) {
  .docs-layout {
    grid-template-columns: 1fr;
  }
  .menu-toggle {
    display: inline-block;
  }
  .docs-side {
    display: none;
    position: fixed;
    top: var(--nav-h);
    left: 0;
    bottom: 0;
    width: min(320px, 100%);
    z-index: 20;
  }
  html.docs-menu-open .docs-side {
    display: block;
  }
  html.docs-menu-open {
    overflow: hidden;
  }
}

@media (max-width: 800px) {
  .hero,
  .cols {
    grid-template-columns: 1fr;
  }
  .hero h1 {
    font-size: 34px;
  }
}

/* Narrow marketing pages let the bar wrap; the docs bar stays one line and
   moves its links into the drawer. */
@media (max-width: 720px) {
  .nav {
    height: auto;
    min-height: var(--nav-h);
    flex-wrap: wrap;
    padding: 12px 3.2vw;
  }
  .nav nav {
    flex-wrap: wrap;
  }
  html[data-site="docs"] .nav {
    height: var(--nav-h);
    flex-wrap: nowrap;
    padding: 0 3.2vw;
  }
  html[data-site="docs"] .nav nav a {
    display: none;
  }
  .docs-nav-site {
    display: block;
  }
  .docs-main .page {
    padding: 28px 20px 64px;
  }
  .docs-main .footer {
    padding: 20px;
  }
}
