/* HyperGrowth Docs — Dark specification documentation UI */

:root {
  --bg: #070A0F;
  --surface: #0B1018;
  --surface-elevated: #101722;
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.14);
  --ink: #F3F7FB;
  --ink-secondary: #A7B0BF;
  --ink-muted: #6F7A89;
  --ink-dim: rgba(255,255,255,0.35);
  --accent-cyan: #8BE9FF;
  --accent-mint: #6FFFE9;
  --accent-blue: #7C9CFF;
  --accent-glow: rgba(139,233,255,0.12);
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, monospace;
  --sidebar-width: 280px;
  --toc-width: 220px;
  --header-height: 56px;
  --content-max: 820px;
}

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

html { scroll-behavior: smooth; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.1) var(--surface); }
html::-webkit-scrollbar { width: 8px; }
html::-webkit-scrollbar-track { background: var(--surface); }
html::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }
html::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Header */
.docs-header {
  position: fixed; top: 0; left: 0; right: 0; height: var(--header-height);
  background: rgba(7,10,15,0.92); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border); z-index: 100;
}
.docs-header-inner {
  max-width: 1440px; margin: 0 auto; padding: 0 24px; height: 100%;
  display: flex; align-items: center; gap: 28px;
}
.docs-brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--ink); font-weight: 600; font-size: 15px; letter-spacing: -0.01em; flex-shrink: 0;
}
.docs-brand-mark svg,
.docs-brand-mark img {
  display: block;
  width: 28px;
  height: 28px;
  object-fit: contain;
}
.docs-brand-wordmark { color: var(--ink); }
.docs-header-nav {
  display: flex; align-items: center; gap: 22px; flex: 1;
}
.docs-header-nav a {
  color: var(--ink-secondary); text-decoration: none; font-size: 13.5px; font-weight: 500;
  transition: color 0.15s ease; position: relative; padding: 4px 0;
}
.docs-header-nav a:hover { color: var(--ink); }
.docs-header-nav a.active { color: var(--accent-cyan); }
.docs-header-nav a.active::after {
  content: ""; position: absolute; bottom: -2px; left: 0; right: 0;
  height: 1.5px; background: linear-gradient(90deg, var(--accent-mint), var(--accent-blue)); border-radius: 2px;
}

/* Search */
.docs-search {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; min-width: 220px; cursor: pointer; transition: border-color 0.15s ease;
}
.docs-search:hover { border-color: var(--border-strong); }
.docs-search svg { color: var(--ink-muted); flex-shrink: 0; }
.docs-search input {
  background: transparent; border: none; outline: none; color: var(--ink);
  font-family: var(--font-body); font-size: 13px; width: 100%; cursor: pointer;
}
.docs-search input::placeholder { color: var(--ink-dim); }
.docs-search kbd {
  font-family: var(--font-mono); font-size: 11px; color: var(--ink-dim);
  background: var(--surface-elevated); padding: 2px 6px; border-radius: 4px; border: 1px solid var(--border); flex-shrink: 0;
}

/* Mobile menu button */
.docs-mobile-menu-btn {
  display: none; background: transparent; border: 1px solid var(--border); color: var(--ink-secondary);
  padding: 6px; border-radius: 6px; cursor: pointer; align-items: center; justify-content: center;
}
.docs-mobile-menu-btn:hover { color: var(--ink); border-color: var(--border-strong); }

/* Layout */
.docs-layout {
  display: flex; max-width: 1440px; margin: 0 auto; padding-top: var(--header-height); min-height: 100vh;
}

