/* assets/css/docs.css — the developer documentation page.
   Tokens from tokens.css; layout, prose and the code pane are this file's own.
   Sidebar TOC on wide screens, stacked above the prose on narrow ones. */

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body {
  margin: 0;
  font-family: var(--mh-font-body);
  font-size: 15px;
  line-height: 1.65;
  color: var(--mh-fg);
  background: var(--mh-bg-raised);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--mh-fg-brand); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
  font-family: var(--mh-font-mono);
  font-size: 0.92em;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--mh-bg-subtle);
  color: var(--mh-fg);
  direction: ltr;
  unicode-bidi: isolate;
  overflow-wrap: anywhere;
}

/* ---------- Header ---------- */
.docs-header {
  position: sticky; top: 0; z-index: 60;
  background: var(--mh-bg-raised);
  background: color-mix(in srgb, var(--mh-bg-raised) 86%, transparent);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--mh-border);
}
.docs-header__inner {
  max-width: 1200px; margin: 0 auto; padding: 0 22px; height: 62px;
  display: flex; align-items: center; gap: 16px;
}
.docs-brand { display: flex; align-items: center; gap: 10px; color: var(--mh-fg); }
.docs-brand:hover { text-decoration: none; }
.docs-brand__mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--mh-signal-600); display: grid; place-items: center;
}
.docs-brand__name { font-family: var(--mh-font-display); font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }
.docs-brand__section { font-size: 13.5px; color: var(--mh-fg-3); padding-inline-start: 10px; border-inline-start: 1px solid var(--mh-border); }
.docs-spacer { flex: 1; }
.docs-header__link { font-size: 13.5px; color: var(--mh-fg-2); }
.docs-btn {
  display: inline-flex; align-items: center;
  padding: 9px 15px; font-size: 13.5px; font-weight: 600;
  border: 1px solid var(--mh-border-strong); border-radius: 8px; color: var(--mh-fg);
}
.docs-btn:hover { background: var(--mh-bg-subtle); text-decoration: none; }

/* ---------- Layout ---------- */
.docs-layout {
  max-width: 1200px; margin: 0 auto; padding: 40px 22px 96px;
  display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 48px;
}
.docs-aside {
  position: sticky; top: 86px; align-self: start;
  /* The TOC outgrows most viewports; without this the pinned aside's tail is unreachable
     until the page itself has scrolled to the end. 86px matches `top`, 24px is bottom room. */
  max-height: calc(100vh - 86px - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  padding-inline-end: 6px;
}
.docs-toc__label { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--mh-fg-3); margin-bottom: 8px; }
.docs-toc { display: flex; flex-direction: column; gap: 2px; }
.docs-toc__item { font-size: 13px; color: var(--mh-fg-2); padding: 6px 10px; border-radius: 6px; }
.docs-toc__item:hover { background: var(--mh-bg-subtle); color: var(--mh-fg); text-decoration: none; }

.docs-main { min-width: 0; }
.docs-kicker { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--mh-fg-brand); margin: 0 0 10px; }
.docs-title { font-family: var(--mh-font-display); font-size: 40px; line-height: 1.1; letter-spacing: -0.03em; margin: 0 0 14px; }
.docs-intro { font-size: 18px; color: var(--mh-fg-2); margin: 0 0 8px; max-width: 720px; }
.docs-meta { font-size: 13px; color: var(--mh-fg-3); margin: 0 0 40px; }

.docs-section { padding-top: 8px; }
.docs-section h2 {
  font-family: var(--mh-font-display); font-size: 22px; letter-spacing: -0.02em;
  margin: 44px 0 12px; padding-top: 16px; border-top: 1px solid var(--mh-border);
}
.docs-section p { margin: 0 0 12px; max-width: 760px; overflow-wrap: anywhere; }
.docs-section ul { padding-inline-start: 20px; margin: 0 0 14px; max-width: 760px; }
.docs-section li { margin-bottom: 6px; overflow-wrap: anywhere; }

/* ---------- Code pane (the site's dark pane, self-contained here) ---------- */
.docs-code {
  position: relative;
  margin: 12px 0 18px;
  padding: 18px 20px;
  border-radius: 10px;
  background: var(--mh-ink-900);
  color: var(--mh-chrome-100);
  overflow-x: auto;
  direction: ltr;
  text-align: start;
}
.docs-code__lang { position: absolute; top: 10px; inset-inline-end: 14px; font-family: var(--mh-font-mono); font-size: 10.5px; color: var(--mh-chrome-500); text-transform: uppercase; letter-spacing: 0.06em; }
.docs-code__line { display: flex; gap: 14px; font-family: var(--mh-font-mono); font-size: 12.5px; line-height: 1.72; }
.docs-code__n { color: #4A5568; width: 22px; text-align: end; flex: none; user-select: none; }
.docs-code__t { white-space: pre; }

.docs-code, .docs-table-wrap { max-width: 100%; }

/* ---------- Tables ---------- */
.docs-table-wrap { overflow-x: auto; margin: 12px 0 18px; border: 1px solid var(--mh-border); border-radius: 10px; }
.docs-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.docs-table th, .docs-table td { text-align: start; vertical-align: top; padding: 10px 14px; border-bottom: 1px solid var(--mh-border); }
.docs-table th { font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--mh-fg-3); background: var(--mh-bg-subtle); }
.docs-table tr:last-child td { border-bottom: 0; }
.docs-table td code { overflow-wrap: normal; white-space: nowrap; }
.docs-table { min-width: 520px; }

/* ---------- Footer ---------- */
.docs-footer { margin-top: 64px; padding-top: 20px; border-top: 1px solid var(--mh-border); font-size: 13.5px; color: var(--mh-fg-2); }
.docs-footer p { margin: 0 0 6px; }
.docs-footer__fine { font-size: 12.5px; color: var(--mh-fg-3); }

/* ---------- Narrow ---------- */
@media (max-width: 960px) {
  .docs-layout { grid-template-columns: minmax(0, 1fr); gap: 28px; padding-top: 28px; }
  .docs-aside { position: static; max-height: none; overflow: visible; padding-inline-end: 0; }
  .docs-toc { flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .docs-title { font-size: 32px; }
  .docs-brand__section { display: none; }
  .docs-header__link { display: none; }
}
@media (max-width: 480px) {
  .docs-layout { padding-inline: 16px; }
  .docs-title { font-size: 28px; }
}
