/* Dark docs layout — content-first, no marketing chrome */

:root {
  --bg: #0d1117;
  --bg-sidebar: #010409;
  --bg-elevated: #161b22;
  --bg-code: #161b22;
  --border: #30363d;
  --text: #e6edf3;
  --muted: #8b949e;
  --link: #58a6ff;
  --link-hover: #79b8ff;
  --heading: #f0f6fc;
  --sidebar-w: 260px;
  --content-w: 760px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --radius: 6px;
}

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

html { scroll-behavior: smooth; color-scheme: dark; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--link);
  text-decoration: none;
}
a:hover { text-decoration: underline; color: var(--link-hover); }

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 56px;
  border-bottom: 1px solid var(--border);
  background: rgba(13, 17, 23, 0.92);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  padding: 0 1rem;
  gap: 0.75rem;
}
.topbar .brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.topbar .brand:hover { text-decoration: none; color: var(--text); }
.topbar .brand img {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  object-fit: contain;
  display: block;
}
.topbar .brand span { color: var(--muted); font-weight: 400; }
.topbar-right {
  margin-left: auto;
  display: flex;
  gap: 1rem;
  align-items: center;
  font-size: 0.9rem;
}
.topbar-right a { color: var(--muted); }
.topbar-right a:hover { color: var(--text); }

.menu-btn {
  display: none;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  border-radius: var(--radius);
  padding: 0.35rem 0.6rem;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text);
}

/* Shell */
.shell {
  display: flex;
  min-height: calc(100vh - 56px);
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: var(--bg-sidebar);
  padding: 1.25rem 0 2rem;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
}
.sidebar-group {
  padding: 0 1rem;
  margin-bottom: 1.25rem;
}
.sidebar-group h2 {
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.sidebar a {
  display: block;
  padding: 0.3rem 0.5rem;
  margin: 0.1rem 0;
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.9rem;
  text-decoration: none;
}
.sidebar a:hover {
  background: rgba(177, 186, 196, 0.08);
  text-decoration: none;
}
.sidebar a.active {
  background: rgba(56, 139, 253, 0.12);
  color: var(--link);
  font-weight: 500;
}

/* Content */
.content {
  flex: 1;
  min-width: 0;
  padding: 2rem 2.5rem 4rem;
}
.prose {
  max-width: var(--content-w);
}
.prose h1 {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--heading);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.6rem;
}
.prose h2 {
  margin: 2rem 0 0.75rem;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4rem;
}
.prose h3 {
  margin: 1.5rem 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 600;
}
.prose p { margin: 0.75rem 0; }
.prose .lead {
  font-size: 1.05rem;
  color: var(--muted);
  margin: 0.75rem 0 1.25rem;
}
.prose ul, .prose ol {
  margin: 0.75rem 0;
  padding-left: 1.5rem;
}
.prose li { margin: 0.35rem 0; }

.prose code,
.prose tt {
  font-family: var(--mono);
  font-size: 0.85em;
  background: rgba(110, 118, 129, 0.2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.35em;
}
.prose pre {
  margin: 1rem 0;
  padding: 0.9rem 1rem;
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.5;
}
.prose pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.9rem;
  display: block;
  overflow-x: auto;
}
.prose th,
.prose td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  text-align: left;
  vertical-align: top;
}
.prose th {
  background: var(--bg-elevated);
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--muted);
}

.prose blockquote,
.note {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.note strong { display: block; margin-bottom: 0.2rem; font-size: 0.9rem; }
.note.warning {
  border-left-color: #d29922;
  background: rgba(210, 153, 34, 0.1);
}
.note.info {
  border-left-color: var(--link);
  background: rgba(56, 139, 253, 0.1);
}

/* Copy row */
.copy-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
  margin: 0.75rem 0 1rem;
  max-width: 100%;
}
.copy-row input {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 0.82rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  color: var(--text);
}
.copy-row button,
.btn {
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}
.copy-row button:hover,
.btn:hover {
  background: #21262d;
  border-color: #8b949e;
  text-decoration: none;
}
.btn-primary {
  background: #f0f6fc;
  border-color: #f0f6fc;
  color: #0d1117;
}
.btn-primary:hover {
  background: #fff;
  border-color: #fff;
  color: #0d1117;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}

/* Catalog list */
.pack {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin: 0.75rem 0;
  background: var(--bg-elevated);
}
.pack h3 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  border: none;
  padding: 0;
}
.pack .meta {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}
.pack p { margin: 0.4rem 0 0.75rem; color: var(--muted); font-size: 0.95rem; }

.footer {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--muted);
}
.footer a { color: var(--muted); }

.toast {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%) translateY(2rem);
  background: #f0f6fc;
  color: #0d1117;
  font-size: 0.85rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  opacity: 0;
  transition: 0.15s ease;
  z-index: 50;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 860px) {
  .menu-btn { display: inline-flex; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 56px;
    z-index: 30;
    transform: translateX(-100%);
    transition: transform 0.15s ease;
    box-shadow: none;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
  }
  .content { padding: 1.25rem 1rem 3rem; }
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 56px 0 0 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 25;
  }
  .sidebar-backdrop.show { display: block; }
}
