html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  font-family: "Figtree", sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-body);
  background: var(--bg);
}

a {
  text-decoration: none;
  color: inherit;
}

/* ===================== HEADER ===================== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: 60px;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
}

.header-inner {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-brand a {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.header-brand .brand-mark {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.header-brand .brand-text {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 32px;
}

.header-nav a {
  font-family: "Figtree", sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color 0.15s ease;
}

.header-nav a:hover {
  color: var(--text-primary);
}

.header-nav a.active {
  color: var(--text-primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.btn-download {
  display: inline-flex;
  align-items: center;
  background: var(--text-primary);
  color: var(--white);
  font-family: "Figtree", sans-serif;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: 6px;
  transition: background 0.15s ease;
}

.btn-download:hover {
  background: #333;
}

.github-link {
  display: flex;
  align-items: center;
  color: var(--text-secondary);
  transition: color 0.15s ease;
}

.github-link:hover {
  color: var(--text-primary);
}

.github-link svg {
  width: 20px;
  height: 20px;
}

/* ===================== LAYOUT ===================== */
.docs-layout {
  display: flex;
  min-height: 100vh;
}

/* ===================== LEFT SIDEBAR ===================== */
.sidebar {
  position: fixed;
  top: 60px;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-alt);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px 0;
  z-index: 100;
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--border-dark);
  border-radius: 2px;
}

.sidebar-search {
  padding: 0 20px;
  margin-bottom: 24px;
}

.search-input {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  font-family: "Figtree", sans-serif;
  font-size: 13px;
  color: var(--text-body);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s ease;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-input:focus {
  border-color: var(--border-dark);
}

.search-input-wrap {
  position: relative;
}

.search-kbd {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-family: "Figtree", sans-serif;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-subtle);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
  pointer-events: none;
}

.sidebar-nav {
  padding: 0;
}

.sidebar-section {
  margin-bottom: 8px;
}

.sidebar-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 20px;
  cursor: pointer;
  user-select: none;
}

.sidebar-section-title {
  font-family: "Figtree", sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.sidebar-section-arrow {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.sidebar-section.collapsed .sidebar-section-arrow {
  transform: rotate(-90deg);
}

.sidebar-section.collapsed .sidebar-links {
  display: none;
}

.sidebar-links {
  padding: 0 8px;
  list-style: none;
}

.sidebar-links li {
  margin: 0;
}

.sidebar-links a {
  display: block;
  font-family: "Figtree", sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 6px;
  border-left: 2px solid transparent;
  transition: color 0.12s ease, background 0.12s ease;
  margin-left: 8px;
}

.sidebar-links a:hover {
  color: var(--text-primary);
  background: var(--bg-subtle);
}

.sidebar-links a.active {
  color: var(--accent);
  background: var(--accent-light);
  border-left: 2px solid var(--accent);
  font-weight: 500;
}

/* ===================== MAIN CONTENT ===================== */
.docs-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  margin-right: var(--toc-width);
  display: flex;
  justify-content: center;
}

.docs-content {
  max-width: 720px;
  width: 100%;
  padding: 100px 48px 80px;
}

/* Breadcrumb */
.breadcrumb {
  font-family: "Figtree", sans-serif;
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 32px;
}

.breadcrumb a {
  color: var(--text-muted);
  transition: color 0.12s ease;
}

.breadcrumb a:hover {
  color: var(--text-secondary);
}

.breadcrumb .sep {
  margin: 0 8px;
  color: var(--border-dark);
}

/* Content typography */
.doc-content h1 {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 36px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.doc-content h2 {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  margin-top: 48px;
  margin-bottom: 16px;
  scroll-margin-top: 80px;
}

.doc-content h3 {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-primary);
  margin-top: 32px;
  margin-bottom: 12px;
}

.doc-content p {
  font-family: "Figtree", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-body);
  margin-bottom: 16px;
}

.doc-content .lead {
  font-size: 17px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.doc-content code {
  font-family: "JetBrains Mono", monospace;
  font-size: 14px;
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text-primary);
}

.doc-content pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
  overflow-x: auto;
  position: relative;
}

.doc-content pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-body);
}

