/* ============================================================
   Termdeck — docs.css  (the /docs vocabulary)
   Loads AFTER home.css and site.css and only ADDS: tokens, nav,
   footer, buttons and links all come from home.css. Nothing here
   may restyle a class the homepage or the /vs pages use.

   Layout is three columns inside the same lit 1280px column the
   rest of the site draws: page tree, prose, "on this page".
   Below 1080px the right rail folds away; below 900px the tree
   becomes a disclosure above the prose, so a phone reads one
   column with no horizontal scroll anywhere.
   ============================================================ */

:root {
  --doc-nav-w: 254px;
  --doc-toc-w: 204px;
  --doc-top: 64px; /* the sticky .nav height — every sticky rail hangs off this */
}

/* ---------- shell ---------- */
.doc-shell {
  max-width: var(--shell);
  margin: 0 auto;
  background: var(--bg);
  border-left: 1px solid var(--rail);
  border-right: 1px solid var(--rail);
  display: grid;
  grid-template-columns: var(--doc-nav-w) minmax(0, 1fr) var(--doc-toc-w);
  /* stretch, not start: a sticky rail needs a full-height containing block, or
     it stops sticking the moment its own content is shorter than the article. */
  align-items: stretch;
}

/* ---------- left: the page tree ----------
   The tree is a DIRECT grid child, deliberately unwrapped. It used to sit
   inside a <details> that doubled as the phone disclosure, and that quietly
   broke the sticky rail: the disclosure's content box is the sticky element's
   containing block, so the tree stopped sticking and scrolled away with the
   article. The toggle is a sibling button instead, shown only on a phone, and
   the collapse is a class docs.js adds — so with no script the tree is simply
   there, which is the correct degradation for a navigation list. */
.doc-nav {
  position: sticky;
  top: var(--doc-top);
  max-height: calc(100vh - var(--doc-top));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 26px 18px 40px 26px;
  border-right: 1px solid var(--border-soft);
  scrollbar-width: thin;
}
.doc-navtoggle { display: none; }
.doc-search {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 22px;
}
.doc-search svg {
  position: absolute;
  left: 10px;
  width: 14px;
  height: 14px;
  color: var(--faint);
  pointer-events: none;
}
.doc-search input {
  width: 100%;
  height: 34px;
  padding: 0 46px 0 31px;
  border-radius:var(--r-md);
  border: 1px solid var(--border);
  background: var(--sunken);
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  letter-spacing: -.01em;
}
.doc-search input::placeholder { color: var(--faint); }
.doc-search input:focus { outline: none; border-color: var(--input); background: var(--card); }
.doc-search input::-webkit-search-cancel-button { display: none; }
.doc-search-key {
  position: absolute;
  right: 7px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--faint);
  border: 1px solid var(--border);
  border-radius:var(--r-sm);
  padding: 2px 5px;
  pointer-events: none;
}
.doc-tree { display: flex; flex-direction: column; gap: 1px; }
.doc-group {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 20px 0 7px 8px;
}
.doc-group:first-child { margin-top: 0; }
.doc-tree a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 9px;
  border-radius:var(--r-md);
  font-size: 13.5px;
  line-height: 1.35;
  color: var(--muted);
  transition: color .14s, background .14s;
}
.doc-tree a svg { width: 15px; height: 15px; flex: none; opacity: .72; }
.doc-tree a:hover { color: var(--text); background: var(--muted-surface); }
.doc-tree a[aria-current="page"] { color: var(--text); background: var(--sunken); font-weight: 500; }
.doc-tree a[aria-current="page"] svg { opacity: 1; color: var(--brand-green-400); }
.doc-tree a.is-hidden, .doc-group.is-hidden { display: none; }
.doc-nav-empty {
  display: none;
  font-size: 13px;
  color: var(--faint);
  padding: 8px 9px;
}
.doc-nav-empty.is-on { display: block; }
.doc-nav-foot {
  margin-top: 26px;
  padding-top: 16px;
  border-top: 1px solid var(--border-soft);
  font-size: 12.5px;
  color: var(--faint);
}
.doc-nav-foot a { color: var(--muted); text-decoration: underline; text-decoration-color: var(--link-rule); text-underline-offset: .16em; }
.doc-nav-foot a:hover { color: var(--text); }

