/* ── Decibri Docs Shared Stylesheet ── */

:root {
  --bg: #0a0a0f;
  --bg-elevated: #12121a;
  --bg-code: #0d0d15;
  --surface: #1a1a26;
  --border: #252536;
  --border-glow: #3b3b5c;
  --text-primary: #e8e8f0;
  --text-secondary: #9494b0;
  --text-muted: #7a7a96;
  --accent: #5ea3f8;
  --accent-glow: rgba(94, 163, 248, 0.15);
  --accent-glow-strong: rgba(94, 163, 248, 0.25);
  --red: #ff6b6b;
  --red-dim: rgba(255, 107, 107, 0.12);
  --font-display: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --sidebar-width: 260px;
}

[data-theme="light"] {
  --bg: #f8f8fb;
  --bg-elevated: #ffffff;
  --bg-code: #f0f0f6;
  --surface: #eaeaf0;
  --border: #d4d4de;
  --border-glow: #b0b0c4;
  --text-primary: #1a1a2e;
  --text-secondary: #52526e;
  --text-muted: #6e6e86;
  --accent: #1d5bbf;
  --accent-glow: rgba(29, 91, 191, 0.10);
  --accent-glow-strong: rgba(29, 91, 191, 0.18);
  --red: #d94444;
  --red-dim: rgba(217, 68, 68, 0.08);
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-display);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 24px 0;
  z-index: 251;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 0 20px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-logo {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.5px;
}

.sidebar-logo span { color: var(--accent); }

.sidebar-theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s;
  padding: 0;
}

.sidebar-theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}

.sidebar-theme-toggle svg { width: 14px; height: 14px; }
.sidebar-theme-toggle .icon-sun { display: none; }
.sidebar-theme-toggle .icon-moon { display: block; }
[data-theme="light"] .sidebar-theme-toggle .icon-sun { display: block; }
[data-theme="light"] .sidebar-theme-toggle .icon-moon { display: none; }

.sidebar-nav {
  flex: 1;
  padding: 0 12px;
}

.sidebar-section {
  margin-bottom: 8px;
}

.sidebar-section-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 8px 12px 4px;
}

.sidebar-link {
  display: block;
  font-size: 13.5px;
  font-weight: 400;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
  transition: all 0.15s;
  line-height: 1.4;
}

.sidebar-link:hover {
  color: var(--text-primary);
  background: var(--surface);
}

.sidebar-link.active {
  color: var(--accent);
  background: var(--accent-glow);
  font-weight: 500;
}

.sidebar-sub {
  padding-left: 12px;
}

.sidebar-sub .sidebar-link {
  font-size: 13px;
  padding: 5px 12px;
}

.sidebar-sub .sidebar-sub .sidebar-link {
  font-size: 12.5px;
  padding: 4px 12px;
}

.sidebar-back {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.sidebar-back a {
  font-size: 12.5px;
  color: var(--text-muted);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s;
}

.sidebar-back a:hover { color: var(--accent); }

/* ── Mobile nav (shared structure with homepage) ── */
.docs-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 16px 24px;
  background: rgba(10, 10, 15, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

[data-theme="light"] .docs-nav {
  background: rgba(248, 248, 251, 0.85);
}

.docs-nav .nav-inner {
  max-width: 840px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.5px;
}

.nav-logo span { color: var(--accent); }

.mobile-nav {
  display: none;
  align-items: center;
  gap: 10px;
}

.mobile-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  padding: 0;
  color: var(--text-secondary);
  transition: all 0.2s;
  flex-shrink: 0;
}

.mobile-nav-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}

.mobile-nav-btn svg { width: 16px; height: 16px; }

.mobile-nav-btn .icon-sun { display: none; }
.mobile-nav-btn .icon-moon { display: block; }
[data-theme="light"] .mobile-nav-btn .icon-sun { display: block; }
[data-theme="light"] .mobile-nav-btn .icon-moon { display: none; }

.mobile-nav .nav-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-secondary);
  transition: all 0.2s;
  text-decoration: none;
}

.mobile-nav .nav-cta:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}

.mobile-nav .nav-cta svg { width: 16px; height: 16px; }

