/* =====================
   CSS Variables
   ===================== */
:root {
  /* Conan-inspired color palette */
  --accent: #1a73c1;
  --accent-dark: #0d5a9e;
  --accent-light: #e8f3fc;
  --top-bar-bg: #1c2b3a;
  --top-bar-text: #d4e6f5;
  --sidebar-bg: #f5f7fa;
  --sidebar-border: #dce3ec;
  --sidebar-active-bg: #deeaf6;
  --sidebar-active-text: #1a73c1;
  --sidebar-hover-bg: #eaf2fb;
  --bg: #ffffff;
  --text: #1e2633;
  --text-muted: #5a6a7e;
  --border: #d9e2ec;
  --code-bg: #f0f4f8;
  --code-block-bg: #1e2633;
  --code-block-text: #c9d8e8;
  --note-bg: #e8f3fc;
  --note-border: #1a73c1;
  --tip-bg: #e8f8ef;
  --tip-border: #27ae60;
  --warn-bg: #fff8e6;
  --warn-border: #f0a500;
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
  --sidebar-width: 260px;
  --top-bar-height: 54px;
  --radius: 6px;
}

[data-theme="dark"] {
  --accent: #5aabee;
  --accent-dark: #7ec0f5;
  --accent-light: #1a2d40;
  --top-bar-bg: #0d1520;
  --top-bar-text: #b8d0e8;
  --sidebar-bg: #141e2b;
  --sidebar-border: #1e2d3e;
  --sidebar-active-bg: #1a3050;
  --sidebar-active-text: #5aabee;
  --sidebar-hover-bg: #172235;
  --bg: #0f1923;
  --text: #d0dde8;
  --text-muted: #7a95b0;
  --border: #1e2d3e;
  --code-bg: #1a2535;
  --code-block-bg: #0d1520;
  --code-block-text: #9ec8e8;
  --note-bg: #0e2035;
  --note-border: #5aabee;
  --tip-bg: #0e2318;
  --tip-border: #27ae60;
  --warn-bg: #201800;
  --warn-border: #f0a500;
}

/* =====================
   Reset
   ===================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
               'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.7;
  transition: background 0.25s, color 0.25s;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); text-decoration: underline; }

/* =====================
   Top Bar
   ===================== */
.top-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--top-bar-height);
  background: var(--top-bar-bg);
  z-index: 200;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
}
.top-bar-inner {
  width: 100%;
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 0;
}

/* Logo area — same width as sidebar */
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  flex-shrink: 0;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  padding-right: 20px;
}
.logo:hover { text-decoration: none; color: #fff; }
.logo-icon { font-size: 24px; line-height: 1; }
.logo-version {
  font-size: 11px;
  font-weight: 400;
  color: #7a9fbf;
  margin-left: 4px;
  align-self: flex-end;
  padding-bottom: 2px;
}

/* Top nav links */
.top-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
}
.top-nav a {
  color: var(--top-bar-text);
  font-size: 13.5px;
  padding: 6px 13px;
  border-radius: 5px;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.top-nav a:hover, .top-nav a.active {
  background: rgba(255,255,255,0.12);
  color: #fff;
  text-decoration: none;
}

/* Search bar & toolbar */
.top-search {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.search-input {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 5px;
  padding: 5px 12px;
  color: var(--top-bar-text);
  font-size: 13px;
  width: 180px;
  outline: none;
  transition: background 0.2s, border-color 0.2s;
}
.search-input::placeholder { color: #6a8ca8; }
.search-input:focus {
  background: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.3);
}
.theme-toggle {
  background: none;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 5px;
  color: var(--top-bar-text);
  cursor: pointer;
  font-size: 15px;
  padding: 4px 9px;
  transition: background 0.2s;
  white-space: nowrap;
}
.theme-toggle:hover { background: rgba(255,255,255,0.12); }

/* Language toggle button */
.lang-toggle {
  background: none;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 5px;
  color: var(--top-bar-text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  transition: background 0.2s;
  white-space: nowrap;
  letter-spacing: 0.04em;
}
.lang-toggle:hover { background: rgba(255,255,255,0.12); }

/* =====================
   Layout
   ===================== */
.layout {
  display: flex;
  margin-top: var(--top-bar-height);
  min-height: calc(100vh - var(--top-bar-height));
}

/* =====================
   Sidebar
   ===================== */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  position: sticky;
  top: var(--top-bar-height);
  height: calc(100vh - var(--top-bar-height));
  overflow-y: auto;
  padding: 20px 0 32px;
  flex-shrink: 0;
}

/* Custom scrollbar */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

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

.sidebar-group-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 10px 20px 4px;
}

.sidebar ul { list-style: none; }
.sidebar ul li a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 20px 6px 20px;
  font-size: 13.5px;
  color: var(--text);
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  text-decoration: none;
  line-height: 1.4;
}
.sidebar ul li a:hover {
  background: var(--sidebar-hover-bg);
  color: var(--accent);
  text-decoration: none;
}
.sidebar ul li a.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  border-left-color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

