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

:root {
  --bg: #fafafa;
  --fg: #1a1a1a;
  --sidebar-bg: #f0f0f0;
  --sidebar-w: 260px;
  --border: #e0e0e0;
  --accent: #2563eb;
  --accent-light: #dbeafe;
  --code-bg: #f5f5f5;
  --callout-note: #2563eb;
  --callout-tip: #059669;
  --callout-warning: #d97706;
  --callout-important: #7c3aed;
  --callout-caution: #dc2626;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.7;
  color: var(--fg);
  background: var(--bg);
}

/* Layout */
.wiki-shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 1.5rem 1rem;
  overflow-y: auto;
  position: sticky;
  top: 0;
  height: 100vh;
  font-size: 13px;
}
.sidebar-title {
  display: block;
  font-weight: 700;
  font-size: 16px;
  color: var(--fg);
  text-decoration: none;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}
.sidebar ul { list-style: none; }
.sidebar .nav-root > li { margin-bottom: 0.75rem; }
.sidebar .nav-root > li > a { font-weight: 600; }
.sidebar .nav-children { padding-left: 1rem; margin-top: 0.25rem; }
.sidebar .nav-children li { margin-bottom: 0.15rem; }
.sidebar a {
  color: var(--fg);
  text-decoration: none;
  opacity: 0.8;
}
.sidebar a:hover { opacity: 1; color: var(--accent); }

/* Content */
.content {
  flex: 1;
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 3rem;
}

/* Typography */
h1 { font-size: 1.8rem; margin: 0 0 1rem; border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; }
h2 { font-size: 1.4rem; margin: 2rem 0 0.75rem; }
h3 { font-size: 1.15rem; margin: 1.5rem 0 0.5rem; }
h4, h5, h6 { font-size: 1rem; margin: 1.25rem 0 0.5rem; }
p { margin: 0.75rem 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
strong { font-weight: 600; }

/* Tags */
.tags { margin-bottom: 1rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 3px;
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 500;
}

/* Tables */
table { border-collapse: collapse; width: 100%; margin: 1rem 0; font-size: 14px; }
th, td { border: 1px solid var(--border); padding: 0.5rem 0.75rem; text-align: left; }
th { background: var(--sidebar-bg); font-weight: 600; }

/* Code */
code {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 13px;
  background: var(--code-bg);
  padding: 2px 5px;
  border-radius: 3px;
}
pre { background: var(--code-bg); padding: 1rem; border-radius: 6px; overflow-x: auto; margin: 1rem 0; }
pre code { background: none; padding: 0; }

/* Lists */
ul, ol { margin: 0.5rem 0; padding-left: 1.5rem; }
li { margin: 0.25rem 0; }
li input[type="checkbox"] { margin-right: 0.5rem; }

/* Blockquotes */
blockquote {
  border-left: 3px solid var(--border);
  margin: 1rem 0;
  padding: 0.5rem 1rem;
  color: #555;
}

/* Callouts */
.callout {
  border-left: 4px solid var(--callout-note);
  border-radius: 4px;
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  background: #f8fafc;
  color: var(--fg);
}
.callout-title { font-weight: 700; margin-bottom: 0.25rem; }
.callout-note { border-left-color: var(--callout-note); }
.callout-info { border-left-color: var(--callout-note); }
.callout-tip { border-left-color: var(--callout-tip); }
.callout-success { border-left-color: var(--callout-tip); }
.callout-warning { border-left-color: var(--callout-warning); }
.callout-important { border-left-color: var(--callout-important); }
.callout-caution { border-left-color: var(--callout-caution); }
.callout-danger { border-left-color: var(--callout-caution); }

/* Wiki links */
.wiki-link { color: var(--accent); font-weight: 500; }
.wiki-link:hover { text-decoration: underline; }

/* Responsive */
@media (max-width: 768px) {
  .wiki-shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; border-right: none; border-bottom: 1px solid var(--border); }
  .content { padding: 1.5rem; }
}
