/* Linknesis Docs — light/dark responsive stylesheet */

:root {
  --font-sans: 'Google Sans Flex Variable', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --bg-body: #121212;
  --bg-surface: #1e1e1e;
  --bg-surface-2: #252525;
  --bg-sidebar: #181818;
  --text-body: #e0e0e0;
  --text-muted: #9e9e9e;
  --text-heading: #ffffff;
  --border-color: #333333;
  --primary: #0d6efd;
  --primary-hover: #0b5ed7;
  --accent: #8ab4f8;
  --navbar-bg: rgba(18, 18, 18, 0.95);
  --code-bg: #2a2a2a;
  --radius: 0.75rem;
  --transition: 0.2s ease;
  --sidebar-width: 280px;
  --toc-width: 260px;
  --navbar-height: 64px;
}

html[data-bs-theme="light"] {
  --bg-body: #f8f9fa;
  --bg-surface: #ffffff;
  --bg-surface-2: #f1f3f5;
  --bg-sidebar: #ffffff;
  --text-body: #212529;
  --text-muted: #6c757d;
  --text-heading: #111827;
  --border-color: #e5e7eb;
  --accent: #0d6efd;
  --navbar-bg: rgba(255, 255, 255, 0.95);
  --code-bg: #f3f4f6;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-body);
  color: var(--text-body);
  line-height: 1.7;
  transition: background-color var(--transition), color var(--transition);
  -webkit-font-smoothing: antialiased;
}

/* Navbar */
.navbar {
  background-color: var(--navbar-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  height: var(--navbar-height);
  transition: background-color var(--transition), border-color var(--transition);
}

.navbar-brand {
  color: var(--text-heading);
  font-weight: 600;
  font-size: 1.15rem;
}

.navbar-brand:hover {
  color: var(--accent);
}

.navbar-brand img {
  filter: brightness(1.1);
}

html[data-bs-theme="light"] .navbar-brand img {
  filter: none;
}

.btn-outline-theme {
  color: var(--text-body);
  border-color: var(--border-color);
  background: transparent;
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-outline-theme:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Layout wrapper */
.docs-wrapper {
  display: flex;
  min-height: calc(100vh - var(--navbar-height));
  padding-top: var(--navbar-height);
}

/* Sidebars */
.sidebar {
  position: fixed;
  top: var(--navbar-height);
  bottom: 0;
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  padding: 1.5rem;
  transition: background-color var(--transition), border-color var(--transition);
  z-index: 100;
}

.sidebar-left {
  left: 0;
}

.sidebar-right {
  right: 0;
  border-right: none;
  border-left: 1px solid var(--border-color);
  width: var(--toc-width);
}

.sidebar-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.nav-docs {
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-docs li {
  margin-bottom: 0.25rem;
}

.nav-docs a {
  display: block;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  transition: background-color var(--transition), color var(--transition), transform var(--transition);
}

.nav-docs a:hover {
  background-color: var(--bg-surface-2);
  color: var(--text-body);
}

.nav-docs a.active {
  background-color: rgba(13, 110, 253, 0.15);
  color: var(--accent);
}

html[data-bs-theme="light"] .nav-docs a.active {
  background-color: rgba(13, 110, 253, 0.08);
  color: var(--primary);
}

/* TOC */
.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-list li {
  margin-bottom: 0.25rem;
  opacity: 0;
  transform: translateX(20px);
  animation: slideInRight 0.4s ease forwards;
}

.toc-list li:nth-child(1) { animation-delay: 0.05s; }
.toc-list li:nth-child(2) { animation-delay: 0.1s; }
.toc-list li:nth-child(3) { animation-delay: 0.15s; }
.toc-list li:nth-child(4) { animation-delay: 0.2s; }
.toc-list li:nth-child(5) { animation-delay: 0.25s; }
.toc-list li:nth-child(6) { animation-delay: 0.3s; }
.toc-list li:nth-child(7) { animation-delay: 0.35s; }
.toc-list li:nth-child(8) { animation-delay: 0.4s; }
.toc-list li:nth-child(9) { animation-delay: 0.45s; }
.toc-list li:nth-child(10) { animation-delay: 0.5s; }

@keyframes slideInRight {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.toc-list a {
  display: block;
  padding: 0.35rem 0.75rem;
  border-left: 2px solid transparent;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color var(--transition), border-color var(--transition), transform var(--transition);
  position: relative;
}

.toc-list a::before {
  content: '';
  position: absolute;
  left: -2px;
  top: 0;
  bottom: 0;
  width: 2px;
  background-color: var(--primary);
  transform: scaleY(0);
  transition: transform 0.25s ease;
}

.toc-list a:hover {
  color: var(--text-body);
}

.toc-list a.active {
  color: var(--accent);
}

html[data-bs-theme="light"] .toc-list a.active {
  color: var(--primary);
}

.toc-list a.active::before {
  transform: scaleY(1);
}

/* Main content */
.docs-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  margin-right: var(--toc-width);
  padding: 2.5rem;
  max-width: 900px;
}

.docs-content h1 {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}

.docs-content h2 {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--text-heading);
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

.docs-content h3 {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text-heading);
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.docs-content p {
  margin-bottom: 1.25rem;
  color: var(--text-body);
}

.docs-content a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition);
}

html[data-bs-theme="light"] .docs-content a {
  color: var(--primary);
}

.docs-content a:hover {
  border-bottom-color: currentColor;
}

.docs-content ul,
.docs-content ol {
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
}

.docs-content li {
  margin-bottom: 0.5rem;
}

.docs-content code {
  background-color: var(--code-bg);
  color: var(--accent);
  padding: 0.2rem 0.4rem;
  border-radius: 0.35rem;
  font-size: 0.9em;
}

html[data-bs-theme="light"] .docs-content code {
  color: var(--primary);
}

.docs-content pre {
  background-color: var(--code-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1.5rem;
  overflow-x: auto;
}

.docs-content pre code {
  background: none;
  padding: 0;
  color: var(--text-body);
}

.docs-content .lead {
  color: var(--text-muted);
  font-size: 1.15rem;
}

.docs-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
}

.docs-content th,
.docs-content td {
  border: 1px solid var(--border-color);
  padding: 0.75rem;
  text-align: left;
}

.docs-content th {
  background-color: var(--bg-surface-2);
  color: var(--text-heading);
}

/* Section reveal animation */
.reveal-section {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal-section.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Mobile sidebar toggle */
.sidebar-toggle {
  display: none;
  margin-right: 0.75rem;
}

/* Footer */
.docs-footer {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 1199.98px) {
  .sidebar-right {
    display: none;
  }

  .docs-main {
    margin-right: 0;
  }
}

@media (max-width: 991.98px) {
  .sidebar-left {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.25);
  }

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

  .docs-main {
    margin-left: 0;
    padding: 1.5rem;
  }

  .sidebar-toggle {
    display: inline-flex;
  }

  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: var(--navbar-height) 0 0 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
  }

  .sidebar-backdrop.show {
    display: block;
  }
}

@media (max-width: 575.98px) {
  .docs-content h1 {
    font-size: 2rem;
  }

  .docs-content h2 {
    font-size: 1.5rem;
  }

  .docs-main {
    padding: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .reveal-section,
  .toc-list li {
    transition: none;
    animation: none;
    opacity: 1;
    transform: none;
  }
}