/* Sub-items indent */
.sidebar ul ul li a {
  padding-left: 36px;
  font-size: 13px;
  color: var(--text-muted);
}
.sidebar ul ul li a:hover,
.sidebar ul ul li a.active {
  color: var(--accent);
}

/* =====================
   Main Content — Index / Home
   ===================== */
.content {
  flex: 1;
  padding: 48px 56px 60px;
  max-width: 1100px;
  min-width: 0;
}

/* Hero Banner */
.hero-banner {
  background: linear-gradient(135deg, var(--top-bar-bg) 0%, #1a3a5c 100%);
  border-radius: var(--radius);
  padding: 48px 40px;
  margin-bottom: 40px;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.hero-banner::after {
  content: '🐬';
  position: absolute;
  right: 40px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 80px;
  opacity: 0.15;
}
.hero-banner h1 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 10px;
  line-height: 1.2;
}
.hero-banner .hero-sub {
  font-size: 1.05rem;
  color: rgba(255,255,255,0.75);
  max-width: 560px;
}

/* Page header */
.page-header {
  margin-bottom: 40px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.page-header h1 {
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 10px;
}
.page-header .subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
}

/* Version badge */
.badge {
  display: inline-block;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 20px;
  margin-left: 10px;
  vertical-align: middle;
}

/* Info banner */
.banner {
  background: var(--note-bg);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 14px 18px;
  margin-bottom: 36px;
  font-size: 14px;
  color: var(--text);
}
.banner a { color: var(--accent); }

/* Board Card Grid */
.board-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
  margin-bottom: 40px;
}
.board-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 20px 18px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
  background: var(--bg);
  box-shadow: var(--shadow-sm);
}
.board-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  text-decoration: none;
  color: var(--text);
}
.board-card-icon {
  font-size: 28px;
  margin-bottom: 12px;
  line-height: 1;
  color: var(--accent);
}
.board-card-icon svg {
  width: 52px;
  height: 52px;
  display: block;
  margin: 0 auto;
  color: var(--accent);
}
.board-card:hover .board-card-icon svg {
  color: #fff;
}
.board-card h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 6px;
}
.board-card p {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.55;
  flex: 1;
  margin-bottom: 14px;
}
.board-card-btn {
  display: inline-block;
  background: var(--accent);
  color: #fff !important;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: 5px;
  text-decoration: none;
  align-self: flex-start;
  transition: background 0.15s;
}
.board-card:hover .board-card-btn {
  background: var(--accent-dark);
  text-decoration: none;
}

/* Generic Card Grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 18px;
  margin-bottom: 40px;
}
.card {
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 20px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
  background: var(--bg);
  box-shadow: var(--shadow-sm);
}
.card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  text-decoration: none;
  color: var(--text);
}
.card-icon {
  font-size: 26px;
  margin-bottom: 12px;
  line-height: 1;
}
.card h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 6px;
}
.card p {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.55;
}

/* TOC List (index page) */
.toc-list {
  columns: 2;
  column-gap: 40px;
  margin-bottom: 40px;
}
.toc-list ul {
  list-style: none;
  break-inside: avoid;
  margin-bottom: 24px;
}
.toc-list .toc-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.toc-list ul li a {
  font-size: 13.5px;
  color: var(--accent);
  display: block;
  padding: 3px 0;
}
.toc-list ul li a:hover { text-decoration: underline; }

/* =====================
   Doc Content
   ===================== */
.doc-content {
  flex: 1;
  padding: 40px 56px 60px;
  max-width: 900px;
  min-width: 0;
}

.doc-content h1 {
  font-size: 1.9rem;
  font-weight: 800;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.doc-content h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 36px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.doc-content h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 24px 0 8px;
  color: var(--text);
}
.doc-content p { margin-bottom: 14px; }
.doc-content ul, .doc-content ol {
  margin: 10px 0 16px 24px;
}
.doc-content li { margin-bottom: 6px; }

/* Inline code */
.doc-content code, .content code {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 13px;
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  color: #c0392b;
}
[data-theme="dark"] .doc-content code,
[data-theme="dark"] .content code {
  color: #e07b7b;
}

/* Code blocks */
.doc-content pre, .content pre {
  background: var(--code-block-bg);
  border-radius: var(--radius);
  padding: 16px 20px;
  overflow-x: auto;
  margin: 16px 0;
  box-shadow: var(--shadow-sm);
}
.doc-content pre code, .content pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--code-block-text);
  font-size: 13.5px;
  line-height: 1.6;
}

/* Admonition boxes */
.note, .tip, .warning {
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 14px 18px;
  margin: 20px 0;
  font-size: 14px;
}
.note {
  background: var(--note-bg);
  border-left: 4px solid var(--note-border);
}
.tip {
  background: var(--tip-bg);
  border-left: 4px solid var(--tip-border);
}
.warning {
  background: var(--warn-bg);
  border-left: 4px solid var(--warn-border);
}
.note strong { color: var(--note-border); }
.tip strong { color: var(--tip-border); }
.warning strong { color: var(--warn-border); }

