/* ============================================================================
   The docs. On top of ../site.css, so the header, footer, colours and type are
   the site's own; this adds the three columns and the reading styles. Built
   for reading, not selling: narrower measure, calmer headings, no gradients
   past the top of the page.
   ========================================================================== */

.docs-body { background: var(--bg); }
.docs-body::before {
  content: ""; position: fixed; inset: 0 0 auto 0; height: 520px; z-index: -1; pointer-events: none;
  background: radial-gradient(900px 420px at 12% -20%, rgba(var(--brand-rgb),.12), transparent 65%);
}

.docs-body .top, .docs-body footer { max-width: 1240px; }

.docs-home {
  color: var(--ink-2); text-decoration: none;
  font: 500 14.5px/1 var(--font);
  padding-left: 14px; border-left: 1px solid var(--line);
}
.docs-home:hover { color: var(--ink); }

.docs {
  max-width: 1240px; margin: 0 auto;
  display: grid; gap: 48px;
  grid-template-columns: 210px minmax(0, 1fr) 190px;
  align-items: start;
  padding-block: 8px 72px;
}

/* ---- Sidebar --------------------------------------------------------------- */

.docs-nav { position: sticky; top: 20px; max-height: calc(100vh - 40px); overflow-y: auto; }
.docs-nav summary { display: none; }
.nav-group {
  margin: 22px 0 8px; font: 600 11px/1 var(--font);
  letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3);
}
.docs-nav .nav-group:first-of-type { margin-top: 4px; }
.docs-nav ul, .doc-toc ul { list-style: none; margin: 0; padding: 0; }
.docs-nav a {
  display: block; padding: 6px 10px; margin-left: -10px; border-radius: 8px;
  color: var(--ink-2); text-decoration: none; font-size: 14.5px; line-height: 1.35;
}
.docs-nav a:hover { color: var(--ink); background: rgba(255,255,255,.04); }
.docs-nav a[aria-current="page"] { color: var(--ink); background: rgba(var(--brand-rgb),.14); font-weight: 550; }

/* ---- On this page ----------------------------------------------------------- */

.doc-toc { position: sticky; top: 20px; }
.doc-toc .nav-group { margin-top: 4px; }
.doc-toc a {
  display: block; padding: 4px 0 4px 12px; border-left: 1.5px solid var(--line);
  color: var(--ink-3); text-decoration: none; font-size: 13px; line-height: 1.4;
}
.doc-toc a:hover { color: var(--ink); }
.doc-toc a.on { color: var(--ink); border-left-color: var(--brand); }

/* ---- The page ------------------------------------------------------------------ */