/* Sidebar */
.docs-sidebar {
  width: var(--sidebar-width); flex-shrink: 0; position: fixed;
  top: var(--header-height); left: 0; bottom: 0; overflow-y: auto;
  padding: 20px 0; border-right: 1px solid var(--border); background: var(--bg); z-index: 50;
}
.docs-sidebar-nav { padding: 0 16px; }
.docs-sidebar-category { margin-bottom: 4px; }
.docs-sidebar-summary {
  list-style: none; cursor: pointer; padding: 8px 12px; font-size: 13px; font-weight: 600;
  color: var(--ink); border-radius: 6px; display: flex; align-items: center;
  justify-content: space-between; user-select: none; transition: background 0.15s ease;
}
.docs-sidebar-summary::-webkit-details-marker { display: none; }
.docs-sidebar-summary::after {
  content: "\203A"; font-size: 14px; color: var(--ink-dim); transition: transform 0.2s ease; display: inline-block;
}
.docs-sidebar-category[open] .docs-sidebar-summary::after { transform: rotate(90deg); }
.docs-sidebar-summary:hover { background: rgba(255,255,255,0.04); }
.docs-sidebar-category ul { list-style: none; padding: 4px 0 4px 12px; }
.docs-sidebar-category li { margin: 2px 0; }
.docs-sidebar-category li a {
  display: block; padding: 5px 12px; font-size: 13px; color: var(--ink-secondary);
  text-decoration: none; border-radius: 6px; transition: all 0.15s ease;
  border-left: 2px solid transparent;
}
.docs-sidebar-category li a:hover { color: var(--ink); background: rgba(255,255,255,0.03); }
.docs-sidebar-category li a.active {
  color: var(--accent-mint); background: rgba(111,255,233,0.06);
  border-left-color: var(--accent-mint); font-weight: 500;
}

/* Content */
.docs-content {
  flex: 1; margin-left: var(--sidebar-width); margin-right: var(--toc-width);
  max-width: var(--content-max); padding: 40px 48px 80px;
}
.docs-article h1 {
  font-size: 40px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15;
  margin-bottom: 24px; color: var(--ink); display: flex; align-items: flex-start; gap: 12px;
}
.docs-article h2 {
  font-size: 28px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.25;
  margin-top: 48px; margin-bottom: 20px; color: var(--ink); padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
.docs-article h3 {
  font-size: 20px; font-weight: 600; line-height: 1.35;
  margin-top: 32px; margin-bottom: 16px; color: var(--ink-secondary);
}
.docs-article p {
  margin-bottom: 16px; color: var(--ink-secondary); font-size: 16px; line-height: 1.75;
}
.docs-article ul, .docs-article ol { margin-bottom: 16px; padding-left: 24px; }
.docs-article li { margin-bottom: 8px; color: var(--ink-secondary); font-size: 16px; line-height: 1.7; }
.docs-article strong { color: var(--ink); font-weight: 600; }
.docs-article a { color: var(--accent-cyan); text-decoration: none; transition: opacity 0.15s ease; }
.docs-article a:hover { opacity: 0.8; text-decoration: underline; }
.docs-article blockquote {
  border-left: 3px solid var(--accent-blue); padding-left: 16px; margin: 20px 0;
  color: var(--ink-secondary); font-style: italic; background: rgba(124,156,255,0.04);
  padding: 12px 16px; border-radius: 0 8px 8px 0;
}
.docs-article code {
  font-family: var(--font-mono); font-size: 13.5px; background: rgba(255,255,255,0.05);
  padding: 2px 6px; border-radius: 4px; color: var(--accent-cyan);
}
.docs-article pre {
  background: var(--surface-elevated); border: 1px solid var(--border); border-radius: 10px;
  padding: 20px; overflow-x: auto; margin-bottom: 20px; position: relative;
}
.docs-article pre code {
  background: transparent; padding: 0; font-size: 13px; line-height: 1.6;
  color: var(--ink-secondary); display: block;
}

/* Copy button */
.docs-copy-btn {
  position: absolute; top: 8px; right: 8px; background: var(--surface); border: 1px solid var(--border);
  color: var(--ink-muted); padding: 4px 10px; border-radius: 6px; font-size: 12px; cursor: pointer;
  display: flex; align-items: center; gap: 4px; opacity: 0; transition: opacity 0.15s ease, color 0.15s ease;
}
.docs-article pre:hover .docs-copy-btn { opacity: 1; }
.docs-copy-btn:hover { color: var(--ink); border-color: var(--border-strong); }
.docs-copy-btn.copied { color: var(--accent-mint); }

/* TOC */
.docs-toc {
  width: var(--toc-width); flex-shrink: 0; position: fixed;
  top: var(--header-height); right: 0; bottom: 0; overflow-y: auto;
  padding: 20px 16px; border-left: 1px solid var(--border); background: var(--bg); z-index: 50;
}
.docs-toc-inner h3 {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-muted); margin-bottom: 12px; padding-left: 8px;
}
.docs-toc-inner ul { list-style: none; }
.docs-toc-inner li { margin-bottom: 2px; }
.docs-toc-inner li a {
  display: block; padding: 4px 8px; font-size: 12.5px; color: var(--ink-muted);
  text-decoration: none; border-radius: 4px; transition: all 0.15s ease;
  border-left: 2px solid transparent; line-height: 1.5;
}
.docs-toc-inner li a:hover { color: var(--ink-secondary); background: rgba(255,255,255,0.03); }
.docs-toc-inner li a.active {
  color: var(--accent-mint); border-left-color: var(--accent-mint); font-weight: 500;
}

