/* AMC Docs — Dark green on black design system */
:root {
  --bg: #0a0a0a;
  --bg2: #111111;
  --bg3: #1a1a1a;
  --card: rgba(74,239,121,0.04);
  --fg: #FFFFFF;
  --fg2: #a0a0a0;
  --muted: #a0a0a0;
  --green: #4AEF79;
  --green2: #3CD468;
  --green3: #2A9D50;
  --green-glow: rgba(74,239,121,0.12);
  --amber: #f59e0b;
  --cyan: #00e5ff;
  --red: #ff3355;
  --border: rgba(255,255,255,0.08);
  --border2: rgba(74,239,121,0.2);
  --sidebar-w: 280px;
  --topbar-h: 52px;
  --mono: 'Space Mono', 'JetBrains Mono', monospace;
  --sans: 'Inter', system-ui, sans-serif;
}

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

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--fg2);
  line-height: 1.7;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--green); text-decoration: none; }
a:hover { color: var(--green2); }

:where(a, button, input, select, textarea, [tabindex]:not([tabindex="-1"])):focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}

code, pre { font-family: var(--mono); }

.skip-link {
  position: fixed;
  left: -9999px;
  top: 12px;
  z-index: 10000;
  padding: 8px 14px;
  background: var(--green);
  color: var(--bg);
  font-family: var(--mono);
  font-weight: 700;
}
.skip-link:focus,
.skip-link:focus-visible {
  left: 12px;
}

/* ─── Topbar ─── */
.topbar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: rgba(10,10,10,0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 20px; gap: 16px; z-index: 100;
}
.topbar-logo {
  font-family: var(--mono); font-weight: 700; font-size: 1rem;
  color: var(--fg); display: flex; align-items: center; gap: 6px;
  white-space: nowrap; letter-spacing: -0.02em;
}
.topbar-logo:hover { text-decoration: none; }
.topbar-logo span { color: var(--fg); }
.menu-btn {
  display: none; background: none; border: none;
  color: var(--green); font-size: 1.4rem; cursor: pointer;
}
.topbar-search { flex: 1; max-width: 400px; position: relative; }
.topbar-search input {
  width: 100%; padding: 7px 14px;
  border: 1px solid var(--border); background: rgba(255,255,255,0.04);
  color: var(--fg); font-size: 0.82rem; outline: none;
  font-family: var(--mono);
}
.topbar-search input:focus { border-color: var(--green); box-shadow: 0 0 0 2px rgba(74,239,121,0.1); }
.topbar-links { display: flex; gap: 14px; margin-left: auto; align-items: center; }
.topbar-links a { color: var(--muted); font-size: 0.78rem; font-family: var(--mono); text-transform: lowercase; letter-spacing: 0.04em; }
.topbar-links a:hover { color: var(--green); text-decoration: none; }

/* ─── Search Results ─── */
.search-results {
  position: absolute; top: 100%; left: 0; right: 0;
  background: var(--bg2); border: 1px solid var(--border2);
  max-height: 420px; overflow-y: auto;
  display: none; z-index: 200; margin-top: 4px;
}
.search-results.visible { display: block; }
.search-result {
  padding: 10px 14px; cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.search-result:hover, .search-result.active { background: var(--card); }
.search-result-title { font-weight: 600; font-size: 0.88rem; color: var(--fg); }
.search-result-cat { font-size: 0.72rem; color: var(--muted); font-family: var(--mono); text-transform: lowercase; }
.search-result-match {
  font-size: 0.78rem; color: var(--muted); margin-top: 3px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.search-result-match mark { background: rgba(74,239,121,0.2); color: var(--green); border-radius: 2px; padding: 0 2px; }

/* ─── Layout ─── */
.layout {
  display: flex; min-height: 100vh;
  padding-top: var(--topbar-h);
}

/* ─── Sidebar ─── */
.sidebar {
  width: var(--sidebar-w); min-height: calc(100vh - var(--topbar-h));
  background: var(--bg2); border-right: 1px solid var(--border);
  position: fixed; top: var(--topbar-h); bottom: 0; left: 0;
  overflow-y: auto; z-index: 50;
}
.sidebar-inner { padding: 16px 0; }

/* Sidebar sections generated by docs.js */
.sidebar-section { padding: 0 12px; margin-bottom: 2px; }
.sidebar-section h4 {
  font-family: var(--mono); font-size: 0.68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); padding: 10px 4px 6px;
  cursor: pointer; display: flex; align-items: center; gap: 6px;
  transition: color 0.15s; border: none; background: none;
}
.sidebar-section h4:hover { color: var(--green); }
.sidebar-count { font-size: 0.62rem; color: var(--muted); opacity: 0.6; margin-left: auto; }
.sidebar-section .items { display: none; padding-bottom: 6px; }
.sidebar-section .items.expanded { display: flex; flex-direction: column; }
.sidebar-section .items a {
  display: block; padding: 4px 12px; margin: 1px 0;
  font-size: 0.72rem; color: var(--muted);
  transition: color 0.15s, background 0.15s;
  line-height: 1.5; text-decoration: none;
  text-transform: none; letter-spacing: 0;
}
.sidebar-section .items a:hover { color: var(--fg); background: rgba(255,255,255,0.04); }
.sidebar-section .items a.active { color: var(--green); background: rgba(74,239,121,0.06); font-weight: 600; }

/* Compat aliases for any old markup */
.sidebar-category { padding: 0 12px; }
.sidebar-cat-label { font-family: var(--mono); font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); padding: 10px 0 6px; cursor: pointer; }
.sidebar-cat-items { display: none; padding-bottom: 4px; }
.sidebar-cat-items.expanded { display: block; }
.sidebar-link { display: block; padding: 4px 12px; font-size: 0.72rem; color: var(--muted); line-height: 1.5; }
.sidebar-link:hover { color: var(--fg); background: rgba(255,255,255,0.03); }
.sidebar-link.active { color: var(--green); background: rgba(74,239,121,0.06); font-weight: 600; }