/* ---------- middle: the prose ---------- */
.doc-main { min-width: 0; padding: 44px 44px 64px; }
.doc-eyebrow {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--faint);
}
.doc-main h1 {
  font-size: clamp(2rem, 3.4vw, 2.6rem);
  letter-spacing: -.035em;
  margin: 12px 0 0;
  max-width: 22ch;
}
.doc-lede {
  margin-top: 16px;
  font-size: 17px;
  line-height: 1.6;
  color: var(--muted);
  max-width: 68ch;
}
.doc-body { margin-top: 40px; }
.doc-body h2 {
  font-size: 24px;
  letter-spacing: -.025em;
  margin: 52px 0 0;
  padding-top: 24px;
  border-top: 1px solid var(--border-soft);
  scroll-margin-top: calc(var(--doc-top) + 20px);
}
.doc-body h3 {
  font-size: 17.5px;
  letter-spacing: -.018em;
  margin: 34px 0 0;
  scroll-margin-top: calc(var(--doc-top) + 20px);
}
.doc-body h4 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -.008em;
  margin: 26px 0 0;
  color: var(--text);
}
.doc-body h2 + *, .doc-body h3 + *, .doc-body h4 + * { margin-top: 14px; }
.doc-body p, .doc-body ul, .doc-body ol {
  margin-top: 16px;
  font-size: 15.5px;
  line-height: 1.68;
  color: var(--muted);
  max-width: 72ch;
}
.doc-body strong { color: var(--text); font-weight: 600; }
.doc-body ul, .doc-body ol { padding-left: 22px; }
.doc-body li { margin-top: 7px; }
.doc-body li::marker { color: var(--faint); }
.doc-body a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--link-rule);
  text-decoration-thickness: 1px;
  text-underline-offset: .16em;
  text-decoration-skip-ink: auto;
  transition: text-decoration-color .15s;
}
.doc-body a:hover { text-decoration-color: var(--brand-green-400); }
/* A card is a target, not a phrase. The prose underline above would run under
   its title, its description and its arrow, which reads as three broken links
   rather than one panel. */
.doc-body a.doc-card, .doc-body a.doc-card:hover { text-decoration: none; }
.doc-body code {
  font-family: var(--mono);
  font-size: .875em;
  background: var(--sunken);
  border: 1px solid var(--border-soft);
  border-radius:var(--r-sm);
  padding: 1.5px 5px;
  color: var(--text);
  /* Inline code must be able to break, or one long path (a transcript location,
     a global npm install line) pushes the whole document sideways on a phone.
     `anywhere` rather than `break-word` because the offenders have no spaces. */
  overflow-wrap: anywhere;
}
.doc-body a code { color: inherit; }
.doc-body pre code { background: none; border: 0; padding: 0; white-space: pre; font-size: 13px; }

/* heading anchor: appears on hover, never shifts the line */
.doc-anchor {
  margin-left: 9px;
  font-size: .62em;
  font-weight: 400;
  color: var(--faint);
  opacity: 0;
  text-decoration: none;
  transition: opacity .14s;
}
h2:hover .doc-anchor, h3:hover .doc-anchor, .doc-anchor:focus-visible { opacity: 1; }

/* ---------- code blocks ---------- */
.doc-code {
  margin-top: 18px;
  border: 1px solid var(--border);
  border-radius:var(--r-md);
  background: var(--well);
  box-shadow: var(--edge);
  overflow: hidden;
}
.doc-code-h {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 8px 0 13px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--card);
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--faint);
}
.doc-copy {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius:var(--r-md);
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color .14s, border-color .14s, background .14s;
}
.doc-copy:hover { color: var(--text); border-color: var(--input); background: var(--muted-surface); }
.doc-copy svg { width: 12px; height: 12px; }
.doc-copy.is-done { color: var(--live); border-color: rgba(10, 200, 100, .4); }
.doc-code pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.62;
  color: var(--text);
  scrollbar-width: thin;
}
.doc-code .c { color: var(--faint); }
.doc-code .k { color: var(--brand-green-300); }
.doc-code .s { color: var(--cat-orange); }

/* ---------- platform tabs ---------- */
.doc-tabbar {
  display: flex;
  gap: 2px;
  margin-top: 20px;
  border-bottom: 1px solid var(--border-soft);
}
.doc-tabbar button {
  position: relative;
  height: 34px;
  padding: 0 13px;
  border: 0;
  background: transparent;
  color: var(--faint);
  font-family: var(--sans);
  font-size: 13.5px;
  cursor: pointer;
  transition: color .14s;
}
.doc-tabbar button:hover { color: var(--muted); }
.doc-tabbar button[aria-selected="true"] { color: var(--text); }
.doc-tabbar button[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: -1px;
  height: 2px;
  border-radius:var(--r-xs);
  background: var(--brand-green-400);
}
.doc-tabpanel[hidden] { display: none; }
.doc-tabpanel > .doc-code:first-child { margin-top: 14px; }

