/* ============================================================
   DOCS  (/docs/*) — Linear-docs-style layout: full-height
   sidebar rail, centered article, on-this-page rail.
   Loads after global.css and reuses its tokens.
   ============================================================ */
:root {
  --mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
  --docs-nav-h: 64px;
  --docs-ink: #b9bfc8;      /* body copy — between --ink-2 and --ink-3 */
}

.docs-shell {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  padding-top: var(--docs-nav-h);
  min-height: 100dvh;
}

/* ------------------------------------------------------------
   Left rail — full-height, hairline divider
   ------------------------------------------------------------ */
.docs-side { border-right: 1px solid var(--border); }
.docs-sidebar {
  position: sticky;
  top: var(--docs-nav-h);
  height: calc(100dvh - var(--docs-nav-h));
  padding: 18px 12px 14px;
  display: flex;
  flex-direction: column;
}
.docs-menu-btn { display: none; }        /* mobile only */
.docs-sidebar-panel { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.docs-sidenav { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; padding-bottom: 12px; }

/* collapsible section rows */
.docs-group { margin-bottom: 2px; }
.docs-group-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 400;
  color: var(--ink-2);
  border-radius: 8px;
  cursor: pointer;
  transition: color .14s ease, background .14s ease;
}
.docs-group-btn:hover { color: var(--ink); background: rgba(255,255,255,.04); }
.docs-group-btn svg { color: var(--ink-4); transition: transform .15s ease; }
.docs-group.is-open > .docs-group-btn svg { transform: rotate(90deg); }
.docs-group-items { display: none; padding: 2px 0 6px; }
.docs-group.is-open .docs-group-items { display: flex; flex-direction: column; gap: 1px; }

.docs-nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--ink-3);
  transition: color .14s ease, background .14s ease;
}
.docs-nav-link svg { flex-shrink: 0; opacity: .75; }
.docs-nav-link:hover { color: var(--ink); background: rgba(255,255,255,.04); }
.docs-nav-link[aria-current="page"] { color: var(--ink); background: rgba(255,255,255,.06); }
.docs-nav-link[aria-current="page"] svg { opacity: 1; }

/* pinned bottom links */
.docs-side-foot {
  flex-shrink: 0;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 1px;
}

/* ------------------------------------------------------------
   Content — centered article + toc rail
   ------------------------------------------------------------ */
.docs-content {
  display: grid;
  grid-template-columns: minmax(0, 688px) 200px;
  justify-content: center;
  align-items: start;
  gap: 72px;
  padding: 40px 48px 120px;
}
.docs-article { min-width: 0; }

.docs-crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-4);
  margin-bottom: 32px;
}
.docs-crumbs a { color: var(--ink-3); transition: color .14s ease; }
.docs-crumbs a:hover { color: var(--ink); }
.docs-crumbs span:first-child { color: var(--ink-3); }
.docs-crumbs span:last-child { color: var(--ink-2); }

.docs-title {
  font-family: var(--font);
  font-size: 38px;
  font-weight: 400;
  letter-spacing: -.02em;
  line-height: 1.15;
  color: var(--ink);
  margin-bottom: 18px;
}
.docs-lede {
  font-size: 16px;
  color: var(--docs-ink);
  line-height: 1.65;
  margin-bottom: 28px;
}

/* ---- "Copy page" widget (injected by docs.js under the lede) ---- */
.docs-actions { position: relative; display: inline-flex; align-items: stretch; margin: -6px 0 32px; }
.docs-copy-page {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border-2);
  border-right: 0;
  border-radius: 9px 0 0 9px;
  font-family: var(--font);
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
  transition: color .14s ease, background .14s ease;
}
.docs-copy-page:hover { color: var(--ink); background: var(--surface); }
.docs-copy-page svg { color: var(--ink-3); }
.docs-copy-caret {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 32px;
  background: var(--bg-elev);
  border: 1px solid var(--border-2);
  border-left-color: var(--border);
  border-radius: 0 9px 9px 0;
  color: var(--ink-3);
  cursor: pointer;
  transition: color .14s ease, background .14s ease;
}
.docs-copy-caret:hover { color: var(--ink); background: var(--surface); }
.docs-copy-caret svg { transition: transform .15s ease; }
.docs-copy-caret[aria-expanded="true"] svg { transform: rotate(180deg); }