/* ─── Main Content ─── */
.main {
  flex: 1; margin-left: var(--sidebar-w);
  padding: 32px clamp(24px, 4vw, 48px);
  max-width: 880px;
}
.breadcrumbs {
  font-family: var(--mono); font-size: 0.72rem;
  color: var(--muted); margin-bottom: 20px;
  display: flex; gap: 6px; flex-wrap: wrap;
}
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--green); }
.breadcrumbs .sep { color: rgba(255,255,255,0.2); }

.loading {
  font-family: var(--mono); font-size: 0.88rem;
  color: var(--muted); padding: 40px 0;
}

/* ─── Document Content ─── */
.doc-content {
  font-size: 0.95rem;
  line-height: 1.75;
  color: var(--fg2);
}
.doc-content h1 {
  font-size: 1.8rem; font-weight: 700; color: var(--fg);
  margin: 0 0 16px; line-height: 1.2; letter-spacing: -0.02em;
}
.doc-content h2 {
  font-size: 1.3rem; font-weight: 700; color: var(--fg);
  margin: 32px 0 12px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border); letter-spacing: -0.01em;
}
.doc-content h3 {
  font-size: 1.05rem; font-weight: 600; color: var(--fg);
  margin: 24px 0 8px;
}
.doc-content h4 {
  font-size: 0.95rem; font-weight: 600; color: var(--fg);
  margin: 20px 0 6px;
}
.doc-content p { margin: 0 0 14px; }
.doc-content ul, .doc-content ol { margin: 0 0 14px; padding-left: 24px; }
.doc-content li { margin: 4px 0; }
.doc-content li::marker { color: var(--green); }
.doc-content strong { color: var(--fg); font-weight: 600; }
.doc-content em { color: var(--muted); }
.doc-content blockquote {
  border-left: 3px solid var(--green);
  padding: 8px 16px; margin: 14px 0;
  background: rgba(74,239,121,0.04);
  color: var(--fg2); font-style: italic;
}
.doc-content code {
  font-size: 0.85em; background: rgba(255,255,255,0.05);
  padding: 2px 6px; color: var(--green);
}
.doc-content pre {
  background: var(--bg2); border: 1px solid var(--border);
  padding: 16px; margin: 14px 0; overflow-x: auto;
  font-size: 0.82rem; line-height: 1.6;
}
.doc-content pre code { background: none; padding: 0; color: var(--fg2); }
.doc-content table {
  width: 100%; border-collapse: collapse; margin: 14px 0;
  font-size: 0.88rem;
}
.doc-content th {
  text-align: left; padding: 8px 12px;
  border-bottom: 2px solid var(--border2);
  font-family: var(--mono); font-size: 0.75rem;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--green); font-weight: 600;
}
.doc-content td {
  padding: 8px 12px; border-bottom: 1px solid var(--border);
  color: var(--fg2);
}
.doc-content tr:hover td { background: rgba(255,255,255,0.02); }
.doc-content img { max-width: 100%; border: 1px solid var(--border); }
.doc-content hr { border: none; border-top: 1px solid var(--border); margin: 24px 0; }
.doc-content a { color: var(--green); }
.doc-content a:hover { color: var(--green2); }

/* ─── Category grid (home view) ─── */
.cat-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1px; background: var(--border); margin-top: 20px;
}
.cat-card {
  background: var(--bg); padding: 20px; cursor: pointer;
  transition: background 0.2s;
}
.cat-card:hover { background: var(--card); }
.cat-card-icon { font-size: 1.2rem; margin-bottom: 6px; }
.cat-card-name {
  font-weight: 700; font-size: 0.92rem; color: var(--fg);
  margin-bottom: 4px;
}
.cat-card-name::after { content: '_'; color: var(--green); }
.cat-card-count { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); }

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .menu-btn { display: block; }
  .sidebar { transform: translateX(-100%); transition: transform 0.3s; }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .topbar-links { display: none; }
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }
