/* ACS docs — borrows design tokens from landing/styles.css.
 * Three-column layout: sticky sidebar nav · scrolling article · sticky TOC.
 * Mobile collapses to a single column with the sidebar promoted to a top bar.
 */

/* ── Top nav — minimal, monospace mark, subtle ── */
.docs-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-2);
}
.docs-nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.docs-nav .brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.01em;
}
.docs-nav .brand img {
  display: block;
  margin-right: 2px;
}
.docs-nav .brand-mark {
  color: var(--ink-2);
  font-weight: 500;
}
.docs-nav .brand-sep {
  color: var(--ink-3);
  font-weight: 300;
  margin: 0 1px;
}
.docs-nav .brand-section {
  color: var(--ink);
  font-weight: 500;
}
.docs-nav .brand:hover .brand-mark { color: var(--ink); }

/* ── Right-side nav cluster: search + GitHub ──
 *
 * margin-left: auto on the cluster pushes it to the far right of the
 * nav row; the brand stays anchored at the left, the inline link list
 * sits next to it, and the cluster floats to the trailing edge —
 * mirrors Stripe / Resend / shadcn doc-site conventions. */
.docs-nav-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.docs-search-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 6px 0 10px;
  height: 30px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink-3);
  font-family: var(--font-sans);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 120ms, color 120ms, background-color 120ms;
}
.docs-search-trigger:hover {
  border-color: var(--ink-3);
  color: var(--ink-2);
  background: var(--bg);
}
.docs-search-trigger svg { color: var(--ink-3); flex-shrink: 0; }
.docs-search-trigger span { padding-right: 8px; }
.docs-search-kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg);
  color: var(--ink-3);
  line-height: 1;
}
.docs-github {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  color: var(--ink-3);
  text-decoration: none;
  transition: color 120ms, background-color 120ms;
}
.docs-github:hover { color: var(--ink); background: var(--bg-sunk); }
@media (max-width: 760px) {
  .docs-nav-actions { gap: 6px; }
  .docs-search-trigger {
    width: 30px;
    height: 30px;
    padding: 0;
    justify-content: center;
  }
  .docs-search-trigger span,
  .docs-search-kbd { display: none; }
}

.docs-nav-links {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: var(--tx-2);
}
.docs-nav-links a {
  color: var(--ink-3);
  text-decoration: none;
  transition: color 0.15s;
  display: inline-flex;
  align-items: center;
}
.docs-nav-links a:hover { color: var(--ink); }
.docs-nav-links a.active {
  color: var(--ink);
  font-weight: 500;
}

@media (max-width: 760px) {
  .docs-nav-inner { padding: 10px 16px; gap: 12px; }
  /* On phones, hide the entire secondary link strip — brand on the
   * left, search + GitHub on the right is enough chrome. The drawer-
   * worthy nav links live in the home page's hamburger menu, so we
   * don't need to repeat them here. */
  .docs-nav-links { display: none; }
}


.docs-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 220px;
  gap: 48px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 24px 96px;
}

@media (max-width: 1100px) {
  .docs-shell { grid-template-columns: 220px minmax(0, 1fr); }
  .docs-toc { display: none; }
}

@media (max-width: 760px) {
  .docs-shell { grid-template-columns: 1fr; padding: 16px 16px 64px; gap: 24px; }
  .docs-sidebar { position: static !important; max-height: none !important; }
}

/* ── Sidebar ─────────────────────────────────────────── */
.docs-sidebar {
  position: sticky;
  top: 80px;
  align-self: start;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  font-size: var(--tx-2);
  padding-right: 8px;
}

.docs-sidebar h5 {
  margin: 16px 0 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.docs-sidebar h5:first-child { margin-top: 0; }

.docs-sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0 0 0 0;
  display: flex;
  flex-direction: column;
}

