/* ── LoomVTT Docs — docs.css ─────────────────────────────────────────────── */

:root {
  --docs-sidebar-width: 272px;
  --docs-header-height: 56px;
  --docs-bg: #080c14;
  --docs-sidebar-bg: #0d1220;
  --docs-sidebar-border: rgba(255, 255, 255, 0.07);
  --docs-accent: #f59e0b;
  --docs-accent-dim: rgba(245, 158, 11, 0.12);
  --docs-text: #e2e8f0;
  --docs-text-muted: #64748b;
  --docs-border: rgba(255, 255, 255, 0.06);
  --docs-code-bg: #0d1117;
  --docs-active-bg: rgba(245, 158, 11, 0.08);
}

html, body { margin: 0; padding: 0; height: 100%; }

.docs-page {
  background: var(--docs-bg);
  color: var(--docs-text);
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  min-height: 100vh;
}

/* Top Bar */
.docs-topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--docs-header-height);
  background: rgba(8, 12, 20, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--docs-sidebar-border);
  display: flex;
  align-items: center;
  padding: 0 1rem;
  z-index: 100;
  gap: 0.75rem;
}

.docs-hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--docs-text-muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
}
.docs-hamburger:hover { color: var(--docs-text); background: rgba(255,255,255,0.06); }

.docs-topbar-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--docs-text);
  font-weight: 800;
  font-size: 0.9375rem;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}
.docs-topbar-logo img { width: 26px; height: 26px; object-fit: contain; border-radius: 5px; }
.docs-topbar-logo .accent { color: var(--docs-accent); }

.docs-topbar-sep { color: var(--docs-text-muted); opacity: 0.35; font-size: 1.25rem; font-weight: 300; flex-shrink: 0; }

.docs-topbar-badge {
  font-size: 0.625rem;
  font-weight: 700;
  color: var(--docs-accent);
  background: var(--docs-accent-dim);
  border: 1px solid rgba(245, 158, 11, 0.28);
  border-radius: 4px;
  padding: 2px 7px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  flex-shrink: 0;
}

.docs-topbar-spacer { flex: 1; }

.docs-lang-toggle {
  display: flex;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--docs-border);
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
}

.docs-lang-btn {
  padding: 4px 11px;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--docs-text-muted);
  background: none;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.06em;
  line-height: 1;
}
.docs-lang-btn.active { background: var(--docs-accent-dim); color: var(--docs-accent); }
.docs-lang-btn:hover:not(.active) { color: var(--docs-text); background: rgba(255,255,255,0.05); }

.docs-back-link {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8rem;
  color: var(--docs-text-muted);
  text-decoration: none;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid var(--docs-border);
  transition: all 0.15s;
  flex-shrink: 0;
}
.docs-back-link:hover { color: var(--docs-text); border-color: rgba(255,255,255,0.14); background: rgba(255,255,255,0.04); }

/* Sidebar */
.docs-sidebar {
  position: fixed;
  top: var(--docs-header-height);
  left: 0; bottom: 0;
  width: var(--docs-sidebar-width);
  background: var(--docs-sidebar-bg);
  border-right: 1px solid var(--docs-sidebar-border);
  display: flex;
  flex-direction: column;
  z-index: 50;
  overflow: hidden;
}

.docs-search-wrap {
  position: relative;
  padding: 0.875rem 0.875rem 0.75rem;
  border-bottom: 1px solid var(--docs-border);
  flex-shrink: 0;
}

.docs-search-icon {
  position: absolute;
  left: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--docs-text-muted);
  font-size: 0.7rem;
  pointer-events: none;
}

.docs-search {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--docs-border);
  border-radius: 8px;
  color: var(--docs-text);
  font-size: 0.8125rem;
  padding: 7px 10px 7px 30px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
  font-family: inherit;
}
.docs-search:focus { border-color: rgba(245,158,11,0.35); background: rgba(245,158,11,0.03); }
.docs-search::placeholder { color: var(--docs-text-muted); }

