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

:root {
  --font-sans: 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --bg:          #ffffff;
  --bg-subtle:   #f8f9fb;
  --bg-muted:    #f0f2f5;
  --bg-hover:    #eef0f4;
  --border:      #e3e6ed;
  --border-sub:  #eceef3;

  --text:        #0d0f14;
  --text-2:      #52576b;
  --text-3:      #9297aa;

  --accent:      #2563eb;
  --accent-2:    #1d4ed8;
  --accent-bg:   #eff6ff;
  --accent-dim:  #bfdbfe;

  --green:       #16a34a;
  --green-bg:    #f0fdf4;
  --green-dim:   #bbf7d0;
  --amber:       #b45309;
  --amber-bg:    #fffbeb;
  --amber-dim:   #fde68a;
  --red:         #dc2626;
  --red-bg:      #fef2f2;
  --red-dim:     #fecaca;

  --code-bg:     #f6f8fb;
  --code-border: #e3e6ed;
  --sidebar-w:   272px;
  --header-h:    58px;
  --radius:      7px;
  --radius-lg:   12px;
}

[data-theme="dark"] {
  --bg:          #0c0e12;
  --bg-subtle:   #131620;
  --bg-muted:    #1a1d2b;
  --bg-hover:    #1f2235;
  --border:      #252a3a;
  --border-sub:  #1e2232;

  --text:        #eef0f6;
  --text-2:      #8b91a8;
  --text-3:      #525770;

  --accent:      #3b82f6;
  --accent-2:    #60a5fa;
  --accent-bg:   #0f1829;
  --accent-dim:  #1e3a5f;

  --green:       #22c55e;
  --green-bg:    #0a1f0f;
  --green-dim:   #14532d;
  --amber:       #f59e0b;
  --amber-bg:    #1c1200;
  --amber-dim:   #451a03;
  --red:         #f87171;
  --red-bg:      #1c0505;
  --red-dim:     #7f1d1d;

  --code-bg:     #10131e;
  --code-border: #1e2335;
}

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

html { font-size: 15px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--accent-2); text-decoration: underline; }

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

/* ── Header ──────────────────────────────────────────────────────── */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  z-index: 100;
  backdrop-filter: blur(8px);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.2px;
  white-space: nowrap;
}
.header-logo:hover { color: var(--text); text-decoration: none; }

.logo-mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-version {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-bg);
  border: 1px solid var(--accent-dim);
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: 0.01em;
}

.header-spacer { flex: 1; }

.header-links { display: flex; align-items: center; gap: 2px; }

.header-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  padding: 6px 11px;
  border-radius: var(--radius);
  transition: background 0.12s, color 0.12s;
  display: flex;
  align-items: center;
  gap: 5px;
}
.header-link:hover { background: var(--bg-muted); color: var(--text); text-decoration: none; }

.header-icon-btn {
  width: 34px; height: 34px;
  border: 1px solid var(--border);
  background: transparent;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  flex-shrink: 0;
}
.header-icon-btn:hover { background: var(--bg-muted); color: var(--text); border-color: var(--text-3); }
.header-icon-btn svg { width: 16px; height: 16px; }

.menu-btn { display: none; }

/* ── Sidebar ─────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  position: fixed;
  top: var(--header-h);
  left: 0;
  bottom: 0;
  background: var(--bg-subtle);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 20px 12px 40px;
}
.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.nav-section { margin-bottom: 6px; }

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 8px 10px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 400;
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  text-decoration: none;
  line-height: 1.4;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--accent-bg); color: var(--accent); font-weight: 600; }
.nav-item.active .nav-icon { color: var(--accent); }

.nav-icon {
  width: 16px; height: 16px;
  flex-shrink: 0;
  color: var(--text-3);
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-icon svg { width: 14px; height: 14px; }

/* ── Main ────────────────────────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  margin-top: var(--header-h);
  flex: 1;
  min-width: 0;
}

.page-content {
  max-width: 840px;
  margin: 0 auto;
  padding: 52px 52px 96px;
}

/* ── Typography ──────────────────────────────────────────────────── */
.page-title {
  font-size: 30px;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 12px;
  letter-spacing: -0.5px;
  color: var(--text);
}

