/* 网络安全博客 - 黑客风格主题 */
:root {
  --hacker-green: #20C20E;
  --hacker-blue: #00BFFF;
  --hacker-orange: #FFA500;
  --hacker-red: #FF5555;
  --hacker-cyan: #00ffea;
  --dark-bg: #0a0e14;
  --dark-blue-bg: #0A1626;
  --darker-bg: rgba(10, 14, 20, 0.85);
  --card-bg: rgba(16, 22, 32, 0.75);
  --text-color: #b0bac5;
  --border-color: rgba(32, 194, 14, 0.12);
  --theme-main: var(--hacker-green);
  --theme-bg: var(--dark-bg);
  --theme-darker-bg: var(--darker-bg);
}

/* ===== 亮色主题：蓝白毛玻璃 ===== */
[data-theme="light"] {
  --dark-bg: #EEF2F7;
  --darker-bg: rgba(255, 255, 255, 0.65);
  --card-bg: rgba(255, 255, 255, 0.5);
  --text-color: #3a4a5c;
  --border-color: rgba(255, 255, 255, 0.5);
  --theme-main: #3B82F6;
  --theme-bg: #EEF2F7;
  --theme-darker-bg: rgba(255, 255, 255, 0.65);
  --hacker-red: #EF4444;
  --hacker-blue: #3B82F6;
}

[data-theme="light"] body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #2c3e50;
  background: linear-gradient(135deg, #dbeafe 0%, #e0e7ff 25%, #dbeafe 50%, #ede9fe 75%, #dbeafe 100%);
  background-size: 400% 400%;
  animation: gradientShift 20s ease infinite;
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  25% { background-position: 100% 0%; }
  50% { background-position: 100% 100%; }
  75% { background-position: 0% 100%; }
}

[data-theme="light"] #matrix { display: none; }

[data-theme="light"] .navbar {
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(59, 130, 246, 0.15);
  box-shadow: 0 1px 12px rgba(59, 130, 246, 0.06);
}

