/* kept.computer/docs: sidebar, article, "On this page", and Stripe-style API sections with code on the
   right. Builds on style.css tokens; black and white only. */

.docs-body header.site .wrap { max-width: none; }
.docs-crumb { font: 400 var(--fs-small)/1 var(--mono); color: var(--text-2); margin-right: auto; margin-left: -0.75rem; }

.docs-shell { display: grid; grid-template-columns: 16rem minmax(0, 1fr); max-width: 90rem; margin: 0 auto; }
.docs-main { display: grid; grid-template-columns: minmax(0, 46rem) 13rem; gap: 4rem; justify-content: start;
  padding: 2.5rem max(var(--gutter), 2.5rem) 4rem; min-width: 0; }
.docs-wide .docs-main { grid-template-columns: minmax(0, 1fr); }
.docs-wide .docs-toc { display: none; }

/* ---- Sidebar ---- */
.docs-nav { position: sticky; top: var(--header-h); align-self: start; max-height: calc(100vh - var(--header-h)); overflow-y: auto;
  padding: 2rem 1.25rem 3rem max(var(--gutter), 1.5rem); border-right: 1px solid var(--border); }
.docs-nav ul { list-style: none; margin: 0 0 1.5rem; padding: 0; }
.docs-nav li a { display: block; padding: 0.35rem 0.75rem; margin-left: -0.75rem; border-radius: 6px; color: var(--text-2);
  text-decoration: none; font-size: var(--fs-small); line-height: 1.4; }
.docs-nav li a:hover { color: var(--text); background: var(--surface); }
.docs-nav li a[aria-current="page"] { color: var(--text); font-weight: 600; background: var(--surface); }
.docs-group { font: 400 var(--fs-label)/1.4 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-2); margin: 0 0 0.5rem; }

.docs-search { position: relative; margin-bottom: 1.75rem; }
.docs-search input { width: 100%; font: 400 var(--fs-small)/1.2 var(--sans); padding: 9px 2.25rem 9px 12px; border: 1px solid var(--border);
  border-radius: 6px; background: var(--bg); color: var(--text); }
.docs-search input:focus { border-color: var(--text); outline: none; }
.docs-search kbd { position: absolute; right: 8px; top: 7px; font-size: 0.75rem; line-height: 1; padding: 3px 6px; border: 1px solid var(--border);
  border-radius: 4px; color: var(--text-2); pointer-events: none; }
.docs-results { position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 4px); list-style: none; margin: 0; padding: 0.25rem;
  background: var(--bg); border: 1px solid var(--border-strong); border-radius: 8px; max-height: 22rem; overflow-y: auto;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--text) 12%, transparent); }
.docs-results a { display: block; padding: 0.5rem 0.6rem; border-radius: 6px; text-decoration: none; color: var(--text); font-size: var(--fs-small); }
.docs-results a span { display: block; color: var(--text-2); font-size: 0.8rem; }
.docs-results a:hover, .docs-results a.on { background: var(--surface); }
.docs-results .none { padding: 0.5rem 0.6rem; color: var(--text-2); font-size: var(--fs-small); }

/* ---- Article ---- */
.docs-article { min-width: 0; }
.docs-article h1 { font-size: clamp(2rem, 1.6rem + 1.4vw, 2.5rem); margin-bottom: 0.75rem; }
.docs-article > .lede, .docs-article .lede { font-size: 1.125rem; color: var(--text-2); max-width: 40rem; margin: 0 0 2rem; }
.docs-article h2 { font-size: 1.5rem; margin: 3rem 0 0.75rem; padding-top: 2rem; border-top: 1px solid var(--border); scroll-margin-top: calc(var(--header-h) + 1rem); }
.docs-article h3 { font-size: 1.125rem; margin: 2rem 0 0.5rem; scroll-margin-top: calc(var(--header-h) + 1rem); }
.docs-article h2 + h3 { margin-top: 1rem; }
.docs-article p, .docs-article li { max-width: 44rem; }
.docs-article ul, .docs-article ol { padding-left: 1.25rem; }
.docs-article li { margin: 0.35rem 0; }
.docs-article :not(pre) > code { background: var(--surface); border: 1px solid var(--border); border-radius: 4px; padding: 0.05em 0.35em; font-size: 0.86em; }
.docs-article a.anchor { color: var(--text-2); text-decoration: none; margin-left: 0.4rem; opacity: 0; font-weight: 400; }
.docs-article :is(h2, h3):hover a.anchor, .docs-article a.anchor:focus { opacity: 1; }
.docs-article kbd { font-size: 0.8em; padding: 0.1em 0.4em; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; }
.ui { font-weight: 600; } /* a label in the app: Settings → Sharing */

