/* Shared styles for both docs */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: #07090d;
  color: #e6edf3;
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
code, pre, .mono { font-family: 'JetBrains Mono', monospace; }

/* Layout: sidebar + content */
.app {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}
@media (max-width: 1024px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}

/* Sidebar */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid #161b22;
  padding: 28px 0;
  background: #0a0d12;
}
.sidebar-head {
  padding: 0 24px 24px;
  border-bottom: 1px solid #161b22;
  margin-bottom: 20px;
}
.sidebar-head a.back {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #6e7681;
  text-decoration: none;
  letter-spacing: 0.1em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
}
.sidebar-head a.back:hover { color: #e6edf3; }
.sidebar-head h3 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.sidebar-head .tag { font-family: 'JetBrains Mono', monospace; font-size: 10.5px; color: #6e7681; letter-spacing: 0.1em; }

.toc { list-style: none; padding: 0 12px; }
.toc li a {
  display: block;
  padding: 7px 14px;
  color: #8b949e;
  text-decoration: none;
  font-size: 13px;
  border-radius: 6px;
  border-left: 2px solid transparent;
  transition: all 0.15s;
}
.toc li a:hover { color: #e6edf3; background: rgba(255,255,255,0.03); }
.toc li a.active { color: #58a6ff; border-left-color: #58a6ff; background: rgba(56,139,253,0.06); }
.toc .group {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: #484f58;
  padding: 16px 14px 6px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

/* Content */
.content {
  padding: 48px 56px 120px;
  max-width: 1100px;
}
@media (max-width: 768px) {
  .content { padding: 32px 20px 80px; }
}

/* Section headers */
section { scroll-margin-top: 24px; margin-bottom: 72px; }
section h2 {
  font-size: 32px;
  font-weight: 300;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}
section h2 b { font-weight: 700; }
section > .sec-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #6e7681;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}
section > .sec-tag .num {
  width: 24px; height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(56,139,253,0.12);
  color: #58a6ff;
  border-radius: 4px;
  font-size: 11px;
}
section h3 {
  font-size: 19px;
  font-weight: 600;
  margin: 32px 0 12px;
  letter-spacing: -0.005em;
}
section h4 {
  font-size: 14px;
  font-weight: 600;
  margin: 20px 0 8px;
  color: #c9d1d9;
}
section p { margin-bottom: 14px; color: #c9d1d9; }
section p strong { color: #e6edf3; }
section ul, section ol { margin: 12px 0 16px 22px; color: #c9d1d9; }
section li { margin-bottom: 6px; }
section li::marker { color: #6e7681; }

/* Hero */
.hero {
  padding: 60px 0 48px;
  border-bottom: 1px solid #161b22;
  margin-bottom: 48px;
}
.hero .eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #6e7681;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.hero .eyebrow .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #3fb950;
  box-shadow: 0 0 0 3px rgba(63,185,80,0.2);
}
.hero h1 {
  font-size: clamp(36px, 4.5vw, 52px);
  font-weight: 300;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin-bottom: 18px;
}
.hero h1 b { font-weight: 700; }
.hero .lead {
  font-size: 17px;
  color: #8b949e;
  max-width: 720px;
  line-height: 1.65;
}
.hero-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  margin-top: 32px;
}
.stat {
  padding: 16px 18px;
  background: #0d1117;
  border: 1px solid #161b22;
  border-radius: 10px;
}
.stat .k {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: #6e7681;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.stat .v { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.stat .v small { font-size: 12px; color: #8b949e; font-weight: 400; margin-left: 4px; }

/* Code blocks */
pre {
  background: #0d1117;
  border: 1px solid #161b22;
  border-radius: 8px;
  padding: 16px 18px;
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.55;
  color: #c9d1d9;
  margin: 12px 0 18px;
}
code:not(pre code) {
  background: rgba(110,118,129,0.12);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.88em;
  color: #f0883e;
}
pre code { color: inherit; font-size: inherit; }
.tok-kw { color: #ff7b72; }
.tok-fn { color: #d2a8ff; }
.tok-str { color: #a5d6ff; }
.tok-num { color: #79c0ff; }
.tok-com { color: #6e7681; font-style: italic; }
.tok-op { color: #ff7b72; }

/* Expandable detail */
details {
  background: #0d1117;
  border: 1px solid #21262d;
  border-radius: 10px;
  margin: 14px 0;
  overflow: hidden;
  transition: border-color 0.15s;
}
details[open] { border-color: #30363d; }
details > summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 18px;
  font-size: 13.5px;
  font-weight: 500;
  color: #c9d1d9;
  display: flex;
  align-items: center;
  gap: 10px;
  user-select: none;
}
details > summary::-webkit-details-marker { display: none; }
details > summary::before {
  content: '▸';
  font-size: 10px;
  color: #6e7681;
  transition: transform 0.15s;
}
details[open] > summary::before { transform: rotate(90deg); }
details > summary .chip {
  margin-left: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: #6e7681;
  letter-spacing: 0.1em;
  padding: 2px 8px;
  background: rgba(110,118,129,0.1);
  border-radius: 3px;
}
details > summary:hover { color: #e6edf3; }
details .body {
  padding: 4px 18px 18px;
  border-top: 1px solid #161b22;
  padding-top: 16px;
}
details .body p { font-size: 13.5px; }
details .body pre { margin-top: 6px; margin-bottom: 10px; }

/* Callouts */
.callout {
  padding: 14px 16px;
  border-radius: 8px;
  margin: 16px 0;
  font-size: 13.5px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.callout .icon { font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 11px; letter-spacing: 0.1em; flex-shrink: 0; padding-top: 2px; }
.callout.info { background: rgba(56,139,253,0.08); border-left: 3px solid #388bfd; }
.callout.info .icon { color: #58a6ff; }
.callout.warn { background: rgba(210,153,34,0.08); border-left: 3px solid #d29922; }
.callout.warn .icon { color: #f0883e; }
.callout.danger { background: rgba(248,81,73,0.08); border-left: 3px solid #f85149; }
.callout.danger .icon { color: #ff7b72; }
.callout.good { background: rgba(63,185,80,0.08); border-left: 3px solid #3fb950; }
.callout.good .icon { color: #3fb950; }

/* Pipeline / step diagrams */
.pipeline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 24px 0;
}
.stage {
  background: #0d1117;
  border: 1px solid #21262d;
  border-radius: 10px;
  padding: 18px;
  position: relative;
}
.stage .n {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: #6e7681;
  letter-spacing: 0.15em;
  margin-bottom: 8px;
}
.stage .name { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.stage .desc { font-size: 12.5px; color: #8b949e; line-height: 1.5; }
.stage .out {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #161b22;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #79c0ff;
}

/* KV tables */
table.kv {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
  font-size: 13px;
}
table.kv th, table.kv td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid #161b22;
  vertical-align: top;
}
table.kv th {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #6e7681;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: #0d1117;
}
table.kv td:first-child { color: #e6edf3; font-family: 'JetBrains Mono', monospace; font-size: 12px; }
table.kv td { color: #c9d1d9; }

/* Badges */
.pill {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.05em;
}
.pill.good { background: rgba(63,185,80,0.12); color: #3fb950; }
.pill.warn { background: rgba(210,153,34,0.12); color: #d29922; }
.pill.danger { background: rgba(248,81,73,0.12); color: #ff7b72; }
.pill.info { background: rgba(56,139,253,0.12); color: #58a6ff; }
.pill.gray { background: rgba(110,118,129,0.12); color: #8b949e; }

/* Flow diagram arrows */
.flow-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6e7681;
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  margin: 8px 0;
}

/* Grid helpers */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* Visual boxes */
.box {
  padding: 18px;
  background: #0d1117;
  border: 1px solid #21262d;
  border-radius: 10px;
}
.box .title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #6e7681;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
  text-transform: uppercase;
}
.box .big {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}
.box .note { font-size: 12.5px; color: #8b949e; }

/* Tabs */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid #21262d;
  margin: 18px 0 0;
}
.tab {
  padding: 10px 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: #8b949e;
  cursor: pointer;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  background: transparent;
  letter-spacing: 0.05em;
}
.tab.active {
  color: #e6edf3;
  background: #0d1117;
  border-color: #21262d;
  border-bottom: 1px solid #0d1117;
  margin-bottom: -1px;
}
.tab-panel {
  display: none;
  padding: 18px;
  background: #0d1117;
  border: 1px solid #21262d;
  border-top: none;
  border-radius: 0 8px 8px 8px;
}
.tab-panel.active { display: block; }

/* Divider */
.hr { border-top: 1px solid #161b22; margin: 40px 0; }

/* Anchor link style */
.anchor {
  opacity: 0;
  margin-left: 8px;
  color: #6e7681;
  text-decoration: none;
  font-size: 0.8em;
}
section h2:hover .anchor, section h3:hover .anchor { opacity: 1; }