.code-label {
  position: absolute;
  top: 8px;
  right: 12px;
  font-family: "Figtree", sans-serif;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

/* Code syntax colors */
.code-comment { color: var(--text-muted); }
.code-keyword { color: #8250DF; }
.code-string { color: #0A6640; }
.code-flag { color: var(--accent); }

/* Tables */
.doc-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
  font-size: 15px;
}

.doc-content table th {
  font-family: "Figtree", sans-serif;
  font-weight: 600;
  font-size: 13px;
  text-align: left;
  color: var(--text-secondary);
  background: var(--bg-alt);
  padding: 12px 16px;
  border: 1px solid var(--border);
}

.doc-content table td {
  font-family: "Figtree", sans-serif;
  padding: 12px 16px;
  border: 1px solid var(--border);
  color: var(--text-body);
}

/* Links in content */
.doc-content a {
  color: var(--accent);
  transition: color 0.12s ease;
}

.doc-content a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* Next steps */
.next-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.next-links a {
  font-family: "Figtree", sans-serif;
  font-size: 15px;
  font-weight: 500;
  color: var(--accent);
  transition: color 0.12s ease;
}

.next-links a:hover {
  color: var(--accent-hover);
}

/* Edit on GitHub */
.edit-link {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.edit-link a {
  font-family: "Figtree", sans-serif;
  font-size: 14px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.12s ease;
}

.edit-link a:hover {
  color: var(--text-secondary);
  text-decoration: none;
}

.edit-link svg {
  width: 16px;
  height: 16px;
}

/* Prev / Next nav */
.page-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.page-nav a {
  font-family: "Figtree", sans-serif;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-decoration: none;
  max-width: 48%;
}

.page-nav a:hover .page-nav-title {
  color: var(--accent);
}

.page-nav-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.page-nav-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  transition: color 0.12s ease;
}

.page-nav a.next {
  text-align: right;
  margin-left: auto;
}

/* ===================== TOC (RIGHT SIDEBAR) ===================== */
.toc {
  position: fixed;
  top: 60px;
  right: 0;
  width: var(--toc-width);
  height: calc(100vh - 60px);
  padding: 40px 24px 40px 20px;
  overflow-y: auto;
}

.toc-title {
  font-family: "Figtree", sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 16px;
}

.toc-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-links li {
  margin: 0;
}

.toc-links a {
  display: block;
  font-family: "Figtree", sans-serif;
  font-size: 13px;
  color: var(--text-muted);
  padding: 5px 0 5px 12px;
  border-left: 2px solid transparent;
  transition: color 0.12s ease, border-color 0.12s ease;
}

.toc-links a:hover {
  color: var(--text-primary);
}

.toc-links a.active {
  color: var(--accent);
  border-left: 2px solid var(--accent);
}

/* ===================== MOBILE HAMBURGER ===================== */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--text-primary);
}

.mobile-menu-btn svg {
  width: 22px;
  height: 22px;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 90;
}

.sidebar-overlay.open {
  display: block;
}

/* ===================== FOOTER (MINIMAL FOR DOCS) ===================== */
.docs-footer {
  margin-left: var(--sidebar-width);
  margin-right: var(--toc-width);
  border-top: 1px solid var(--border);
  padding: 24px 48px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 1100px) {
  .toc {
    display: none;
  }

  .docs-main {
    margin-right: 0;
  }

  .docs-footer {
    margin-right: 0;
  }
}

@media (max-width: 768px) {
  .header-nav {
    display: none;
  }

  .mobile-menu-btn {
    display: flex;
  }

  .sidebar {
    left: -280px;
    width: 280px;
    transition: left 0.2s ease;
    z-index: 200;
  }

  .sidebar.open {
    left: 0;
  }

  .docs-main {
    margin-left: 0;
  }

  .docs-content {
    padding: 90px 24px 60px;
  }

  .docs-footer {
    margin-left: 0;
    padding: 24px;
  }

  .doc-content h1 {
    font-size: 28px;
  }

  .doc-content h2 {
    font-size: 20px;
    margin-top: 36px;
  }

  .doc-content h3 {
    font-size: 17px;
  }

  .page-nav {
    flex-direction: column;
    gap: 16px;
  }

  .page-nav a.next {
    text-align: left;
  }
}

@media (max-width: 480px) {
  .header-inner {
    padding: 0 16px;
  }

  .docs-content {
    padding: 80px 16px 48px;
  }

  .doc-content pre {
    padding: 16px;
    border-radius: 6px;
    font-size: 13px;
  }

  .doc-content table {
    font-size: 13px;
  }

  .doc-content table th,
  .doc-content table td {
    padding: 8px 10px;
  }
}
