/* Static wiki — clean, neutral, self-contained theme (no external fonts/CDNs). */
:root {
  --bg: #ffffff;
  --fg: #1f2328;
  --muted: #57606a;
  --border: #d0d7de;
  --soft: #f6f8fa;
  --accent: #0b62d6;
  --accent-soft: #ddeafe;
  --max: 1320px;
  --radius: 8px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  color: var(--fg);
  background: var(--bg);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }

.wiki-skip {
  position: absolute; left: -999px; top: 0; background: var(--accent); color: #fff;
  padding: 8px 14px; border-radius: 0 0 var(--radius) 0; z-index: 50;
}
.wiki-skip:focus { left: 0; }

/* header */
.wiki-header {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 24px;
  padding: 12px 24px; background: var(--bg); border-bottom: 1px solid var(--border);
}
.wiki-brand { font-weight: 700; font-size: 1.05rem; color: var(--fg); white-space: nowrap; }
.wiki-brand:hover { text-decoration: none; color: var(--accent); }
.wiki-search { position: relative; margin-left: auto; width: min(420px, 50vw); }
.wiki-search input {
  width: 100%; padding: 8px 12px; font-size: 0.95rem;
  border: 1px solid var(--border); border-radius: 999px; background: var(--soft);
}
.wiki-search input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); background: #fff; }
.wiki-search__results {
  position: absolute; top: calc(100% + 6px); right: 0; left: 0;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(0,0,0,0.12); max-height: 70vh; overflow: auto; padding: 6px;
}
.wiki-search__results a {
  display: block; padding: 8px 10px; border-radius: 6px; color: var(--fg);
}
.wiki-search__results a:hover, .wiki-search__results a.active { background: var(--accent-soft); text-decoration: none; }
.wiki-search__results .r-title { font-weight: 600; }
.wiki-search__results .r-sec { font-size: 0.8rem; color: var(--muted); }
.wiki-search__results .r-empty { padding: 10px; color: var(--muted); }

/* layout */
.wiki-layout {
  display: grid; grid-template-columns: 280px minmax(0, 1fr) 240px;
  gap: 32px; max-width: var(--max); margin: 0 auto; padding: 28px 24px 64px;
}
.wiki-sidebar { position: sticky; top: 72px; align-self: start; max-height: calc(100vh - 96px); overflow: auto; }
.wiki-nav__group { margin-bottom: 18px; }
.wiki-nav__title { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 6px; }
.wiki-nav ul { list-style: none; margin: 0; padding: 0; }
.wiki-nav li a {
  display: block; padding: 4px 10px; border-radius: 6px; color: var(--fg); font-size: 0.92rem;
}
.wiki-nav li a:hover { background: var(--soft); text-decoration: none; }
.wiki-nav li a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.wiki-main { min-width: 0; }
.wiki-pagehead { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.wiki-breadcrumb { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.wiki-md-link {
  display: inline-flex; align-items: center; gap: 5px; flex: none;
  font-size: 0.78rem; font-weight: 600; color: var(--muted);
  border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; background: var(--soft);
}
.wiki-md-link:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }
.wiki-md-link svg { width: 13px; height: 13px; }

/* on-page toc */
.wiki-toc { position: sticky; top: 72px; align-self: start; font-size: 0.88rem; max-height: calc(100vh - 96px); overflow: auto; }
.wiki-toc__title { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 8px; }
.wiki-toc ul { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--border); }
.wiki-toc li a { display: block; padding: 3px 0 3px 12px; color: var(--muted); }
.wiki-toc li.toc-l3 a { padding-left: 24px; font-size: 0.85rem; }
.wiki-toc li a:hover { color: var(--accent); text-decoration: none; }

/* article content */
.wiki-article { font-size: 1rem; }
.wiki-article h1 { font-size: 2rem; line-height: 1.25; margin: 0 0 0.6em; }
.wiki-article h2 { font-size: 1.5rem; margin: 1.8em 0 0.6em; padding-bottom: 0.3em; border-bottom: 1px solid var(--border); }
.wiki-article h3 { font-size: 1.2rem; margin: 1.5em 0 0.5em; }
.wiki-article h4 { font-size: 1.05rem; margin: 1.3em 0 0.4em; }
.wiki-article p, .wiki-article ul, .wiki-article ol { margin: 0 0 1em; }
.wiki-article li { margin: 0.25em 0; }
.wiki-article a.anchor { float: left; margin-left: -1em; padding-right: 0.3em; color: var(--border); opacity: 0; }
.wiki-article :hover > a.anchor { opacity: 1; }
/* Generic blockquotes only — must NOT clobber .callout padding (callouts rely
   on the 44px left gutter for their absolutely-positioned icon). */