.doc { max-width: 720px; min-width: 0; color: #C3CAD3; font-size: 16px; line-height: 1.7; }

.doc h1 {
  font-size: clamp(30px, 4vw, 40px); font-weight: 640; max-width: none;
  margin: 6px 0 14px;
}
.doc h1 + p { font-size: 18px; color: var(--ink-2); line-height: 1.6; }

.doc h2, .doc h3 { color: var(--ink); position: relative; scroll-margin-top: 24px; }
.doc h2 {
  font-size: 23px; font-weight: 620; letter-spacing: -.02em; line-height: 1.25;
  margin: 48px 0 12px; padding-top: 30px; border-top: 1px solid var(--line);
}
.doc h3 { font-size: 17.5px; font-weight: 600; letter-spacing: -.01em; margin: 34px 0 8px; line-height: 1.35; }

.anchor {
  margin-left: 8px; color: var(--ink-3); text-decoration: none; font-weight: 400;
  opacity: 0; transition: opacity .15s;
}
.doc h2:hover .anchor, .doc h3:hover .anchor, .anchor:focus { opacity: 1; }

/* A numbered step: the number in a ring, the way the home page counts. */
.doc h3.step { display: flex; align-items: center; gap: 12px; margin-top: 40px; }
.doc h3.step span {
  flex: none; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  font: 600 13px/1 var(--font); color: var(--ink);
  background: rgba(var(--brand-rgb),.16); box-shadow: inset 0 0 0 1.5px rgba(var(--brand-rgb),.45);
}

.doc p { margin: 12px 0; }
.doc ul, .doc ol { margin: 12px 0; padding-left: 22px; }
.doc li { margin: 6px 0; padding-left: 2px; }
.doc li::marker { color: var(--ink-3); }
.doc strong { color: var(--ink); font-weight: 600; }
.doc em { color: var(--ink); }
.doc a { color: var(--soft); text-decoration: underline; text-decoration-color: rgba(155,123,255,.35); text-underline-offset: 3px; }
.doc a:hover { text-decoration-color: var(--soft); }
.doc hr { border: 0; border-top: 1px solid var(--line); margin: 36px 0; }

.doc code {
  font: 400 .88em/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #E4E7EC; background: rgba(255,255,255,.07);
  padding: 2px 6px; border-radius: 6px;
  overflow-wrap: anywhere;
}

kbd {
  display: inline-block; min-width: 1.6em; text-align: center;
  font: 500 12.5px/1 var(--font); color: var(--ink);
  padding: 4px 6px; border-radius: 6px;
  background: var(--panel); box-shadow: inset 0 0 0 1px var(--line), 0 1.5px 0 var(--line);
}

/* ---- Code --------------------------------------------------------------------- */

.code {
  position: relative; margin: 16px 0;
  background: #0A0D11; border: 1.5px solid var(--line); border-radius: 12px;
}
.code pre {
  margin: 0; padding: 16px 18px; overflow-x: auto;
  font: 400 13.5px/1.65 ui-monospace, SFMono-Regular, Menlo, monospace; color: #D2D8E1;
}
.code pre code { background: none; padding: 0; font: inherit; color: inherit; overflow-wrap: normal; }
.code-lang {
  position: absolute; top: 9px; right: 66px;
  font: 500 11px/1 var(--font); color: var(--ink-3); letter-spacing: .04em; text-transform: uppercase;
}
.copy {
  position: absolute; top: 6px; right: 6px;
  font: 500 12px/1 var(--font); color: var(--ink-2);
  background: var(--panel); border: 1px solid var(--line); border-radius: 7px;
  padding: 6px 9px; cursor: pointer; opacity: 0; transition: opacity .15s;
}
.code:hover .copy, .copy:focus-visible, .copy.done { opacity: 1; }
.copy:hover { color: var(--ink); }
.copy.done { color: var(--ok); }
@media (hover: none) { .copy { opacity: 1; } .code-lang { display: none; } }

/* ---- Tables -------------------------------------------------------------------- */

.table { margin: 16px 0; overflow-x: auto; border: 1.5px solid var(--line); border-radius: 12px; }
.table table { width: 100%; border-collapse: collapse; font-size: 14.5px; line-height: 1.55; }
.table th {
  text-align: left; color: var(--ink); font-weight: 600; font-size: 13px;
  background: var(--panel); padding: 10px 14px; border-bottom: 1px solid var(--line);
}
.table td { padding: 10px 14px; border-top: 1px solid var(--line); vertical-align: top; }
.table tr:first-child td { border-top: 0; }
.table td:first-child { white-space: nowrap; color: var(--ink); }
.table td code { white-space: nowrap; }
.table td:not(:first-child) code { white-space: normal; }

/* ---- Callouts ------------------------------------------------------------------ */

.callout {
  margin: 18px 0; padding: 12px 16px; border-radius: 12px;
  background: rgba(var(--brand-rgb),.08); box-shadow: inset 3px 0 0 var(--brand);
  font-size: 15px;
}
.callout p { margin: 4px 0; }
.callout-word { display: block; font: 600 12px/1.4 var(--font); letter-spacing: .05em; text-transform: uppercase; color: var(--soft); }
.callout.tip { background: rgba(52,200,138,.07); box-shadow: inset 3px 0 0 var(--ok); }
.callout.tip .callout-word { color: var(--ok); }
.callout.warn { background: rgba(245,176,65,.08); box-shadow: inset 3px 0 0 #F5B041; }
.callout.warn .callout-word { color: #F5B041; }

.doc-toc li.sub a { padding-left: 24px; font-size: 12.5px; }

/* ---- How the pieces connect: boxes and arrows, not ASCII ------------------- */

.flow {
  display: flex; align-items: stretch; gap: 8px; margin: 18px 0;
}
.flow > div {
  flex: 1; min-width: 0; padding: 12px 12px; border-radius: 12px;
  background: var(--panel); border: 1.5px solid var(--line);
}
.flow strong { display: block; color: var(--ink); font-size: 14.5px; line-height: 1.3; }
.flow span { display: block; margin-top: 2px; color: var(--ink-3); font-size: 12.5px; line-height: 1.4; }
.flow > i { align-self: center; font-style: normal; color: var(--soft); font-size: 16px; }
@media (max-width: 780px) {
  .flow { flex-direction: column; }
  .flow > i { transform: rotate(90deg); padding: 0 0 0 16px; align-self: flex-start; line-height: 1; }
}

/* ---- Where to go ------------------------------------------------------------------ */

.paths { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 26px 0 8px; }
.paths.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.doc .paths a {
  display: block; padding: 16px 18px; border-radius: 14px; text-decoration: none;
  background: var(--panel); border: 1.5px solid var(--line);
  transition: border-color .15s, transform .15s;
}
.doc .paths a:hover { border-color: rgba(var(--brand-rgb),.55); transform: translateY(-1px); }
.paths strong { display: block; color: var(--ink); font-size: 15.5px; }
.paths span { display: block; margin-top: 3px; color: var(--ink-2); font-size: 14px; line-height: 1.45; }

/* ---- Next and previous -------------------------------------------------------------- */

.pager { display: flex; gap: 12px; margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--line); }
.doc .pager a {
  flex: 1; display: block; padding: 14px 16px; border-radius: 12px; text-decoration: none;
  border: 1.5px solid var(--line); color: var(--ink); font-weight: 550;
}
.doc .pager a:hover { border-color: rgba(var(--brand-rgb),.55); }
.pager span { display: block; color: var(--ink-3); font-size: 12.5px; font-weight: 400; }
.pager .next { text-align: right; margin-left: auto; }

/* ---- Narrower ------------------------------------------------------------------ */

@media (max-width: 1100px) {
  .docs { grid-template-columns: 200px minmax(0, 1fr); gap: 40px; }
  .doc-toc { display: none; }
}

@media (max-width: 780px) {
  .docs { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .docs-nav { position: static; max-height: none; }
  .docs-nav details { border: 1.5px solid var(--line); border-radius: 12px; background: var(--panel); }
  .docs-nav summary {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 14px; cursor: pointer; list-style: none;
    color: var(--ink); font-weight: 550; font-size: 15px;
  }
  .docs-nav summary::-webkit-details-marker { display: none; }
  .docs-nav summary::after { content: "▾"; color: var(--ink-3); }
  .docs-nav details[open] summary::after { content: "▴"; }
  .docs-nav details > p, .docs-nav details > ul { padding-inline: 14px; }
  .docs-nav details > ul:last-child { padding-bottom: 12px; }
  .doc { margin-top: 18px; }
  .paths, .paths.three { grid-template-columns: minmax(0, 1fr); }
  .table td:first-child { white-space: normal; }
  .top .ghost { display: none; }
  .docs-home { margin-right: auto; }
}