/* =====================
   Spec Table (板子规格表)
   ===================== */
.spec-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0 28px;
  font-size: 14px;
}
.spec-table th, .spec-table td {
  padding: 10px 14px;
  border: 1px solid var(--border);
  text-align: left;
}
.spec-table th {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 700;
  white-space: nowrap;
  width: 180px;
}
.spec-table tr:nth-child(even) td {
  background: var(--sidebar-bg);
}
[data-theme="dark"] .spec-table tr:nth-child(even) td {
  background: var(--sidebar-active-bg);
}

/* =====================
   Tutorial List
   ===================== */
.tutorial-list {
  list-style: none;
  margin: 0 0 28px;
}
.tutorial-list li {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.tutorial-list li:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}
.tutorial-list li a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  text-decoration: none;
  color: var(--text);
}
.tutorial-list li a:hover { text-decoration: none; color: var(--text); }
.tutorial-list .tl-icon {
  font-size: 22px;
  flex-shrink: 0;
}
.tutorial-list .tl-info h3 {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 3px;
}
.tutorial-list .tl-info p {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

/* =====================
   Accordion (Q&A / FAQ)
   ===================== */
.accordion {
  margin: 0 0 28px;
}
.accordion-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  overflow: hidden;
}
.accordion-header {
  width: 100%;
  background: var(--bg);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
  text-align: left;
  transition: background 0.15s;
  gap: 10px;
}
.accordion-header:hover {
  background: var(--sidebar-hover-bg);
  color: var(--accent);
}
.accordion-header.open {
  background: var(--accent-light);
  color: var(--accent);
  border-bottom: 1px solid var(--border);
}
.accordion-arrow {
  font-size: 12px;
  transition: transform 0.25s;
  flex-shrink: 0;
  color: var(--text-muted);
}
.accordion-header.open .accordion-arrow {
  transform: rotate(180deg);
  color: var(--accent);
}
.accordion-body {
  display: none;
  padding: 16px 18px;
  font-size: 14px;
  color: var(--text);
  line-height: 1.7;
  background: var(--bg);
}
.accordion-body.open { display: block; }
.accordion-body p { margin-bottom: 10px; }
.accordion-body p:last-child { margin-bottom: 0; }
.accordion-body ul {
  margin: 8px 0 10px 20px;
}
.accordion-body li { margin-bottom: 4px; }

/* =====================
   Search Page
   ===================== */
.search-bar-wrap {
  margin-bottom: 28px;
}
.search-bar-wrap input {
  width: 100%;
  max-width: 560px;
  padding: 11px 16px;
  font-size: 15px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}
.search-bar-wrap input:focus {
  border-color: var(--accent);
}
.search-results { margin-top: 4px; }
.search-result-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 10px;
  transition: border-color 0.15s, box-shadow 0.15s;
  background: var(--bg);
}
.search-result-item:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}
.search-result-item .sri-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
}
.search-result-item .sri-title a {
  color: var(--accent);
  text-decoration: none;
}
.search-result-item .sri-title a:hover { text-decoration: underline; }
.search-result-item .sri-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.search-result-item .sri-summary {
  font-size: 13.5px;
  color: var(--text-muted);
}
.search-no-results {
  color: var(--text-muted);
  font-size: 14px;
  padding: 20px 0;
}

/* =====================
   Entry Buttons (板子介绍页)
   ===================== */
.entry-buttons {
  display: flex;
  gap: 14px;
  margin: 28px 0;
  flex-wrap: wrap;
}
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 22px;
  border-radius: var(--radius);
  text-decoration: none;
  transition: background 0.15s, box-shadow 0.15s;
  box-shadow: 0 2px 6px rgba(26,115,193,0.25);
}
.btn-primary:hover {
  background: var(--accent-dark);
  text-decoration: none;
  color: #fff;
  box-shadow: 0 4px 12px rgba(26,115,193,0.35);
}
.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--bg);
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 22px;
  border-radius: var(--radius);
  text-decoration: none;
  border: 1.5px solid var(--accent);
  transition: background 0.15s, box-shadow 0.15s;
}
.btn-secondary:hover {
  background: var(--accent-light);
  text-decoration: none;
  color: var(--accent);
}

/* =====================
   Page Footer
   ===================== */
.page-footer {
  border-top: 1px solid var(--border);
  margin-top: 50px;
  padding-top: 20px;
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.page-footer a { color: var(--accent); }

/* =====================
   Breadcrumb
   ===================== */
.breadcrumb {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { color: var(--border); }

/* =====================
   Home sidebar (no board)
   ===================== */
.sidebar-home { padding: 24px 0; }

/* =====================
   Responsive
   ===================== */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .content, .doc-content { padding: 24px 20px; }
  .board-grid { grid-template-columns: 1fr; }
  .card-grid { grid-template-columns: 1fr; }
  .toc-list { columns: 1; }
  .top-nav { display: none; }
  .search-input { width: 120px; }
  .hero-banner { padding: 28px 20px; }
  .hero-banner::after { display: none; }
}
