/* docs.css — the custom widget docs (views/docs.ejs) */

.docs-container { max-width: 1240px; }

.docs-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.docs-layout {
  display: grid;
  flex: 1;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 3rem;
  width: 100%;
  padding-top: 2rem;
  padding-bottom: 4rem;
}

/* ── Navigation ────────────────────────────────────────────────────────────── */
.docs-nav {
  position: sticky;
  top: 1.5rem;
  align-self: start;
  max-height: calc(100vh - 3rem);
  overflow-y: auto;
}

.docs-nav-toggle { display: none; }

.docs-nav-list,
.docs-toc { list-style: none; }

.docs-nav-link {
  display: block;
  padding: 0.35rem 0.75rem;
  border-left: 2px solid #2a2a2e;
  color: var(--text-muted);
  font-size: 0.92rem;
  text-decoration: none;
}
.docs-nav-link:hover { color: var(--text); border-left-color: #4a4a52; }
.docs-nav-link.active { border-left-color: var(--purple); color: var(--text); font-weight: 600; }

.docs-toc { margin: 0.15rem 0 0.5rem; border-left: 2px solid #2a2a2e; }
.docs-toc a {
  display: block;
  padding: 0.2rem 0.75rem 0.2rem 1.5rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  text-decoration: none;
}
.docs-toc a:hover { color: var(--text); }

.docs-ai {
  margin-top: 1.5rem;
  padding: 1rem;
  border: 1px solid #2a2a2e;
  border-radius: 10px;
  background: var(--surface);
}
.docs-ai-title { font-size: 0.9rem; font-weight: 600; }
.docs-ai-title i { color: var(--purple); margin-right: 0.25rem; }
.docs-ai-hint { margin: 0.35rem 0 0.75rem; color: var(--text-muted); font-size: 0.8rem; line-height: 1.45; }
.docs-ai-copy { width: 100%; text-align: center; }
.docs-ai-links { margin-top: 0.6rem; color: var(--text-muted); font-size: 0.8rem; text-align: center; }
.docs-ai-links a { color: var(--text-muted); }
.docs-ai-links a:hover { color: var(--text); }

/* ── Page ──────────────────────────────────────────────────────────────────── */
.docs-main { min-width: 0; }

.docs-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.docs-actions .btn { padding: 0.3rem 0.75rem; font-size: 0.8rem; }
.docs-actions .btn-ghost { border: 1px solid #2a2a2e; } /* buttons too, like the link beside them */
.docs-language-note { margin-right: auto; color: var(--text-muted); font-size: 0.8rem; }

/* ── Article ───────────────────────────────────────────────────────────────── */
.docs-article {
  max-width: 820px;
  font-size: 1rem;
  line-height: 1.7;
}

.docs-article > * + * { margin-top: 1rem; }

.docs-article h1 { font-size: 2.1rem; line-height: 1.25; }
.docs-article h1 + p { color: var(--text-muted); font-size: 1.1rem; }
.docs-article h2 {
  margin-top: 2.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid #2a2a2e;
  font-size: 1.5rem;
  line-height: 1.3;
}
.docs-article h3 { margin-top: 2rem; font-size: 1.2rem; }
.docs-article h4 { margin-top: 1.5rem; font-size: 1rem; }
.docs-article :is(h1, h2, h3, h4) { position: relative; scroll-margin-top: 1rem; }

.docs-anchor {
  position: absolute;
  left: -1.1em;
  padding-right: 0.3em;
  color: var(--text-muted);
  font-weight: 400;
  text-decoration: none;
  opacity: 0;
}
.docs-article :is(h1, h2, h3, h4):hover .docs-anchor,
.docs-anchor:focus { opacity: 1; }

.docs-article a { color: #bf94ff; }
.docs-article a:hover { color: #d7bbff; }
.docs-article strong { color: #fff; }

.docs-article :is(ul, ol) { padding-left: 1.5rem; }
.docs-article li + li { margin-top: 0.3rem; }

.docs-article :not(pre) > code {
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: rgba(145, 71, 255, 0.14);
  color: #e3d3ff;
  font-family: ui-monospace, 'Cascadia Code', 'JetBrains Mono', Consolas, monospace;
  font-size: 0.88em;
  overflow-wrap: anywhere;
}

.docs-article blockquote {
  padding: 0.75rem 1rem;
  border-left: 3px solid #f5a623;
  border-radius: 0 8px 8px 0;
  background: rgba(245, 166, 35, 0.08);
}
.docs-article blockquote > * + * { margin-top: 0.6rem; }

/* Code blocks: language label, copy button (public/js/docs.js) */
.docs-code {
  position: relative;
  border: 1px solid #2a2a2e;
  border-radius: 8px;
  background: #111114;
}
.docs-code[data-lang]::before {
  content: attr(data-lang);
  position: absolute;
  top: 0.45rem;
  left: 0.85rem;
  color: var(--text-muted);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.docs-code pre {
  max-height: 34rem;
  padding: 1rem 0.95rem;
  overflow: auto;
  font-family: ui-monospace, 'Cascadia Code', 'JetBrains Mono', Consolas, monospace;
  font-size: 0.84rem;
  line-height: 1.55;
  tab-size: 2;
}
.docs-code[data-lang] pre { padding-top: 1.75rem; }

.docs-copy {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  padding: 0.2rem 0.55rem;
  border: 1px solid #2a2a2e;
  border-radius: 5px;
  background: var(--surface);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}
.docs-code:hover .docs-copy,
.docs-copy:focus-visible,
.docs-copy.is-done { opacity: 1; }
.docs-copy:hover { color: var(--text); }
@media (hover: none) { .docs-copy { opacity: 1; } }

/* Tables scroll on their own on narrow screens */
.docs-table { overflow-x: auto; border: 1px solid #2a2a2e; border-radius: 8px; }
.docs-table table { width: 100%; border-collapse: collapse; font-size: 0.9rem; line-height: 1.5; }
.docs-table :is(th, td) { padding: 0.5rem 0.75rem; border-bottom: 1px solid #2a2a2e; text-align: left; vertical-align: top; }
.docs-table th { background: var(--surface); font-weight: 600; white-space: nowrap; }
.docs-table td:first-child code { white-space: nowrap; }
.docs-table tr:last-child td { border-bottom: none; }

/* ── Previous / next ───────────────────────────────────────────────────────── */
.docs-pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  max-width: 820px;
  margin-top: 3.5rem;
}
.docs-pager-link {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  padding: 0.75rem 1rem;
  border: 1px solid #2a2a2e;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
}
.docs-pager-link:hover { border-color: var(--purple); }
.docs-pager-link small { color: var(--text-muted); font-size: 0.78rem; }
.docs-pager-link.is-next { margin-left: auto; text-align: right; }

/* ── Narrow screens: the navigation folds above the page ───────────────────── */
@media (max-width: 900px) {
  .docs-layout { grid-template-columns: minmax(0, 1fr); gap: 1.25rem; padding-top: 1rem; }
  .docs-nav { position: static; max-height: none; border: 1px solid #2a2a2e; border-radius: 10px; background: var(--surface); }
  .docs-nav-toggle { display: block; padding: 0.75rem 1rem; font-weight: 600; cursor: pointer; }
  .docs-nav-toggle i { margin-right: 0.4rem; color: var(--purple); }
  .docs-nav > nav { padding: 0 0.5rem 0.5rem; }
  .docs-ai { margin: 0.5rem; }
  .docs-article h1 { font-size: 1.7rem; }
  .docs-anchor { display: none; }
  .site-header .tagline { display: none; }
}
