/* ===========================================================================
   DOCS — INDUSTRIAL BRUTALISM / TACTICAL TELEMETRY

   docs.html is a thousand lines of markup built against portal.css and
   docs.css, and rewriting it would be rewriting the documentation rather than
   restyling it. So this sheet comes last and overrules the chrome: corners,
   rules, type registers and the one accent.

   Loaded after /docs.css, which is the whole mechanism — nothing here needs
   !important except the corners, because a radius set on a class this file
   does not know about is the one thing that cannot be overruled by order.

   The palette is the landing page's, unchanged: near-black surfaces, white as
   the signal, grey for everything mechanical.
   =========================================================================== */

:root {
  --dk-sub: #050505;
  --dk-panel: #0c0c0c;
  --dk-panel-2: #141414;
  --dk-fg: #ffffff;
  --dk-dim: #a1a1a1;
  --dk-faint: #6b6b6b;
  --dk-line: #1f1f1f;
  --dk-line-hot: #2e2e2e;

  --dk-macro: 'Chivo', 'Neue Haas Grotesk', 'Helvetica Neue', Arial, sans-serif;
  --dk-body: 'Geist', 'Inter', ui-sans-serif, system-ui, sans-serif;
  --dk-mono: 'Geist Mono', 'JetBrains Mono', ui-monospace, Menlo, monospace;
}

/* Ninety degrees, everywhere. */
*,
*::before,
*::after {
  border-radius: 0 !important;
  box-shadow: none !important;
}

html, body {
  background: var(--dk-sub);
  color: var(--dk-fg);
  font-family: var(--dk-body);
}

::selection { background: var(--dk-fg); color: var(--dk-sub); }

:focus-visible {
  outline: 2px solid var(--dk-fg);
  outline-offset: 2px;
}

/* --- the shell ---------------------------------------------------------- */

.docs { background: var(--dk-sub); }

.docs-toc {
  background: var(--dk-sub);
  border-right: 1px solid var(--dk-line);
}

.docs-brand {
  border-bottom: 1px solid var(--dk-line);
  padding-bottom: 14px;
  margin-bottom: 14px;
  color: var(--dk-fg);
}

.brand-tag {
  font-family: var(--dk-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dk-faint);
}

.toc-group-label {
  font-family: var(--dk-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dk-faint);
}

/* A section you are reading is marked by a rule down its leading edge, the
   same way the console marks the page you are on. */
.toc-link {
  display: block;
  padding: 6px 12px;
  border-left: 2px solid transparent;
  font-family: var(--dk-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--dk-dim);
  transition: color 90ms cubic-bezier(0.2, 0, 0, 1),
              background 90ms cubic-bezier(0.2, 0, 0, 1),
              border-color 90ms cubic-bezier(0.2, 0, 0, 1);
}
.toc-link:hover {
  background: var(--dk-panel-2);
  color: var(--dk-fg);
}
.toc-link.is-active,
.toc-link[aria-current] {
  border-left-color: var(--dk-fg);
  background: var(--dk-panel-2);
  color: var(--dk-fg);
}

.docs-topbar {
  background: var(--dk-sub);
  border-bottom: 1px solid var(--dk-line);
  backdrop-filter: none;
}

.docs-menu-btn {
  border: 1px solid var(--dk-line-hot);
  background: var(--dk-panel);
  color: var(--dk-fg);
}

/* --- type --------------------------------------------------------------- */

.docs-hero h1,
.docs-main h1 {
  font-family: var(--dk-macro);
  font-weight: 900;
  font-size: clamp(2.4rem, 1.7rem + 3vw, 4.6rem);
  line-height: 0.88;
  letter-spacing: -0.045em;
  text-transform: uppercase;
}

.docs-hero h1,
.docs-main h1,
.docs-main h2,
.docs-section h2,
.docs-main h3,
.docs-section h3 {
  color: var(--dk-fg);
}