/* ---------- callouts ---------- */
.doc-callout {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  padding: 15px 17px;
  border: 1px solid var(--border);
  border-left-width: 2px;
  border-radius:var(--r-md);
  background: var(--sunken);
  max-width: 72ch;
}
.doc-callout > svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.doc-callout p { margin: 0; font-size: 14.5px; line-height: 1.6; color: var(--muted); }
.doc-callout p + p { margin-top: 9px; }
.doc-callout strong { color: var(--text); }
.doc-callout.note { border-left-color: var(--ink-300); }
.doc-callout.note > svg { color: var(--ink-300); }
.doc-callout.tip { border-left-color: var(--live); }
.doc-callout.tip > svg { color: var(--live); }
.doc-callout.warn { border-left-color: var(--busy); }
.doc-callout.warn > svg { color: var(--busy); }
.doc-callout.danger { border-left-color: var(--danger); }
.doc-callout.danger > svg { color: var(--danger); }

/* ---------- card grid (the landing page and section jump-offs) ---------- */
.doc-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 22px;
}
.doc-cards.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.doc-card {
  display: flex;
  flex-direction: column;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius:var(--r-lg);
  background: var(--panel);
  box-shadow: var(--edge), var(--lift);
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease), transform .18s var(--ease);
}
a.doc-card:hover { border-color: var(--input); box-shadow: var(--edge), var(--lift-2); transform: translateY(-2px); }
.doc-card-ic {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius:var(--r-md);
  background: var(--sunken);
  color: var(--text);
}
.doc-card-ic svg { width: 15px; height: 15px; }
.doc-card h3 { font-size: 15.5px; margin: 0 0 6px; letter-spacing: -.015em; }
.doc-card p { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--muted); max-width: none; }
.doc-card .doc-card-go {
  margin-top: 14px;
  font-size: 13px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
a.doc-card:hover .doc-card-go { color: var(--text); }

/* ---------- numbered steps ---------- */
.doc-steps { counter-reset: dstep; margin-top: 24px; padding: 0; list-style: none; max-width: 72ch; }
.doc-steps > li {
  position: relative;
  margin: 0;
  padding: 0 0 28px 46px;
  border-left: 1px solid var(--border-soft);
  margin-left: 14px;
}
.doc-steps > li:last-child { border-left-color: transparent; padding-bottom: 0; }
.doc-steps > li::before {
  counter-increment: dstep;
  content: counter(dstep);
  position: absolute;
  left: -14px;
  top: -3px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius:50%;
  background: var(--card);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 500;
}
.doc-steps > li > h3:first-child { margin: 2px 0 0; font-size: 16px; }
.doc-steps > li > h4:first-child { margin: 4px 0 0; font-size: 15px; }
.doc-steps p, .doc-steps ul, .doc-steps ol { max-width: 66ch; }

/* ---------- tables ---------- */
.doc-tablewrap {
  margin-top: 20px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius:var(--r-lg);
  background: var(--panel);
  box-shadow: var(--edge), var(--lift);
  scrollbar-width: thin;
}
.doc-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.doc-table th {
  text-align: left;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 400;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
}
.doc-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--muted);
  vertical-align: top;
  line-height: 1.55;
}
.doc-table tr:last-child td { border-bottom: 0; }
.doc-table td:first-child { color: var(--text); }
.doc-table code { font-family: var(--mono); font-size: 12.5px; color: var(--text); white-space: nowrap; }

/* ---------- property rows (env vars, file paths) ---------- */
.doc-props { margin-top: 20px; border: 1px solid var(--border); border-radius:var(--r-lg); background: var(--panel); box-shadow: var(--edge), var(--lift); overflow: hidden; }
.doc-prop { padding: 15px 18px; border-bottom: 1px solid var(--border-soft); }
.doc-prop:last-child { border-bottom: 0; }
.doc-prop-h { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.doc-prop-n { font-family: var(--mono); font-size: 13px; color: var(--text); overflow-wrap: anywhere; }
.doc-prop-t { font-family: var(--mono); font-size: 10.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--faint); border: 1px solid var(--border); border-radius:var(--pill); padding: 2px 8px; }
.doc-prop p { margin: 7px 0 0; font-size: 13.5px; line-height: 1.55; color: var(--muted); max-width: 70ch; }

/* ---------- accordion (symptom lists) ---------- */
.doc-acc {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius:var(--r-md);
  background: var(--panel);
  overflow: hidden;
}
.doc-acc > summary {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 17px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  list-style: none;
  transition: background .14s;
}
.doc-acc > summary::-webkit-details-marker { display: none; }
.doc-acc > summary:hover { background: var(--muted-surface); }
.doc-acc > summary::after {
  content: "";
  margin-left: auto;
  width: 8px;
  height: 8px;
  border-right: 1.5px solid var(--faint);
  border-bottom: 1.5px solid var(--faint);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform .18s var(--ease);
  flex: none;
}
.doc-acc[open] > summary::after { transform: rotate(225deg) translate(-2px, -2px); }
.doc-acc[open] > summary { border-bottom: 1px solid var(--border-soft); }
.doc-acc-body { padding: 4px 17px 18px; }
.doc-acc-body > :first-child { margin-top: 14px; }
.doc-acc-body p, .doc-acc-body ul, .doc-acc-body ol { font-size: 14.5px; }

/* ---------- inline bits ---------- */
kbd {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text);
  background: var(--sunken);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius:var(--r-sm);
  padding: 1px 6px;
  white-space: nowrap;
}
.doc-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius:var(--pill);
  padding: 2px 9px;
  white-space: nowrap;
}
.doc-pill.paid { color: var(--brand-green-300); border-color: rgba(148, 240, 135, .3); }
.doc-pill.free { color: var(--faint); }
.doc-hr { height: 1px; background: var(--border-soft); border: 0; margin: 44px 0 0; }

/* ---------- prev / next ---------- */
.doc-pager {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 56px;
  padding-top: 28px;
  border-top: 1px solid var(--border-soft);
}
.doc-pager a {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 15px 18px;
  border: 1px solid var(--border);
  border-radius:var(--r-md);
  background: var(--panel);
  transition: border-color .16s, background .16s;
}
.doc-pager a:hover { border-color: var(--input); background: var(--panel-2); }
.doc-pager .lbl { font-family: var(--mono); font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); }
.doc-pager .ttl { font-size: 14.5px; color: var(--text); font-weight: 500; }
.doc-pager .next { text-align: right; grid-column: 2; }

/* ---------- right: on this page ---------- */
.doc-toc {
  position: sticky;
  top: var(--doc-top);
  max-height: calc(100vh - var(--doc-top));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 46px 26px 40px 18px;
  scrollbar-width: thin;
}
.doc-toc-h {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 12px;
}
.doc-toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border-soft); }
.doc-toc li a {
  display: block;
  padding: 5px 0 5px 12px;
  margin-left: -1px;
  border-left: 1px solid transparent;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--faint);
  transition: color .14s, border-color .14s;
}
.doc-toc li a:hover { color: var(--muted); }
.doc-toc li a.is-active { color: var(--text); border-left-color: var(--brand-green-400); }
.doc-toc li.lvl3 a { padding-left: 24px; font-size: 12px; }
.doc-toc-empty { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .doc-main { padding: 40px 32px 60px; }
  .doc-cards.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1080px) {
  .doc-shell { grid-template-columns: var(--doc-nav-w) minmax(0, 1fr); }
  .doc-toc { display: none; }
}
@media (max-width: 900px) {
  .doc-shell { display: block; }
  /* The tree becomes a disclosure under the site header, driven by the button. */
  .doc-navtoggle {
    display: flex;
    align-items: center;
    gap: 9px;
    position: sticky;
    top: var(--doc-top);
    z-index: 40;
    width: 100%;
    height: 46px;
    padding: 0 20px;
    border: 0;
    border-bottom: 1px solid var(--border-soft);
    background: var(--bg);
    color: var(--muted);
    font-family: var(--sans);
    font-size: 13.5px;
    text-align: left;
    cursor: pointer;
  }
  .doc-navtoggle > svg { width: 15px; height: 15px; flex: none; }
  .doc-navtoggle::after {
    content: "";
    margin-left: auto;
    width: 7px;
    height: 7px;
    border-right: 1.5px solid var(--faint);
    border-bottom: 1.5px solid var(--faint);
    transform: rotate(45deg) translateY(-2px);
    transition: transform .18s var(--ease);
  }
  .doc-navtoggle[aria-expanded="true"]::after { transform: rotate(225deg) translateY(-2px); }
  .doc-nav {
    position: static;
    max-height: none;
    overflow: visible;
    padding: 4px 20px 24px;
    border-right: 0;
    border-bottom: 1px solid var(--border-soft);
  }
  .doc-navtoggle[aria-expanded="false"] + .doc-nav { display: none; }
  .doc-nav-foot { display: none; }
  .doc-main { padding: 32px 20px 56px; }
  .doc-cards, .doc-cards.three, .doc-pager { grid-template-columns: minmax(0, 1fr); }
  .doc-pager .next { grid-column: 1; text-align: left; }
}
@media (max-width: 600px) {
  .doc-main h1 { font-size: 1.85rem; }
  .doc-lede { font-size: 15.5px; }
  .doc-body p, .doc-body ul, .doc-body ol { font-size: 15px; }
  .doc-search-key { display: none; }
  .doc-search input { padding-right: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .doc-card, .doc-copy, .doc-acc > summary::after, .doc-navbar > summary::after { transition: none; }
  a.doc-card:hover { transform: none; }
}
