/* Here is your custom css styles. */

/*
 * ============================================================================
 * macOS 风格代码块样式 - macOS Style Code Block Styling
 * ============================================================================
 * 
 * 目的 (Purpose):
 * 实现类似 macOS Terminal 的代码块展示效果
 * Implement macOS Terminal-like code block display
 * 
 * 修改日期 (Modification Date): 2025-11-27
 * 
 * 功能特性 (Features):
 * - macOS 深色背景 (#1e1e1e)
 * - 顶部三个彩色圆点装饰（红、黄、绿）
 * - 圆角边框 (border-radius: 8px)
 * - 完全隐藏行号
 * - 优雅的字体和间距
 * - 保留复制功能
 * 
 * 相关需求 (Related Requirements): 4.2
 * 
 * ============================================================================
 */

/* ============================================================================
 * 1. macOS 风格代码块容器 - macOS Style Code Block Container
 * ============================================================================
 */

/* 代码块外层容器 - Outer container */
figure.highlight {
  background-color: #1e1e1e !important;
  border-radius: 8px !important;
  overflow: hidden !important;
  margin: 1.5rem 0 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
  position: relative !important;
  padding-top: 40px !important; /* 为顶部圆点留出空间 */
}

/* macOS 风格顶部栏 - macOS style top bar */
figure.highlight::before {
  content: "" !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  height: 40px !important;
  background-color: #2d2d2d !important;
  border-bottom: 1px solid #3d3d3d !important;
  z-index: 1 !important;
}

/* 隐藏主题默认的圆点装饰 - Hide theme's default dots */
.code-area::after {
  display: none !important;
}

/* 确保复制按钮在顶部栏之上 - Ensure copy button is above top bar */
figure.highlight .code_copy,
figure.highlight .codecopy_notice,
figure.highlight .code_lang {
  z-index: 10 !important;
}

/* macOS 三个彩色圆点 - macOS three colored dots */
figure.highlight::after {
  content: "" !important;
  position: absolute !important;
  top: 14px !important;
  left: 12px !important;
  width: 12px !important;
  height: 12px !important;
  border-radius: 50% !important;
  background-color: #ff5f56 !important;
  box-shadow: 
    20px 0 0 #ffbd2e,
    40px 0 0 #27c93f !important;
  z-index: 2 !important;
}

/* ============================================================================
 * 2. 隐藏行号 - Hide Line Numbers
 * ============================================================================
 */

/* 隐藏 gutter 列（行号列）- Hide gutter column (line numbers) */
figure.highlight .gutter {
  display: none !important;
}

/* 隐藏 table 中的行号单元格 - Hide line number cells in table */
figure.highlight table tr td.gutter {
  display: none !important;
}

/* 确保代码列占满整个宽度 - Ensure code column takes full width */
figure.highlight table tr td.code {
  width: 100% !important;
  padding: 0 !important;
}

/* 移除 table 的边框和间距 - Remove table borders and spacing */
figure.highlight table {
  display: block !important;
  border: none !important;
  margin: 0 !important;
  padding: 0 !important;
  width: 100% !important;
  border-spacing: 0 !important;
  border-collapse: collapse !important;
  background-color: transparent !important;
}

figure.highlight table tbody {
  display: block !important;
}

figure.highlight table tr {
  display: block !important;
  border: none !important;
  background-color: transparent !important;
}

figure.highlight table tr td {
  display: block !important;
  border: none !important;
  background-color: transparent !important;
  padding: 0 !important;
}

/* ============================================================================
 * 3. 代码样式 - Code Styling
 * ============================================================================
 */

/* pre 标签样式 - pre tag styling */
figure.highlight pre {
  background-color: #1e1e1e !important;
  color: #d4d4d4 !important;
  margin: 0 !important;
  padding: 1.2rem 1.5rem !important;
  /* 优先使用常见的等宽字体 */
  font-family: 'Consolas', 'Monaco', 'Courier New', 'Courier', 'Menlo', 'Ubuntu Mono', 'DejaVu Sans Mono', monospace !important;
  font-size: 15px !important;
  line-height: 1.7 !important;
  overflow-x: auto !important;
  border-radius: 0 !important;
  letter-spacing: 0.02em !important; /* 增加字符间距提高可读性 */
}

/* 代码内容样式 - Code content styling */
figure.highlight pre code {
  background-color: transparent !important;
  color: inherit !important;
  padding: 0 !important;
  margin: 0 !important;
  font-family: inherit !important;
  font-size: inherit !important;
  line-height: inherit !important;
}

/* 代码行样式 - Code line styling */
figure.highlight .line {
  color: #d4d4d4 !important;
}