.docs-search-results {
  position: absolute;
  top: calc(100% - 0.25rem);
  left: 0.875rem; right: 0.875rem;
  background: #131929;
  border: 1px solid var(--docs-sidebar-border);
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  max-height: 280px;
  overflow-y: auto;
  z-index: 300;
  display: none;
}
.docs-search-results.visible { display: block; }

.docs-search-result-item {
  display: block;
  padding: 8px 12px;
  font-size: 0.8rem;
  color: var(--docs-text-muted);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.1s;
  border-bottom: 1px solid var(--docs-border);
  line-height: 1.4;
}
.docs-search-result-item:last-child { border-bottom: none; }
.docs-search-result-item:hover { background: rgba(255,255,255,0.05); color: var(--docs-text); }
.docs-search-result-item strong { color: var(--docs-accent); font-weight: 600; }

.docs-search-result-section {
  font-size: 0.6875rem;
  color: var(--docs-text-muted);
  opacity: 0.65;
  display: block;
  margin-top: 1px;
}

.docs-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.375rem 0 1rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.08) transparent;
}
.docs-nav::-webkit-scrollbar { width: 3px; }
.docs-nav::-webkit-scrollbar-track { background: transparent; }
.docs-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 2px; }

.docs-section-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.875rem 0.25rem;
  cursor: pointer;
  user-select: none;
  color: var(--docs-text-muted);
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: color 0.15s;
  margin-top: 0.375rem;
}
.docs-section-header:hover { color: var(--docs-text); }

.docs-section-icon { font-size: 0.75rem; width: 15px; text-align: center; }

.docs-section-chevron {
  margin-left: auto;
  font-size: 0.5625rem;
  transition: transform 0.2s ease;
  opacity: 0.5;
}
.docs-section-header.collapsed .docs-section-chevron { transform: rotate(-90deg); }

.docs-section-pages { overflow: hidden; transition: max-height 0.25s ease; }

.docs-page-link {
  display: block;
  padding: 4px 0.875rem 4px 2.25rem;
  font-size: 0.8rem;
  color: var(--docs-text-muted);
  text-decoration: none;
  transition: all 0.12s;
  border-left: 2px solid transparent;
  margin-left: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.5;
}
.docs-page-link:hover { color: #cbd5e1; background: rgba(255,255,255,0.03); }
.docs-page-link.active { color: var(--docs-accent); background: var(--docs-active-bg); border-left-color: var(--docs-accent); font-weight: 500; }

/* Overlay mobile */
.docs-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.65); z-index: 40; }
.docs-overlay.visible { display: block; }

/* Main */
.docs-main { margin-left: var(--docs-sidebar-width); padding-top: var(--docs-header-height); min-height: 100vh; }

.docs-content-wrap { max-width: 820px; margin: 0 auto; padding: 2.5rem 2.5rem 5rem; }

.docs-loading {
  display: flex; align-items: center; justify-content: center;
  height: 55vh; color: var(--docs-text-muted); gap: 0.625rem; font-size: 0.875rem;
}

/* Prose */
.docs-prose { line-height: 1.78; font-size: 0.9375rem; }

