/* OCTAVE Wiki — Dark Technical Docs Theme */
@import url('https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@300;400;600;700&family=Source+Code+Pro:wght@400;500;600&display=swap');

:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #1c2128;
  --bg-sidebar: #0d1117;
  --bg-code: #1c2128;
  --bg-code-inline: #1e252e;
  --bg-table-header: #1c2128;
  --bg-table-row-alt: #131920;
  --bg-card: #161b22;
  --bg-hover: #1f2937;

  --border: #30363d;
  --border-light: #21262d;

  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-tertiary: #6e7681;
  --text-link: #58a6ff;
  --text-link-hover: #79c0ff;

  --accent-blue: #58a6ff;
  --accent-green: #3fb950;
  --accent-cyan: #39d2c0;
  --accent-purple: #bc8cff;
  --accent-orange: #d29922;
  --accent-red: #f85149;

  --syntax-keyword: #ff7b72;
  --syntax-string: #a5d6ff;
  --syntax-comment: #6e7681;
  --syntax-function: #d2a8ff;
  --syntax-number: #79c0ff;
  --syntax-class: #ffa657;
  --syntax-property: #7ee787;

  --sidebar-width: 260px;
  --content-max-width: 900px;
  --header-height: 56px;

  --font-body: 'Source Sans 3', 'Source Sans Pro', 'Nunito Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Source Code Pro', 'IBM Plex Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;
  --font-heading: var(--font-body);

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 16px);
}

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
}

/* Layout */
.wiki-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  z-index: 100;
  padding: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.sidebar-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-sidebar);
  z-index: 1;
}

.sidebar-logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.5px;
}

.sidebar-logo .logo-accent {
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 14px;
}

.sidebar-section {
  padding: 12px 0 4px;
}

.sidebar-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-tertiary);
  padding: 0 20px;
  margin-bottom: 4px;
}

.sidebar-link {
  display: block;
  padding: 5px 20px 5px 28px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.15s, background 0.15s;
  border-left: 2px solid transparent;
}

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

.sidebar-link.active {
  color: var(--accent-cyan);
  border-left-color: var(--accent-cyan);
  background: rgba(57, 210, 192, 0.06);
}

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

.content-inner {
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: 40px 48px 80px;
}

/* Page Header */
.page-header {
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.breadcrumb {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: 8px;
  font-family: var(--font-mono);
}

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

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

.page-title {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
}

.page-subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  margin-top: 8px;
  line-height: 1.5;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--text-primary);
  line-height: 1.3;
}

h2 {
  font-size: 24px;
  font-weight: 600;
  margin: 40px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

h3 {
  font-size: 19px;
  font-weight: 600;
  margin: 32px 0 12px;
}

h4 {
  font-size: 16px;
  font-weight: 600;
  margin: 24px 0 8px;
}

p {
  margin: 0 0 16px;
  color: var(--text-primary);
}

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

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

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

/* Lists */
ul, ol {
  margin: 0 0 16px;
  padding-left: 24px;
}

li {
  margin-bottom: 4px;
  color: var(--text-primary);
}

li > ul, li > ol {
  margin-top: 4px;
  margin-bottom: 4px;
}

/* Inline Code */
code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--bg-code-inline);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  color: var(--accent-cyan);
  border: 1px solid var(--border-light);
}

/* Code Blocks */
pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  overflow-x: auto;
  margin: 0 0 20px;
  position: relative;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--text-primary);
  font-weight: 400;
}

.code-label {
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-tertiary);
  background: var(--bg-tertiary);
  padding: 1px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

/* Syntax Highlighting */
.kw { color: var(--syntax-keyword); }
.str { color: var(--syntax-string); }
.cmt { color: var(--syntax-comment); font-style: italic; }
.fn { color: var(--syntax-function); }
.num { color: var(--syntax-number); }
.cls { color: var(--syntax-class); }
.prop { color: var(--syntax-property); }
.op { color: var(--text-secondary); }

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 20px;
  font-size: 15px;
}

th {
  background: var(--bg-table-header);
  font-weight: 600;
  text-align: left;
  padding: 10px 14px;
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

td {
  padding: 9px 14px;
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  vertical-align: top;
}

tr:nth-child(even) {
  background: var(--bg-table-row-alt);
}

tr:hover {
  background: var(--bg-hover);
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 16px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}

.card-description {
  color: var(--text-secondary);
  font-size: 14px;
}

/* Feature Grid (Home Page) */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin: 20px 0;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color 0.2s, transform 0.2s;
}

.feature-card:hover {
  border-color: var(--accent-cyan);
  transform: translateY(-1px);
}

.feature-card a {
  text-decoration: none;
}

.feature-card .feature-icon {
  font-size: 24px;
  margin-bottom: 8px;
  display: block;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
}

.feature-card .feature-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.feature-card .feature-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Info/Warning/Tip Boxes */
.info-box {
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin: 16px 0;
  font-size: 14px;
  border-left: 3px solid;
}

