/* /docs: two columns that scroll on their own on desktop, one normal page with a menu on phones. Builds on site.css tokens. */

:root { --docs-nav-h: 52px; --docs-side: 288px; --docs-bar: 48px; }

.docs-page main { display: block; }

/* ---------- Desktop: the page stays put, each column scrolls ---------- */
@media (min-width: 900px) {
  html.docs-page, .docs-page body { height: 100%; overflow: hidden; }
  .docs-page body { display: flex; flex-direction: column; }
  .docs-page .nav { flex: none; border-bottom-color: var(--line); }
  .docs-page main { flex: 1 1 auto; min-height: 0; }
  .docs-shell { display: grid; grid-template-columns: var(--docs-side) minmax(0, 1fr); height: 100%; }
  .docs-side { overflow-y: auto; overscroll-behavior: contain; border-right: 1px solid var(--line); padding: 22px 14px 40px 20px; scrollbar-width: thin; }
  .docs-main { overflow-y: auto; overscroll-behavior: contain; scroll-behavior: smooth; scrollbar-gutter: stable; }
  .docs-bar { display: none; }
  .docs-main .footer { margin-top: 24px; }
}
@media (min-width: 900px) and (prefers-reduced-motion: reduce) { .docs-main { scroll-behavior: auto; } }

