/* EduForge - Documentation Tree Layout - Cursor-inspired warm cream design */
:root {
  --canvas:      #f7f7f4;
  --canvas-soft: #fafaf8;
  --surface:     #ffffff;
  --primary:     #d97706;
  --primary-d:   #b45309;
  --ink:         #26251e;
  --body:        #4b4940;
  --muted:       #7c7a72;
  --hairline:    #e5e3dc;
  --hairline-s:  #efeee8;
  --tag-bg:      #fef3c7;
  --tag-text:    #92400e;
  --code-bg:     #f0ede6;
  --radius-sm:   4px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --sidebar-w:   240px;
  --topbar-h:    56px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--canvas);
  color: var(--body);
  line-height: 1.6;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  color: var(--ink);
}
pre {
  background: var(--ink);
  color: #f7f7f4;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  padding: 20px 24px;
  border-radius: var(--radius-lg);
  overflow-x: auto;
  margin: 20px 0;
  line-height: 1.7;
}

/* Top bar */
.topbar {
  background: var(--canvas);
  border-bottom: 1px solid var(--hairline);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-h);
  z-index: 200;
}

.topbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-link {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--ink);
  flex-shrink: 0;
}

.logo-badge {
  width: 28px;
  height: 28px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11px;
}

.logo-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

.logo-sub {
  font-size: 13px;
  color: var(--muted);
  display: none;
}

@media (min-width: 900px) { .logo-sub { display: block; } }

.sidebar-toggle {
  display: none;
  background: none;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  cursor: pointer;
  color: var(--ink);
  font-size: 16px;
  margin-left: auto;
}

/* Layout */
.doc-layout {
  display: flex;
  padding-top: var(--topbar-h);
  min-height: 100vh;
  max-width: 1400px;
  margin: 0 auto;
}

/* Sidebar */
.doc-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--canvas-soft);
  border-right: 1px solid var(--hairline);
  padding: 24px 0;
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
}

.sidebar-header {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  padding: 0 20px 12px;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 8px;
}

.doc-sidebar ul { list-style: none; }
.doc-sidebar li { }
.doc-sidebar a {
  display: block;
  padding: 8px 20px;
  font-size: 14px;
  color: var(--body);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background 0.1s, color 0.1s;
}
.doc-sidebar a:hover { background: var(--hairline-s); color: var(--ink); }
.doc-sidebar li.active a {
  border-left-color: var(--primary);
  background: var(--tag-bg);
  color: var(--primary-d);
  font-weight: 600;
}

/* Main content */
.doc-main {
  flex: 1;
  min-width: 0;
  padding: 40px 48px 80px;
}

/* Breadcrumb */
.doc-breadcrumb {
  margin-bottom: 24px;
}
.doc-breadcrumb ol {
  display: flex;
  list-style: none;
  gap: 8px;
  flex-wrap: wrap;
}
.doc-breadcrumb li {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.doc-breadcrumb li:not(:last-child)::after { content: '›'; }
.doc-breadcrumb a { color: var(--primary); text-decoration: none; }
.doc-breadcrumb li.current { color: var(--body); }

/* Article typography */
.doc-article h1 {
  font-size: clamp(26px, 3.5vw, 38px);
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 16px;
  letter-spacing: -0.4px;
  line-height: 1.15;
}

.doc-article .lead {
  font-size: 17px;
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 32px;
  max-width: 680px;
}

.doc-article h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  margin: 40px 0 12px;
  padding-top: 40px;
  border-top: 1px solid var(--hairline);
  scroll-margin-top: 72px;
  letter-spacing: -0.2px;
}
.doc-article h2:first-of-type { border-top: none; padding-top: 0; margin-top: 0; }

.doc-article h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
  margin: 24px 0 8px;
  scroll-margin-top: 72px;
}

.doc-article p {
  font-size: 15px;
  line-height: 1.8;
  color: var(--body);
  margin-bottom: 14px;
  max-width: 720px;
}

.doc-article ul, .doc-article ol {
  padding-left: 22px;
  margin-bottom: 14px;
  max-width: 720px;
}
.doc-article li {
  font-size: 15px;
  line-height: 1.7;
  color: var(--body);
  margin-bottom: 5px;
}

