/* 基础变量 */
:root {
  --primary: #0066ff;
  --sidebar-width: 280px;
  --bg: #ffffff;
  --text: #1a1a1a;
  --sidebar-bg: #f8f9fa;
  --border: #e1e4e8;
  --code-bg: #f6f8fa;
}

/* 导航层级缩进 */
.nav-level-2 { /* 二级标题 - 缩进一级 */
  margin-left: 1rem;
}
.nav-level-3 { /* 三级标题 - 缩进两级 */
  margin-left: 1.5rem;
  font-size: 0.9rem;
}
.nav-level-4 { /* 四级标题 - 缩进三级 */
  margin-left: 3rem;
  font-size: 0.85rem;
  opacity: 0.7;
}

/* 确保 summary 中的链接样式正确 */
.nav details summary a.nav-link {
  display: inline;
  padding: 0;
  background: none;
  font-weight: inherit;
}
.nav details summary a.nav-link:hover {
  background: none;
  text-decoration: underline;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --text: #f0f6fc;
    --sidebar-bg: #161b22;
    --border: #30363d;
    --code-bg: #161b22;
  }
}

body.dark {
  --bg: #0d1117;
  --text: #f0f6fc;
  --sidebar-bg: #161b22;
  --border: #30363d;
  --code-bg: #161b22;
}

/* 布局 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background 0.3s, color 0.3s;
}

.container {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  overflow-y: auto;
  padding: 1rem;
  transition: transform 0.3s ease;
  z-index: 100;
}

.sidebar-header {
  margin-bottom: 0rem;
  text-align:left;
  margin-left: 5px;

}
.sidebar-header img {
  width: 22px;
  vertical-align:top;
}

.sidebar h2 {
  font-size: 1.2rem;
  font-weight: 600;
}

.nav {
  margin-top: 1rem;
}

.nav details {
  margin-bottom: 0.5rem;
}

.nav summary {
  cursor: pointer;
  padding: 0.5rem 0.1rem;
  border-radius: 6px;
  font-weight: 500;
  user-select: none;
  outline: none;
}

.nav summary:hover {
  background: rgba(0, 102, 255, 0.1);
}

.nav a {
  display: block;
  padding: 0.5rem 1.5rem;
  color: var(--text);
  text-decoration: none;
  border-radius: 6px;
  font-size: 0.95rem;
  opacity: 0.8;
  transition: all 0.2s;
}

.nav a:hover {
  background: rgba(0, 102, 255, 0.15);
  opacity: 1;
  font-weight: 500;
}

.content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 2rem;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
  padding-top: 3rem;
}

.content h1 {
  font-size: 2rem;
  margin-bottom: 1.5rem;
  color: var(--primary);
}

.content h2 {
  font-size: 1.5rem;
  margin: 2rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.content code {
  background: var(--code-bg);
  padding: 0.2em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
}

.content pre {
  background: var(--code-bg);
  padding: 1rem;
  border-radius: 8px;
  overflow-x: auto;
  position: relative;
  margin: 1.5rem 0;
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-family: monospace;
  font-size: 0.85rem;
  color: #888;
}

.copy-btn {
  background: rgba(0,0,0,0.1);
  border: none;
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  opacity: 0.7;
}

.copy-btn:hover {
  opacity: 1;
}

.loading {
  text-align: center;
  padding: 4rem;
  color: #888;
  font-style: italic;
}

/* 深色切换按钮 */
.theme-toggle {
  visibility: collapse;
  position: absolute;
  bottom: 1.5rem;
  left: 1.5rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  transition: background 0.2s;
}

.theme-toggle:hover {
  background: rgba(0,0,0,0.1);
}

/* 移动端 */
.menu-toggle {
  display: none;
  position: fixed;
  bottom: 5rem;
  left: 1.5rem;
  z-index: 200;
  background: var(--primary);
  color: white;
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
}
/* ---------- 移动端遮罩层 ---------- */
.overlay {
  display: none;
  position: fixed;
  inset: 0;                     /* top:0;left:0;right:0;bottom:0 */
  background: rgba(0, 0, 0, 0.5);
  z-index: 50;
  backdrop-filter: blur(2px);
  cursor: pointer;
}

/* 移动端显示/隐藏 */
@media (max-width: 768px) {
    .container {
    position: relative;
    padding-left: 0;
    transition: padding-left 0.3s ease;
  }
 .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100%;
    width: 280px;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 100;
  }
  .sidebar.open {
    transform: translateX(0);
  }
   /* 当侧边栏打开时，将内容向右推 */
  .sidebar.open ~ .content {
    transform: translateX(280px);
  }
  
.content {
    margin-left: 0;
    padding: 1.5rem;
    transition: transform 0.3s ease;
    width: 100%;
    min-height: 100vh;
  }
  
  .menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* 关键：只有 .sidebar.open 时显示遮罩 */
  .sidebar.open ~ .overlay {
    display: block;
  }
}
/* 确保大屏幕布局不变 */
@media (min-width: 769px) {
  .sidebar {
    position: fixed;
    transform: translateX(0) !important;
  }
  
  .content {
    margin-left: var(--sidebar-width);
    transform: translateX(0) !important;
  }
  
  .menu-toggle {
    display: none !important;
  }
  
  .overlay {
    display: none !important;
  }
}
.skeleton {
  padding: 1rem;
  animation: pulse 1.5s ease-in-out infinite;
}

.skeleton-title {
  height: 2rem;
  width: 60%;
  background: #e2e8f0;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.skeleton-line {
  height: 1rem;
  width: 100%;
  background: #e2e8f0;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

.skeleton-line.short { width: 80%; }

.skeleton-code {
  height: 8rem;
  width: 100%;
  background: #f6f8fa;
  border-radius: 8px;
  margin-top: 1.5rem;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}




.content img {
  max-width: 100%;
  border-radius: 0px;
  cursor: zoom-in;
  transition: transform 0.2s;
}

/* .content img:hover {
  transform: scale(1.02);
} */

/* === 图片模态框增强版 === */
.image-modal {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.95);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  user-select: none;
}
.image-modal.active { display: flex; }

.modal-content {
  position: relative;
  max-width: 90%;
  max-height: 90%;
  transform-origin: center;
  transition: transform 0.1s ease-out;
  cursor: grab;
}
.modal-content:active { cursor: grabbing; }

.modal-content img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.6);
}

/* 控制按钮 */
.modal-controls {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 1rem;
  background: rgba(0,0,0,0.5);
  padding: 0.5rem 1rem;
  border-radius: 2rem;
  backdrop-filter: blur(10px);
}
.modal-btn {
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  width: 40px; height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-btn:hover { background: rgba(255,255,255,0.2); }

.modal-close-btn {
  position: absolute;
  top: 1rem; right: 1rem;
  color: white; font-size: 2rem; cursor: pointer;
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.5);
}

