:root {
  /* Professional Dark Theme - Inspired by Linear, Stripe, Vercel */
  --color-accent: #3b82f6;
  --color-accent-hover: #2563eb;
  --color-accent-soft: rgba(59, 130, 246, 0.1);
  
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-error: #ef4444;

  --bg-base: #000000;
  --bg-elevated: #0a0a0a;
  --bg-surface: #111111;
  --bg-hover: #1a1a1a;

  --text-primary: #f5f5f5;
  --text-secondary: #a3a3a3;
  --text-tertiary: #737373;

  --border-subtle: #1f1f1f;
  --border-default: #262626;
  --border-strong: #404040;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.7), 0 4px 6px -2px rgba(0, 0, 0, 0.5);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', Menlo, Monaco, Consolas, monospace;
  
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  max-width: 100vw;
  overflow-x: hidden;
}

body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-secondary);
  background: var(--bg-base);
  font-feature-settings: 'liga' 1, 'calt' 1;
  font-weight: 400;
  max-width: 100vw;
  overflow-x: hidden;
}

/* Layout */
.container {
  display: grid;
  grid-template-columns: 260px 1fr 220px;
  grid-template-areas: "sidebar content toc";
  min-height: 100vh;
  max-width: 1600px;
  margin: 0 auto;
  overflow-x: hidden;
}

/* Sidebar */
.sidebar {
  grid-area: sidebar;
  position: fixed;
  top: 0;
  left: 0;
  width: 260px;
  height: 100vh;
  background: var(--bg-base);
  border-right: 1px solid var(--border-subtle);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
}

.logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.logo h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

/* Search */
.search {
  padding: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.search input {
  width: 100%;
  padding: 8px 12px;
  font-size: 14px;
  font-family: var(--font-sans);
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  outline: none;
  transition: all var(--transition-fast);
}

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

.search input:focus {
  background: var(--bg-elevated);
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

/* Navigation */
.nav {
  padding: 8px 0;
}

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

.nav-title {
  padding: 12px 20px 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
}

.nav-children {
  list-style: none;
}

.nav-children li {
  margin: 1px 8px;
}

.nav-children a {
  display: block;
  padding: 6px 12px;
  font-size: 14px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.nav-children a:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.nav-children a.active {
  color: var(--color-accent);
  background: var(--color-accent-soft);
  font-weight: 500;
}

/* Main Content */
.content {
  grid-area: content;
  max-width: 800px;
  padding: 48px 64px 96px;
  margin-left: 260px;
}

.content-wrapper {
  animation: fadeIn 0.3s ease-out;
}

/* Typography */
.content h1 {
  font-size: 36px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin: 0 0 24px 0;
}

.content h2 {
  font-size: 28px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  margin: 48px 0 16px 0;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.content h2:first-child {
  margin-top: 0;
  border-top: none;
  padding-top: 0;
}

.content h3 {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  margin: 32px 0 12px 0;
}

.content h4 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 24px 0 8px 0;
}

.content p {
  margin: 0 0 20px 0;
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.7;
}

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

.content a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

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

.content ul,
.content ol {
  margin: 0 0 20px 0;
  padding-left: 24px;
}

.content li {
  margin: 8px 0;
  color: var(--text-secondary);
  line-height: 1.7;
}

.content li::marker {
  color: var(--text-tertiary);
}

/* Code */
.content code {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--color-accent);
  max-width: 100%;
  overflow-x: auto;
  background: var(--bg-surface);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-default);
}

.content pre {
  margin: 24px 0;
  padding: 16px;
  background: var(--bg-surface);
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.6;
}

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

/* Tables */
.content table {
  width: 100%;
  margin: 24px 0;
  border-collapse: collapse;
  font-size: 14px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.content th,
.content td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}

.content th {
  background: var(--bg-surface);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.content td {
  color: var(--text-secondary);
}

.content tr:last-child td {
  border-bottom: none;
}

/* Blockquotes */
.content blockquote {
  margin: 24px 0;
  padding: 16px 20px;
  border-left: 3px solid var(--color-accent);
  background: var(--bg-surface);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.content blockquote p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
}

/* Table of Contents */
.toc {
  grid-area: toc;
  position: fixed;
  top: 0;
  right: 0;
  width: 220px;
  height: 100vh;
  padding: 48px 20px;
  overflow-y: auto;
  border-left: 1px solid var(--border-subtle);
}

.toc-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  margin-bottom: 12px;
}

#toc-content a {
  display: block;
  padding: 4px 0;
  font-size: 13px;
  color: var(--text-tertiary);
  text-decoration: none;
  transition: color var(--transition-fast);
  line-height: 1.5;
}

#toc-content a:hover {
  color: var(--text-secondary);
}

#toc-content a.active {
  color: var(--color-accent);
  font-weight: 500;
}

/* Footer */
.footer {
  margin-top: 64px;
  padding-top: 32px;
  border-top: 1px solid var(--border-subtle);
  font-size: 13px;
  color: var(--text-tertiary);
}

.footer a {
  color: var(--text-tertiary);
  transition: color var(--transition-fast);
}

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

/* Mobile Navigation */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 1000;
  padding: 10px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 18px;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-fast);
}

.sidebar-toggle:hover {
  background: var(--bg-hover);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 99;
  opacity: 0;
  transition: opacity var(--transition-base);
}

.sidebar-overlay.active {
  opacity: 1;
}

/* Responsive Design */
@media (max-width: 1200px) {
  .container {
    grid-template-columns: 260px 1fr;
    grid-template-areas: "sidebar content";
  }
  
  .toc {
    display: none;
  }
}

@media (max-width: 768px) {
  .container {
    grid-template-columns: 1fr;
    grid-template-areas: "content";
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition-base);
    z-index: 101;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-toggle {
    display: block;
  }

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

  .content {
    margin-left: 0;
    padding: 80px 24px 64px;
  }

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

  .content h2 {
    font-size: 22px;
  }

  .content h3 {
    font-size: 18px;
  }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-strong);
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Focus Styles */
*:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* Print */
@media print {
  .sidebar,
  .toc,
  .sidebar-toggle,
  .sidebar-overlay,
  .footer {
    display: none;
  }

  .container {
    grid-template-columns: 1fr;
    grid-template-areas: "content";
  }

  .content {
    margin: 0;
    padding: 0;
  }

  body {
    background: white;
    color: black;
  }

  .content h1,
  .content h2,
  .content h3,
  .content p,
  .content li {
    color: black;
  }
}
