/* ============================================
   ZeroClaw Documentation — Dark Tech Theme
   ============================================ */

:root {
  --bg-primary: #0d1117;
  --bg-surface: #161b22;
  --bg-elevated: #1c2128;
  --bg-hover: #21262d;
  --border: #30363d;
  --border-light: #21262d;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #484f58;
  --accent-blue: #58a6ff;
  --accent-purple: #bc8cff;
  --accent-cyan: #39d2c0;
  --accent-green: #3fb950;
  --accent-orange: #d29922;
  --accent-red: #f85149;
  --gradient: linear-gradient(135deg, #58a6ff, #bc8cff);
  --gradient-subtle: linear-gradient(135deg, rgba(88,166,255,0.15), rgba(188,140,255,0.15));
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans SC', Helvetica, Arial, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'JetBrains Mono', 'Cascadia Code', Consolas, monospace;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
  --transition: 0.2s ease;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

/* ============ TOP NAVIGATION ============ */

.topnav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(13,17,23,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  height: 60px;
  display: flex;
  align-items: center;
  padding: 0 24px;
}

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

.topnav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 700;
  font-size: 18px;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.topnav-logo .logo-icon {
  width: 28px;
  height: 28px;
  background: var(--gradient);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  -webkit-text-fill-color: #fff;
}

.topnav-links {
  display: flex;
  gap: 4px;
}

.topnav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
}

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

.topnav-links a.active {
  color: var(--accent-blue);
  background: rgba(88,166,255,0.1);
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
  padding: 4px;
}

/* ============ LAYOUT ============ */

.page-body {
  margin-top: 60px;
}

/* Index page */
.hero {
  text-align: center;
  padding: 80px 24px 40px;
  position: relative;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 400px;
  background: radial-gradient(ellipse, rgba(88,166,255,0.08) 0%, transparent 70%);
  pointer-events: none;
}

.hero h1 {
  font-size: 48px;
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 16px;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero .subtitle {
  font-size: 20px;
  color: var(--text-secondary);
  max-width: 640px;
  margin: 0 auto 12px;
  line-height: 1.5;
}

.hero .version-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(88,166,255,0.12);
  color: var(--accent-blue);
  border: 1px solid rgba(88,166,255,0.25);
  margin-top: 8px;
}

/* Stat cards */
.stats-row {
  display: flex;
  justify-content: center;
  gap: 20px;
  padding: 20px 24px 48px;
  flex-wrap: wrap;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 32px;
  text-align: center;
  min-width: 180px;
  transition: var(--transition);
}

.stat-card:hover {
  border-color: var(--accent-blue);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(88,166,255,0.1);
}

.stat-card .stat-value {
  font-size: 32px;
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-card .stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Doc cards */
.cards-section {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 24px 60px;
}

.cards-section h2 {
  text-align: center;
  font-size: 24px;
  margin-bottom: 32px;
  color: var(--text-primary);
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.doc-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.doc-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient);
  opacity: 0;
  transition: var(--transition);
}

.doc-card:hover {
  border-color: var(--accent-blue);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.doc-card:hover::before {
  opacity: 1;
}

.doc-card .card-icon {
  font-size: 32px;
  margin-bottom: 14px;
  display: block;
}

.doc-card h3 {
  font-size: 18px;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.doc-card p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.doc-card .card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.doc-card .tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--bg-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

/* Tech stack footer */
.tech-footer {
  text-align: center;
  padding: 40px 24px 60px;
  border-top: 1px solid var(--border);
  max-width: 800px;
  margin: 0 auto;
}

.tech-footer h3 {
  font-size: 14px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 16px;
}

.tech-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.tech-tag {
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 20px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

/* ============ CONTENT PAGE LAYOUT ============ */

.content-layout {
  display: flex;
  margin-top: 60px;
}

.sidebar {
  position: fixed;
  top: 60px;
  left: 0;
  bottom: 0;
  width: 260px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 20px 0;
  z-index: 100;
}

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

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

.sidebar-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  padding: 8px 20px;
  margin-bottom: 4px;
}

.sidebar a {
  display: block;
  padding: 6px 20px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  line-height: 1.5;
  border-left: 2px solid transparent;
  transition: var(--transition);
}

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

.sidebar a.active {
  color: var(--accent-blue);
  border-left-color: var(--accent-blue);
  background: rgba(88,166,255,0.06);
}

.sidebar a.level-3 {
  padding-left: 36px;
  font-size: 12px;
}

.main-content {
  margin-left: 260px;
  flex: 1;
  min-width: 0;
  padding: 40px 48px 80px;
  max-width: 960px;
}

/* ============ TYPOGRAPHY ============ */

.main-content h1 {
  font-size: 36px;
  font-weight: 800;
  margin-bottom: 8px;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.main-content .doc-meta {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.main-content h2 {
  font-size: 24px;
  font-weight: 700;
  margin-top: 48px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}

.main-content h3 {
  font-size: 18px;
  font-weight: 600;
  margin-top: 32px;
  margin-bottom: 12px;
  color: var(--accent-blue);
}

.main-content h4 {
  font-size: 15px;
  font-weight: 600;
  margin-top: 24px;
  margin-bottom: 8px;
  color: var(--accent-purple);
}

.main-content p {
  margin-bottom: 16px;
  color: var(--text-primary);
}

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

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

.main-content a:hover {
  text-decoration: underline;
}

.main-content ul, .main-content ol {
  margin-bottom: 16px;
  padding-left: 24px;
}

.main-content li {
  margin-bottom: 6px;
  color: var(--text-primary);
}

.main-content li::marker {
  color: var(--accent-blue);
}

.main-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 40px 0;
}

/* Blockquote */
.main-content blockquote {
  border-left: 3px solid var(--accent-purple);
  padding: 12px 20px;
  margin: 16px 0;
  background: rgba(188,140,255,0.06);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-secondary);
  font-style: italic;
}

/* ============ CODE BLOCKS ============ */

.main-content code {
  font-family: var(--font-mono);
  font-size: 13px;
}

.main-content :not(pre) > code {
  background: var(--bg-elevated);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--accent-cyan);
  font-size: 0.88em;
}

.main-content pre {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  overflow-x: auto;
  margin: 16px 0;
  position: relative;
}

.main-content pre code {
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 13px;
}

/* Code language label */
.main-content pre[data-lang]::before {
  content: attr(data-lang);
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Syntax highlight colors */
.kw { color: #ff7b72; }       /* keywords: pub, fn, async, let, use, struct, impl, enum */
.ty { color: #ffa657; }       /* types: String, bool, Vec, Result, Self */
.fn { color: #d2a8ff; }       /* function names */
.st { color: #a5d6ff; }       /* strings */
.cm { color: #8b949e; font-style: italic; }  /* comments */
.num { color: #79c0ff; }      /* numbers */
.at { color: #ff7b72; }       /* attributes: #[async_trait] */
.mc { color: #ffa657; }       /* macros: json!, bail! */
.op { color: #8b949e; }       /* operators */
.lf { color: #7ee787; }       /* lifetimes */

/* ASCII art blocks */
pre.ascii-art {
  font-size: 12px;
  line-height: 1.4;
  color: var(--accent-cyan);
  background: var(--bg-primary);
  overflow-x: auto;
}

/* ============ TABLES ============ */

.main-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 14px;
}

.main-content thead th {
  text-align: left;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
}

.main-content tbody td {
  padding: 8px 14px;
  border: 1px solid var(--border);
  color: var(--text-primary);
}

.main-content tbody tr:hover {
  background: var(--bg-hover);
}

.main-content td:first-child {
  color: var(--accent-blue);
  font-weight: 500;
}

/* Centered emoji check marks */
.main-content td.center {
  text-align: center;
}

/* ============ CALLOUT BOXES ============ */

.callout {
  padding: 16px 20px;
  border-radius: var(--radius);
  margin: 16px 0;
  border-left: 3px solid;
}

.callout-info {
  background: rgba(88,166,255,0.08);
  border-left-color: var(--accent-blue);
}

.callout-warn {
  background: rgba(210,153,34,0.08);
  border-left-color: var(--accent-orange);
}

.callout-tip {
  background: rgba(63,185,80,0.08);
  border-left-color: var(--accent-green);
}

.callout-title {
  font-weight: 600;
  margin-bottom: 4px;
  font-size: 14px;
}

/* ============ RESPONSIVE ============ */

@media (max-width: 900px) {
  .topnav-links {
    display: none;
  }

  .topnav-links.show {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    padding: 8px;
    box-shadow: var(--shadow);
  }

  .menu-toggle {
    display: block;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

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

  .main-content {
    margin-left: 0;
    padding: 24px 16px 60px;
  }

  .hero h1 {
    font-size: 32px;
  }

  .hero .subtitle {
    font-size: 16px;
  }

  .stat-card {
    min-width: 140px;
    padding: 16px 20px;
  }

  .stat-card .stat-value {
    font-size: 24px;
  }

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

  .main-content h2 {
    font-size: 20px;
  }

  .main-content pre {
    font-size: 12px;
    padding: 12px;
  }

  .main-content table {
    font-size: 12px;
    display: block;
    overflow-x: auto;
  }
}

/* ============ SCROLLBAR ============ */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

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

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ============ SELECTION ============ */

::selection {
  background: rgba(88,166,255,0.3);
  color: var(--text-primary);
}

/* ============ ANIMATIONS ============ */

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.4s ease forwards;
}

/* staggered */
.cards-grid .doc-card:nth-child(1) { animation-delay: 0.1s; }
.cards-grid .doc-card:nth-child(2) { animation-delay: 0.2s; }
.cards-grid .doc-card:nth-child(3) { animation-delay: 0.3s; }

.stats-row .stat-card:nth-child(1) { animation-delay: 0.05s; }
.stats-row .stat-card:nth-child(2) { animation-delay: 0.1s; }
.stats-row .stat-card:nth-child(3) { animation-delay: 0.15s; }
.stats-row .stat-card:nth-child(4) { animation-delay: 0.2s; }
.stats-row .stat-card:nth-child(5) { animation-delay: 0.25s; }