/* Steps: numbered, with a rule down the side. */
ol.steps { list-style: none; counter-reset: step; padding: 0; margin: 1.5rem 0; }
ol.steps > li { counter-increment: step; position: relative; padding: 0 0 1.5rem 2.75rem; margin: 0; border-left: 1px solid var(--border); margin-left: 0.875rem; }
ol.steps > li:last-child { border-left-color: transparent; padding-bottom: 0; }
ol.steps > li::before { content: counter(step); position: absolute; left: -0.875rem; top: -0.1rem; width: 1.75rem; height: 1.75rem;
  border-radius: 50%; background: var(--primary); color: var(--on-primary); font: 600 0.8rem/1.75rem var(--mono); text-align: center; }
ol.steps > li > strong:first-child { display: block; margin-bottom: 0.25rem; }

/* Callouts. */
.callout { border: 1px solid var(--border-strong); border-left-width: 3px; border-radius: 6px; padding: 0.9rem 1.1rem; margin: 1.5rem 0; max-width: 44rem; }
.callout > :first-child { margin-top: 0; }
.callout > :last-child { margin-bottom: 0; }
.callout .callout-title { font: 500 var(--fs-label)/1.4 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; display: block; margin-bottom: 0.35rem; }
.callout.soft { border-color: var(--border); background: var(--surface); }

/* Cards (overview). */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 0.75rem; margin: 1.5rem 0 0; padding: 0; list-style: none; }
.cards li { margin: 0; max-width: none; }
.cards a { display: block; height: 100%; padding: 1.1rem 1.25rem; border: 1px solid var(--border); border-radius: 10px; text-decoration: none; color: var(--text); }
.cards a:hover { border-color: var(--text); }
.cards a strong { display: block; font: 600 1rem/1.3 var(--display); margin-bottom: 0.3rem; }
.cards a span { display: block; color: var(--text-2); font-size: var(--fs-small); line-height: 1.5; }
.cards a strong::after { content: " →"; }

/* Tables. */
.docs-article .table-scroll { margin: 1.25rem 0; max-width: 46rem; }
.docs-article table { width: 100%; border-collapse: collapse; font-size: var(--fs-small); }
.docs-article th, .docs-article td { text-align: left; vertical-align: top; padding: 0.6rem 0.75rem 0.6rem 0; border-bottom: 1px solid var(--border); }
.docs-article th { font: 500 var(--fs-label)/1.4 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2); }

/* ---- Code ---- */
.docs-article pre.code { position: relative; margin: 1.25rem 0; padding: 1.1rem 1.25rem; border-radius: 10px; font-size: 0.82rem; line-height: 1.6; max-width: 46rem; }
.codebox { margin: 1.25rem 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; max-width: 46rem; background: var(--surface); }
.codebox .codebar { display: flex; align-items: center; gap: 0.25rem; padding: 0 0.5rem 0 0.75rem; min-height: 40px; border-bottom: 1px solid var(--border); }
.codebox .codebar .title { font: 400 var(--fs-label)/1 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2); margin-right: auto; }
.codebox [role="tab"] { font: 400 0.78rem/1 var(--mono); color: var(--text-2); background: none; border: 0; padding: 0.55rem 0.6rem; border-radius: 5px; cursor: pointer; }
.codebox [role="tab"][aria-selected="true"] { color: var(--text); background: var(--bg); box-shadow: inset 0 0 0 1px var(--border); }
.codebox [role="tab"]:hover { color: var(--text); }
.codebox [role="tab"]:first-of-type { margin-left: auto; }
.codebox .codebar .title + [role="tab"] { margin-left: 0; }
.codebox pre.code { margin: 0; border-radius: 0; max-width: none; background: transparent; }
.codebox pre.code[data-label]:not(:first-of-type) { border-top: 1px solid var(--border); } /* no-JS: stacked */
.codebox.js pre.code { border-top: 0; }
.copy { font: 400 0.75rem/1 var(--mono); color: var(--text-2); background: var(--bg); border: 1px solid var(--border); border-radius: 5px;
  padding: 0.4rem 0.55rem; cursor: pointer; }
.copy:hover { color: var(--text); border-color: var(--text-2); }
pre.code > .copy { position: absolute; top: 0.6rem; right: 0.6rem; opacity: 0; transition: opacity 120ms; }
pre.code:hover > .copy, pre.code > .copy:focus { opacity: 1; }
.codebox pre.code > .copy { display: none; }
.c { color: var(--text-2); } /* comment in a code sample */

/* ---- API reference: text left, code right (Stripe-style) ---- */
.endpoint { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 3rem; padding: 0 0 1rem; }
.endpoint + .endpoint { border-top: 1px solid var(--border); padding-top: 0.5rem; }
.endpoint h2 { border-top: 0; margin-top: 1.5rem; padding-top: 1.5rem; }
.endpoint .ep-code { position: sticky; top: calc(var(--header-h) + 1.5rem); align-self: start; padding-top: 3rem; }
.endpoint .ep-code .codebox { margin: 0 0 1rem; max-width: none; }
.method { display: inline-block; font: 600 0.72rem/1 var(--mono); padding: 0.3rem 0.45rem; border: 1px solid var(--text); border-radius: 4px; margin-right: 0.5rem; vertical-align: 0.1em; }
.route { font: 500 0.95rem/1.4 var(--mono); }
.ep-route { margin: 0 0 1rem; }

dl.params { margin: 1rem 0 1.5rem; border-top: 1px solid var(--border); max-width: 44rem; }
dl.params > div { padding: 0.85rem 0; border-bottom: 1px solid var(--border); }
dl.params dt { font: 600 0.85rem/1.4 var(--mono); }
dl.params dt .type { font-weight: 400; color: var(--text-2); margin-left: 0.5rem; }
dl.params dt .req { font: 500 0.7rem/1 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; margin-left: 0.5rem; padding: 0.15rem 0.35rem; border: 1px solid var(--border-strong); border-radius: 3px; }
dl.params dd { margin: 0.3rem 0 0; color: var(--text-2); font-size: var(--fs-small); }
dl.params dd p { margin: 0.3rem 0 0; }

/* ---- Right rail and footer of the article ---- */
.docs-toc { position: sticky; top: calc(var(--header-h) + 2.5rem); align-self: start; font-size: var(--fs-small); }
.docs-toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.docs-toc a { display: block; padding: 0.3rem 0 0.3rem 0.9rem; margin-left: -1px; border-left: 1px solid transparent; color: var(--text-2); text-decoration: none; line-height: 1.4; }
.docs-toc a:hover { color: var(--text); }
.docs-toc a.on { color: var(--text); border-left-color: var(--text); }

.docs-updated { margin: 4rem 0 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border); color: var(--text-2); font-size: var(--fs-small); }
.docs-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.docs-pager a { display: block; padding: 0.9rem 1.1rem; border: 1px solid var(--border); border-radius: 10px; text-decoration: none; color: var(--text); font-weight: 600; }
.docs-pager a:hover { border-color: var(--text); }
.docs-pager a span { display: block; font: 400 var(--fs-label)/1.4 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2); margin-bottom: 0.2rem; }
.docs-pager .next { text-align: right; grid-column: 2; }

/* ---- Smaller screens ---- */
@media (max-width: 1279px) {
  .docs-main { grid-template-columns: minmax(0, 46rem); }
  .docs-toc { display: none; }
  .endpoint { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .endpoint .ep-code { position: static; padding-top: 0.5rem; }
}
@media (max-width: 899px) {
  .docs-shell { grid-template-columns: minmax(0, 1fr); }
  .docs-menu { display: inline-flex !important; }
  .docs-nav { display: none; position: fixed; inset: var(--header-h) 0 auto 0; height: calc(100dvh - var(--header-h)); z-index: 9; max-height: none; background: var(--bg); border-right: 0; padding: 1.5rem var(--gutter) 3rem; }
  .docs-nav.open { display: block; }
  .docs-main { padding: 1.75rem var(--gutter) 3rem; }
  .docs-crumb { display: none; }
}
.docs-menu { display: none; align-items: center; min-height: 44px; padding: 0 0.75rem; color: var(--text-2); background: none; border: 0;
  font: 400 var(--fs-small) var(--mono); cursor: pointer; }
@media (max-width: 479px) { .docs-pager { grid-template-columns: 1fr; } .docs-pager .next { grid-column: 1; } }
@media (prefers-reduced-motion: reduce) { pre.code > .copy { transition: none; } }

/* API code panels are always dark, like a terminal, so they read as a separate column. */
.endpoint .ep-code .codebox { --bg: #0A0A0A; --surface: #141414; --text: #FAFAFA; --text-2: #9A9A9A; --border: #2A2A2A; --border-strong: #6B6B6B;
  background: var(--surface); color: var(--text); border-color: var(--border); }