.docs-copy-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 60;
  min-width: 280px;
  max-width: calc(100vw - 40px);
  padding: 6px;
  background: var(--bg-elev);
  border: 1px solid var(--border-2);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0,0,0,.5);
}
.docs-copy-menu[hidden] { display: none; }
.docs-copy-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 8px;
  border: 0;
  background: none;
  border-radius: 9px;
  font-family: var(--font);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background .14s ease;
}
.docs-copy-item:hover { background: rgba(255,255,255,.04); }
.docs-copy-item-ico {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(255,255,255,.06);
  border: 1px solid var(--border);
  color: var(--ink-2);
}
.docs-copy-item-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.docs-copy-item-title {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13.5px;
  font-weight: 400;
  color: var(--ink);
}
.docs-copy-item-title svg { color: var(--ink-4); }
.docs-copy-item-desc { font-size: 12.5px; color: var(--ink-3); line-height: 1.4; }

/* hero image card */
.docs-image-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  margin: 6px 0 34px;
}
.docs-image-card img { width: 100%; height: auto; display: block; }

/* ---- body typography ---- */
.docs-body h2 {
  font-size: 24px;
  font-weight: 400;
  color: var(--ink);
  letter-spacing: -.015em;
  line-height: 1.3;
  margin: 54px 0 16px;
  scroll-margin-top: calc(var(--docs-nav-h) + 32px);
}
.docs-body h3 {
  font-size: 17.5px;
  font-weight: 400;
  color: var(--ink);
  margin: 34px 0 12px;
  scroll-margin-top: calc(var(--docs-nav-h) + 32px);
}
.docs-body p {
  font-size: 16px;
  color: var(--docs-ink);
  line-height: 1.65;
  margin-bottom: 16px;
}
.docs-body ul, .docs-body ol {
  padding-left: 22px;
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.docs-body ul { list-style: disc; }
.docs-body li { font-size: 16px; color: var(--docs-ink); line-height: 1.6; }
.docs-body li::marker { color: var(--ink-4); }
.docs-body strong { color: var(--ink); font-weight: 400; }
.docs-body em { color: inherit; }
.docs-body a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: rgba(255,255,255,.3);
  text-underline-offset: 3px;
  transition: text-decoration-color .15s ease;
}
.docs-body a:hover { text-decoration-color: rgba(255,255,255,.75); }

/* inline code — wraps, so long paths/URLs can't stretch the page on mobile
   (tables and pre blocks keep nowrap and scroll in their own containers) */
.docs-body code {
  font-family: var(--mono);
  font-size: .85em;
  color: var(--ink-2);
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 6px;
  padding: 1.5px 6px;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* ---- code blocks: minimal, copy button floats on hover ---- */
.docs-code {
  position: relative;
  margin: 20px 0 26px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elev);
  overflow: hidden;
}
.docs-code-head {
  position: absolute;
  top: 7px;
  right: 7px;
  z-index: 1;
}
.docs-code-head span { display: none; }     /* language chip dropped for the Linear look */
.docs-copy {
  opacity: 0;
  border: 1px solid var(--border-2);
  background: rgba(20,21,22,.92);
  font-family: var(--font);
  font-size: 12px;
  color: var(--ink-3);
  padding: 4px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: opacity .12s ease, color .14s ease, background .14s ease;
}
.docs-code:hover .docs-copy,
.docs-copy:focus-visible { opacity: 1; }
/* no hover on touch — keep the copy button visible */
@media (hover: none) {
  .docs-copy { opacity: 1; }
}
.docs-copy:hover { color: var(--ink); background: var(--surface); }
.docs-code pre { margin: 0; padding: 14px 16px; overflow-x: auto; }
.docs-code pre code {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink-2);
  background: none;
  border: 0;
  padding: 0;
  white-space: pre;
}

/* ---- tables ---- */
.docs-table {
  margin: 20px 0 26px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow-x: auto;
}
.docs-table table { width: 100%; border-collapse: collapse; min-width: 540px; }
.docs-table th {
  text-align: left;
  font-size: 12.5px;
  font-weight: 400;
  color: var(--ink-3);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-2);
  white-space: nowrap;
}
.docs-table td {
  font-size: 13.5px;
  color: var(--docs-ink);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  line-height: 1.6;
}
.docs-table tr:last-child td { border-bottom: 0; }
.docs-table td:first-child { color: var(--ink-2); }
.docs-table code {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-2);
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 6px;
  padding: 1.5px 5px;
  white-space: nowrap;
}

