/* Docs pages — standalone stylesheet (the docs entry does not import index.css).
 * The :root tokens are re-declared here, mirroring src/bulk-analyzer.css; keep
 * the values in sync with src/index.css (see DESIGN.md). Rendered-markdown
 * element → token mapping is intentional and documented inline below. */

:root {
  --color-primary: #0d1421;
  --color-secondary: #e8edf6;
  --color-accent: #1ba6c9;
  --color-brand: #9b86f5;
  --color-neutral: #8b95ad;
  --color-muted: #6b7892;
  --color-faint: #566076;
  --color-border: rgba(110, 135, 170, 0.28);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    monospace;
  font-size: 14px;
  line-height: 1.6;
  color-scheme: dark;
  background: var(--color-primary);
  color: var(--color-secondary);
  min-height: 100vh;
}

/* Readable prose measure, centered; narrower than the app's 70vw because docs
 * are text, not data tables. Wide code/tables scroll inside their own boxes. */
.docs-page {
  width: min(92vw, 860px);
  margin: 0 auto;
  padding: 24px 0 64px;
}

/* ── Header + doc nav ────────────────────────────────────────────────────── */
.docs-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
  padding: 12px 0 20px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 28px;
}
.docs-home {
  display: inline-flex;
  text-decoration: none;
}
/* The shared SiteLogo lockup is sized at 40px in the app; scale it down for the
 * docs header so the nav sits beside it comfortably. */
.docs-home .site-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 26px;
  line-height: 1;
}
.docs-home .site-logo__mark {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--color-brand);
}
.docs-home .site-logo__gear {
  width: 0.72em;
  height: 0.72em;
  display: block;
}
.docs-home .site-logo__word {
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--color-secondary);
}
.docs-home .site-logo__tools {
  color: var(--color-brand);
}

.docs-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-left: auto;
}
/* Quiet nav links (muted → cyan on hover), mirroring .info-links in the app. */
.docs-nav__link {
  color: var(--color-muted);
  text-decoration: none;
  font-size: 14px;
}
.docs-nav__link:hover {
  color: var(--color-accent);
  text-decoration: underline;
}
/* Active doc = cyan, the interactive/active treatment from the design system. */
.docs-nav__link--active {
  color: var(--color-accent);
  font-weight: 700;
}

/* ── Index ───────────────────────────────────────────────────────────────── */
.docs-title {
  color: var(--color-secondary);
  font-size: 28px;
  margin-bottom: 20px;
}
.docs-index {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.docs-index__item {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 16px 18px;
  background: color-mix(in srgb, var(--color-primary) 90%, black);
}
.docs-index__link {
  color: var(--color-brand);
  text-decoration: none;
  font-size: 18px;
  font-weight: 700;
}
.docs-index__link:hover {
  text-decoration: underline;
}
.docs-index__desc {
  color: var(--color-muted);
  margin-top: 6px;
}
.docs-empty {
  color: var(--color-muted);
}

/* ── Rendered markdown article ───────────────────────────────────────────── */
/* Headings: ink (--color-secondary). Links: brand violet, underlined. Inline
 * code & pre: recessed surface. Tables: header on --color-primary, body on a
 * recessed mix, soft borders. Blockquote & hr: --color-border. */
.docs-article {
  color: var(--color-secondary);
}
.docs-article h1,
.docs-article h2,
.docs-article h3,
.docs-article h4,
.docs-article h5,
.docs-article h6 {
  color: var(--color-secondary);
  line-height: 1.25;
  margin: 1.6em 0 0.6em;
}
.docs-article h1 {
  font-size: 28px;
  margin-top: 0;
}
.docs-article h2 {
  font-size: 22px;
  padding-bottom: 0.3em;
  border-bottom: 1px solid var(--color-border);
}
.docs-article h3 {
  font-size: 18px;
}
.docs-article h4 {
  font-size: 15px;
}
.docs-article p,
.docs-article ul,
.docs-article ol {
  margin: 0.8em 0;
}
.docs-article ul,
.docs-article ol {
  padding-left: 1.5em;
}
.docs-article li {
  margin: 0.3em 0;
}
.docs-article a {
  color: var(--color-brand);
  text-decoration: underline;
}
.docs-article a:hover {
  color: color-mix(in srgb, var(--color-brand) 80%, white);
}
.docs-article strong {
  color: var(--color-secondary);
  font-weight: 700;
}

/* Inline code on a recessed surface. */
.docs-article :not(pre) > code {
  background: color-mix(in srgb, var(--color-primary) 80%, black);
  padding: 0.15em 0.4em;
  border-radius: 0.3em;
  font-size: 0.92em;
}
/* Fenced code blocks (including the mermaid source fallback) — recessed surface,
 * soft border, horizontal scroll instead of overflowing the page. */
.docs-article pre {
  background: color-mix(in srgb, var(--color-primary) 70%, black);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 14px 16px;
  margin: 1em 0;
  overflow-x: auto;
}
.docs-article pre code {
  font-size: 0.9em;
  white-space: pre;
}

/* Tables — full width, scroll horizontally when too wide for the column. */
.docs-article .docs-table-wrap,
.docs-article table {
  width: 100%;
}
.docs-article table {
  border-collapse: collapse;
  font-size: 13px;
  margin: 1em 0;
  display: block;
  overflow-x: auto;
  border: 1px solid var(--color-border);
}
.docs-article th {
  text-align: left;
  padding: 10px 14px;
  background: var(--color-primary);
  color: var(--color-secondary);
  font-weight: 600;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}
.docs-article td {
  padding: 10px 14px;
  background: color-mix(in srgb, var(--color-primary) 80%, black);
  border-bottom: 1px solid
    color-mix(in srgb, var(--color-muted) 30%, transparent);
  vertical-align: top;
}

.docs-article blockquote {
  margin: 1em 0;
  padding: 0.4em 1em;
  border-left: 3px solid var(--color-border);
  color: var(--color-muted);
}
.docs-article hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 2em 0;
}
.docs-article img {
  max-width: 100%;
  height: auto;
}

/* Build-time-rendered mermaid diagrams (inline SVG from scripts/gen-docs.ts). */
.docs-mermaid {
  margin: 1.4em 0;
  padding: 12px;
  text-align: center;
  overflow-x: auto;
  background: color-mix(in srgb, var(--color-primary) 70%, black);
  border: 1px solid var(--color-border);
  border-radius: 6px;
}
.docs-mermaid svg {
  max-width: 100%;
  height: auto;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */
.docs-footer {
  margin-top: 48px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
  color: var(--color-muted);
  font-size: 13px;
}
.docs-inline-link,
.docs-footer a {
  color: var(--color-brand);
  text-decoration: none;
}
.docs-inline-link:hover,
.docs-footer a:hover {
  text-decoration: underline;
}

@media (prefers-reduced-motion) {
  *,
  ::before,
  ::after {
    animation: none !important;
  }
}
