@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg-base:       #0d1117;
  --bg-secondary:  #161b22;
  --bg-card:       #1c2128;
  --bg-card-hover: #21262d;
  --accent:        #7c6af7;
  --accent-light:  #a89df9;
  --accent-dim:    #2d2860;
  --cyan:          #22d3ee;
  --cyan-dim:      #0e4f5c;
  --green:         #3fb950;
  --yellow:        #d29922;
  --red:           #f85149;
  --text-primary:  #e6edf3;
  --text-secondary:#8b949e;
  --text-muted:    #484f58;
  --border:        #30363d;
  --border-subtle: #21262d;
  --sidebar-w:     260px;
  --radius:        8px;
  --radius-lg:     12px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 15px;
}

/* ── Layout ── */
.layout { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar-logo { padding: 24px 20px 16px; border-bottom: 1px solid var(--border-subtle); }
.logo-img { height: 32px; width: auto; }

.nav-list { list-style: none; padding: 12px 8px; flex: 1; }
.nav-list li { margin: 2px 0; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.15s;
}
.nav-link svg { width: 16px; height: 16px; flex-shrink: 0; }
.nav-link:hover { background: var(--bg-card); color: var(--text-primary); }
.nav-link.active { background: var(--accent-dim); color: var(--accent-light); }

.sidebar-related {
  padding: 10px 16px 4px;
  border-top: 1px solid var(--border-subtle);
}
.sidebar-related-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.sidebar-related-link {
  display: block;
  font-size: 12px;
  color: var(--accent-light);
  text-decoration: none;
  padding: 3px 0;
  transition: color 0.15s;
}
.sidebar-related-link:hover { color: var(--cyan); }

.sidebar-version {
  padding: 12px 16px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.sidebar-version span {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 2px 8px;
  border-radius: 20px;
  border: 1px solid var(--border-subtle);
}

/* ── Main Content ── */
.main { flex: 1; min-width: 0; padding: 48px 56px; max-width: 1100px; }

/* ── Hero ── */
.hero { margin-bottom: 48px; }
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-dim);
  color: var(--accent-light);
  border: 1px solid var(--accent);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 16px;
}
.hero h1 {
  font-size: 36px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #e6edf3 0%, var(--accent-light) 60%, var(--cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-sub {
  font-size: 16px;
  color: var(--text-secondary);
  max-width: 640px;
  line-height: 1.7;
}

/* ── Page title ── */
.page-title { font-size: 28px; font-weight: 700; margin-bottom: 8px; }
.page-sub { color: var(--text-secondary); margin-bottom: 36px; font-size: 15px; }

/* ── Section ── */
.section { margin-bottom: 48px; }
.section-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title svg { width: 18px; height: 18px; color: var(--accent); }

/* ── Cards ── */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-bottom: 32px; }
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: border-color 0.15s, transform 0.15s;
  text-decoration: none;
  color: inherit;
  display: block;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card-icon {
  width: 40px; height: 40px;
  background: var(--accent-dim);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.card-icon svg { width: 20px; height: 20px; color: var(--accent-light); }
.card h3 { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.card p { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.card .card-tag {
  display: inline-block;
  margin-top: 12px;
  font-size: 11px;
  color: var(--cyan);
  background: var(--cyan-dim);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
}

/* ── Code blocks ── */
.code-block {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 16px 0;
}
.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-subtle);
}
.code-lang {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.copy-btn {
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 10px;
  cursor: pointer;
  transition: all 0.15s;
}
.copy-btn:hover { color: var(--text-primary); border-color: var(--accent); }
.code-block pre { overflow-x: auto; }
.code-block code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 13px;
  line-height: 1.7;
  display: block;
  padding: 16px;
  color: var(--text-primary);
}

/* ── Syntax highlighting ── */
.kw { color: #ff79c6; }
.ty { color: #8be9fd; }
.st { color: #f1fa8c; }
.cm { color: var(--text-muted); font-style: italic; }
.nm { color: #bd93f9; }
.jk { color: var(--cyan); }
.jv { color: #f1fa8c; }
.jn { color: #bd93f9; }
.jb { color: #ff79c6; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; margin: 16px 0; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead tr { background: var(--bg-secondary); }
th {
  text-align: left;
  padding: 10px 14px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
}
tbody tr:hover { background: var(--bg-secondary); }
td code, th code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  background: var(--bg-card);
  padding: 1px 6px;
  border-radius: 3px;
  color: var(--accent-light);
}

/* ── Badges ── */
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
}
.badge-primary   { background: var(--accent-dim); color: var(--accent-light); }
.badge-danger    { background: #3d1515; color: #f85149; }
.badge-secondary { background: var(--bg-card); color: var(--text-secondary); }
.badge-ghost     { background: var(--border-subtle); color: var(--text-muted); }
.badge-cyan      { background: var(--cyan-dim); color: var(--cyan); }
.badge-green     { background: #122a1a; color: var(--green); }
.badge-yellow    { background: #2a1f05; color: var(--yellow); }

/* ── Alert boxes ── */
.alert {
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: 16px 0;
  border-left: 3px solid;
  display: flex;
  gap: 12px;
  font-size: 13.5px;
}
.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.alert-info  { background: #0c1f3a; border-color: var(--cyan); color: #a0d8ef; }
.alert-info svg { color: var(--cyan); }
.alert-tip   { background: #122a1a; border-color: var(--green); color: #9be9a8; }
.alert-tip svg { color: var(--green); }
.alert-warn  { background: #2a1f05; border-color: var(--yellow); color: #e3b341; }
.alert-warn svg { color: var(--yellow); }

/* ── Property reference list ── */
.prop-list { display: flex; flex-direction: column; gap: 2px; margin: 12px 0; }
.prop-item {
  display: grid;
  grid-template-columns: 220px 80px 1fr;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  border: 1px solid var(--border-subtle);
  font-size: 13px;
  align-items: start;
}
.prop-item:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.prop-item:last-child  { border-radius: 0 0 var(--radius) var(--radius); }
.prop-item + .prop-item { border-top: none; }
.prop-name { font-family: 'JetBrains Mono', monospace; font-size: 12.5px; color: var(--accent-light); font-weight: 500; }
.prop-type { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--cyan); white-space: nowrap; }
.prop-desc { color: var(--text-secondary); line-height: 1.5; }

/* ── Mermaid ── */
.diagram-wrap {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin: 20px 0;
  overflow-x: auto;
}
.diagram-wrap .mermaid { display: flex; justify-content: center; }

/* ── Structure tree ── */
.tree {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  line-height: 2;
  color: var(--text-secondary);
}
.tree .node    { color: var(--accent-light); font-weight: 600; }
.tree .leaf    { color: var(--text-primary); }
.tree .comment { color: var(--text-muted); }

/* ── Divider ── */
.divider { border: none; border-top: 1px solid var(--border); margin: 40px 0; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Animated edge pulse for Mermaid SVG ── */
@keyframes dash-flow {
  to { stroke-dashoffset: -30; }
}
.mermaid svg .edgePath path {
  stroke-dasharray: 8 4;
  animation: dash-flow 1.2s linear infinite;
}