/* ---- callout ---- */
.docs-note {
  display: flex;
  gap: 11px;
  margin: 20px 0 26px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255,255,255,.03);
  font-size: 14px;
  color: var(--ink-2);
  line-height: 1.6;
}
.docs-note svg { flex-shrink: 0; margin-top: 3px; color: var(--ink-3); }
.docs-note p { margin: 0; font-size: 14px; color: var(--ink-2); }
.docs-note p + p { margin-top: 8px; }

/* ---- link cards (overview) ---- */
.docs-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 22px 0 10px;
}
.docs-card,
.docs-body a.docs-card {
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elev);
  text-decoration: none;
  transition: border-color .15s ease, background .15s ease;
}
.docs-card:hover { border-color: var(--border-2); background: var(--surface); }
.docs-card-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(255,255,255,.06);
  border: 1px solid var(--border);
  color: var(--ink-2);
}
.docs-card-title { font-size: 14.5px; font-weight: 400; color: var(--ink); }
.docs-card-desc { font-size: 13.5px; color: var(--ink-3); line-height: 1.55; }

/* ---- prev / next pager ---- */
.docs-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 64px;
}
.docs-pager a {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color .15s ease, background .15s ease;
}
.docs-pager a:hover { border-color: var(--border-2); background: rgba(255,255,255,.02); }
.docs-pager a.next { grid-column: 2; text-align: right; }
.docs-pager-label { font-size: 12px; color: var(--ink-4); }
.docs-pager-title { font-size: 14px; font-weight: 400; color: var(--ink); }

/* ------------------------------------------------------------
   Right rail — on this page
   ------------------------------------------------------------ */
.docs-toc-rail { position: sticky; top: calc(var(--docs-nav-h) + 40px); }
.docs-toc-label { display: none; }
.docs-toc { display: flex; flex-direction: column; border-left: 1px solid var(--border); }
.docs-toc a {
  font-size: 13px;
  color: var(--ink-3);
  line-height: 1.5;
  padding: 5px 0 5px 16px;
  margin-left: -1px;
  border-left: 1px solid transparent;
  transition: color .14s ease, border-color .14s ease;
}
.docs-toc a:hover { color: var(--ink); }
.docs-toc a.is-sub { padding-left: 30px; }
.docs-toc a.is-active { color: var(--ink); border-left-color: var(--ink); }

/* ------------------------------------------------------------
   Responsive
   ------------------------------------------------------------ */
@media (max-width: 1200px) {
  .docs-content { grid-template-columns: minmax(0, 688px); padding: 36px 36px 100px; }
  .docs-toc-rail { display: none; }
}

@media (max-width: 900px) {
  .docs-shell { grid-template-columns: 1fr; }
  .docs-side { border-right: 0; border-bottom: 1px solid var(--border); }

  /* sidebar collapses behind a "Documentation" disclosure button */
  .docs-sidebar { position: static; height: auto; padding: 14px 20px; }
  .docs-menu-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 42px;
    padding: 0 14px;
    background: var(--bg-elev);
    border: 1px solid var(--border-2);
    border-radius: 12px;
    color: var(--ink-2);
    font-family: var(--font);
    font-size: 14px;
    cursor: pointer;
  }
  .docs-menu-btn svg { color: var(--ink-4); transition: transform .15s ease; }
  .docs-menu-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
  .docs-sidebar-panel { display: none; margin-top: 10px; }
  .docs-sidebar.is-open .docs-sidebar-panel { display: flex; }
  .docs-sidenav { flex: none; overflow: visible; padding-bottom: 8px; }
  .docs-nav-link, .docs-group-btn { height: 38px; }      /* tappable rows */

  .docs-content { padding: 26px 20px 80px; }
  .docs-title { font-size: 30px; }
  .docs-body h2 { font-size: 21px; margin-top: 44px; }
  .docs-cards { grid-template-columns: 1fr; }
  .docs-pager { grid-template-columns: 1fr; }
  .docs-pager a.next { grid-column: auto; text-align: left; }
}

@media (max-width: 640px) {
  :root { --docs-nav-h: 58px; }      /* the site nav shrinks at this width */
}
