/* RESET & VARIABLES (Inherited from root design but structured for Docs) */

/* SKIP NAVIGATION (Accessibility + SEO) */
.skip-to-content {
  position: absolute; top: -999px; left: -999px;
  background: #6e40c9; color: #fff; padding: 0.75rem 1.5rem;
  border-radius: 8px; font-weight: 600; z-index: 9999;
  text-decoration: none; transition: none;
}
.skip-to-content:focus { top: 0.5rem; left: 0.5rem; }

:root {
  --bg-color: #ffffff;
  --surface: #f5f5f7;
  --surface-hover: #ebebeb;
  --surface-border: rgba(0, 0, 0, 0.1);
  --surface-border-hover: rgba(0, 0, 0, 0.2);
  
  --text-primary: #111111;
  --text-secondary: #555555;
  
  --neon-blue: #0056d2;
  --nav-bg: rgba(255, 255, 255, 0.8);
  --code-bg: #f8f9fa;
  --badge-bg: rgba(0, 0, 0, 0.05);

  --editor-header-bg: #ffffff;
  --editor-body-bg: #000000;
  --editor-text-title: #666666;
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --sidebar-width: 280px;
  --topbar-height: 60px;
}

[data-theme="dark"] {
  --bg-color: #030303;
  --surface: #0a0a0a;
  --surface-hover: #121212;
  --surface-border: rgba(255, 255, 255, 0.1);
  --surface-border-hover: rgba(255, 255, 255, 0.2);
  
  --text-primary: #f5f5f5;
  --text-secondary: #999999;
  
  --neon-blue: #3b82f6;
  
  --nav-bg: rgba(3, 3, 3, 0.85);
  --code-bg: #000000;
  --badge-bg: rgba(255, 255, 255, 0.08);
  
  --editor-header-bg: rgba(255, 255, 255, 0.03);
  --editor-body-bg: #000000;
  --editor-text-title: #999999;
}

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

html { scroll-behavior: smooth; overflow-x: hidden; }

body {
  font-family: var(--font-sans);
  background-color: var(--bg-color);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden; /* Lock the body, allow internal pane scrolling */
}

/* TOP NAVIGATION */
.top-nav {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--topbar-height);
  background: var(--nav-bg); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--surface-border);
  display: flex; justify-content: space-between; align-items: center; padding: 0 1.5rem;
  z-index: 100;
}
.nav-left { display: flex; align-items: center; gap: 1rem; }
.logo { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; font-size: 1.1rem; color: var(--text-primary); text-decoration: none; }
.mobile-menu-btn { display: none; background: none; border: none; color: var(--text-secondary); cursor: pointer; }

.nav-right { display: flex; align-items: center; gap: 1.5rem; }
.nav-link { color: var(--text-secondary); text-decoration: none; font-size: 0.875rem; transition: color 0.2s; }
.nav-link:hover { color: var(--text-primary); }
.btn-outline:hover { background: rgba(255,255,255,0.05); border-color: var(--text-secondary); }

/* THEME TOGGLE */
.theme-toggle {
  background: transparent;
  border: 1px solid var(--surface-border);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.theme-toggle:hover {
  border-color: var(--text-primary);
  color: var(--text-primary);
  background: var(--surface-hover);
}
.theme-toggle svg { width: 18px; height: 18px; }
.sun-icon { display: none; }
.moon-icon { display: block; }
[data-theme="light"] .sun-icon { display: block; }
[data-theme="light"] .moon-icon { display: none; }

/* APP LAYOUT */
.app-container {
  display: flex;
  margin-top: var(--topbar-height);
  height: calc(100vh - var(--topbar-height));
  position: relative;
}

/* LEFT SIDEBAR */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  border-right: 1px solid var(--surface-border);
  background: var(--bg-color);
  overflow-y: auto;
  padding: 2rem 1.5rem;
  z-index: 50;
  transition: transform 0.3s ease;
}

.nav-group { margin-bottom: 2rem; }
.nav-group h4 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-secondary); margin-bottom: 0.75rem; }
.toc-link {
  display: block; font-size: 0.875rem; color: #888; text-decoration: none;
  padding: 0.4rem 0; margin-bottom: 0.25rem; border-left: 2px solid transparent; padding-left: 0.75rem;
  transition: all 0.2s;
}
.toc-link:hover { color: var(--text-primary); }
.toc-link.active {
  color: var(--neon-blue); border-left-color: var(--neon-blue); background: rgba(59, 130, 246, 0.05);
  font-weight: 500;
}

/* MAIN CONTENT */
.content-area {
  flex-grow: 1;
  overflow-y: auto;
  padding: 3rem 4rem 10rem;
  scroll-behavior: smooth;
}
.content-wrapper { max-width: 800px; margin: 0 auto; }

.breadcrumbs { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 2rem; font-family: var(--font-mono); }