.docs-prose h1 { font-size: 1.875rem; font-weight: 800; color: #ffffff; margin: 0 0 1.25rem; padding-bottom: 0.875rem; border-bottom: 1px solid var(--docs-border); letter-spacing: -0.025em; line-height: 1.25; }
.docs-prose h2 { font-size: 1.3125rem; font-weight: 700; color: #f1f5f9; margin: 2.5rem 0 0.875rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--docs-border); letter-spacing: -0.018em; }
.docs-prose h3 { font-size: 1.0625rem; font-weight: 600; color: #e2e8f0; margin: 2rem 0 0.625rem; }
.docs-prose h4 { font-size: 0.9375rem; font-weight: 600; color: #cbd5e1; margin: 1.5rem 0 0.5rem; }
.docs-prose h5, .docs-prose h6 { font-size: 0.875rem; font-weight: 600; color: #94a3b8; margin: 1.25rem 0 0.375rem; text-transform: uppercase; letter-spacing: 0.05em; }

.docs-prose p { margin: 0 0 1rem; color: #94a3b8; }
.docs-prose a { color: var(--docs-accent); text-decoration: none; border-bottom: 1px solid rgba(245,158,11,0.28); transition: border-color 0.15s, color 0.15s; }
.docs-prose a:hover { color: #fbbf24; border-bottom-color: #fbbf24; }

.docs-prose ul, .docs-prose ol { margin: 0.25rem 0 1rem; padding-left: 1.625rem; color: #94a3b8; }
.docs-prose li { margin-bottom: 0.375rem; }
.docs-prose li strong { color: #e2e8f0; }
.docs-prose strong { color: #e2e8f0; font-weight: 600; }
.docs-prose em { color: #94a3b8; }

.docs-prose :not(pre) > code {
  font-family: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  font-size: 0.825em;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  padding: 0.1em 0.45em;
  color: #c084fc;
}

.docs-prose pre { margin: 1.125rem 0 1.75rem; border-radius: 10px; overflow: hidden; border: 1px solid rgba(255,255,255,0.07); box-shadow: 0 8px 32px rgba(0,0,0,0.35); }
.docs-prose pre code { font-family: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', 'Consolas', monospace; background: none !important; border: none; padding: 0; color: inherit; font-size: 0.84rem; }
.docs-prose .hljs { padding: 1.25rem 1.5rem; background: #0d1117 !important; font-size: 0.84rem; line-height: 1.65; }

.docs-prose table { width: 100%; border-collapse: collapse; margin: 0.875rem 0 1.75rem; font-size: 0.875rem; border-radius: 8px; border: 1px solid var(--docs-border); overflow: hidden; }
.docs-prose thead th { background: rgba(255,255,255,0.04); color: #e2e8f0; font-weight: 600; text-align: left; padding: 0.625rem 1rem; border-bottom: 1px solid var(--docs-border); font-size: 0.8125rem; white-space: nowrap; }
.docs-prose tbody td { padding: 0.5625rem 1rem; border-bottom: 1px solid var(--docs-border); color: #94a3b8; vertical-align: top; line-height: 1.55; }
.docs-prose tbody tr:last-child td { border-bottom: none; }
.docs-prose tbody tr:hover td { background: rgba(255,255,255,0.015); }

.docs-prose blockquote { margin: 1.25rem 0; padding: 0.875rem 1.25rem; border-left: 3px solid var(--docs-accent); background: rgba(245,158,11,0.05); border-radius: 0 8px 8px 0; color: #94a3b8; }
.docs-prose blockquote p { margin: 0; }

.docs-prose hr { border: none; border-top: 1px solid var(--docs-border); margin: 2.25rem 0; }

.docs-prose img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--docs-border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  margin: 1.25rem 0;
  display: block;
}

/* Responsive */
@media (max-width: 900px) { .docs-content-wrap { padding: 2rem 1.5rem 4rem; } }

@media (max-width: 768px) {
  .docs-hamburger { display: block; }
  .docs-topbar-badge { display: none; }
  .docs-sidebar {
    transform: translateX(-100%);
    transition: transform 0.26s cubic-bezier(0.4,0,0.2,1);
    z-index: 200;
    width: min(var(--docs-sidebar-width), 85vw);
  }
  .docs-sidebar.open { transform: translateX(0); }
  .docs-main { margin-left: 0; }
  .docs-content-wrap { padding: 1.5rem 1rem 3.5rem; }
  .docs-prose h1 { font-size: 1.5rem; }
  .docs-prose h2 { font-size: 1.125rem; }
}
