/* ========== TOKENS ========== */
:root {
  --bg: #f5f3ee;
  --bg-warm: #edeae3;
  --bg-card: #faf8f3;
  --bg-white: #ffffff;
  --text: #1c1c1a;
  --text-secondary: #6b6b66;
  --text-tertiary: #a8a8a2;
  --border: #d8d4c8;
  --border-light: #e8e5de;
  --accent: #9ca383;
  --accent-bg: #c5d44a;
  --accent-light: #dde87a;
  --card-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.03);
  --card-shadow-hover: 0 2px 8px rgba(0,0,0,0.06), 0 8px 24px rgba(0,0,0,0.05);
  --sidebar-width: 260px;
}

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

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 16px;
  line-height: 1.6;
}

/* ========== NAV ========== */
.nav {
  display: flex;
  justify-content: center;
  padding: 16px 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(245, 243, 238, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.nav-inner {
  display: flex;
  align-items: center;
  gap: 36px;
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: 100px;
  padding: 8px 8px 8px 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.nav-logo {
  font-family: 'Newsreader', serif;
  font-size: 18px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.3px;
  white-space: nowrap;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
}
.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s;
}
.nav-links a:hover, .nav-links a.active { color: var(--text); }
.nav-download {
  background: var(--text) !important;
  color: var(--bg-card) !important;
  padding: 10px 22px !important;
  border-radius: 100px;
  font-weight: 600 !important;
  font-size: 13px !important;
  transition: all 0.2s;
  white-space: nowrap;
}
.nav-download:hover {
  background: #333 !important;
  transform: scale(1.02);
}

/* ========== DOCS LAYOUT ========== */
.docs-layout {
  display: flex;
  max-width: 1200px;
  margin: 0 auto;
  min-height: calc(100vh - 140px);
}

/* ========== SIDEBAR ========== */
.docs-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  padding: 32px 24px 48px 24px;
  border-right: 1px solid var(--border-light);
  position: sticky;
  top: 68px;
  height: calc(100vh - 68px);
  overflow-y: auto;
}
.docs-sidebar::-webkit-scrollbar { width: 4px; }
.docs-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.sidebar-section {
  margin-bottom: 24px;
}
.sidebar-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-tertiary);
  margin-bottom: 8px;
  padding: 0 8px;
}
.sidebar-section a {
  display: block;
  padding: 5px 8px;
  font-size: 14px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 6px;
  transition: all 0.15s;
  line-height: 1.5;
}
.sidebar-section a:hover {
  color: var(--text);
  background: var(--bg-warm);
}
.sidebar-section a.current {
  color: var(--text);
  background: var(--bg-warm);
  font-weight: 500;
}

/* ========== MAIN CONTENT ========== */
.docs-main {
  flex: 1;
  min-width: 0;
  padding: 40px 56px 80px;
}

/* ========== DOCS INDEX ========== */
.docs-hero {
  margin-bottom: 48px;
}
.docs-hero h1 {
  font-family: 'Newsreader', serif;
  font-size: 40px;
  font-weight: 400;
  letter-spacing: -1px;
  line-height: 1.15;
  margin-bottom: 12px;
}
.docs-hero p {
  font-size: 17px;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 560px;
}

.docs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.docs-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 28px 24px;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--card-shadow);
  transition: all 0.2s;
}
.docs-card:hover {
  box-shadow: var(--card-shadow-hover);
  transform: translateY(-2px);
}
.docs-card-icon {
  font-size: 24px;
  margin-bottom: 12px;
}
.docs-card h3 {
  font-family: 'Newsreader', serif;
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 6px;
  letter-spacing: -0.3px;
}
.docs-card p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ========== ARTICLE CONTENT ========== */
.doc-breadcrumb {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-bottom: 24px;
}
.doc-breadcrumb a {
  color: var(--text-tertiary);
  text-decoration: none;
}
.doc-breadcrumb a:hover { color: var(--text-secondary); }
.doc-breadcrumb span { margin: 0 6px; }