[data-theme="light"] .logo a { color: #3B82F6; text-shadow: none; }
[data-theme="light"] .nav-link { color: #475569; font-weight: 500; }
[data-theme="light"] .nav-link:hover { color: #3B82F6; text-shadow: none; }
[data-theme="light"] .nav-link.active { color: #3B82F6; }
[data-theme="light"] .nav-link.active:after { color: #3B82F6; }
[data-theme="light"] .nav-dropdown-label { color: #475569; }
[data-theme="light"] .nav-dropdown-label:hover { color: #3B82F6; text-shadow: none; }

[data-theme="light"] .dropdown-menu {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 8px 32px rgba(59, 130, 246, 0.1);
  border-radius: 8px;
}

[data-theme="light"] .dropdown-item { color: #475569; border-radius: 4px; margin: 2px 4px; }
[data-theme="light"] .dropdown-item:hover { background: rgba(59, 130, 246, 0.08); color: #3B82F6; }

[data-theme="light"] .theme-toggle {
  border-color: rgba(59, 130, 246, 0.3); color: #3B82F6;
  background: rgba(255, 255, 255, 0.4); backdrop-filter: blur(10px); border-radius: 8px;
}
[data-theme="light"] .theme-toggle:hover { background: #3B82F6; color: #FFFFFF; box-shadow: 0 0 16px rgba(59,130,246,0.3); }

[data-theme="light"] .search-bar input {
  background: rgba(255, 255, 255, 0.5); backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.6); color: #2c3e50; border-radius: 10px;
}
[data-theme="light"] .search-bar input:focus { border-color: rgba(59,130,246,0.4); box-shadow: 0 0 0 3px rgba(59,130,246,0.1), 0 4px 16px rgba(59,130,246,0.08); }
[data-theme="light"] .search-bar input::placeholder { color: #94a3b8; }

[data-theme="light"] .search-results {
  background: rgba(255, 255, 255, 0.75); backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.6); box-shadow: 0 8px 32px rgba(59,130,246,0.12); border-radius: 10px;
}
[data-theme="light"] .search-result-item:hover { background: rgba(59, 130, 246, 0.06); }
[data-theme="light"] .search-result-item h4 { color: #1e293b; }

[data-theme="light"] .sidebar-module {
  background: rgba(255, 255, 255, 0.5); backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.6); box-shadow: 0 4px 24px rgba(59,130,246,0.06); border-radius: 12px;
}
[data-theme="light"] .sidebar-module::before { background: linear-gradient(90deg, transparent, rgba(59,130,246,0.3), transparent); animation: none; opacity: 0.5; }
[data-theme="light"] .sidebar-title { color: #3B82F6; border-bottom: 1px solid rgba(59,130,246,0.15); }
[data-theme="light"] .stat-num { color: #3B82F6; font-weight: 600; }

[data-theme="light"] .toc-container {
  background: rgba(255, 255, 255, 0.5); backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.6); border-radius: 12px; box-shadow: 0 4px 24px rgba(59,130,246,0.06);
}
[data-theme="light"] .toc-title { color: #3B82F6; border-bottom: 1px solid rgba(59,130,246,0.15); }
[data-theme="light"] .toc-link { color: #64748b; transition: all 0.25s ease; }
[data-theme="light"] .toc-link:hover, [data-theme="light"] .toc-link.active { color: #3B82F6; border-left-color: #3B82F6; transform: translateX(2px); }

[data-theme="light"] .page-title { color: #3B82F6; text-shadow: none; font-weight: 700; }
[data-theme="light"] .page-title:after { color: #3B82F6; }

[data-theme="light"] .post-card {
  background: rgba(255, 255, 255, 0.5); backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.6); border-radius: 14px; overflow: hidden;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
[data-theme="light"] .post-card:hover { transform: translateY(-4px); box-shadow: 0 12px 40px rgba(59,130,246,0.12), 0 0 0 1px rgba(59,130,246,0.1); border-color: rgba(59,130,246,0.2); }
[data-theme="light"] .post-card h2 a { color: #1e293b; }
[data-theme="light"] .post-card h2 a:hover { color: #3B82F6; text-shadow: none; }
[data-theme="light"] .post-card time { color: #94a3b8; }
[data-theme="light"] .post-card p { color: #64748b; }

[data-theme="light"] .tag { background: rgba(59,130,246,0.06); border: 1px solid rgba(59,130,246,0.2); color: #3B82F6; border-radius: 6px; transition: all 0.25s ease; }
[data-theme="light"] .tag:hover { background: #3B82F6; color: #FFFFFF; box-shadow: 0 2px 8px rgba(59,130,246,0.25); }

[data-theme="light"] .post-detail h1 { color: #1e293b; text-shadow: none; font-weight: 700; }
[data-theme="light"] .post-detail header { border-bottom: 1px solid rgba(59,130,246,0.1); }
[data-theme="light"] .post-detail .meta { color: #94a3b8; }
[data-theme="light"] .read-time { color: #3B82F6; }

[data-theme="light"] .content h2 { color: #3B82F6; border-bottom: 1px solid rgba(59,130,246,0.15); }
[data-theme="light"] .content h3 { color: #3B82F6; }
[data-theme="light"] .content p { color: #475569; }
[data-theme="light"] .content li { color: #475569; }
[data-theme="light"] .content code { background: rgba(59,130,246,0.08); color: #2563EB; padding: 2px 6px; border-radius: 4px; font-family: 'Fira Mono', 'Consolas', monospace; }
[data-theme="light"] .content pre { background: rgba(30,41,59,0.04); border: 1px solid rgba(59,130,246,0.1); border-radius: 10px; border-image: none; border-left: 3px solid rgba(59,130,246,0.3); }
[data-theme="light"] .content blockquote { border-left: 4px solid #3B82F6; color: #64748b; background: rgba(59,130,246,0.04); padding: 0.8rem 1.5rem; border-radius: 0 8px 8px 0; }
[data-theme="light"] .content a { color: #3B82F6; }
[data-theme="light"] .content a:hover { color: #2563EB; text-shadow: none; }

[data-theme="light"] .code-copy-btn { background: rgba(59,130,246,0.08); border: 1px solid rgba(59,130,246,0.15); color: #64748b; border-radius: 6px; }
[data-theme="light"] .code-copy-btn:hover { background: #3B82F6; color: #FFFFFF; }
[data-theme="light"] .code-copy-btn.copied { background: #10B981; color: #FFFFFF; border-color: #10B981; }

[data-theme="light"] .post-nav { border-top: 1px solid rgba(59,130,246,0.1); }
[data-theme="light"] .post-nav-prev, [data-theme="light"] .post-nav-next { color: #3B82F6; transition: all 0.25s ease; }
[data-theme="light"] .post-nav-prev:hover, [data-theme="light"] .post-nav-next:hover { color: #2563EB; text-shadow: none; transform: translateX(2px); }

[data-theme="light"] .footer { background: rgba(255,255,255,0.4); backdrop-filter: blur(16px); border-top: 1px solid rgba(59,130,246,0.1); color: #94a3b8; }

[data-theme="light"] .nav-list a { color: #3B82F6; }
[data-theme="light"] .nav-list a:hover { color: #2563EB; text-shadow: none; }

[data-theme="light"] .back-to-top { background: rgba(255,255,255,0.6); backdrop-filter: blur(12px); border: 1px solid rgba(59,130,246,0.2); color: #3B82F6; box-shadow: 0 4px 16px rgba(59,130,246,0.1); border-radius: 10px; }
[data-theme="light"] .back-to-top:hover { background: #3B82F6; color: #FFFFFF; box-shadow: 0 4px 20px rgba(59,130,246,0.3); }

[data-theme="light"] .progress-bar { background-color: rgba(59,130,246,0.1); border-radius: 2px; }
[data-theme="light"] .progress-fill { background: linear-gradient(90deg, #3B82F6, #60A5FA); animation: none; border-radius: 2px; }

[data-theme="light"] .error-code { color: #3B82F6; text-shadow: none; }
[data-theme="light"] .error-link { color: #3B82F6; }
[data-theme="light"] .error-link:hover { color: #2563EB; text-shadow: none; }

[data-theme="light"] .nav-dropdown .dropdown-menu { background: rgba(255,255,255,0.8); backdrop-filter: blur(16px); }
[data-theme="light"] .empty-hint { color: #94a3b8; }

/* 卡片入场动画 */
[data-theme="light"] .post-card { animation: fadeSlideUp 0.5s ease both; }
[data-theme="light"] .post-card:nth-child(1) { animation-delay: 0.05s; }
[data-theme="light"] .post-card:nth-child(2) { animation-delay: 0.1s; }
[data-theme="light"] .post-card:nth-child(3) { animation-delay: 0.15s; }
[data-theme="light"] .post-card:nth-child(4) { animation-delay: 0.2s; }
[data-theme="light"] .post-card:nth-child(5) { animation-delay: 0.25s; }
[data-theme="light"] .post-card:nth-child(6) { animation-delay: 0.3s; }

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

[data-theme="light"] .sidebar-module { animation: fadeSlideUp 0.6s ease both; }
[data-theme="light"] .sidebar-module:nth-child(1) { animation-delay: 0.1s; }
[data-theme="light"] .sidebar-module:nth-child(2) { animation-delay: 0.2s; }
[data-theme="light"] .sidebar-module:nth-child(3) { animation-delay: 0.3s; }
[data-theme="light"] .sidebar-module:nth-child(4) { animation-delay: 0.4s; }

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Noto Sans SC', 'Fira Mono', -apple-system, sans-serif;
  background-color: var(--theme-bg);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(32, 194, 14, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(0, 191, 255, 0.03) 0%, transparent 50%),
    linear-gradient(180deg, #0a0e14 0%, #0d1117 50%, #0a0e14 100%);
  color: var(--theme-main);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

code, pre, .code-copy-btn, .nav-link, .dropdown-item {
  font-family: 'JetBrains Mono', 'Fira Mono', 'Consolas', monospace;
}

a { color: inherit; }

/* 矩阵背景 */
#matrix {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: -1;
  opacity: 0.04;
  pointer-events: none;
}

/* ===== 导航栏 ===== */
.navbar {
  background: rgba(10, 14, 20, 0.8);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  padding: 0.8rem 2rem;
  border-bottom: 1px solid rgba(32, 194, 14, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-size: 1.5rem;
  font-weight: bold;
  color: #FF0000;
  letter-spacing: 2px;
  text-shadow: 0 0 10px #FF0000;
}

.logo a {
  color: #FF0000;
  text-decoration: none;
}

.logo a { text-decoration: none; }

.menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--theme-main);
  color: var(--theme-main);
  font-size: 1.5rem;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
}

.nav-links {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.nav-link {
  color: var(--theme-main);
  text-decoration: none;
  font-size: 1.1rem;
  padding: 0.5rem 1rem;
  position: relative;
  transition: all 0.3s ease;
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
}

.nav-link:hover {
  color: #fff;
  text-shadow: 0 0 8px var(--theme-main);
}

.nav-link.active {
  color: var(--hacker-red);
}

.nav-link.active:after {
  content: "_";
  animation: blink 1s step-end infinite;
}

/* 展开式导航组（一级页面时） */
.nav-group-expanded {
  display: flex;
  align-items: center;
  gap: 0;
}

.nav-group-expanded .nav-link {
  font-size: 0.95rem;
  padding: 0.4rem 0.8rem;
}

.nav-group-label {
  font-weight: bold;
  color: var(--hacker-red) !important;
}

/* 下拉标签可点击 */
.nav-dropdown-label {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.nav-dropdown-label:hover {
  color: #fff;
  text-shadow: 0 0 8px var(--theme-main);
}

/* 下拉菜单 */
.nav-dropdown { position: relative; }

.dropdown-menu {
  display: none;
  position: absolute;
  left: 0; top: 100%;
  background: rgba(16, 22, 32, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(32, 194, 14, 0.15);
  min-width: 180px;
  z-index: 999;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 20px rgba(32, 194, 14, 0.05);
  padding: 0.3rem 0;
  margin-top: 0.5rem;
}

.nav-dropdown:hover .dropdown-menu { display: block; }

.dropdown-item {
  color: var(--theme-main);
  padding: 0.8rem 1.2rem;
  display: block;
  text-decoration: none;
  transition: all 0.2s ease;
}

.dropdown-item:hover {
  background: rgba(32, 194, 14, 0.08);
  color: #fff;
}

/* 主题切换按钮 */
.theme-toggle {
  background: none;
  border: 1px solid var(--theme-main);
  color: var(--theme-main);
  width: 36px; height: 36px;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.theme-toggle:hover {
  background: var(--theme-main);
  color: var(--theme-bg);
}

/* ===== 首页 Hero 区域 ===== */
.hero {
  text-align: center;
  padding: 6rem 2rem 4rem;
  max-width: 900px;
  margin: 0 auto;
  position: relative;
}

.hero::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 600px;
  height: 400px;
  background: radial-gradient(circle, rgba(32, 194, 14, 0.06) 0%, transparent 70%);
  pointer-events: none;
}

.hero-brand {
  font-size: 4rem;
  font-weight: 700;
  color: var(--theme-main);
  text-shadow: 0 0 40px rgba(32, 194, 14, 0.4), 0 0 80px rgba(32, 194, 14, 0.1);
  letter-spacing: 12px;
  margin-bottom: 0.5rem;
  position: relative;
}

.hero-tagline {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1rem;
  color: rgba(32, 194, 14, 0.4);
  letter-spacing: 6px;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
}

.hero-motto {
  color: var(--text-color);
  font-size: 1.15rem;
  line-height: 1.8;
  margin-bottom: 1.5rem;
  letter-spacing: 2px;
}

.hero-divider {
  width: 60px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--hacker-green), transparent);
  margin: 0 auto 1.5rem;
  opacity: 0.5;
}

.hero-sub {
  color: #556677;
  font-size: 0.9rem;
  letter-spacing: 1px;
}

/* ===== 精选文章区域 ===== */
.featured-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem 3rem;
}

.section-title {
  color: var(--theme-main);
  font-size: 1.4rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px dashed var(--theme-main);
  text-shadow: 0 0 6px var(--theme-main);
}

.section-title:after {
  content: "_";
  animation: blink 1s step-end infinite;
}

.featured-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.featured-card {
  display: block;
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(32, 194, 14, 0.1);
  border-radius: 12px;
  padding: 2rem;
  text-decoration: none;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.featured-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--hacker-green), var(--hacker-cyan));
  opacity: 0.6;
  transition: opacity 0.3s;
}

.featured-card:hover {
  border-color: rgba(32, 194, 14, 0.3);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3), 0 0 30px rgba(32, 194, 14, 0.08);
  transform: translateY(-6px);
}

.featured-card:hover::before {
  opacity: 1;
}

.featured-badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--theme-main);
  color: var(--dark-bg);
  padding: 2px 10px;
  font-size: 0.75rem;
  font-weight: bold;
}

.featured-title {
  color: #fff;
  font-size: 1.2rem;
  margin-bottom: 0.8rem;
  transition: color 0.3s;
}

.featured-card:hover .featured-title {
  color: var(--theme-main);
}

.featured-desc {
  color: var(--text-color);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.featured-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.featured-meta time {
  color: #666;
  font-size: 0.85em;
}

/* ===== 最近发布区域 ===== */
.recent-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem 3rem;
}

.recent-card {
  display: block;
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(32, 194, 14, 0.08);
  border-radius: 10px;
  padding: 1.5rem 2rem;
  text-decoration: none;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  margin-bottom: 1rem;
}

.recent-card:hover {
  border-color: rgba(32, 194, 14, 0.25);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25), 0 0 20px rgba(32, 194, 14, 0.06);
  transform: translateY(-3px);
}

.recent-title {
  color: #fff;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  transition: color 0.3s;
}

.recent-card:hover .recent-title {
  color: var(--theme-main);
}

.recent-desc {
  color: var(--text-color);
  font-size: 0.9rem;
  margin-bottom: 0.8rem;
}

.recent-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.recent-meta time {
  color: #666;
  font-size: 0.85em;
}

.view-all {
  text-align: center;
  margin-top: 2rem;
}

.view-all-btn {
  display: inline-block;
  color: var(--theme-main);
  text-decoration: none;
  padding: 0.7rem 2rem;
  border: 1px solid rgba(32, 194, 14, 0.3);
  border-radius: 6px;
  transition: all 0.3s ease;
  letter-spacing: 1px;
}

.view-all-btn:hover {
  background: rgba(32, 194, 14, 0.1);
  border-color: var(--theme-main);
  box-shadow: 0 0 20px rgba(32, 194, 14, 0.15);
}

/* 暗色主题入场动画 */
.hero { animation: fadeInUp 0.8s ease both; }
.featured-section { animation: fadeInUp 0.8s ease 0.2s both; }
.recent-section { animation: fadeInUp 0.8s ease 0.4s both; }

.featured-card { animation: fadeInUp 0.6s ease both; }
.featured-card:nth-child(1) { animation-delay: 0.3s; }
.featured-card:nth-child(2) { animation-delay: 0.45s; }

.post-card { animation: fadeInUp 0.5s ease both; }
.post-card:nth-child(1) { animation-delay: 0.05s; }
.post-card:nth-child(2) { animation-delay: 0.1s; }
.post-card:nth-child(3) { animation-delay: 0.15s; }
.post-card:nth-child(4) { animation-delay: 0.2s; }
.post-card:nth-child(5) { animation-delay: 0.25s; }
.post-card:nth-child(6) { animation-delay: 0.3s; }
.post-card:nth-child(7) { animation-delay: 0.35s; }
.post-card:nth-child(8) { animation-delay: 0.4s; }

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* 搜索栏 ===== */
[data-theme="light"] .hero-brand { color: #3B82F6; text-shadow: 0 0 30px rgba(59,130,246,0.3); }
[data-theme="light"] .hero-tagline { color: rgba(59,130,246,0.4); }
[data-theme="light"] .hero-divider { background: linear-gradient(90deg, transparent, #3B82F6, transparent); }
[data-theme="light"] .section-title { color: #3B82F6; border-bottom-color: rgba(59,130,246,0.2); text-shadow: none; }
[data-theme="light"] .section-title:after { color: #3B82F6; }
[data-theme="light"] .featured-card { background: rgba(255,255,255,0.5); backdrop-filter: blur(16px); border: 1px solid rgba(255,255,255,0.6); border-radius: 14px; }
[data-theme="light"] .featured-card:hover { box-shadow: 0 12px 40px rgba(59,130,246,0.12); border-color: rgba(59,130,246,0.2); }
[data-theme="light"] .featured-badge { background: #3B82F6; color: #fff; }
[data-theme="light"] .featured-title { color: #1e293b; }
[data-theme="light"] .featured-card:hover .featured-title { color: #3B82F6; }
[data-theme="light"] .featured-desc { color: #64748b; }
[data-theme="light"] .recent-card { background: rgba(255,255,255,0.5); backdrop-filter: blur(16px); border: 1px solid rgba(255,255,255,0.6); border-radius: 10px; }
[data-theme="light"] .recent-card:hover { box-shadow: 0 8px 30px rgba(59,130,246,0.1); border-color: rgba(59,130,246,0.2); }
[data-theme="light"] .recent-title { color: #1e293b; }
[data-theme="light"] .recent-card:hover .recent-title { color: #3B82F6; }
[data-theme="light"] .recent-desc { color: #64748b; }
[data-theme="light"] .view-all-btn { color: #3B82F6; border-color: #3B82F6; }
[data-theme="light"] .view-all-btn:hover { background: #3B82F6; color: #fff; }

/* 响应式：首页 */
@media (max-width: 992px) {
  .featured-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .hero { padding: 3rem 1rem 2rem; }
  .hero-brand { font-size: 2.5rem; letter-spacing: 6px; }
  .hero-motto { font-size: 1rem; }
  .featured-grid { grid-template-columns: 1fr; }
  .featured-section { padding: 0 1rem 2rem; }
}

/* ===== 搜索栏 ===== */
.search-bar {
  max-width: 600px;
  margin: 1.5rem auto 0;
  padding: 0 2rem;
  position: relative;
}

.search-bar input {
  width: 100%;
  padding: 0.8rem 1.2rem;
  background: var(--theme-darker-bg);
  border: 1px solid var(--border-color);
  color: var(--theme-main);
  font-family: inherit;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.3s ease;
}

.search-bar input:focus {
  border-color: var(--theme-main);
  box-shadow: 0 0 10px rgba(32, 194, 14, 0.2);
}

.search-bar input::placeholder {
  color: #555;
}

.search-results {
  position: absolute;
  top: 100%;
  left: 2rem; right: 2rem;
  background: var(--theme-darker-bg);
  border: 1px solid var(--theme-main);
  max-height: 400px;
  overflow-y: auto;
  z-index: 200;
  display: none;
}

.search-results.active { display: block; }

.search-result-item {
  padding: 0.8rem 1.2rem;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background 0.2s;
}

.search-result-item:hover { background: rgba(32, 194, 14, 0.1); }

.search-result-item h4 {
  color: #fff;
  margin-bottom: 0.3rem;
  font-size: 0.95rem;
}

.search-result-item p {
  color: var(--text-color);
  font-size: 0.8rem;
  margin: 0;
}

.search-no-result {
  padding: 1rem 1.2rem;
  color: var(--text-color);
  text-align: center;
}

/* ===== 主内容区 ===== */
.main-container {
  display: flex;
  flex: 1;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  padding: 2rem;
}

.main-content {
  flex: 1;
  padding-right: 2rem;
  min-width: 0;
}

/* ===== 侧边栏 ===== */
.sidebar-right {
  width: 300px;
  padding: 2rem 0;
  border-left: 1px dashed var(--border-color);
  position: sticky;
  top: 80px;
  height: calc(100vh - 80px);
  overflow-y: auto;
}

.sidebar-module {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  margin-bottom: 2rem;
  padding: 1.5rem;
  border: 1px solid rgba(32, 194, 14, 0.08);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  position: relative;
}

.sidebar-module::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--hacker-green), transparent);
  opacity: 0.3;
  border-radius: 10px 10px 0 0;
}

.sidebar-title {
  color: var(--theme-main);
  margin-top: 0;
  font-size: 1.2rem;
  border-bottom: 1px dashed var(--theme-main);
  padding-bottom: 0.5rem;
}

.stat-num {
  color: var(--hacker-blue);
  font-weight: bold;
}

/* ===== 目录 TOC ===== */
.toc-container {
  background-color: var(--theme-darker-bg);
  margin-bottom: 2rem;
  padding: 1.5rem;
  border: 1px solid var(--theme-main);
}

.toc-title {
  color: var(--theme-main);
  font-size: 1.1rem;
  margin-bottom: 1rem;
  border-bottom: 1px dashed var(--theme-main);
  padding-bottom: 0.5rem;
}

.toc-nav {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.toc-link {
  color: var(--text-color);
  text-decoration: none;
  font-size: 0.85rem;
  padding: 0.2rem 0;
  transition: color 0.2s;
  border-left: 2px solid transparent;
  padding-left: 0.5rem;
}

.toc-link:hover,
.toc-link.active {
  color: var(--theme-main);
  border-left-color: var(--theme-main);
}

.toc-level-3 { padding-left: 1.5rem; }

/* ===== 页面标题 ===== */
.page-title {
  text-align: center;
  color: var(--theme-main);
  margin: 2rem 0;
  font-size: 1.8rem;
  text-shadow: 0 0 10px var(--theme-main);
}

.page-title:after {
  content: "_";
  animation: blink 1s step-end infinite;
}

/* ===== 文章卡片 ===== */
.post-card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  margin-bottom: 1.5rem;
  border: 1px solid rgba(32, 194, 14, 0.08);
  border-radius: 10px;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.post-card:hover {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 20px rgba(32, 194, 14, 0.06);
  border-color: rgba(32, 194, 14, 0.2);
  transform: translateY(-3px);
}

.post-card-cover {
  width: 100%;
  height: 200px;
  overflow: hidden;
}

.post-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.post-card:hover .post-card-cover img {
  transform: scale(1.05);
}

.post-card-body {
  padding: 1.5rem;
}

.post-card h2 {
  margin-bottom: 0.8rem;
}

.post-card h2 a {
  color: #fff;
  text-decoration: none;
  transition: color 0.3s ease;
}

.post-card h2 a:hover {
  color: var(--theme-main);
  text-shadow: 0 0 8px var(--theme-main);
}

.post-card time {
  color: #666;
  font-size: 0.9em;
}

.post-card p {
  margin: 1rem 0;
  color: var(--text-color);
}

/* ===== 标签 ===== */
.tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.tag {
  background: rgba(32, 194, 14, 0.1);
  padding: 4px 12px;
  border: 1px solid var(--theme-main);
  font-size: 0.85em;
  color: var(--theme-main);
  transition: all 0.3s ease;
  text-decoration: none;
  cursor: pointer;
}

.tag:hover {
  background: var(--theme-main);
  color: var(--dark-bg);
}

/* ===== 文章详情 ===== */
.post-detail {
  padding: 2rem 0;
}

.post-detail header {
  margin-bottom: 2rem;
  border-bottom: 1px dashed var(--border-color);
  padding-bottom: 1rem;
}

.post-detail h1 {
  color: var(--theme-main);
  text-shadow: 0 0 10px var(--theme-main);
  margin-bottom: 1rem;
}

.post-cover {
  width: 100%;
  max-height: 400px;
  overflow: hidden;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-color);
}

.post-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-detail .meta {
  color: #666;
  display: flex;
  gap: 2rem;
  align-items: center;
  flex-wrap: wrap;
}

.read-time {
  color: var(--hacker-cyan);
  font-size: 0.9em;
}

/* ===== 上一篇/下一篇 ===== */
.post-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px dashed var(--border-color);
  gap: 1rem;
}

.post-nav-prev, .post-nav-next {
  color: var(--hacker-blue);
  text-decoration: none;
  max-width: 48%;
  transition: color 0.3s;
  font-size: 0.9rem;
}

.post-nav-prev:hover, .post-nav-next:hover {
  color: #fff;
  text-shadow: 0 0 8px var(--hacker-blue);
}

.post-nav-next { text-align: right; margin-left: auto; }

/* ===== 内容样式 ===== */
.content {
  padding: 2rem 0;
  color: var(--text-color);
}

.content h2 {
  color: var(--theme-main);
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px dashed var(--theme-main);
}

.content h3 {
  color: var(--theme-main);
  margin: 2rem 0 0.8rem;
}

.content p {
  margin-bottom: 1.2rem;
  line-height: 1.8;
}

.content ul, .content ol {
  margin: 1.2rem 0;
  padding-left: 2rem;
}

.content li { margin-bottom: 0.5rem; }

.content code {
  background: rgba(32, 194, 14, 0.1);
  padding: 2px 8px;
  color: var(--theme-main);
  font-family: 'Fira Mono', monospace;
}

.content pre {
  background: rgba(16, 22, 32, 0.8);
  border: 1px solid rgba(32, 194, 14, 0.1);
  border-left: 3px solid;
  border-image: linear-gradient(180deg, var(--hacker-green), var(--hacker-cyan)) 1;
  overflow-x: auto;
  margin: 1.5rem 0;
  border-radius: 0 6px 6px 0;
  position: relative;
}

.content pre code {
  background: none;
  padding: 0;
  font-size: 0.9em;
  line-height: 1.6;
}

/* 代码复制按钮 */
.code-copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(32, 194, 14, 0.15);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  z-index: 5;
}

.code-copy-btn:hover {
  background: var(--theme-main);
  color: var(--dark-bg);
}

.code-copy-btn.copied {
  background: var(--hacker-blue);
  color: #fff;
  border-color: var(--hacker-blue);
}

.content blockquote {
  border-left: 4px solid var(--theme-main);
  padding-left: 1.5rem;
  margin: 1.5rem 0;
  color: #999;
  font-style: italic;
}

.content a {
  color: var(--hacker-blue);
  text-decoration: none;
  transition: all 0.3s ease;
}

.content a:hover {
  color: #fff;
  text-shadow: 0 0 8px var(--hacker-blue);
}

/* ===== 页脚 ===== */
.footer {
  background-color: var(--theme-darker-bg);
  padding: 2rem;
  text-align: center;
  color: #666;
  border-top: 1px solid var(--theme-main);
  margin-top: auto;
}

/* ===== 学习进度 ===== */
.progress-container { margin: 1rem 0; }

.progress-title {
  color: var(--text-color);
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.progress-bar {
  height: 4px;
  background-color: var(--border-color);
  margin: 0.8rem 0;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: repeating-linear-gradient(
    45deg,
    var(--theme-main),
    var(--theme-main) 10px,
    var(--dark-bg) 10px,
    var(--dark-bg) 20px
  );
  animation: progress-animation 2s linear infinite;
}

/* ===== 导航链接列表 ===== */
.nav-list {
  list-style: none;
  padding: 0;
}

.nav-list li { margin-bottom: 1rem; }

.nav-list a {
  color: #00ff99;
  text-decoration: none;
  transition: all 0.3s ease;
}

.nav-list a:hover {
  color: #fff;
  text-shadow: 0 0 8px #00ff99;
}

/* ===== 三级分类页：左侧标签导航 + 右侧文章列表 ===== */
.subcat-container {
  display: flex;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  padding: 2rem;
  gap: 2rem;
  flex: 1;
}

.subcat-sidebar {
  width: 220px;
  flex-shrink: 0;
  position: sticky;
  top: 80px;
  height: calc(100vh - 80px);
  overflow-y: auto;
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(32, 194, 14, 0.08);
  border-radius: 10px;
  padding: 1.2rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.subcat-sidebar-title {
  color: var(--theme-main);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid rgba(32, 194, 14, 0.15);
  letter-spacing: 1px;
}

.subcat-nav {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.subcat-tag {
  color: var(--text-color);
  text-decoration: none;
  padding: 0.5rem 0.8rem;
  font-size: 0.9rem;
  border-left: 2px solid transparent;
  transition: all 0.25s ease;
  cursor: pointer;
  border-radius: 0 4px 4px 0;
}

.subcat-tag:hover {
  color: var(--theme-main);
  background: rgba(32, 194, 14, 0.05);
  border-left-color: var(--theme-main);
}

.subcat-tag.active {
  color: var(--theme-main);
  border-left-color: var(--theme-main);
  background: rgba(32, 194, 14, 0.08);
  font-weight: 600;
}

/* 分组标签 */
.subcat-group {
  margin: 0.3rem 0;
}

.subcat-group-label {
  color: var(--text-color);
  padding: 0.5rem 0.8rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  user-select: none;
}

.subcat-group-label:hover {
  color: var(--theme-main);
}

.subcat-group-label.open {
  color: var(--theme-main);
}

.subcat-group-arrow {
  font-size: 0.75rem;
  transition: transform 0.2s;
  display: inline-block;
  width: 1em;
}

.subcat-group-items {
  display: none;
  padding-left: 0.5rem;
  border-left: 1px dashed var(--border-color);
  margin-left: 0.8rem;
}

.subcat-sub-tag {
  font-size: 0.82rem;
  padding: 0.35rem 0.6rem;
  color: #888;
}

.subcat-sub-tag:hover {
  color: var(--theme-main);
}

.subcat-sub-tag.active {
  color: var(--theme-main);
  font-weight: 600;
}

/* 空占位标签（暂无文章） */
.subcat-sub-tag.subcat-empty {
  opacity: 0.4;
  cursor: default;
}

.subcat-sub-tag.subcat-empty:hover {
  opacity: 0.6;
}

.subcat-content {
  flex: 1;
  min-width: 0;
}

.subcat-header {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px dashed var(--border-color);
}

.subcat-title {
  color: var(--theme-main);
  font-size: 1.6rem;
  text-shadow: 0 0 8px var(--theme-main);
}

.subcat-count {
  color: #666;
  font-size: 0.9rem;
}

.subcat-article-item {
  padding: 1.2rem 1.5rem;
  margin-bottom: 0.8rem;
  border: 1px solid rgba(32, 194, 14, 0.08);
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  border-radius: 10px;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.subcat-article-item:hover {
  border-color: rgba(32, 194, 14, 0.2);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25), 0 0 15px rgba(32, 194, 14, 0.06);
  transform: translateY(-2px);
}

.subcat-article-item h2 {
  margin-bottom: 0.5rem;
}

.subcat-article-item h2 a {
  color: #fff;
  text-decoration: none;
  font-size: 1.05rem;
  transition: color 0.3s;
}

.subcat-article-item h2 a:hover {
  color: var(--theme-main);
  text-shadow: 0 0 6px var(--theme-main);
}

.subcat-article-item time {
  color: #666;
  font-size: 0.85em;
}

.subcat-article-item p {
  color: var(--text-color);
  margin-top: 0.5rem;
  font-size: 0.9rem;
  line-height: 1.6;
}

/* 亮色主题：三级分类页 */
[data-theme="light"] .subcat-sidebar {
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 12px;
  padding: 1.2rem;
  box-shadow: 0 4px 24px rgba(59, 130, 246, 0.06);
}

[data-theme="light"] .subcat-sidebar-title {
  color: #3B82F6;
  border-bottom: 1px solid rgba(59, 130, 246, 0.15);
}

[data-theme="light"] .subcat-tag {
  color: #64748b;
}

[data-theme="light"] .subcat-tag:hover {
  color: #3B82F6;
  background: rgba(59, 130, 246, 0.06);
  border-left-color: #3B82F6;
}

[data-theme="light"] .subcat-tag.active {
  color: #3B82F6;
  border-left-color: #3B82F6;
  background: rgba(59, 130, 246, 0.08);
}

[data-theme="light"] .subcat-group-label { color: #64748b; }
[data-theme="light"] .subcat-group-label:hover { color: #3B82F6; }
[data-theme="light"] .subcat-group-label.open { color: #3B82F6; }
[data-theme="light"] .subcat-group-items { border-left-color: rgba(59, 130, 246, 0.15); }
[data-theme="light"] .subcat-sub-tag { color: #94a3b8; }
[data-theme="light"] .subcat-sub-tag:hover { color: #3B82F6; }
[data-theme="light"] .subcat-sub-tag.active { color: #3B82F6; }

[data-theme="light"] .subcat-title {
  color: #3B82F6;
  text-shadow: none;
}

[data-theme="light"] .subcat-count { color: #94a3b8; }

[data-theme="light"] .subcat-article-item {
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 10px;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] .subcat-article-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.2);
}

[data-theme="light"] .subcat-article-item h2 a { color: #1e293b; }
[data-theme="light"] .subcat-article-item h2 a:hover { color: #3B82F6; text-shadow: none; }
[data-theme="light"] .subcat-article-item time { color: #94a3b8; }
[data-theme="light"] .subcat-article-item p { color: #64748b; }

/* 响应式：三级分类页 */
@media (max-width: 992px) {
  .subcat-container {
    flex-direction: column;
    padding: 1rem;
  }
  .subcat-sidebar {
    width: 100%;
    position: static;
    height: auto;
    overflow: visible;
  }
  .subcat-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.4rem;
  }
  .subcat-tag {
    border-left: none;
    border-bottom: 2px solid transparent;
    border-radius: 4px;
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
  }
  .subcat-tag:hover, .subcat-tag.active {
    border-left-color: transparent;
    border-bottom-color: var(--theme-main);
  }
  [data-theme="light"] .subcat-tag:hover,
  [data-theme="light"] .subcat-tag.active {
    border-left-color: transparent;
    border-bottom-color: #3B82F6;
  }
}

/* ===== 回到顶部 ===== */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 44px;
  height: 44px;
  background: var(--theme-darker-bg);
  border: 1px solid var(--theme-main);
  color: var(--theme-main);
  font-size: 1.2rem;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  transition: all 0.3s ease;
}

.back-to-top.visible {
  display: flex;
}

.back-to-top:hover {
  background: var(--theme-main);
  color: var(--dark-bg);
}

/* ===== 404 页面 ===== */
.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 80vh;
  text-align: center;
}

.error-code {
  font-size: 6rem;
  color: var(--hacker-red);
  text-shadow: 0 0 20px var(--hacker-red);
}

.error-msg {
  color: var(--text-color);
  font-size: 1.2rem;
  margin: 1rem 0;
}

.error-link {
  color: var(--hacker-blue);
  text-decoration: none;
  font-size: 1.1rem;
}

.error-link:hover {
  text-shadow: 0 0 8px var(--hacker-blue);
}

/* ===== 空状态提示 ===== */
.empty-hint {
  color: var(--text-color);
  text-align: center;
  padding: 3rem 0;
  font-size: 1.1rem;
}

/* ===== 动画 ===== */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@keyframes scanline {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

@keyframes progress-animation {
  0% { background-position: 0 0; }
  100% { background-position: 40px 0; }
}

/* ===== 响应式 ===== */
@media (max-width: 992px) {
  .main-container {
    flex-direction: column;
    padding: 1rem;
  }

  .main-content { padding-right: 0; }

  .sidebar-right {
    width: 100%;
    height: auto;
    position: static;
    border-left: none;
    border-top: 1px dashed var(--border-color);
    padding: 1rem 0;
  }

  .toc-container {
    position: static;
  }
}

@media (max-width: 768px) {
  .navbar {
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.8rem 1rem;
  }

  .menu-toggle { display: block; }

  .nav-links {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding-top: 0.5rem;
  }

  .nav-links.open { display: flex; }

  .nav-link { padding: 0.8rem 1rem; border-bottom: 1px solid var(--border-color); }

  .nav-dropdown .dropdown-menu {
    position: static;
    box-shadow: none;
    border: none;
    border-top: 1px solid var(--border-color);
    display: block;
    background: rgba(0,0,0,0.2);
  }

  .page-title { font-size: 1.4rem; }

  .search-bar { padding: 0 1rem; }

  .post-nav { flex-direction: column; }
  .post-nav-next { text-align: left; }
}