/* ============================================================================
 * 4. 内联代码样式隔离 - Inline Code Style Isolation
 * ============================================================================
 */

/* 确保内联代码不受影响 - Ensure inline code is not affected */
code:not(pre code) {
  background-color: #f5f5f5 !important;
  color: #e96900 !important;
  padding: 2px 6px !important;
  border-radius: 3px !important;
  font-family: 'Consolas', 'Monaco', 'Courier New', 'Menlo', monospace !important;
  font-size: 0.9em !important;
}

/* ============================================================================
 * 5. 滚动条样式 - Scrollbar Styling
 * ============================================================================
 */

/* 自定义滚动条 - Custom scrollbar for WebKit browsers */
figure.highlight pre::-webkit-scrollbar {
  height: 8px !important;
}

figure.highlight pre::-webkit-scrollbar-track {
  background: #2d2d2d !important;
  border-radius: 4px !important;
}

figure.highlight pre::-webkit-scrollbar-thumb {
  background: #4d4d4d !important;
  border-radius: 4px !important;
}

figure.highlight pre::-webkit-scrollbar-thumb:hover {
  background: #5d5d5d !important;
}

/* ============================================================================
 * 6. 响应式设计 - Responsive Design
 * ============================================================================
 */

/* 移动端适配 - Mobile adaptation */
@media screen and (max-width: 768px) {
  figure.highlight {
    margin: 1rem 0 !important;
    border-radius: 6px !important;
  }
  
  figure.highlight pre {
    padding: 1rem !important;
    font-size: 13px !important;
  }
  
  figure.highlight::after {
    top: 12px !important;
    left: 10px !important;
    width: 10px !important;
    height: 10px !important;
    box-shadow: 
      18px 0 0 #ffbd2e,
      36px 0 0 #27c93f !important;
  }
}

/* ============================================================================
 * 7. 版权声明板块优化 - Reprint Statement Optimization
 * ============================================================================
 */

/* 版权声明容器 - Reprint statement container */
#artDetail .reprint {
  background: linear-gradient(135deg, #f5f7fa 0%, #f9fafb 100%) !important;
  border: 1px solid #e1e8ed !important;
  border-left: 4px solid #42b983 !important;
  border-radius: 8px !important;
  padding: 1.5rem !important;
  margin: 2rem 0 !important;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08) !important;
  transition: all 0.3s ease !important;
}

#artDetail .reprint:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12) !important;
  transform: translateY(-2px) !important;
}

/* 版权声明各项 - Reprint items */
#artDetail .reprint__author,
#artDetail .reprint__type,
#artDetail .reprint__notice {
  display: flex !important;
  align-items: flex-start !important;
  margin-bottom: 0.8rem !important;
  padding: 0.5rem 0 !important;
}

#artDetail .reprint__author:last-child,
#artDetail .reprint__type:last-child,
#artDetail .reprint__notice:last-child {
  margin-bottom: 0 !important;
}

/* 图标和标签样式 - Icon and label styling */
#artDetail .reprint-meta {
  display: inline-flex !important;
  align-items: center !important;
  width: 110px !important;
  flex-shrink: 0 !important;
  font-weight: 600 !important;
  font-size: 0.95rem !important;
  color: #2c3e50 !important;
  white-space: nowrap !important;
  margin-right: 1rem !important;
}

#artDetail .reprint-meta i {
  margin-right: 0.5rem !important;
  color: #42b983 !important;
  font-size: 1rem !important;
}

/* 内容样式 - Content styling */
#artDetail .reprint-info {
  flex: 1 !important;
  font-size: 0.95rem !important;
  line-height: 1.6 !important;
  color: #5a6c7d !important;
  word-break: break-all !important;
}

/* 链接样式 - Link styling */
#artDetail .reprint a {
  color: #42b983 !important;
  font-weight: 500 !important;
  text-decoration: none !important;
  border-bottom: 1px solid transparent !important;
  transition: all 0.2s ease !important;
  padding-bottom: 1px !important;
}

#artDetail .reprint a:hover {
  color: #35a372 !important;
  border-bottom-color: #35a372 !important;
}

/* 响应式设计 - Responsive design */
@media screen and (max-width: 768px) {
  #artDetail .reprint {
    padding: 1rem !important;
    margin: 1.5rem 0 !important;
  }
  
  #artDetail .reprint__author,
  #artDetail .reprint__type,
  #artDetail .reprint__notice {
    flex-direction: column !important;
    margin-bottom: 1rem !important;
  }
  
  #artDetail .reprint-meta {
    width: auto !important;
    margin-bottom: 0.5rem !important;
    margin-right: 0 !important;
  }
  
  #artDetail .reprint-info {
    padding-left: 0 !important;
  }
}
