/* ========================================
   林海听涛 (theme-linhai) 自定义样式
   ======================================== */

/* ===== 深色模式变量 — 源流智库配色方案 ===== */
:root {
  --lh-bg: #ffffff;
  --lh-card-bg: #ffffff;
  --lh-text: #1e293b;
  --lh-text-secondary: #64748b;
  --lh-border: #e2e8f0;
  --lh-accent: #4f6af5;
  --lh-accent-light: #eef0ff;
  --lh-accent-dark: #3b52d9;
}

.dark {
  --lh-bg: #0b1120;
  --lh-card-bg: #111827;
  --lh-text: #f1f5f9;
  --lh-text-secondary: #94a3b8;
  --lh-border: #1e293b;
  --lh-accent: #4f6af5;
  --lh-accent-light: rgba(79, 106, 245, 0.08);
  --lh-accent-dark: #6b82ff;
}

/* ===== 卡片样式 ===== */
.dark .rounded-xl.bg-white,
.dark .rounded-xl.shadow,
aside .rounded-xl {
  background: var(--lh-card-bg) !important;
  border: 1px solid var(--lh-border) !important;
}

/* ===== 导航栏 ===== */
.dark #header-menu {
  background: rgba(11, 17, 32, 0.92) !important;
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--lh-border) !important;
}

/* ===== 文章卡片 ===== */
.dark .overflow-hidden.rounded-xl {
  background: var(--lh-card-bg) !important;
  border: 1px solid var(--lh-border) !important;
}

/* ===== 页脚 ===== */
.dark footer {
  background: var(--lh-card-bg) !important;
  border-top: 1px solid var(--lh-border) !important;
}

/* ===== 正文链接 ===== */
.dark .markdown-body a {
  color: #6b82ff !important;
}
.dark .markdown-body a:hover {
  color: #8a9bff !important;
}

/* ===== 代码块 ===== */
.dark .markdown-body pre {
  background: #0d1117 !important;
  border: 1px solid #1e293b !important;
}
.dark .markdown-body code {
  color: #e2e8f0 !important;
}

/* ===== 引用块 ===== */
.dark .markdown-body blockquote {
  border-left-color: var(--lh-accent) !important;
  background: var(--lh-accent-light) !important;
}

/* ===== 表格 ===== */
.dark .markdown-body table tr { background: var(--lh-card-bg) !important; }
.dark .markdown-body table tr:nth-child(2n) { background: rgba(79,106,245,0.03) !important; }
.dark .markdown-body table td, .dark .markdown-body table th { border-color: var(--lh-border) !important; }

/* ===== 滚动条美化 ===== */
.dark ::-webkit-scrollbar-thumb { background: var(--lh-accent) !important; border-radius: 4px; }
.dark ::-webkit-scrollbar-track { background: #0a1628 !important; }
.dark ::selection { background: rgba(79,106,245,0.3); }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  #header-menu { height: 52px !important; }
  .dark .rounded-xl.bg-white { border-radius: 8px !important; }
}

/* ===== 侧边栏左置（覆盖 Tailwind 预编译 CSS） ===== */
@media (min-width: 768px) {
  section.mx-auto.mt-6.grid.max-w-7xl.grid-cols-1.gap-6.px-4.lg\:px-6 {
    grid-template-columns: 280px 1fr !important;
  }
}

/* ===== 文章版权声明深色 ===== */
.dark .article-copyright {
  background-color: transparent !important;
  border-color: #374151 !important;
  color: #94a3b8 !important;
}
.dark .article-copyright p:first-child {
  color: #cbd5e1 !important;
}
/* ===== 侧边栏分类选中高亮增强 ===== */
aside a[class*="!bg-blue-50"] {
  border-left: 3px solid #4f6af5 !important;
  position: relative;
}

/* ===== 文章卡片分类色彩标识 ===== */
/* 在没有封面图时，根据分类显示不同渐变背景 */
a[href*="/categories/solar"]:has(+ *) {
  --cat-color: #e67e22;
}
a[href*="/categories/energy-storage"]:has(+ *) {
  --cat-color: #2980b9;
}
a[href*="/categories/ev-charging"]:has(+ *) {
  --cat-color: #16a085;
}
a[href*="/categories/supply-chain"]:has(+ *) {
  --cat-color: #7f8c8d;
}
a[href*="/categories/projects"]:has(+ *) {
  --cat-color: #27ae60;
}
a[href*="/categories/technology"]:has(+ *) {
  --cat-color: #8e44ad;
}

/* ===== 文章正文排版优化 ===== */
#content {
  font-size: 1.05rem;
  line-height: 1.85;
  color: #374151;
}
.dark #content {
  color: #d1d5db;
}
#content h2 {
  margin-top: 2.25rem;
  margin-bottom: 1rem;
  font-size: 1.4rem;
  font-weight: 600;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid #e5e7eb;
}
.dark #content h2 {
  border-bottom-color: #374151;
}
#content h3 {
  margin-top: 1.75rem;
  margin-bottom: 0.75rem;
  font-size: 1.15rem;
  font-weight: 600;
}
#content p {
  margin-bottom: 1.25rem;
}
#content blockquote {
  border-left: 3px solid #4f6af5;
  background: #f0f4ff;
  padding: 0.75rem 1rem;
  margin: 1.25rem 0;
  border-radius: 0 8px 8px 0;
  color: #374151;
}
.dark #content blockquote {
  background: #1e293b;
  color: #cbd5e1;
}
#content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-size: 0.95rem;
}
#content th, #content td {
  border: 1px solid #e5e7eb;
  padding: 0.6rem 0.8rem;
  text-align: left;
}
.dark #content th, .dark #content td {
  border-color: #374151;
}
#content th {
  background: #f9fafb;
  font-weight: 600;
}
.dark #content th {
  background: #1e293b;
}
#content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 1rem 0;
}
#content code {
  background: #f1f5f9;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.9em;
}
.dark #content code {
  background: #1e293b;
}
#content pre {
  overflow-x: auto;
  border-radius: 8px;
  margin: 1.25rem 0;
  padding: 1rem;
}
