:root {
  --bg: #0e1013;
  --bg2: #14171c;
  --bg3: #1a1e25;
  --line: #262c36;
  --text: #d7dce3;
  --muted: #8b93a1;
  --accent: #e8a33d;
  --accent2: #c97b2d;
  --link: #e8a33d;
  --code-bg: #171b22;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

.layout { display: flex; min-height: 100vh; }

/* ---------- sidebar ---------- */
.sidebar {
  width: 290px; flex: 0 0 290px;
  background: var(--bg2);
  border-right: 1px solid var(--line);
  padding: 18px 14px 14px;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow: hidden;
}
.brand { font-weight: 800; font-size: 22px; letter-spacing: 1px; padding: 2px 6px 12px; }
.brand a { color: var(--text); }
.brand span { color: var(--accent); }
.searchbox { padding: 0 0 10px; }
.searchbox input {
  width: 100%; padding: 8px 10px;
  background: var(--bg3); color: var(--text);
  border: 1px solid var(--line); border-radius: 6px;
  font-size: 14px; outline: none;
}
.searchbox input:focus { border-color: var(--accent2); }
#nav { overflow-y: auto; flex: 1; padding-bottom: 8px; }
#nav a {
  display: block; padding: 4px 8px; border-radius: 5px;
  color: var(--muted); font-size: 13.5px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
#nav a:hover { color: var(--text); background: var(--bg3); text-decoration: none; }
#nav a.on { color: var(--accent); background: var(--bg3); font-weight: 600; }
.sidefoot { font-size: 11px; color: var(--muted); padding: 10px 6px 0; border-top: 1px solid var(--line); }

/* ---------- content ---------- */
.content { flex: 1; min-width: 0; padding: 26px 44px 60px; max-width: 980px; }
.crumb { font-size: 12.5px; color: var(--muted); margin-bottom: 18px; }
.crumb a { color: var(--muted); }
.crumb a:hover { color: var(--link); }
article h1 {
  font-size: 30px; line-height: 1.25; margin: 0 0 6px; color: #fff;
  border-bottom: 2px solid var(--line); padding-bottom: 14px;
}
article h2 { font-size: 21px; color: var(--accent); margin: 30px 0 10px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
article h3 { font-size: 17px; color: #f0ede6; margin: 22px 0 8px; }
article p { margin: 10px 0; }
article ul, article ol { padding-left: 22px; margin: 10px 0; }
article li { margin: 4px 0; }
article blockquote {
  margin: 14px 0; padding: 10px 16px;
  background: var(--bg2); border-left: 3px solid var(--accent2);
  color: var(--muted); border-radius: 0 6px 6px 0;
}
article code {
  background: var(--code-bg); border: 1px solid var(--line);
  padding: 1px 6px; border-radius: 4px; font-size: 13.5px;
  font-family: "SF Mono", Menlo, Consolas, monospace;
}
article pre {
  background: var(--code-bg); border: 1px solid var(--line);
  padding: 14px; border-radius: 8px; overflow-x: auto;
}
article pre code { border: none; padding: 0; background: none; }
article table {
  border-collapse: collapse; width: 100%; margin: 14px 0; font-size: 14.5px;
}
article th, article td { border: 1px solid var(--line); padding: 7px 11px; text-align: left; }
article th { background: var(--bg2); color: #fff; font-weight: 600; }
article tr:nth-child(even) td { background: var(--bg2); }
article hr { border: none; border-top: 1px solid var(--line); margin: 26px 0; }
.pagefoot { margin-top: 44px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }

/* ---------- search results ---------- */
#results {
  position: absolute; z-index: 20; background: var(--bg3);
  border: 1px solid var(--line); border-radius: 8px; max-height: 320px;
  overflow-y: auto; box-shadow: 0 8px 24px rgba(0,0,0,.5);
}
#results a { display: block; padding: 8px 12px; color: var(--text); font-size: 13.5px; }
#results a:hover { background: var(--bg2); text-decoration: none; color: var(--accent); }
#results .tag { color: var(--muted); font-size: 11px; margin-left: 6px; }

@media (max-width: 860px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .content { padding: 20px 18px 50px; }
}