.docs-sidebar a {
  display: block;
  padding: 5px 10px;
  border-radius: 6px;
  color: var(--ink-2);
  text-decoration: none;
  font-weight: 450;
  line-height: 1.4;
  transition: color 0.15s, background-color 0.15s;
}

.docs-sidebar a:hover {
  color: var(--ink);
  background: var(--bg-sunk);
}

.docs-sidebar a.active {
  color: var(--ink);
  background: var(--bg-sunk);
  font-weight: 550;
}

/* ── Article ─────────────────────────────────────────── */
.docs-article {
  font-size: var(--tx-3);
  line-height: 1.65;
  color: var(--ink-2);
  min-width: 0;
}

.docs-article > section {
  scroll-margin-top: 80px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--line-2);
  margin-bottom: 32px;
}

.docs-article > section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.docs-article h1 {
  font-family: var(--font-display);
  font-size: var(--tx-7);
  letter-spacing: -0.02em;
  margin: 0 0 8px;
  color: var(--ink);
  font-weight: 600;
}

.docs-article h2 {
  font-family: var(--font-display);
  font-size: var(--tx-6);
  letter-spacing: -0.01em;
  margin: 32px 0 12px;
  color: var(--ink);
  font-weight: 600;
  scroll-margin-top: 80px;
}

.docs-article h3 {
  font-family: var(--font-display);
  font-size: var(--tx-5);
  margin: 28px 0 10px;
  color: var(--ink);
  font-weight: 550;
  scroll-margin-top: 80px;
}

.docs-article h4 {
  font-size: var(--tx-4);
  margin: 20px 0 8px;
  color: var(--ink);
  font-weight: 600;
  scroll-margin-top: 80px;
}

.docs-article p {
  margin: 0 0 14px;
}

.docs-article a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.15s;
}

.docs-article a:hover {
  text-decoration-color: var(--accent);
}

.docs-article ul, .docs-article ol {
  margin: 0 0 16px 0;
  padding-left: 22px;
}

.docs-article li {
  margin-bottom: 4px;
}

.docs-article code:not(pre code) {
  background: var(--code-bg);
  color: var(--code-ink);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.88em;
  white-space: nowrap;
}

.docs-article pre {
  background: var(--code-bg);
  color: var(--code-ink);
  padding: 16px 18px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 0 0 16px;
  font-family: var(--font-mono);
  font-size: var(--tx-2);
  line-height: 1.55;
  border: 1px solid var(--line-2);
}

.docs-article pre code {
  background: transparent;
  padding: 0;
  color: inherit;
  font-size: inherit;
  white-space: pre;
}

.docs-article blockquote {
  margin: 16px 0;
  padding: 10px 14px;
  border-left: 2px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 6px 6px 0;
  color: var(--ink-2);
  font-size: var(--tx-3);
}

.docs-article blockquote p { margin: 0; }

/* Property tables */
.docs-article table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0 20px;
  font-size: var(--tx-2);
}

.docs-article th, .docs-article td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line-2);
  vertical-align: top;
}

