/* ── docs chrome ──────────────────────────────────────────────────────────
   Loaded AFTER app.css, which supplies the tokens, the type scale, the buttons
   and the code cards. What it does NOT supply here is layout: the landing page
   is a marketing sheet (an announcement banner, a floating pill nav, a rounded
   card, a three-column footer) and documentation is not that. Docs get their
   own full-bleed chrome (header, sidebar to the viewport edge, no footer beyond
   a rule), and inherit only the design system. Same palette, different room. */

/* One container width shared by the header and the three-column shell, so on a
   wide screen the whole page reads as one centred block: the logo sits exactly
   above the sidebar's left edge rather than drifting away from it. */
:root { --doc-max: 1440px; }

body { background: var(--sheet); }
body.no-scroll { overflow: hidden; }

/* ── header ───────────────────────────────────────────────────────────── */

.dnav {
  position: sticky; top: 0; z-index: 60;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(14px) saturate(1.6);
  border-bottom: 1px solid var(--line);
}
.dnav-in {
  display: flex; align-items: center; gap: 11px;
  height: 56px; padding: 0 22px;
  max-width: var(--doc-max); margin-inline: auto;
}
.dnav-brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 16px; font-weight: 700; letter-spacing: -.026em; color: var(--ink);
}
.dnav-brand svg { width: 20px; height: 20px; }
.dnav-tag {
  font-size: 13px; font-weight: 500; color: var(--muted);
  padding: 3px 8px; border: 1px solid var(--line); border-radius: 999px;
}
.dnav-tag:hover { color: var(--ink); border-color: var(--line-2); }

.dnav-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.dnav-links { display: flex; align-items: center; gap: 16px; }
.dnav-links a { font-size: 13.5px; color: var(--ink-2); }
.dnav-links a:hover { color: var(--ink); }

/* ── shell ────────────────────────────────────────────────────────────── */

.docs-shell {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr) 236px;
  align-items: start;
  max-width: var(--doc-max); margin-inline: auto;
}

/* ── sidebar ──────────────────────────────────────────────────────────── */

.docs-side {
  position: sticky;
  top: 56px;
  max-height: calc(100vh - 56px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 26px 22px 56px 30px;
  border-right: 1px solid var(--line);
  scrollbar-width: thin;
}
.docs-side::-webkit-scrollbar { width: 8px; }
.docs-side::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 99px; border: 2px solid var(--sheet); }