/* Page header with copy button */
.docs-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}
.docs-page-header h1 { margin-bottom: 0; }
.docs-copy-page-btn {
  position: static;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.docs-page-header:hover .docs-copy-page-btn { opacity: 1; }

/* Heading copy link */
.docs-heading-anchor {
  color: var(--ink-dim); text-decoration: none; margin-left: 8px; font-size: 0.6em;
  opacity: 0; transition: opacity 0.15s ease; vertical-align: middle;
}
.docs-article h2:hover .docs-heading-anchor, .docs-article h3:hover .docs-heading-anchor { opacity: 1; }
.docs-heading-anchor:hover { color: var(--accent-cyan); }

/* Badges */
.badge-ok {
  display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 600;
  background: rgba(109,205,168,0.12); color: #6dcda8; border: 1px solid rgba(109,205,168,0.25);
}
.badge-warn {
  display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 600;
  background: rgba(224,112,112,0.12); color: #e07070; border: 1px solid rgba(224,112,112,0.25);
}

/* Search modal */
.docs-search-modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(7,10,15,0.7); z-index: 200;
}
.docs-search-modal-overlay.open { display: block; }
.docs-search-modal {
  display: none; position: fixed; top: 80px; left: 50%; transform: translateX(-50%);
  width: min(560px, 90vw); z-index: 201; background: var(--surface-elevated);
  border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.docs-search-modal.open { display: block; }
.docs-search-modal-inner { padding: 12px; }
.docs-search-modal-input-wrap {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
}
.docs-search-modal-input-wrap svg { color: var(--ink-muted); flex-shrink: 0; }
.docs-search-modal-input-wrap input {
  background: transparent; border: none; outline: none; color: var(--ink);
  font-family: var(--font-body); font-size: 14px; width: 100%;
}
.docs-search-modal-input-wrap input::placeholder { color: var(--ink-dim); }
.docs-search-modal-input-wrap kbd {
  font-family: var(--font-mono); font-size: 11px; color: var(--ink-dim);
  background: var(--surface); padding: 2px 6px; border-radius: 4px; border: 1px solid var(--border); flex-shrink: 0;
}
.docs-search-results { list-style: none; max-height: 320px; overflow-y: auto; margin-top: 8px; }
.docs-search-results li a {
  display: block; padding: 8px 12px; border-radius: 6px; text-decoration: none;
  color: var(--ink-secondary); font-size: 13.5px; transition: background 0.12s ease;
}
.docs-search-results li a:hover { background: rgba(255,255,255,0.04); }
.docs-search-results li a .res-title { color: var(--ink); font-weight: 500; }
.docs-search-results li a .res-meta { color: var(--ink-muted); font-size: 12px; }
.docs-search-results .no-results { color: var(--ink-muted); padding: 12px; font-size: 13px; }

/* Mobile drawer */
.docs-mobile-drawer-overlay {
  display: none; position: fixed; inset: 0; background: rgba(7,10,15,0.6); z-index: 80;
}
.docs-mobile-drawer-overlay.open { display: block; }
.docs-mobile-drawer {
  display: none; position: fixed; top: var(--header-height); left: 0; bottom: 0;
  width: min(300px, 85vw); background: var(--surface); border-right: 1px solid var(--border);
  z-index: 90; overflow-y: auto; padding: 16px;
}
.docs-mobile-drawer.open { display: block; }
.docs-mobile-drawer-nav .docs-sidebar-category { margin-bottom: 4px; }

/* Responsive */
@media (max-width: 1200px) {
  .docs-toc { display: none; }
  .docs-content { margin-right: 0; max-width: none; }
}
@media (max-width: 768px) {
  .docs-sidebar { display: none; }
  .docs-content { margin-left: 0; padding: 24px; }
  .docs-header-nav { display: none; }
  .docs-search { display: none; }
  .docs-mobile-menu-btn { display: flex; }
  .docs-header-inner { gap: 12px; }
}
