:root {
  --sidebar-w: 260px;
  --accent: #0f6cbd;
  --accent-dark: #0a4a8f;
  --accent-light: #e6f2fc;
  --bg: #f7f9fc;
  --surface: #ffffff;
  --border: #dde3ea;
  --text: #1a2332;
  --text-muted: #5a6a7e;
  --code-bg: #1e2736;
  --code-text: #e8edf3;
  --tag-bg: #e6f2fc;
  --tag-text: #0a4a8f;
  --warn-bg: #fff8e6;
  --warn-border: #f0a832;
  --danger-bg: #fef0f0;
  --danger-border: #e05252;
  --success-bg: #edfaf3;
  --success-border: #2db87a;
  --radius: 6px;
  --shadow: 0 1px 4px rgba(0,0,0,0.08);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--code-bg);
  color: #c8d4e0;
  padding: 0;
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-brand {
  background: var(--accent-dark);
  padding: 18px 20px;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.5px;
  color: #fff;
  text-transform: uppercase;
}
.sidebar-brand span { display: block; font-size: 10px; font-weight: 400; opacity: 0.7; margin-top: 2px; letter-spacing: 0; text-transform: none; }
.sidebar-section { padding: 12px 20px 4px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: #6a849a; }
.sidebar a {
  display: block;
  padding: 7px 20px;
  color: #b0c4d8;
  text-decoration: none;
  font-size: 13.5px;
  border-left: 3px solid transparent;
  transition: all 0.15s;
}
.sidebar a:hover { color: #fff; background: rgba(255,255,255,0.06); }
.sidebar a.active { color: #fff; border-left-color: var(--accent); background: rgba(15,108,189,0.15); }
.sidebar a .badge { float: right; font-size: 10px; background: rgba(255,255,255,0.1); border-radius: 10px; padding: 1px 6px; margin-top: 2px; }

/* ── Main ── */
main {
  margin-left: var(--sidebar-w);
  max-width: 900px;
  padding: 40px 48px 80px;
}

.page-header {
  margin-bottom: 36px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--border);
}
.page-header .breadcrumb { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.page-header h1 { font-size: 28px; font-weight: 700; color: var(--text); line-height: 1.2; }
.page-header .subtitle { margin-top: 8px; color: var(--text-muted); font-size: 15px; }

h2 { font-size: 20px; font-weight: 700; margin: 36px 0 12px; color: var(--text); padding-bottom: 6px; border-bottom: 1px solid var(--border); }
h3 { font-size: 16px; font-weight: 600; margin: 24px 0 8px; color: var(--text); }
h4 { font-size: 14px; font-weight: 600; margin: 16px 0 6px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

p { margin-bottom: 14px; }
ul, ol { margin: 0 0 14px 20px; }
li { margin-bottom: 4px; }

/* ── Code ── */
pre {
  background: var(--code-bg);
  color: var(--code-text);
  border-radius: var(--radius);
  padding: 18px 20px;
  overflow-x: auto;
  margin: 16px 0;
  font-size: 13.5px;
  line-height: 1.6;
  box-shadow: var(--shadow);
}
code {
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
}
p code, li code, td code {
  background: var(--accent-light);
  color: var(--accent-dark);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 13px;
}

/* ── Syntax colors (manual) ── */
.kw { color: #7ec8f5; }       /* keywords */
.ty { color: #4ec9b0; }       /* types */
.st { color: #ce9178; }       /* strings */
.cm { color: #6a9955; }       /* comments */
.nu { color: #b5cea8; }       /* numbers */
.fn { color: #dcdcaa; }       /* functions */
.di { color: #f9c74f; font-weight: 600; }   /* directive */
.op { color: #c3a6e8; }       /* options */
.pa { color: #9cdcfe; }       /* path */

/* ── Callouts ── */
.callout {
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: 18px 0;
  border-left: 4px solid;
  font-size: 14px;
}
.callout.info { background: var(--accent-light); border-color: var(--accent); }
.callout.warn { background: var(--warn-bg); border-color: var(--warn-border); }
.callout.danger { background: var(--danger-bg); border-color: var(--danger-border); }
.callout.success { background: var(--success-bg); border-color: var(--success-border); }
.callout strong { display: block; margin-bottom: 4px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; }

/* ── Tables ── */
table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 14px; }
th { background: var(--accent); color: #fff; padding: 9px 12px; text-align: left; font-weight: 600; font-size: 13px; }
td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:hover td { background: var(--accent-light); }
tr:last-child td { border-bottom: none; }

/* ── Tags / Chips ── */
.tag {
  display: inline-block;
  background: var(--tag-bg);
  color: var(--tag-text);
  border-radius: 12px;
  padding: 2px 9px;
  font-size: 12px;
  font-weight: 600;
  margin: 2px;
}
.tag.green { background: var(--success-bg); color: #1a7a50; }
.tag.orange { background: var(--warn-bg); color: #8a5a00; }
.tag.red { background: var(--danger-bg); color: #8a2020; }
.tag.gray { background: #eee; color: #555; }

/* ── Expression demo boxes ── */
.expr-box {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 12px 0;
  font-family: 'Cascadia Code', 'Fira Code', monospace;
  font-size: 14px;
}
.expr-box .label { font-size: 10px; color: #6a849a; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; font-family: sans-serif; }
.expr-box .result { margin-top: 10px; color: #3fb950; font-size: 13px; }
.expr-box .result::before { content: '→ '; color: #6a849a; }

/* ── Cards ── */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin: 20px 0; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  display: block;
  transition: box-shadow 0.15s, transform 0.15s;
}
.card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.12); transform: translateY(-1px); }
.card .card-icon { font-size: 24px; margin-bottom: 10px; }
.card h3 { margin: 0 0 6px; font-size: 15px; color: var(--accent); }
.card p { margin: 0; font-size: 13px; color: var(--text-muted); line-height: 1.5; }

/* ── Steps ── */
.steps { counter-reset: step; }
.step { display: flex; gap: 16px; margin-bottom: 24px; }
.step-num {
  counter-increment: step;
  width: 32px; height: 32px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
  flex-shrink: 0;
  margin-top: 2px;
}
.step-content { flex: 1; }
.step-content h3 { margin-top: 0; border: none; padding: 0; }

/* ── TOC ── */
.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 32px;
  font-size: 13.5px;
}
.toc h4 { margin: 0 0 10px; color: var(--text-muted); }
.toc ol { margin: 0; padding-left: 18px; }
.toc li { margin-bottom: 3px; }
.toc a { color: var(--accent); text-decoration: none; }
.toc a:hover { text-decoration: underline; }

/* ── Pipeline diagram ── */
.pipeline {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 20px 0;
  flex-wrap: wrap;
}
.pipeline-box {
  background: var(--surface);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: 10px 16px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  min-width: 110px;
}
.pipeline-arrow { color: var(--text-muted); font-size: 20px; padding: 0 8px; }

/* ── Scrollbar ── */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: #3a4f61; border-radius: 2px; }

/* Logo in sidebar */
.sidebar-logo {
  display: block;
  width: 120px;
  margin-bottom: 10px;
  opacity: 0.9;
}