.ds-group + .ds-group { margin-top: 22px; }
.ds-group h4 {
  font-size: 12.5px; font-weight: 600; letter-spacing: -.005em;
  color: var(--faint); margin-bottom: 6px;
}
.ds-group a {
  display: block; padding: 6px 10px; margin-left: -10px;
  border-radius: var(--r-btn);
  font-size: 13.5px; line-height: 1.45; color: var(--ink-2);
  transition: background .12s, color .12s;
}
.ds-group a:hover { background: var(--accent-soft); color: var(--ink); }
.ds-group a.on { background: var(--ink); color: #fff; font-weight: 500; }

.ds-home > a { display: flex; align-items: center; gap: 9px; font-weight: 500; color: var(--ink); }
.ds-home svg { width: 16px; height: 16px; color: var(--faint); }
.ds-home a.on svg, .ds-home a:hover svg { color: inherit; }

.ds-close { display: none; }

/* ── the article ──────────────────────────────────────────────────────── */

.docs-main {
  min-width: 0;
  margin-inline: auto;
  padding: 44px 56px 80px;
}
.dm-top { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.dm-crumb {
  font-size: 13px; font-weight: 600; letter-spacing: -.01em;
  color: var(--brand-soba);
}
.dm-src { font-size: 12.5px; color: var(--muted); }
.dm-src:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

.dm-h1 {
  /* app.css centres h1 inside 20ch for the landing hero; a docs title is neither */
  max-width: none; margin-inline: 0;
  margin-top: 12px;
  font-size: clamp(30px, 3.4vw, 40px); line-height: 1.1; letter-spacing: -.034em;
}
.dm-lede {
  margin-top: 14px; max-width: 66ch;
  font-size: 16.5px; line-height: 1.62; color: var(--muted);
}
.dm-lede + .prose { margin-top: 34px; }

/* ── prose ────────────────────────────────────────────────────────────── */

.prose { max-width: 74ch; font-size: 15.5px; line-height: 1.7; color: var(--ink-2); }
.prose > * + * { margin-top: 18px; }

.prose .dh { scroll-margin-top: 84px; position: relative; color: var(--ink); }
.prose .dh2 { margin-top: 48px; font-size: 27px; letter-spacing: -.03em; padding-top: 28px; border-top: 1px solid var(--line); }
.prose .dh3 { margin-top: 34px; font-size: 18px; letter-spacing: -.022em; }
.prose .dh4 { margin-top: 28px; font-size: 15px; }
.prose .dh2:first-child { border-top: 0; padding-top: 0; margin-top: 0; }

/* Trailing, not in the gutter. An absolutely positioned anchor has to guess the
   text's vertical centre, which .dh2's 26px of padding-top breaks, and a negative
   left offset collides with the article's own padding on a narrow screen. Inline
   after the text, neither can happen. */
.dh-a {
  margin-left: 9px;
  color: var(--line-2); font-weight: 400; opacity: 0;
  transition: opacity .12s, color .12s;
}
.dh:hover .dh-a,
.dh-a:focus-visible { opacity: 1; }
.dh-a:hover { color: var(--brand-soba); }

.prose strong { color: var(--ink); font-weight: 600; }
.prose a {
  color: var(--ink); font-weight: 500;
  box-shadow: inset 0 -1px 0 var(--line-2);
  transition: box-shadow .12s;
}
.prose a:hover { box-shadow: inset 0 -1px 0 var(--ink); }

.prose ul, .prose ol { margin-left: 0; padding-left: 20px; }
.prose li + li { margin-top: 7px; }
.prose li::marker { color: var(--faint); }
.prose ul { list-style: none; padding-left: 18px; }
.prose ul > li { position: relative; }
.prose ul > li::before {
  content: ""; position: absolute; left: -14px; top: .62em;
  width: 4px; height: 4px; border-radius: 99px; background: var(--line-2);
}

.prose :not(pre) > code {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: .86em;
  background: var(--accent-soft);
  border-radius: 4px;
  padding: .12em .38em;
  color: var(--ink);
  overflow-wrap: break-word;
}

.prose blockquote {
  /* Same trap the diagrams fell into: `margin: 0` beats `.prose > * + *`, and a
     cited block set at sentence rhythm reads as part of the sentence before it.
     A quotation is someone else speaking, so it stands clear on both sides. */
  margin: 26px 0 28px; padding: 12px 17px 12px 18px;
  border-left: 2px solid var(--brand-husk);
  border-radius: 0 var(--r-btn) var(--r-btn) 0;
  background: var(--brand-ground);
  color: var(--ink-2);
}
/* A pull quote is the argument's pivot, not a source. The plain blockquote stays
   a small grey citation, which is what the provider-terms quotation needs. */
.prose blockquote.pull {
  /* Marked as an object, not as larger text. The rule and the indent are what say
     "this is a quote"; without them, anything above body size reads as a heading.
     No max-width: the line fits the column, and forcing a wrap made a ragged block
     that lined up with nothing. It hugs the paragraph it concludes. */
  margin: 18px 0 34px;
  padding: 3px 0 3px 18px;
  border-left: 2px solid var(--ink);
  background: none; border-radius: 0;
  color: var(--ink);
  font-size: 19px; line-height: 1.45;
  font-weight: 600; letter-spacing: -.016em;
}
.prose blockquote.pull p { margin: 0; }
.prose blockquote.pull cite {
  display: block; margin-top: 10px;
  font-size: 12.5px; font-weight: 500; font-style: normal;
  letter-spacing: 0; color: var(--faint);
}

/* ── step rail ────────────────────────────────────────────────────────────
   The same shape the dashboard's own setup page uses, so the docs quickstart
   and the product onboarding read as one thing. */
.steps { position: relative; padding-left: 30px; margin-top: 26px; }
/* .prose > * + * only reaches direct children, and the wrapper is now the child,
   so the rhythm has to be restated for what lives inside it. */
.steps > * + * { margin-top: 18px; }
.steps::before {
  content: ""; position: absolute; left: 4px; top: 9px; bottom: 6px;
  width: 1px; background: var(--line);
}
.steps > .dh2 {
  border-top: 0; padding-top: 0; margin-top: 40px;
  font-size: 20px; letter-spacing: -.024em;
}
.steps > .dh2:first-child { margin-top: 0; }
.steps > .dh2::before {
  content: ""; position: absolute; left: -30px; top: .42em;
  width: 9px; height: 9px; border-radius: 999px;
  background: var(--sheet); border: 1.5px solid var(--line-2);
}
.steps > .dh2:first-child::before,
.steps > .dh2:hover::before { border-color: var(--brand-soba); }

.prose hr { border: 0; border-top: 1px solid var(--line); margin: 34px 0; }

/* code cards come from app.css; docs only widen the type a little and give the
   copy button a home, since the landing page's cards are decorative and these
   are meant to be used */
.prose .codecard { margin-top: 20px; }
.prose .codecard pre { font-size: 13px; padding: 15px 16px; }
.codebar .copy {
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  border-radius: 5px; padding: 3px 9px; font: inherit; font-size: 11.5px; font-weight: 500;
  cursor: pointer; transition: color .12s, border-color .12s, background .12s;
}
.codebar .copy:hover { color: var(--ink); border-color: var(--line-2); }
.codebar .copy.ok { color: var(--green); border-color: var(--green); }
.codebar-bare { justify-content: flex-end; }
.at { color: #7a3fa8; }

/* diagrams — hand-written SVG that takes its palette and its type from here, so
   a token change moves the drawing with everything else */
/* Below the breakpoint the labels would shrink past reading size, so the figure
   scrolls in place instead — the same bargain the tables make. */
/* A drawing is not a paragraph: at the prose rhythm of 18px it reads as one,
   crowded against the heading above and the sentence below. It gets its own
   air, a little more beneath so the caption is not mistaken for body text. */
.dgm { margin: 32px 0 38px; overflow-x: auto; clear: both; }
/* Small enough to sit beside the paragraph it illustrates rather than
   interrupting it, which is also the only way a card reads as a component of a
   page rather than as a figure about one. */
.dgm-side { float: right; clear: none; width: 306px; margin: 14px 0 20px 26px; }
.dgm.dgm-side svg { min-width: 0; }
.dgm-side figcaption { margin-top: 10px; }
.dgm svg { display: block; width: 100%; min-width: 620px; height: auto; }
.dgm .b { fill: #fff; stroke: var(--line); }
.dgm .bt { fill: var(--brand-ground); stroke: var(--brand-husk); }
/* an outcome that never arrives: the box is drawn, but nothing fills it in.
   Named `dim` to match `.s.dim`, and NOT `ghost` — app.css carries an
   unscoped `.ghost` (a blurred backdrop card) that this would inherit. */
.dgm .b.dim { stroke: var(--line-2); stroke-dasharray: 4 4; }
.dgm .t.dim { fill: var(--faint); }
.dgm text { font-family: "Inter", ui-sans-serif, system-ui, sans-serif; }
.dgm .t { fill: var(--ink); font-size: 13.5px; font-weight: 600; letter-spacing: -.018em; }
.dgm .r { fill: var(--ink-2); font-size: 12.5px; letter-spacing: -.008em; }
.dgm .s { fill: var(--muted); font-size: 11.5px; }
.dgm .s.dim { fill: var(--faint); }
.dgm .ac { fill: var(--brand-soba); font-size: 11.5px; font-weight: 600; }
.dgm .lab { fill: var(--faint); font-size: 11px; font-weight: 500; text-anchor: middle; }
.dgm .code { font-family: "JetBrains Mono", ui-monospace, monospace; }
.dgm .lab.code { font-size: 10.5px; }
.dgm .s.code { font-size: 10.5px; }
/* the set operator between two boxes: quieter than a label, louder than a rule */
.dgm .op { fill: var(--muted); font-size: 15px; font-weight: 600; }
.dgm .l { fill: none; stroke: var(--line-2); stroke-width: 1.4; }
.dgm .l.dash { stroke-dasharray: 4 4; }
.dgm .ah { fill: var(--line-2); }
.dgm .acx { fill: var(--faint); font-size: 11.5px; font-weight: 600; }
.dgm .amt { fill: var(--ink); font-size: 19px; font-weight: 600; letter-spacing: -.02em; }
/* a quantity drawn rather than named: the track is what could have been, the
   fill is what the money actually bought */
.dgm .bar-t { fill: #f2f2f4; }
.dgm .bar-a { fill: var(--brand-husk); }
.dgm .bar-b { fill: var(--line-2); }
.dgm figcaption { margin-top: 14px; font-size: 12.5px; line-height: 1.55; color: var(--faint); }

/* tables */
.tw { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-card); }
.prose table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.prose th, .prose td { text-align: left; padding: 10px 14px; vertical-align: top; border-bottom: 1px solid var(--line); }
.prose thead th {
  background: #fbfbfc; color: var(--muted); font-weight: 600;
  font-size: 12.5px; letter-spacing: -.005em;
  white-space: nowrap;
}
.prose tbody tr:last-child td { border-bottom: 0; }
.prose td code { white-space: nowrap; }

/* callouts */
.cal {
  border: 1px solid var(--line); border-left: 2px solid var(--line-2);
  border-radius: var(--r-btn); background: #fcfcfd; padding: 14px 16px;
}
.cal-t {
  font-size: 13px; font-weight: 600; letter-spacing: -.01em;
  color: var(--muted); margin-bottom: 5px;
}
.cal-b { font-size: 14.5px; }
.cal-b > * + * { margin-top: 10px; }
.cal-b .codecard { margin-top: 12px; }
.cal-note   { border-left-color: var(--brand-soba); }
.cal-note   .cal-t { color: var(--brand-soba); }
.cal-tip    { border-left-color: var(--green); }
.cal-tip    .cal-t { color: var(--green); }
.cal-warn   { border-left-color: var(--amber); background: #fffdf8; }
.cal-warn   .cal-t { color: var(--amber); }
.cal-danger { border-left-color: var(--ink); background: #fbfbfc; }
.cal-danger .cal-t { color: var(--ink); }

/* ── pager ────────────────────────────────────────────────────────────── */

.docs-pager {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
  margin-top: 56px; padding-top: 26px; border-top: 1px solid var(--line);
}
.pg {
  display: flex; flex-direction: column; gap: 3px;
  border: 1px solid var(--line); border-radius: var(--r-card);
  padding: 13px 16px; background: #fff;
  transition: border-color .12s, box-shadow .12s;
}
.pg:hover { border-color: var(--line-2); box-shadow: var(--shadow-card); }
.pg span { font-size: 11.5px; color: var(--faint); }
.pg b { font-size: 14px; font-weight: 600; color: var(--ink); letter-spacing: -.015em; }
.pg-next { text-align: right; }

.dfoot {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line);
  font-size: 11.5px; color: var(--faint);
}
.dfoot .mono { font-size: 11px; }

/* ── on this page ─────────────────────────────────────────────────────── */

.docs-toc {
  position: sticky; top: 56px;
  max-height: calc(100vh - 56px); overflow-y: auto;
  padding: 46px 24px 56px 4px;
}
.dt-inner h4 {
  font-size: 12.5px; font-weight: 600; letter-spacing: -.005em;
  color: var(--faint); margin-bottom: 8px;
}
.tl {
  display: block; padding: 4px 0 4px 12px;
  border-left: 1.5px solid var(--line);
  font-size: 12.5px; line-height: 1.5; color: var(--muted);
  transition: color .12s, border-color .12s;
}
.tl3 { padding-left: 24px; }
.tl:hover { color: var(--ink); }
.tl.on { color: var(--ink); border-left-color: var(--ink); font-weight: 500; }

/* ── search ───────────────────────────────────────────────────────────── */

.searchbtn {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  border-radius: var(--r-btn); padding: 5px 8px 5px 10px;
  font: inherit; font-size: 13px; cursor: pointer;
  transition: border-color .12s, color .12s;
}
.searchbtn:hover { border-color: var(--line-2); color: var(--ink); }
.searchbtn kbd {
  font-family: inherit; font-size: 11px; color: var(--faint);
  border: 1px solid var(--line); border-radius: 4px; padding: 1px 4px; background: #fbfbfc;
}

.pal { position: fixed; inset: 0; z-index: 200; }
.pal[hidden] { display: none; }
.pal-scrim { position: absolute; inset: 0; background: rgba(19, 19, 22, .34); backdrop-filter: blur(2px); }
.pal-box {
  position: relative; margin: 11vh auto 0; max-width: 592px;
  background: var(--sheet); border: 1px solid var(--line-2);
  border-radius: var(--r-card); box-shadow: var(--shadow-pop); overflow: hidden;
}
.pal-in { display: flex; align-items: center; gap: 10px; padding: 13px 15px; border-bottom: 1px solid var(--line); color: var(--faint); }
.pal-in input {
  flex: 1; border: 0; outline: 0; background: none;
  font: inherit; font-size: 15px; color: var(--ink);
}
.pal-in input::placeholder { color: var(--faint); }
.pal-in kbd {
  font-family: inherit; font-size: 11px; color: var(--faint);
  border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px;
}
.pal-res { max-height: 58vh; overflow-y: auto; padding: 7px; }
.pal-r {
  display: block; padding: 9px 11px; border-radius: var(--r-btn);
  border: 1px solid transparent;
}
.pal-r.on { background: var(--accent-soft); border-color: var(--line); }
.pal-sec { display: block; font-size: 12px; font-weight: 600; letter-spacing: -.005em; color: var(--brand-soba); }
.pal-t { display: block; font-size: 14px; font-weight: 600; color: var(--ink); letter-spacing: -.015em; margin-top: 2px; }
.pal-s { display: block; font-size: 12.5px; line-height: 1.5; color: var(--muted); margin-top: 2px; }
.pal-empty { padding: 22px; text-align: center; font-size: 13.5px; color: var(--faint); }

/* ── responsive ───────────────────────────────────────────────────────── */

.ds-open { display: none; }

@media (max-width: 1180px) {
  .docs-shell { grid-template-columns: 250px minmax(0, 1fr); }
  .docs-toc { display: none; }
  .docs-main { padding: 40px 44px 76px; }
}

@media (max-width: 1000px) {
  .searchbtn span, .searchbtn kbd { display: none; }
  .dnav-links a[href="/changelog"] { display: none; }
}

@media (max-width: 860px) {
  .docs-shell { grid-template-columns: minmax(0, 1fr); }
  .docs-main { padding: 30px 22px 84px; }
  .dgm-side { float: none; width: 100%; margin: 26px 0 30px; }
  .prose { font-size: 15px; }

  .dnav-in { padding: 0 16px; gap: 9px; }
  .dnav-tag { display: none; }

  .docs-side {
    position: fixed; inset: 0 auto 0 0; z-index: 150;
    width: min(300px, 84vw); max-height: none;
    background: var(--sheet); border-right: 1px solid var(--line-2);
    box-shadow: var(--shadow-pop);
    transform: translateX(-102%); transition: transform .2s ease;
    padding-top: 26px;
  }
  .docs-side.is-open { transform: none; }
  .ds-close {
    display: block; position: absolute; top: 12px; right: 14px;
    border: 0; background: none; font-size: 22px; line-height: 1;
    color: var(--muted); cursor: pointer;
  }
  .ds-open {
    display: inline-flex; align-items: center; gap: 7px;
    position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 140;
    background: var(--ink); color: #fff; border: 0; border-radius: 99px;
    padding: 10px 17px; font: inherit; font-size: 13px; font-weight: 500;
    box-shadow: var(--shadow-pop); cursor: pointer;
  }
  .docs-pager { grid-template-columns: minmax(0, 1fr); }
  .pg-next { text-align: left; }
}