.docs-main h2,
.docs-section h2 {
  font-family: var(--dk-macro);
  font-weight: 900;
  font-size: clamp(1.6rem, 1.25rem + 1.5vw, 2.4rem);
  line-height: 0.95;
  letter-spacing: -0.038em;
  text-transform: uppercase;
  margin-top: 0;
}

.docs-main h3,
.docs-section h3 {
  font-family: var(--dk-macro);
  font-weight: 900;
  font-size: 1.12rem;
  letter-spacing: -0.022em;
  text-transform: uppercase;
}

.docs-main h4,
.docs-section h4 {
  font-family: var(--dk-mono);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dk-dim);
}

.docs-body,
.docs-main p,
.docs-main li {
  color: var(--dk-dim);
  line-height: 1.62;
}

.docs-main a { color: var(--dk-fg); text-decoration: underline; text-underline-offset: 3px; }
.docs-main strong { color: var(--dk-fg); font-weight: 500; }

/* Every section is a compartment, divided by a rule rather than by space. */
.docs-section {
  border-top: 1px solid var(--dk-line);
  padding-top: clamp(2rem, 1.4rem + 2vw, 3rem);
}
.docs-section:first-of-type { border-top: 0; }

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

.code-tabs,
.code-pane,
.endpoint,
.callout,
.sdk-card {
  border: 1px solid var(--dk-line);
  background: var(--dk-panel);
}

.code-tabbar {
  border-bottom: 1px solid var(--dk-line);
  background: var(--dk-sub);
}

.code-tab {
  border: 0;
  border-right: 1px solid var(--dk-line);
  background: transparent;
  padding: 8px 14px;
  font-family: var(--dk-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dk-faint);
}
.code-tab:hover { background: var(--dk-panel-2); color: var(--dk-fg); }
.code-tab.is-active,
.code-tab[aria-selected='true'] {
  background: var(--dk-panel-2);
  color: var(--dk-fg);
}

.code-pane pre,
.code-pane code {
  font-family: var(--dk-mono);
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--dk-fg);
}

.code-copy {
  border: 1px solid var(--dk-line-hot);
  background: var(--dk-sub);
  font-family: var(--dk-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dk-dim);
}
.code-copy:hover { border-color: var(--dk-fg); color: var(--dk-fg); }

/* An endpoint is a specification, so it is typed rather than written. */
.endpoint {
  font-family: var(--dk-mono);
  font-size: 12px;
  letter-spacing: 0.03em;
  padding: 10px 14px;
}

/* A callout is a compartment with a heavier rule down its leading edge —
   emphasis by structure, since there is no tint to reach for. */
.callout {
  border-left: 2px solid var(--dk-fg);
  padding: 14px 16px;
}

.sdk-grid { gap: 0; }
.sdk-card {
  /* The cards collapse their shared borders the way every other grid in the
     system does: one pixel between neighbours, and a frame that closes even
     when the last row is short. */
  margin: 0 -1px -1px 0;
  padding: 16px;
}
.sdk-card h3 { margin-bottom: 6px; }

.sdk-cmd {
  border: 1px solid var(--dk-line-hot);
  background: var(--dk-sub);
  font-family: var(--dk-mono);
  font-size: 11.5px;
  letter-spacing: 0.02em;
  color: var(--dk-dim);
  padding: 8px 12px;
}

/* --- tables ------------------------------------------------------------- */

.docs-main table {
  border-collapse: collapse;
  width: 100%;
  border: 1px solid var(--dk-line);
}
.docs-main th,
.docs-main td {
  border: 1px solid var(--dk-line);
  padding: 9px 12px;
  text-align: left;
  font-size: 12.5px;
}
.docs-main th {
  background: var(--dk-panel);
  font-family: var(--dk-mono);
  font-weight: 400;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dk-faint);
}
.docs-main td { background: var(--dk-panel-2); color: var(--dk-dim); }

/* --- the CRT substrate, as on every other surface ----------------------- */

body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.022) 0px,
    rgba(255, 255, 255, 0.022) 1px,
    transparent 1px,
    transparent 3px
  );
}