.doc-content h1 {
  font-family: 'Newsreader', serif;
  font-size: 36px;
  font-weight: 400;
  letter-spacing: -0.8px;
  line-height: 1.2;
  margin-bottom: 8px;
}
.doc-content .doc-subtitle {
  font-size: 17px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 36px;
}
.doc-content h2 {
  font-family: 'Newsreader', serif;
  font-size: 26px;
  font-weight: 400;
  letter-spacing: -0.5px;
  margin-top: 48px;
  margin-bottom: 16px;
  padding-top: 24px;
  border-top: 1px solid var(--border-light);
}
.doc-content h2:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
.doc-content h3 {
  font-size: 18px;
  font-weight: 600;
  margin-top: 32px;
  margin-bottom: 12px;
}
.doc-content p {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 16px;
}
.doc-content p strong {
  color: var(--text);
  font-weight: 600;
}
.doc-content ul, .doc-content ol {
  margin-bottom: 16px;
  padding-left: 24px;
}
.doc-content li {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 4px;
}
.doc-content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.doc-content a:hover { color: var(--text); }

/* Callout boxes */
.callout {
  border-radius: 12px;
  padding: 20px 24px;
  margin: 24px 0;
  font-size: 14px;
  line-height: 1.7;
}
.callout p { margin-bottom: 0; color: inherit; font-size: inherit; }
.callout-title {
  font-weight: 600;
  margin-bottom: 4px;
}
.callout-info {
  background: rgba(197, 212, 74, 0.12);
  border: 1px solid rgba(197, 212, 74, 0.3);
  color: var(--text-secondary);
}
.callout-info .callout-title { color: var(--accent); }
.callout-warn {
  background: #fff8e1;
  border: 1px solid #ffe082;
  color: #7a6200;
}
.callout-warn .callout-title { color: #b38f00; }
.callout-tip {
  background: #e8f5e9;
  border: 1px solid #a5d6a7;
  color: #2e5e30;
}
.callout-tip .callout-title { color: #2e7d32; }

/* Steps */
.steps {
  counter-reset: step;
  margin: 24px 0;
}
.step {
  counter-increment: step;
  position: relative;
  padding-left: 48px;
  padding-bottom: 28px;
  border-left: 2px solid var(--border-light);
  margin-left: 15px;
}
.step:last-child { border-left-color: transparent; padding-bottom: 0; }
.step::before {
  content: counter(step);
  position: absolute;
  left: -16px;
  top: 0;
  width: 30px;
  height: 30px;
  background: var(--accent-bg);
  border-radius: 50%;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
}
.step h3 {
  margin-top: 2px;
  margin-bottom: 8px;
  font-size: 16px;
}
.step p {
  font-size: 14px;
}

/* Code blocks */
.code-block {
  background: var(--text);
  color: #e8e5de;
  border-radius: 10px;
  padding: 20px 24px;
  margin: 16px 0;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 13px;
  line-height: 1.7;
  overflow-x: auto;
}
code {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 13px;
  background: var(--bg-warm);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text);
}

/* Keyboard shortcuts */
kbd {
  display: inline-block;
  padding: 2px 8px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* Table */
.doc-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 14px;
}
.doc-content th, .doc-content td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
}
.doc-content th {
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
  background: var(--bg-warm);
}
.doc-content td { color: var(--text-secondary); }

/* Images */
.doc-content img {
  max-width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border-light);
  margin: 20px 0;
  box-shadow: var(--card-shadow);
}

/* Prev/Next navigation */
.doc-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 56px;
  padding-top: 32px;
  border-top: 1px solid var(--border-light);
}
.doc-nav a {
  display: block;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  text-decoration: none;
  transition: all 0.2s;
  flex: 1;
  max-width: 50%;
}
.doc-nav a:hover {
  border-color: var(--border);
  box-shadow: var(--card-shadow);
}
.doc-nav-label {
  font-size: 12px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.doc-nav-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}
.doc-nav .next { text-align: right; margin-left: auto; }

/* ========== FOOTER ========== */
.footer {
  padding: 40px 24px;
  border-top: 1px solid var(--border-light);
  text-align: center;
  font-size: 13px;
  color: var(--text-tertiary);
}
.footer a {
  color: var(--text-secondary);
  text-decoration: none;
  margin: 0 12px;
}
.footer a:hover { color: var(--text); }

/* ========== MOBILE ========== */
@media (max-width: 900px) {
  .docs-layout { flex-direction: column; }
  .docs-sidebar {
    width: 100%;
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-light);
    padding: 24px;
    display: none;
  }
  .docs-sidebar.open { display: block; }
  .docs-main { padding: 32px 24px 64px; }
  .docs-grid { grid-template-columns: 1fr; }
  .nav-links a:not(.nav-download) { display: none; }
  .nav-inner { gap: 16px; }
  .doc-nav { flex-direction: column; }
  .doc-nav a { max-width: 100%; }
}

@media (max-width: 1100px) {
  .docs-grid { grid-template-columns: repeat(2, 1fr); }
}