/* TOC inline */
.doc-toc {
  background: var(--tag-bg);
  border: 1px solid #fde68a;
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 36px;
  max-width: 480px;
}
.doc-toc-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--tag-text);
  margin-bottom: 12px;
}
.doc-toc ol { list-style: none; counter-reset: toc; }
.doc-toc li { counter-increment: toc; border-bottom: 1px solid #fde68a; }
.doc-toc li:last-child { border-bottom: none; }
.doc-toc a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 13px;
  color: var(--body);
  text-decoration: none;
}
.doc-toc a::before {
  content: counter(toc, decimal-leading-zero);
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  min-width: 18px;
}
.doc-toc a:hover { color: var(--primary); }

/* Note / info box */
.note {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin: 20px 0;
  font-size: 14px;
  color: var(--body);
  max-width: 720px;
}
.note strong { color: var(--primary-d); }

/* Tip box */
.tip {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-left: 4px solid #16a34a;
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin: 20px 0;
  font-size: 14px;
  color: #14532d;
  max-width: 720px;
}

/* Tool card grid */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin: 20px 0 32px;
}

.tool-card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}

.tool-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 6px;
}

.tool-type {
  display: inline-block;
  background: var(--tag-bg);
  color: var(--tag-text);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 9999px;
  margin-bottom: 8px;
}

.tool-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

/* Hero section */
.doc-hero {
  background: linear-gradient(to right, #fffbeb, #fef3c7);
  border: 1px solid #fde68a;
  border-radius: var(--radius-lg);
  padding: 40px 48px;
  margin-bottom: 48px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: center;
}

.doc-hero h1 {
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 14px;
  line-height: 1.2;
}

.doc-hero p {
  font-size: 16px;
  color: var(--body);
  line-height: 1.7;
}

.doc-hero-img {
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.doc-hero-img img { width: 100%; height: 240px; object-fit: cover; }

/* Steps */
.steps { margin: 20px 0 28px; }
.step {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
}
.step-num {
  width: 28px;
  height: 28px;
  background: var(--primary);
  color: #fff;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}
.step-content h4 { font-size: 15px; font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.step-content p { font-size: 14px; color: var(--body); line-height: 1.6; margin: 0; }

/* Collapsible */
details {
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  background: var(--surface);
  max-width: 720px;
}
details summary {
  cursor: pointer;
  padding: 13px 16px;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}
details summary::-webkit-details-marker { display: none; }
details summary::after { content: '+'; font-size: 18px; color: var(--primary); }
details[open] summary::after { content: '−'; }
details > div {
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--body);
  border-top: 1px solid var(--hairline);
}

/* Related */
.related-docs {
  margin-top: 56px;
  padding-top: 32px;
  border-top: 1px solid var(--hairline);
}
.related-docs h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 16px;
}
.related-docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.related-doc-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  text-decoration: none;
  transition: border-color 0.15s;
}
.related-doc-card:hover { border-color: var(--primary); text-decoration: none; }
.rdc-title { font-size: 14px; font-weight: 600; color: var(--ink); }
.rdc-desc { font-size: 12px; color: var(--muted); }

/* Footer */
.doc-footer {
  background: var(--ink);
  color: #9ca3af;
  padding: 40px 48px;
  margin-left: var(--sidebar-w);
}
.doc-footer-inner { max-width: 900px; }
.doc-footer strong { color: #fff; font-size: 16px; display: block; margin-bottom: 6px; }
.doc-footer p { font-size: 13px; line-height: 1.6; max-width: 480px; margin-bottom: 20px; }
.doc-footer nav { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.doc-footer a { font-size: 13px; color: #9ca3af; text-decoration: none; }
.doc-footer a:hover { color: #fff; }
.footer-copy { font-size: 12px; color: #6b7280; }

/* Responsive */
@media (max-width: 900px) {
  .sidebar-toggle { display: flex; }
  .doc-sidebar {
    position: fixed;
    left: -var(--sidebar-w);
    top: var(--topbar-h);
    transform: translateX(-100%);
    transition: transform 0.25s;
    z-index: 150;
    height: calc(100vh - var(--topbar-h));
  }
  .doc-sidebar.open { transform: translateX(0); }
  .doc-main { padding: 24px 20px 60px; }
  .doc-hero { grid-template-columns: 1fr; }
  .doc-footer { margin-left: 0; padding: 32px 20px; }
}

@media (max-width: 600px) {
  .tool-grid { grid-template-columns: 1fr; }
  .related-docs-grid { grid-template-columns: 1fr; }
}