.docs-article th {
  font-weight: 600;
  color: var(--ink);
  background: var(--bg-sunk);
  font-size: 12px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.docs-article td code {
  font-size: 12px;
  padding: 1px 5px;
}

.docs-article hr {
  border: 0;
  border-top: 1px solid var(--line-2);
  margin: 24px 0;
}

/* Callout / note box */
.docs-note {
  background: var(--bg-sunk);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 16px 0;
  font-size: var(--tx-3);
  color: var(--ink-2);
}

.docs-note strong { color: var(--ink); }

/* ── Right TOC ──────────────────────────────────────── */
.docs-toc {
  position: sticky;
  top: 80px;
  align-self: start;
  font-size: var(--tx-2);
  padding-left: 16px;
  border-left: 1px solid var(--line-2);
  max-height: calc(100vh - 96px);
  overflow-y: auto;
}

.docs-toc h6 {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.docs-toc ul { list-style: none; margin: 0; padding: 0; }
.docs-toc li { margin: 0; }
.docs-toc a {
  display: block;
  padding: 4px 8px;
  color: var(--ink-3);
  text-decoration: none;
  border-left: 2px solid transparent;
  margin-left: -10px;
  padding-left: 10px;
  font-weight: 450;
  line-height: 1.45;
  transition: color 0.15s, border-color 0.15s;
}
.docs-toc a:hover { color: var(--ink); }
.docs-toc a.active {
  color: var(--ink);
  border-left-color: var(--accent);
  font-weight: 550;
}

/* TOC nesting (h3 children) */
.docs-toc ul ul { padding-left: 12px; margin: 2px 0; }
.docs-toc ul ul a { font-size: 11.5px; padding-top: 3px; padding-bottom: 3px; }

/* ── Top bar lives in main nav, but we add subtle docs banner ── */
.docs-banner {
  border-bottom: 1px solid var(--line-2);
  padding: 14px 24px;
  background: var(--bg-elev);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: var(--tx-2);
  color: var(--ink-3);
}

.docs-banner .crumb { font-weight: 500; color: var(--ink-2); }
.docs-banner .crumb-sep { opacity: 0.4; }

/* ── Inline keys & token chips ─────────────────────── */
.kbd {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg-elev);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-2);
  box-shadow: 0 1px 0 var(--line-2);
}

/* Section anchor link (visible on hover) */
.anchor-link {
  margin-left: 8px;
  color: var(--ink-3);
  opacity: 0;
  text-decoration: none;
  font-weight: 400;
}
.docs-article h2:hover .anchor-link,
.docs-article h3:hover .anchor-link,
.docs-article h4:hover .anchor-link { opacity: 1; }

/* ── Install cards (VSCode / Open VSX / .vsix) ─────────── */
.install-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin: 16px 0 8px;
}
.install-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  text-decoration: none !important;
  color: var(--ink-2) !important;
  transition: border-color 0.15s, transform 0.15s, background-color 0.15s;
}
.install-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  background: var(--bg);
}
.install-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: var(--tx-3);
}
.install-card-head strong { font-weight: 600; }
.install-card p {
  margin: 0;
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.45;
}
.install-card-cta {
  margin-top: auto;
  padding-top: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0;
}

/* ── Search modal (Cmd+K) ───────────────────────────────────── */
.docs-search-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: start center;
  padding-top: 14vh;
  pointer-events: none;
}
.docs-search-overlay[hidden] { display: none !important; }
.docs-search-backdrop {
  position: absolute;
  inset: 0;
  /* Flat dark scrim — no backdrop-filter. Live blur compositor cost
   * made the open animation stutter on integrated GPUs; the deeper
   * scrim alpha reads almost identically. */
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
  transition: opacity 140ms ease;
  pointer-events: auto;
  cursor: zoom-out;
}
.docs-search-overlay.open .docs-search-backdrop { opacity: 1; }

.docs-search-panel {
  position: relative;
  width: min(640px, calc(100vw - 32px));
  max-height: min(72vh, 640px);
  display: flex;
  flex-direction: column;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  opacity: 0;
  transform: translateY(-8px) scale(0.985);
  transition: opacity 180ms cubic-bezier(.32,.72,.32,1),
              transform 180ms cubic-bezier(.32,.72,.32,1);
  pointer-events: auto;
}

@supports (color: color(display-p3 0 0 0)) {
  .docs-search-panel {
  box-shadow: 0 24px 64px color(display-p3 0.0000 0.0000 0.0000 / 0.45);
  }
}

@supports (color: color(rec2020 0 0 0)) {
  .docs-search-panel {
  box-shadow: 0 24px 64px color(rec2020 0.0000 0.0000 0.0000 / 0.45);
  }
}
.docs-search-overlay.open .docs-search-panel {
  opacity: 1;
  transform: none;
}