.page-desc {
  font-size: 16px;
  color: var(--text-2);
  line-height: 1.7;
  margin-bottom: 40px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
  max-width: 62ch;
}

h2 {
  font-size: 20px;
  font-weight: 700;
  margin-top: 52px;
  margin-bottom: 14px;
  letter-spacing: -0.3px;
  scroll-margin-top: 80px;
  color: var(--text);
}

h3 {
  font-size: 16px;
  font-weight: 600;
  margin-top: 32px;
  margin-bottom: 10px;
  color: var(--text);
  letter-spacing: -0.1px;
}

h4 {
  font-size: 12px;
  font-weight: 700;
  margin-top: 22px;
  margin-bottom: 8px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

p { margin-bottom: 14px; color: var(--text); }
p:last-child { margin-bottom: 0; }

ul, ol { padding-left: 22px; margin-bottom: 16px; }
li { margin-bottom: 6px; color: var(--text); }

strong { font-weight: 600; color: var(--text); }

hr { border: none; border-top: 1px solid var(--border); margin: 40px 0; }

/* ── Code ────────────────────────────────────────────────────────── */
code {
  font-family: var(--font-mono);
  font-size: 0.855em;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--accent);
  font-weight: 500;
}

pre {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  overflow-x: auto;
  margin: 14px 0 20px;
  line-height: 1.65;
}

pre code {
  font-size: 13px;
  background: none;
  border: none;
  padding: 0;
  color: var(--text);
  font-weight: 400;
}

.code-block { position: relative; margin: 18px 0 22px; }

.code-label {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-bottom: none;
  padding: 5px 12px;
  border-radius: var(--radius) var(--radius) 0 0;
  margin-bottom: -1px;
  letter-spacing: 0.01em;
}

.code-block pre {
  margin: 0;
  border-radius: 0 var(--radius-lg) var(--radius-lg) var(--radius-lg);
}