.info-box.info {
  background: rgba(88, 166, 255, 0.08);
  border-left-color: var(--accent-blue);
}

.info-box.warning {
  background: rgba(210, 153, 34, 0.08);
  border-left-color: var(--accent-orange);
}

.info-box.tip {
  background: rgba(63, 185, 80, 0.08);
  border-left-color: var(--accent-green);
}

.info-box.danger {
  background: rgba(248, 81, 73, 0.08);
  border-left-color: var(--accent-red);
}

.info-box-title {
  font-weight: 600;
  margin-bottom: 4px;
}

/* File Path Badge */
.file-path {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  display: inline-block;
  margin-bottom: 8px;
}

/* Table of Contents */
.toc {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 24px;
  margin-bottom: 32px;
}

.toc-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 8px;
}

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

.toc-list li {
  margin-bottom: 2px;
}

.toc-list a {
  color: var(--text-secondary);
  font-size: 14px;
  text-decoration: none;
  padding: 2px 0;
  display: block;
}

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

.toc-list .toc-h3 {
  padding-left: 16px;
}

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

.related-pages h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 12px;
}

.related-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.related-link {
  display: inline-block;
  padding: 6px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13px;
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s;
}

.related-link:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  text-decoration: none;
}

/* Diagram / ASCII Art */
.diagram {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin: 16px 0;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-secondary);
  white-space: pre;
}

/* Keyboard Shortcut */
kbd {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 2px 6px;
  box-shadow: 0 1px 0 var(--border);
}

/* Horizontal Rule */
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 32px 0;
}

/* Mobile Sidebar Toggle */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  color: var(--text-primary);
  cursor: pointer;
  font-size: 18px;
}

/* Platform Badge */
.platform-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.platform-badge.all { background: rgba(57, 210, 192, 0.15); color: var(--accent-cyan); }
.platform-badge.desktop { background: rgba(88, 166, 255, 0.15); color: var(--accent-blue); }
.platform-badge.linux { background: rgba(188, 140, 255, 0.15); color: var(--accent-purple); }
.platform-badge.android { background: rgba(63, 185, 80, 0.15); color: var(--accent-green); }

/* Step List (for tutorials) */
.steps {
  counter-reset: step;
  list-style: none;
  padding-left: 0;
}

.steps li {
  counter-increment: step;
  position: relative;
  padding-left: 40px;
  margin-bottom: 20px;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 28px;
  height: 28px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-cyan);
}

/* Quick Reference Table */
.quick-ref {
  margin: 16px 0;
}

.quick-ref dt {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent-cyan);
  margin-top: 8px;
}

.quick-ref dd {
  color: var(--text-secondary);
  font-size: 14px;
  margin-left: 0;
  padding-left: 16px;
  margin-bottom: 8px;
}

/* Search */
.search-box {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 8px 12px;
  padding-right: 32px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.search-box input:focus {
  border-color: var(--accent-cyan);
}

.search-box input::placeholder {
  color: var(--text-tertiary);
}

.search-shortcut {
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 6px;
  color: var(--text-tertiary);
  pointer-events: none;
}

.search-box input:focus + .search-shortcut {
  display: none;
}

.search-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 80px;
}

.search-overlay.visible {
  display: flex;
}

.search-results {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 640px;
  max-height: 70vh;
  overflow-y: auto;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.search-result-count {
  padding: 10px 16px 6px;
  font-size: 12px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  border-bottom: 1px solid var(--border-light);
}

.search-no-results {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 15px;
}

.search-result-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.1s;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover,
.search-result-item.selected {
  background: var(--bg-hover);
}

.search-result-link {
  text-decoration: none;
  display: block;
}

.search-result-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.search-result-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.search-result-sections {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.search-section-link {
  font-size: 12px;
  color: var(--accent-cyan);
  background: rgba(57, 210, 192, 0.08);
  padding: 2px 8px;
  border-radius: 3px;
  text-decoration: none;
  border: 1px solid rgba(57, 210, 192, 0.15);
  transition: background 0.15s;
}

.search-section-link:hover {
  background: rgba(57, 210, 192, 0.15);
  text-decoration: none;
}

.search-result-snippet {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-top: 6px;
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

mark {
  background: rgba(210, 153, 34, 0.3);
  color: var(--text-primary);
  border-radius: 2px;
  padding: 0 1px;
}

/* Responsive */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }

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

  .sidebar-toggle {
    display: block;
  }

  .content {
    margin-left: 0;
  }

  .content-inner {
    padding: 24px 20px 60px;
  }

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

@media print {
  .sidebar, .sidebar-toggle {
    display: none;
  }

  .content {
    margin-left: 0;
  }

  body {
    background: white;
    color: black;
  }

  a {
    color: black;
    text-decoration: underline;
  }

  pre {
    border: 1px solid #ddd;
    background: #f5f5f5;
  }

  code {
    background: #f0f0f0;
    color: #333;
  }
}