.docs-search-input-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line-2);
}
.docs-search-input-row > svg { color: var(--ink-3); flex-shrink: 0; }
.docs-search-input {
  flex: 1;
  appearance: none;
  border: none;
  background: transparent;
  outline: none;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  padding: 0;
}
.docs-search-input::placeholder { color: var(--ink-3); }
.docs-search-esc {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink-3);
  background: var(--bg);
}

.docs-search-results {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}
.docs-search-result {
  display: grid;
  grid-template-columns: 24px 1fr 16px;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: transparent;
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
  transition: background-color 80ms;
}
.docs-search-result:not(:last-child) { margin-bottom: 1px; }
.docs-search-result.active {
  background: var(--bg-sunk);
}
.docs-search-result.active .docs-search-arrow { opacity: 1; }
.docs-search-hash {
  font-family: var(--font-mono);
  color: var(--ink-3);
  font-size: 14px;
  text-align: center;
}
.docs-search-result.active .docs-search-hash {
  color: var(--accent);
}
.docs-search-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.docs-search-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.docs-search-section {
  font-size: 12px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.docs-search-result mark {
  background: var(--accent-soft);
  color: var(--ink);
  padding: 0 1px;
  border-radius: 2px;
}
.docs-search-arrow {
  font-family: var(--font-mono);
  color: var(--ink-3);
  font-size: 12px;
  opacity: 0;
  transition: opacity 120ms;
}
.docs-search-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--ink-3);
  font-size: var(--tx-3);
}
.docs-search-empty code {
  background: var(--bg-sunk);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink);
}

.docs-search-footer {
  display: flex;
  gap: 16px;
  padding: 10px 16px;
  border-top: 1px solid var(--line-2);
  font-size: 11px;
  color: var(--ink-3);
  font-family: var(--font-mono);
  background: var(--bg-sunk);
}
.docs-search-footer kbd {
  display: inline-block;
  padding: 1px 6px;
  margin-right: 4px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--bg);
  color: var(--ink-2);
  font-size: 10px;
  font-family: inherit;
}

/* ── Copy button on every <pre> code block ─────────────────── */
.docs-pre-wrap {
  position: relative;
}
.docs-pre-wrap pre {
  /* Reserve a bit of space so long lines don't run under the button. */
  padding-right: 56px;
}
.docs-copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-elev) 92%, transparent);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: var(--ink-3);
  cursor: pointer;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 140ms ease, color 120ms, border-color 120ms, background-color 120ms, transform 100ms;
}
.docs-pre-wrap:hover .docs-copy-btn,
.docs-pre-wrap:focus-within .docs-copy-btn,
.docs-copy-btn:focus-visible {
  opacity: 1;
}
.docs-copy-btn:hover {
  color: var(--ink);
  border-color: var(--ink-3);
  background: var(--bg-elev);
}
.docs-copy-btn:active { transform: scale(0.94); }
.docs-copy-btn.done {
  opacity: 1;
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}
.docs-copy-icon { display: block; }
.docs-copy-icon-done { display: none; }
.docs-copy-btn.done .docs-copy-icon-default { display: none; }
.docs-copy-btn.done .docs-copy-icon-done    { display: block; }

/* ── Shared bottom-center toast ────────────────────────────── */
.docs-toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translate(-50%, 24px);
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--bg);
  border-radius: 999px;
  font-size: var(--tx-2);
  font-weight: 500;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms cubic-bezier(0.32, 0.72, 0.32, 1),
              transform 200ms cubic-bezier(0.32, 0.72, 0.32, 1);
  z-index: 220;
  white-space: nowrap;
  max-width: calc(100vw - 32px);
  overflow: hidden;
  text-overflow: ellipsis;
}
.docs-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
.docs-toast svg {
  color: oklch(0.78 0.18 145);
  flex-shrink: 0;
}
@media (prefers-reduced-motion: reduce) {
  .docs-toast { transition: opacity 120ms; }
  .docs-toast.show { transform: translate(-50%, 0); }
}