.wiki-article blockquote:not(.callout) { margin: 1em 0; padding: 0.5em 1em; border-left: 4px solid var(--border); color: var(--muted); background: var(--soft); }

/* code */
.wiki-article code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.88em; background: var(--soft); padding: 0.15em 0.4em; border-radius: 4px; }
.wiki-article pre { background: #0d1117; color: #e6edf3; padding: 16px; border-radius: var(--radius); overflow: auto; line-height: 1.5; }
.wiki-article pre code { background: none; padding: 0; font-size: 0.85rem; color: inherit; }

/* tables */
.table-wrap { overflow-x: auto; margin: 1em 0; }
.wiki-article table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
.wiki-article th, .wiki-article td { border: 1px solid var(--border); padding: 7px 11px; text-align: left; vertical-align: top; }
.wiki-article thead th { background: var(--soft); }
.wiki-article td.docs-cell--date, .wiki-article th.docs-cell--date { white-space: nowrap; }

/* callouts */
.callout { margin: 1.2em 0; padding: 12px 16px 12px 44px; border-radius: var(--radius); border: 1px solid var(--border); position: relative; background: var(--soft); }
.callout > :first-child { margin-top: 0; }
.callout > :last-child { margin-bottom: 0; }
.callout__icon { position: absolute; left: 14px; top: 14px; font-size: 1rem; line-height: 1; }
.callout--tip { border-color: #1a7f37; background: #eaf6ec; }
.callout--tip .callout__icon::before { content: "💡"; }
.callout--note { border-color: var(--accent); background: var(--accent-soft); }
.callout--note .callout__icon::before { content: "📝"; }
.callout--warning { border-color: #bf8700; background: #fff8e1; }
.callout--warning .callout__icon::before { content: "⚠️"; }
.callout--best { border-color: #1a7f37; background: #eaf6ec; }
.callout--best .callout__icon::before { content: "✅"; }
.callout--anti { border-color: #cf222e; background: #fbe9e7; }
.callout--anti .callout__icon::before { content: "⛔"; }
.callout--review { border-color: #bf8700; background: #fff8e1; padding-left: 16px; }
.callout__label { display: inline-block; font-weight: 700; margin-right: 6px; }

/* diagrams */
figure.diagram { margin: 1.4em 0; text-align: center; }
figure.diagram svg { max-width: 100%; height: auto; }
.diagram-source { white-space: pre; }
.mermaid { margin: 1.4em 0; text-align: center; }

/* pager */
.wiki-pager { display: flex; justify-content: space-between; gap: 16px; margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--border); }
.wiki-pager a { flex: 1; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius); color: var(--fg); }
.wiki-pager a:hover { border-color: var(--accent); text-decoration: none; }
.wiki-pager__next { text-align: right; }
.wiki-pager span { display: block; font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }

/* footer */
.wiki-footer { border-top: 1px solid var(--border); padding: 24px; text-align: center; color: var(--muted); font-size: 0.88rem; }

/* home */
.wiki-home h1 { font-size: 2.2rem; margin: 0 0 0.4em; }
.wiki-home__lead { font-size: 1.1rem; color: var(--muted); margin-bottom: 1.6em; }
.wiki-home__group { margin-bottom: 1.6em; }
.wiki-home__group h2 { font-size: 1.25rem; border-bottom: 1px solid var(--border); padding-bottom: 0.3em; }
.wiki-home__group ul { list-style: none; padding: 0; margin: 0.6em 0; columns: 2; }
.wiki-home__group li { margin: 0.3em 0; break-inside: avoid; }

/* responsive */
@media (max-width: 1100px) {
  .wiki-layout { grid-template-columns: 240px minmax(0,1fr); }
  .wiki-toc { display: none; }
}
@media (max-width: 800px) {
  .wiki-layout { grid-template-columns: 1fr; }
  .wiki-sidebar { position: static; max-height: none; border-bottom: 1px solid var(--border); padding-bottom: 16px; margin-bottom: 8px; }
  .wiki-header { flex-wrap: wrap; gap: 12px; }
  .wiki-search { width: 100%; margin-left: 0; }
  .wiki-home__group ul { columns: 1; }
}

/* minimal highlight.js token colours (dark theme) */
.hljs-comment, .hljs-quote { color: #8b949e; }
.hljs-keyword, .hljs-selector-tag, .hljs-built_in, .hljs-name { color: #ff7b72; }
.hljs-string, .hljs-attr, .hljs-template-tag, .hljs-addition { color: #a5d6ff; }
.hljs-number, .hljs-literal, .hljs-type { color: #79c0ff; }
.hljs-title, .hljs-section, .hljs-function .hljs-title { color: #d2a8ff; }
.hljs-attribute, .hljs-variable, .hljs-tag { color: #7ee787; }
.hljs-meta { color: #8b949e; }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 700; }