.mobile-menu-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 250;
}

.mobile-menu-overlay.open { display: block; }

.mobile-menu {
  position: fixed;
  top: 0;
  right: 0;
  width: 260px;
  height: 100vh;
  background: var(--bg-elevated);
  border-left: 1px solid var(--border);
  z-index: 251;
  padding: 28px 24px;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.mobile-menu.open { transform: translateX(0); }

.mobile-menu a {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  transition: color 0.2s;
}

.mobile-menu a:last-child { border-bottom: none; }
.mobile-menu a:hover { color: var(--accent); }

.mobile-menu-section {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 18px 0 6px;
}

.mobile-menu-section:first-child { padding-top: 0; }

.mobile-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 10px 0;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 250;
}

/* ── Main content ── */
.doc-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
}

.doc-container {
  max-width: 800px;
  padding: 40px 48px 80px;
}

/* ── Breadcrumb ── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.breadcrumb a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
}

.breadcrumb a:hover { color: var(--accent); }

.breadcrumb .sep {
  color: var(--border-glow);
  user-select: none;
}

.breadcrumb .current {
  color: var(--text-primary);
  font-weight: 500;
}

/* ── Typography ── */
.doc-content h1 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -1.5px;
  line-height: 1.2;
  margin-bottom: 12px;
}

.doc-content h2 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.5px;
  margin-top: 48px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.doc-content h3 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.3px;
  margin-top: 32px;
  margin-bottom: 12px;
}

.doc-content .lead {
  font-size: 17px;
  color: var(--text-secondary);
  line-height: 1.7;
  font-weight: 300;
  margin-bottom: 32px;
}

.doc-content p {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 16px;
}

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

.doc-content li {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 6px;
}

.doc-content a {
  color: var(--accent);
  text-decoration: none;
  transition: opacity 0.2s;
}

.doc-content a:hover { opacity: 0.8; }

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

/* ── Inline code ── */
.doc-content code:not([class*="language-"]) {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text-primary);
}

/* ── Code blocks ── */
.doc-content pre[class*="language-"] {
  background: var(--bg-code) !important;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 24px;
  margin: 16px 0 24px;
  overflow-x: auto;
  font-size: 13.5px;
  line-height: 1.7;
}

.doc-content pre[class*="language-"] code {
  font-family: var(--font-mono) !important;
  font-size: 13.5px !important;
  background: none !important;
  border: none !important;
  padding: 0 !important;
}