/* CONTENT TYPOGRAPHY & MARKDOWN STYLING */
.doc-section { scroll-margin-top: calc(var(--topbar-height) + 2rem); margin-bottom: 4rem; }
/* Page-level h1 — appears only once */
.doc-section h1 { font-size: 2.8rem; letter-spacing: -0.03em; margin-bottom: 1.5rem; font-weight: 700; }
/* Section headings (formerly h1, now h2 for correct SEO hierarchy) */
.doc-section h2 { font-size: 2rem; letter-spacing: -0.02em; margin: 3.5rem 0 1.25rem; font-weight: 700; border-bottom: 1px solid var(--surface-border); padding-bottom: 0.75rem; }
/* Subsection headings */
.doc-section h3 { font-size: 1.25rem; margin: 2rem 0 0.75rem; color: var(--text-primary); }
.doc-section p { color: var(--text-secondary); line-height: 1.7; font-size: 1.05rem; margin-bottom: 1.5rem; }
.lead-text { font-size: 1.2rem !important; color: var(--text-primary) !important; line-height: 1.6; opacity: 0.9; }

.doc-section ul { padding-left: 1.5rem; margin-bottom: 1.5rem; color: var(--text-secondary); line-height: 1.7; }
.doc-section li { margin-bottom: 0.5rem; }
.doc-section code { background: var(--badge-bg); padding: 0.2em 0.4em; border-radius: 4px; font-family: var(--font-mono); font-size: 0.85em; color: var(--text-primary); }

.section-divider { border: 0; height: 1px; background: var(--surface-border); margin: 4rem 0; }

/* ALERTS / CALLOUTS */
.alert {
  display: flex; gap: 1rem; padding: 1.25rem; border-radius: 8px; margin: 2rem 0;
  border: 1px solid var(--surface-border); background: var(--surface);
  color: #a3a3a3; font-size: 0.95rem; line-height: 1.6;
}
.alert-info { border-color: rgba(59, 130, 246, 0.4); background: rgba(59, 130, 246, 0.05); }
.alert-info svg { color: var(--neon-blue); flex-shrink: 0; width: 24px; height: 24px; }
.alert-warning { border-color: rgba(245, 158, 11, 0.4); background: rgba(245, 158, 11, 0.05); }
.alert-warning svg { color: #f59e0b; flex-shrink: 0; width: 24px; height: 24px; }

/* CODE BLOCKS */
.code-block-wrapper { margin: 1.5rem 0 2.5rem; border: 1px solid var(--surface-border); border-radius: 8px; overflow: hidden; background: var(--editor-body-bg); }
.code-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.75rem 1rem; background: var(--editor-header-bg); border-bottom: 1px solid var(--surface-border);
  font-family: var(--font-mono); font-size: 0.75rem; color: var(--editor-text-title);
}
.code-header .dots { display: flex; gap: 6px; }
.code-header .dot { width: 10px; height: 10px; border-radius: 50%; opacity: 0.8; }
.code-header .dot.red { background: #ff5f56; }
.code-header .dot.yellow { background: #ffbd2e; }
.code-header .dot.green { background: #27c93f; }
.code-header .title { flex-grow: 1; text-align: center; font-size: 0.75rem; letter-spacing: 0.05em; font-family: var(--font-mono); }

.code-block-wrapper pre { margin: 0; padding: 1.25rem; overflow-x: auto; background: var(--editor-body-bg); }
.code-block-wrapper code { background: transparent; padding: 0; color: #a0aec0; font-size: 0.875rem; line-height: 1.5; white-space: pre; }

.copy-btn { 
    background: var(--bg-color); 
    border: 1px solid var(--surface-border); 
    color: var(--text-secondary); 
    border-radius: 4px; padding: 0.2rem 0.6rem; 
    font-size: 0.7rem; cursor: pointer; transition: all 0.2s; 
}
.copy-btn:hover { color: var(--text-primary); border-color: var(--text-secondary); background: var(--surface-hover); }

/* MOBILE RESPONSIVE */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(4px); z-index: 40; }

@media (max-width: 900px) {
  .sidebar { position: fixed; top: var(--topbar-height); bottom: 0; left: 0; transform: translateX(-100%); width: 260px; box-shadow: 10px 0 30px rgba(0,0,0,0.5); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .mobile-menu-btn { display: block; }
  .content-area { padding: 2rem 1.25rem; }
  .doc-section h1 { font-size: 2rem; }
  /* Prevent code blocks from overflowing the content pane */
  .code-block-wrapper pre { overflow-x: auto; }
  .code-block-wrapper code { word-break: break-all; }
}

@media (max-width: 480px) {
  .content-area { padding: 1.5rem 1rem; }
  .doc-section h1 { font-size: 1.75rem; }
  .doc-section h2 { font-size: 1.5rem; }
  .doc-section p { font-size: 1rem; }
  .alert { flex-direction: column; gap: 0.5rem; }
  /* Allow table to scroll horizontally within its container */
  .content-wrapper { overflow-x: hidden; }
}
