:root {
  --sidebar-w: 290px;
  --bg: #ffffff;
  --fg: #24292e;
  --muted: #6a737d;
  --link: #0366d6;
  --hl: #fff3b0;
  --border: #e1e4e8;
  --bg-alt: #fafbfc;
  --hl-dot: #b8d8ff;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --fg: #c9d1d9;
    --muted: #8b949e;
    --link: #58a6ff;
    --hl: #574a14;
    --border: #30363d;
    --bg-alt: #161b22;
    --hl-dot: #1f6feb;
  }
}
html, body { background: var(--bg); }
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  color: var(--fg);
  font-size: 14px;
  line-height: 1.5;
}
body.page {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}
.sidebar {
  border-right: 1px solid var(--border);
  background: var(--bg-alt);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 0.6em 0.8em;
  font-size: 13px;
}
.sidebar > header {
  font-weight: 600;
  padding-bottom: 0.4em;
  margin-bottom: 0.4em;
  border-bottom: 1px solid var(--border);
}
.sidebar a { color: var(--link); text-decoration: none; }
.sidebar a:hover { text-decoration: underline; }

.tree ul { list-style: none; padding-left: 0.9em; margin: 0; }
.tree > ul { padding-left: 0; }
.tree li { padding: 1px 0; }
.tree li.dir > .label {
  cursor: pointer;
  user-select: none;
  font-weight: 600;
  color: var(--fg);
}
.tree li.dir > .label::before { content: "\25B8"; display: inline-block; width: 1em; color: var(--muted); }
.tree li.dir.open > .label::before { content: "\25BE"; }
.tree li.dir > ul { display: none; }
.tree li.dir.open > ul { display: block; }
.tree a.current { background: var(--hl); padding: 0 2px; border-radius: 2px; font-weight: 600; }

.outline { margin-top: 1em; border-top: 1px solid var(--border); padding-top: 0.6em; }
.outline-heading { font-weight: 600; margin-bottom: 0.3em; color: var(--muted); text-transform: uppercase; font-size: 11px; letter-spacing: 0.05em; }
.outline ul { list-style: none; padding: 0; margin: 0; }
.outline li { padding: 0; }
.outline a { display: block; padding: 1px 2px; color: var(--fg); }
.outline a:hover { background: var(--bg-alt); text-decoration: none; }
.outline .kind { color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; margin-right: 0.4em; }
.outline .name { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

main { padding: 0.6em 1.2em 2em; min-width: 0; }
main > header { padding: 0.4em 0; border-bottom: 1px solid var(--border); margin-bottom: 0.8em; }
main > header .sep { color: var(--muted); margin: 0 0.4em; }
main code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.95em; }
.welcome { max-width: 50em; }
.source pre { font-size: 12.5px; line-height: 1.5; margin: 0; }
.highlight :target { background: var(--hl); }
/* Line numbers live in their own column, as generated text, so selecting
   the code does not put them on the clipboard. */
table.highlighttable { width: 100%; border-collapse: collapse; border-spacing: 0; }
table.highlighttable > tbody > tr { display: flex; align-items: flex-start; }
td.linenos {
  flex: none;
  user-select: none;
  -webkit-user-select: none;
  text-align: right;
  padding-right: 0.8em;
  color: var(--muted);
}
td.linenos pre { user-select: none; -webkit-user-select: none; color: var(--muted); }
td.linenos span::before { content: attr(data-line); }
td.code { flex: 1; min-width: 0; overflow-x: auto; }
.source a.id { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--hl-dot); }
.source a.id:hover { color: var(--link); border-bottom-style: solid; }

@media (max-width: 800px) {
  body.page { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; max-height: 50vh; }
}