/* ---------- Sidebar ---------- */
.docs-find { display: flex; align-items: center; gap: 8px; margin: 0 0 14px 6px; font-size: 13px; color: var(--muted); }
.docs-find a { color: var(--accent); font-weight: 600; }
.docs-nav { font-size: 14px; letter-spacing: -0.01em; }
.docs-nav .grp { margin: 18px 0 0; }
.docs-nav .grp:first-child { margin-top: 0; }
.docs-nav h2 { margin: 0 0 4px 8px; padding: 0; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-family: inherit; line-height: 1.3; }
.docs-nav ul { list-style: none; margin: 0; padding: 0; }
.docs-nav a { display: block; padding: 5px 9px; border-radius: 8px; color: var(--muted); line-height: 1.3; }
.docs-nav a:hover { color: var(--text); background: var(--accent-soft); text-decoration: none; }
.docs-nav a.on { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.docs-nav a:focus-visible, .docs-bar button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- Content ---------- */
.docs-body { max-width: 780px; margin: 0 auto; padding: 44px clamp(20px, 4vw, 48px) 24px; }
.docs-hero { padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.docs-hero .crumbs { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.docs-hero .crumbs a { color: var(--muted); }
.docs-hero h1 { font-size: clamp(36px, 5vw, 52px); line-height: 1.05; letter-spacing: -0.04em; font-weight: 800; }
.docs-hero p { margin-top: 14px; font-size: 19px; line-height: 1.4; color: var(--muted); max-width: 36em; }
.docs-hero .cta { justify-content: flex-start; margin-top: 22px; }
.docs-hero .btn { font-size: 15px; padding: 9px 18px; }

.group-title { margin: 56px 0 0; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); font-family: inherit; scroll-margin-top: 24px; }
.doc { padding: 22px 0 8px; scroll-margin-top: 24px; }
.group-title + .doc { padding-top: 10px; }
.doc + .doc { border-top: 1px solid var(--line); margin-top: 22px; }
.doc h2 { font-size: clamp(26px, 3.4vw, 32px); line-height: 1.12; letter-spacing: -0.03em; font-weight: 750; }
.doc .lede { margin-top: 10px; font-size: 18px; line-height: 1.45; color: var(--text); }
.doc p { margin-top: 12px; }
.doc a { text-underline-offset: 2px; }
.doc code, .docs-body code { font: 0.86em ui-monospace, "SF Mono", Menlo, monospace; background: var(--bg-2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; }

.spec { display: grid; gap: 18px; margin-top: 20px; }
.spec h3 { margin: 0 0 6px; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-family: inherit; }
.spec ul, .spec ol { margin: 0; padding-left: 1.2em; }
.spec li { margin: 4px 0; padding-left: 2px; }
.spec li::marker { color: var(--muted); }
.spec .tips { background: var(--accent-soft); border-radius: 14px; padding: 14px 18px 12px; }
.spec .tips h3 { color: var(--accent); }
.spec .tips ul { padding-left: 1.1em; }
.see { margin-top: 14px; font-size: 14px; color: var(--muted); }
.see a { white-space: nowrap; }

.note { margin-top: 16px; padding: 14px 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); font-size: 16px; }
.note strong { color: var(--text); }

.docs-shot { margin: 22px 0 4px; }

/* Tables */
.tbl { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 15px; }
.tbl th, .tbl td { text-align: left; vertical-align: top; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.tbl th { font-size: 12px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.tbl td:first-child { white-space: nowrap; font-weight: 600; }
.tbl-wrap { overflow-x: auto; }

/* Example questions */
.qgroup { margin-top: 22px; }
.qgroup h3 { margin: 0 0 8px; font-size: 17px; font-weight: 700; letter-spacing: -0.02em; font-family: inherit; }
.qlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.qlist button {
  all: unset; box-sizing: border-box; display: block; width: 100%; cursor: pointer; padding: 9px 14px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--text); font-size: 15px; line-height: 1.4;
  transition: border-color 0.15s, background-color 0.15s;
}
.qlist button:hover { border-color: var(--accent); }
.qlist button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.qlist button.copied { border-color: var(--accent); background: var(--accent-soft); }
.qlist button.copied::after { content: "Copied"; float: right; color: var(--accent); font-size: 12px; font-weight: 600; }
.qhint { margin-top: 12px; font-size: 14px; color: var(--muted); }

.docs-faq { margin-top: 18px; max-width: none; }

.docs-end { margin-top: 56px; padding: 26px 28px; border-radius: 22px; background: var(--accent-soft); text-align: center; }
.docs-end h2 { font-size: 24px; }
.docs-end p { margin-top: 8px; color: var(--text); }
.docs-end .cta { margin-top: 18px; }

/* ---------- Phone and tablet: one normal page, menu on top ---------- */
@media (max-width: 899.98px) {
  html.docs-page { scroll-padding-top: 0; }
  .docs-bar {
    padding: 0 var(--gutter);
    position: sticky; top: var(--docs-nav-h); z-index: 40; height: var(--docs-bar);
    background: var(--nav); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--line);
  }
  .docs-bar button {
    all: unset; box-sizing: border-box; cursor: pointer; display: flex; align-items: center; gap: 10px; width: 100%; height: 100%;
    padding: 0; font-size: 15px; font-weight: 600; color: var(--text);
  }
  .docs-bar .cur { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--accent); }
  .docs-bar .lbl { color: var(--muted); font-weight: 500; }
  .docs-bar svg { width: 18px; height: 18px; flex: none; transition: transform 0.2s; }
  .docs-bar[data-open="true"] svg { transform: rotate(180deg); }
  .docs-side {
    position: fixed; z-index: 39; left: 0; right: 0; top: calc(var(--docs-nav-h) + var(--docs-bar)); bottom: 0;
    background: var(--bg); overflow-y: auto; padding: 14px var(--gutter) 40px; display: none; overscroll-behavior: contain;
  }
  .docs-side[data-open="true"] { display: block; }
  .docs-find { display: none; }
  .docs-nav { font-size: 16px; }
  .docs-nav a { padding: 8px 10px; }
  .docs-body { padding: 28px var(--gutter) 8px; }
  .doc, .group-title { scroll-margin-top: calc(var(--docs-nav-h) + var(--docs-bar) + 8px); }
  .tbl td:first-child { white-space: normal; }
}
@media (max-width: 899.98px) { body.menu-open { overflow: hidden; } }