/* ── Prism.js theme overrides ── */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata { color: #546e7a !important; font-style: italic; }

.token.keyword { color: #c792ea !important; }
.token.function { color: #82aaff !important; }
.token.string,
.token.template-string { color: #c3e88d !important; }
.token.number { color: #f78c6c !important; }
.token.boolean { color: #89ddff !important; }
.token.operator { color: #89ddff !important; }
.token.punctuation { color: #9494b0 !important; }
.token.property { color: #f0c674 !important; }
.token.class-name { color: #ffcb6b !important; }
.token.constant { color: #89ddff !important; }
.token.parameter { color: #e8e8f0 !important; }

[data-theme="light"] .token.comment,
[data-theme="light"] .token.prolog { color: #6c6f85 !important; }
[data-theme="light"] .token.keyword { color: #7633c4 !important; }
[data-theme="light"] .token.function { color: #1558d6 !important; }
[data-theme="light"] .token.string,
[data-theme="light"] .token.template-string { color: #2e8b1e !important; }
[data-theme="light"] .token.number { color: #d4560a !important; }
[data-theme="light"] .token.boolean { color: #c40d33 !important; }
[data-theme="light"] .token.operator { color: #c40d33 !important; }
[data-theme="light"] .token.punctuation { color: #3a3a54 !important; }
[data-theme="light"] .token.property { color: #b87a14 !important; }
[data-theme="light"] .token.class-name { color: #b87a14 !important; }
[data-theme="light"] .token.constant { color: #c40d33 !important; }
[data-theme="light"] .token.parameter { color: #1a1a2e !important; }

[data-theme="light"] pre[class*="language-"],
[data-theme="light"] code[class*="language-"] { color: #3a3a54 !important; }

/* ── Install command ── */
.install-cmd {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  margin: 8px 0 16px;
}

.install-cmd:hover {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.install-cmd .dollar { color: var(--accent); user-select: none; }
.install-cmd .cmd { color: var(--text-primary); }

.install-cmd .copy-icon {
  color: var(--text-muted);
  transition: color 0.2s;
}

.install-cmd:hover .copy-icon { color: var(--accent); }

/* ── Tables ── */
.doc-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 24px;
  font-size: 14px;
}

.doc-content th {
  text-align: left;
  font-weight: 600;
  color: var(--text-primary);
  padding: 10px 14px;
  border-bottom: 2px solid var(--border);
  font-size: 13px;
  letter-spacing: 0.3px;
}

.doc-content td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: top;
}

.doc-content td code {
  font-size: 12.5px;
  white-space: nowrap;
}

.doc-content tr:last-child td { border-bottom: none; }

/* ── Collapsible details ── */
.doc-content details {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 24px 0;
  overflow: hidden;
}

.doc-content details summary {
  padding: 14px 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s;
}

.doc-content details summary:hover {
  background: var(--surface);
}

.doc-content details[open] summary {
  border-bottom: 1px solid var(--border);
}

.doc-content details pre[class*="language-"] {
  border: none;
  border-radius: 0;
  margin: 0;
}

/* ── Cards grid (for docs home / links) ── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 24px 0;
}

.doc-card {
  padding: 24px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  transition: all 0.2s;
  display: block;
}

.doc-card:hover {
  border-color: var(--border-glow);
  transform: translateY(-2px);
  opacity: 1;
}

.doc-card h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 6px;
  letter-spacing: -0.3px;
}

.doc-card p {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}

/* ── Info/note callouts ── */
.callout {
  padding: 16px 20px;
  background: var(--accent-glow);
  border: 1px solid rgba(94, 163, 248, 0.2);
  border-radius: 8px;
  margin: 16px 0 24px;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

[data-theme="light"] .callout {
  border-color: rgba(29, 91, 191, 0.15);
}

.callout strong { color: var(--accent); }

/* ── Related links ── */
.related-links {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.related-links h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
}

.related-links ul {
  list-style: none;
  padding: 0;
}

.related-links li {
  margin-bottom: 8px;
}

.related-links a {
  font-size: 14px;
  color: var(--accent);
  text-decoration: none;
}

.related-links a:hover { opacity: 0.8; }

/* ── Footer ── */
.doc-footer {
  margin-top: 64px;
  padding: 24px 0;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
}

.doc-footer a {
  color: var(--text-secondary);
  text-decoration: none;
}

.doc-footer a:hover { color: var(--accent); }

/* ── Responsive ── */
@media (min-width: 769px) {
  .docs-nav {
    display: none;
  }

  .mobile-menu,
  .mobile-menu-overlay {
    display: none !important;
  }
}

@media (max-width: 768px) {
  .docs-nav {
    padding: 12px 16px;
  }

  .mobile-nav {
    display: flex;
  }

  .sidebar-theme-toggle {
    display: none;
  }

  .sidebar {
    left: auto;
    right: 0;
    width: 260px;
    border-left: 1px solid var(--border);
    border-right: none;
    transform: translateX(100%);
    transition: transform 0.25s ease;
  }

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

  .sidebar-header {
    padding: 0 20px 20px;
    display: none;
  }

  .sidebar-nav {
    padding: 0 16px;
  }

  .sidebar-link {
    font-size: 15px;
    padding: 14px 12px;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
  }

  .sidebar-link:last-child {
    border-bottom: none;
  }

  .sidebar-sub .sidebar-link {
    font-size: 14px;
    padding: 12px 12px;
  }

  .sidebar-sub .sidebar-sub .sidebar-link {
    font-size: 13.5px;
    padding: 12px 12px;
  }

  .sidebar-overlay.open {
    display: block;
  }

  .doc-content {
    margin-left: 0;
  }

  .doc-container {
    padding: 72px 20px 60px;
  }

  .doc-content h1 {
    font-size: 26px;
  }

  .cards-grid {
    grid-template-columns: 1fr;
  }
}