/* Syntax */
.kw  { color: #7c3aed; font-weight: 500; }
.str { color: #059669; }
.cmt { color: var(--text-3); font-style: italic; }
.fn  { color: var(--accent); font-weight: 500; }
.cls { color: #b45309; font-weight: 500; }
.num { color: #ea580c; }
.op  { color: var(--text-2); }
.prop{ color: #0891b2; }
.tag { color: #dc2626; }

/* ── Callouts ────────────────────────────────────────────────────── */
.callout {
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  margin: 22px 0;
  display: flex;
  gap: 12px;
  font-size: 14px;
  line-height: 1.65;
  border-left: 3px solid;
}
.callout-icon { flex-shrink: 0; margin-top: 2px; width: 16px; height: 16px; }
.callout-icon svg { width: 16px; height: 16px; }
.callout-content { flex: 1; }
.callout-title { font-weight: 700; margin-bottom: 3px; font-size: 13.5px; }

.callout.info    { background: var(--accent-bg); border-color: var(--accent); }
.callout.info .callout-title, .callout.info .callout-icon { color: var(--accent); }
.callout.tip     { background: var(--green-bg); border-color: var(--green); }
.callout.tip .callout-title, .callout.tip .callout-icon  { color: var(--green); }
.callout.warning { background: var(--amber-bg); border-color: var(--amber); }
.callout.warning .callout-title, .callout.warning .callout-icon { color: var(--amber); }
.callout.danger  { background: var(--red-bg); border-color: var(--red); }
.callout.danger .callout-title, .callout.danger .callout-icon  { color: var(--red); }

/* ── Tables ──────────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  margin: 18px 0;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead { background: var(--bg-subtle); }

th {
  text-align: left;
  padding: 10px 16px;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-sub);
  vertical-align: top;
  line-height: 1.55;
}

tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg-subtle); }
td code { font-size: 12px; }

/* ── Cards ───────────────────────────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
  margin: 20px 0;
}

.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  cursor: default;
}
.card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
  transform: translateY(-1px);
}

.card-icon {
  width: 36px; height: 36px;
  background: var(--accent-bg);
  border: 1px solid var(--accent-dim);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  color: var(--accent);
}
.card-icon svg { width: 18px; height: 18px; }
.card-title { font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.card-desc { font-size: 13px; color: var(--text-2); line-height: 1.55; }

/* ── Badges ──────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  vertical-align: middle;
  margin-left: 6px;
}
.badge-blue   { background: var(--accent-bg);  color: var(--accent);  border: 1px solid var(--accent-dim); }
.badge-green  { background: var(--green-bg);   color: var(--green);   border: 1px solid var(--green-dim); }
.badge-amber  { background: var(--amber-bg);   color: var(--amber);   border: 1px solid var(--amber-dim); }
.badge-red    { background: var(--red-bg);     color: var(--red);     border: 1px solid var(--red-dim); }

/* ── Steps ───────────────────────────────────────────────────────── */
.steps { list-style: none; padding: 0; margin: 22px 0; }
.steps li {
  display: flex;
  gap: 16px;
  padding-bottom: 26px;
  position: relative;
}
.steps li:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 32px;
  bottom: 0;
  width: 1px;
  background: var(--border);
}
.step-num {
  width: 30px; height: 30px;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.step-body { flex: 1; padding-top: 5px; }
.step-title { font-weight: 700; margin-bottom: 8px; font-size: 14.5px; }

/* ── Param table ─────────────────────────────────────────────────── */
.param-table { width: 100%; border-collapse: collapse; font-size: 13.5px; margin: 14px 0; }
.param-table th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); padding: 7px 12px; text-align: left; font-weight: 700; border-bottom: 1px solid var(--border); }
.param-table td { padding: 9px 12px; border-bottom: 1px solid var(--border-sub); vertical-align: top; }
.param-table tr:last-child td { border-bottom: none; }
.param-name { font-family: var(--font-mono); font-size: 12.5px; color: var(--accent); background: var(--accent-bg); border: 1px solid var(--accent-dim); padding: 1px 6px; border-radius: 4px; font-weight: 500; }
.param-type { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-3); }
.param-required { font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--red); letter-spacing: 0.06em; }
.param-optional { font-size: 10px; font-weight: 600; text-transform: uppercase; color: var(--text-3); letter-spacing: 0.06em; }

/* ── On-page TOC ─────────────────────────────────────────────────── */
.on-page-toc {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  margin-bottom: 36px;
  font-size: 13px;
}
.on-page-toc-title { font-weight: 700; margin-bottom: 10px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); }
.on-page-toc a { color: var(--text-2); display: block; padding: 4px 0; transition: color 0.12s; }
.on-page-toc a:hover { color: var(--accent); text-decoration: none; }

/* ── Intro hero (index page only) ───────────────────────────────── */
.intro-hero {
  background: linear-gradient(135deg, var(--accent-bg) 0%, var(--bg) 60%);
  border: 1px solid var(--accent-dim);
  border-radius: var(--radius-lg);
  padding: 36px 40px;
  margin-bottom: 40px;
}
.intro-hero-eyebrow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 10px;
}
.intro-hero-title {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.6px;
  color: var(--text);
  margin-bottom: 10px;
  line-height: 1.15;
}
.intro-hero-sub {
  font-size: 15px;
  color: var(--text-2);
  line-height: 1.7;
  max-width: 58ch;
  margin-bottom: 22px;
}
.intro-hero-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  border: 1px solid transparent;
}
.btn svg { width: 14px; height: 14px; }
.btn-primary { background: var(--accent); color: white; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); text-decoration: none; color: white; }
.btn-ghost { background: transparent; color: var(--text-2); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg-muted); color: var(--text); text-decoration: none; border-color: var(--text-3); }

/* npm install banner */
.install-banner {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin: 20px 0;
  max-width: 440px;
}
.install-banner-label {
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-3);
  font-family: var(--font-mono);
  border-right: 1px solid var(--code-border);
  background: var(--bg-subtle);
  white-space: nowrap;
}
.install-banner-cmd {
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  flex: 1;
  user-select: all;
}

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    z-index: 90;
    box-shadow: 4px 0 24px rgba(0,0,0,.08);
  }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .menu-btn { display: flex; }
  .page-content { padding: 32px 28px 64px; }
}

@media (max-width: 480px) {
  .page-content { padding: 24px 18px 48px; }
  .page-title { font-size: 24px; }
  .intro-hero { padding: 24px 22px; }
  .intro-hero-title { font-size: 24px; }
}
