@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;600;700&family=Fira+Sans:wght@300;400;500;600;700&display=swap');

/* ===== 基础变量 ===== */
:root {
  --c-primary: #56228b;
  --c-primary-light: #7a3fb8;
  --c-primary-dim: rgba(86,34,139,0.15);
  --c-accent: #8b4513;
  --c-accent-light: #b05a1a;
  --c-dark: #1f1726;
  --c-darker: #160f1c;
  --c-surface: rgba(31,23,38,0.85);
  --c-glass: rgba(86,34,139,0.10);
  --c-glass-border: rgba(86,34,139,0.30);
  --c-text: #e8dff5;
  --c-text-muted: #b09ec8;
  --c-text-dim: #7a6890;
  --c-link: #c49dff;
  --c-link-hover: #e0c4ff;
  --sidebar-w: 260px;
  --radius-sm: 10px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --font-body: 'Fira Sans', system-ui, sans-serif;
  --font-mono: 'Fira Code', 'Courier New', monospace;
  --transition: 0.22s ease;
}

/* ===== 重置 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 17px; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background-color: var(--c-dark);
  color: var(--c-text);
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; height: auto; }
a { color: var(--c-link); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--c-link-hover); }
ul { list-style: none; }
h1,h2,h3,h4,h5,h6 { font-weight: 600; line-height: 1.3; }

/* ===== 有机背景纹理 ===== */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(ellipse 80% 60% at 70% 30%, rgba(86,34,139,0.18) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 20% 80%, rgba(139,69,19,0.10) 0%, transparent 55%);
  pointer-events: none;
  z-index: 0;
}

/* ===== 页面骨架 ===== */
.page-wrapper {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ===== 侧边导航 ===== */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--c-darker);
  border-right: 1px solid var(--c-glass-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 100;
  padding-bottom: 24px;
}

.sidebar-logo {
  padding: 24px 20px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--c-glass-border);
  margin-bottom: 12px;
}

.logo-mark { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }

.logo-text-mark {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--c-primary), var(--c-accent));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.3rem;
  color: #fff;
  box-shadow: 0 4px 16px rgba(86,34,139,0.4);
}

.sidebar-announce {
  margin: 0 16px 16px;
  background: rgba(139,69,19,0.18);
  border: 1px solid rgba(139,69,19,0.35);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: #d4915a;
  text-align: center;
  letter-spacing: 0.05em;
}

.sidebar nav ul { padding: 0 12px; display: flex; flex-direction: column; gap: 4px; }

.sidebar nav ul li a,
.nav-link {
  display: block;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--c-text-muted);
  transition: background var(--transition), color var(--transition);
  line-height: 1.4;
  min-height: 42px;
  display: flex;
  align-items: center;
}

.sidebar nav ul li a:hover,
.nav-link:hover {
  background: var(--c-glass);
  color: var(--c-text);
}

.nav-link--active,
.sidebar nav ul li a.nav-link--active {
  background: linear-gradient(90deg, rgba(86,34,139,0.35), rgba(86,34,139,0.10));
  color: #d0a8ff;
  border-left: 3px solid var(--c-primary-light);
}

/* ===== 内容区 ===== */
.content-wrap {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ===== 面包屑 ===== */
.breadcrumb-bar {
  padding: 14px 40px;
  font-size: 0.82rem;
  color: var(--c-text-dim);
  font-family: var(--font-mono);
  border-bottom: 1px solid var(--c-glass-border);
  background: rgba(31,23,38,0.6);
}
.breadcrumb-bar a { color: var(--c-text-dim); }
.breadcrumb-bar a:hover { color: var(--c-link); }
.bc-sep { margin: 0 8px; }

/* ===== Main / Article / Section 契约 ===== */
main { flex: 1; padding: 0 40px 40px; }
main > div { max-width: 860px; margin: 0 auto; }
main > div > section { margin-bottom: 56px; }

/* ===== 玻璃卡片 ===== */
.glass-card {
  background: var(--c-glass);
  border: 1px solid var(--c-glass-border);
  border-radius: var(--radius-md);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.glass-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(86,34,139,0.25);
  border-color: rgba(86,34,139,0.55);
}

/* ===== Hero 网格底纹 ===== */
.hero-grid-bg {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(86,34,139,0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(86,34,139,0.12) 1px, transparent 1px);
  background-size: 32px 32px;
  border-radius: inherit;
  pointer-events: none;
}

/* ===== 首页 Hero ===== */
.home-hero {
  position: relative;
  min-height: 45vh;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(86,34,139,0.22) 0%, rgba(31,23,38,0.80) 100%);
  border: 1px solid var(--c-glass-border);
  overflow: hidden;
  margin-top: 32px;
  padding: 48px 32px;
  text-align: center;
}
.hero-blob {
  position: absolute;
  width: 420px;
  height: 420px;
  top: 50%;
  right: -60px;
  transform: translateY(-50%);
  opacity: 0.7;
  pointer-events: none;
}
.hero-inner { position: relative; z-index: 2; max-width: 640px; }
.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: #c49dff;
  text-transform: uppercase;
  margin-bottom: 14px;
  background: rgba(86,34,139,0.25);
  border: 1px solid rgba(86,34,139,0.40);
  border-radius: 20px;
  display: inline-block;
  padding: 4px 14px;
}
.home-hero h1 {
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  font-weight: 700;
  color: #fff;
  margin-bottom: 16px;
  line-height: 1.25;
}
.hero-cta-row { display: flex; gap: 14px; justify-content: center; margin-top: 28px; flex-wrap: wrap; }

.btn-primary {
  background: linear-gradient(135deg, var(--c-primary), var(--c-primary-light));
  color: #fff;
  padding: 12px 28px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  transition: transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 4px 18px rgba(86,34,139,0.4);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(86,34,139,0.5); color: #fff; }

.btn-outline {
  background: transparent;
  color: var(--c-link);
  padding: 12px 28px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border: 1.5px solid var(--c-glass-border);
  transition: border-color var(--transition), background var(--transition);
}
.btn-outline:hover { border-color: var(--c-primary-light); background: var(--c-glass); color: var(--c-link-hover); }

/* ===== h2 + .subtitle 装饰 ===== */
h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: #d0a8ff;
  margin-bottom: 8px;
  font-family: var(--font-body);
}
h2 + .subtitle,
h2 + p.subtitle,
h2 + p.subhead,
h2 + p.desc,
h2 + p.lead {
  color: var(--c-text-muted);
  font-size: 0.9rem;
  margin-bottom: 28px;
  margin-top: 0;
}
p.subtitle {
  color: var(--c-text-muted);
  font-size: 0.95rem;
  margin-bottom: 20px;
}

/* ===== 首页频道网格 ===== */
.home-categories { margin-top: 16px; }
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
  margin-top: 8px;
}
.cat-card {
  display: block;
  padding: 24px 20px;
  color: var(--c-text);
  border-radius: var(--radius-md);
}
.cat-card:hover { color: var(--c-text); }
.cat-card-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: #d0a8ff;
  margin-bottom: 10px;
  line-height: 1.4;
}
.cat-card-desc { font-size: 0.83rem; color: var(--c-text-muted); line-height: 1.6; }

/* ===== 首页最新文章 ===== */
.home-latest { margin-top: 16px; display: flex; flex-direction: column; gap: 16px; }
.art-card {
  display: flex;
  gap: 18px;
  padding: 20px;
  border-radius: var(--radius-md);
}
.art-card-img { flex-shrink: 0; width: 100px; }
.art-card-img img { border-radius: var(--radius-sm); width: 100px; height: 70px; object-fit: cover; }
.art-card-body { flex: 1; min-width: 0; }
.art-card-title { font-weight: 700; font-size: 1rem; color: var(--c-text); display: block; margin-bottom: 6px; }
.art-card-title:hover { color: var(--c-link-hover); }
.art-card-desc { font-size: 0.85rem; color: var(--c-text-muted); margin-bottom: 8px; }

/* ===== 日期标签 ===== */
.art-date, .pub-date, .mod-date {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--c-text-dim);
  display: inline-block;
}
.mod-date { margin-left: 6px; }

/* ===== 首页内容区 ===== */
.home-content-section { margin-top: 8px; }

/* ===== 栏目页 Hero ===== */
.cat-hero {
  position: relative;
  border-radius: var(--radius-lg);
  background: linear-gradient(120deg, rgba(86,34,139,0.20) 0%, rgba(139,69,19,0.10) 100%);
  border: 1px solid var(--c-glass-border);
  overflow: hidden;
  padding: 48px 40px;
  margin-top: 32px;
}
.cat-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: #d4915a;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.cat-hero-inner { position: relative; z-index: 2; }
.cat-hero h1 { font-size: clamp(1.4rem, 3vw, 2rem); font-weight: 700; color: #fff; margin-bottom: 12px; }

/* ===== 栏目子页列表 ===== */
.cat-children { display: flex; flex-direction: column; gap: 18px; }
.child-card {
  display: flex;
  gap: 18px;
  padding: 22px 20px;
  border-radius: var(--radius-md);
}
.child-card-img { flex-shrink: 0; width: 90px; }
.child-card-img img { border-radius: var(--radius-sm); width: 90px; height: 62px; object-fit: cover; }
.child-card-body { flex: 1; min-width: 0; }
.child-card-title { margin-bottom: 6px; }
.child-card-title a { font-weight: 700; font-size: 1rem; color: var(--c-text); }
.child-card-title a:hover { color: var(--c-link-hover); }
.child-card-desc { font-size: 0.85rem; color: var(--c-text-muted); margin-bottom: 8px; }

/* ===== 文章页 ===== */
.article-header { margin-top: 32px; margin-bottom: 36px; }
.article-hero { border-radius: var(--radius-md); overflow: hidden; margin-bottom: 22px; }
.article-hero-img { width: 100%; max-height: 380px; object-fit: cover; }
.article-meta-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.tag-badge {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 600;
  background: rgba(86,34,139,0.25);
  border: 1px solid rgba(86,34,139,0.45);
  border-radius: 20px;
  padding: 4px 12px;
  color: #c49dff;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
}
.tag-badge:hover { background: rgba(86,34,139,0.40); color: #d8b8ff; }
.article-header h1 { font-size: clamp(1.5rem, 3.5vw, 2.1rem); font-weight: 700; color: #fff; margin-bottom: 14px; }
.article-lead { font-size: 1.05rem; color: var(--c-text-muted); margin-bottom: 8px; }

/* ===== 正文散文样式 ===== */
.prose { line-height: 1.8; font-size: 1rem; }
.prose h2 { font-size: 1.3rem; margin-top: 40px; margin-bottom: 12px; color: #d0a8ff; }
.prose h3 { font-size: 1.1rem; margin-top: 28px; margin-bottom: 10px; color: #c49dff; font-weight: 600; }
.prose p { margin-bottom: 18px; }
.prose ul, .prose ol { margin: 0 0 18px 24px; list-style: disc; }
.prose ol { list-style: decimal; }
.prose li { margin-bottom: 6px; }
.prose a { color: var(--c-link); border-bottom: 1px solid rgba(196,157,255,0.3); }
.prose a:hover { color: var(--c-link-hover); border-color: rgba(224,196,255,0.6); }
.prose strong { color: #e8dff5; font-weight: 700; }
.prose em { color: #d4915a; font-style: italic; }
.prose code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: rgba(86,34,139,0.20);
  border: 1px solid rgba(86,34,139,0.30);
  border-radius: 6px;
  padding: 2px 7px;
  color: #d0a8ff;
}
.prose pre {
  background: rgba(22,15,28,0.90);
  border: 1px solid var(--c-glass-border);
  border-radius: var(--radius-sm);
  padding: 20px;
  overflow-x: auto;
  margin-bottom: 22px;
  font-family: var(--font-mono);
  font-size: 0.88rem;
}
.prose pre code { background: none; border: none; padding: 0; }
.prose blockquote {
  border-left: 3px solid var(--c-primary-light);
  padding: 12px 20px;
  margin: 20px 0;
  background: var(--c-glass);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--c-text-muted);
  font-style: italic;
}
.prose img { border-radius: var(--radius-sm); margin: 20px 0; }
.prose table { width: 100%; border-collapse: collapse; margin-bottom: 22px; font-size: 0.9rem; }
.prose th {
  background: rgba(86,34,139,0.25);
  border: 1px solid var(--c-glass-border);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  color: #d0a8ff;
}
.prose td { border: 1px solid var(--c-glass-border); padding: 10px 14px; }

/* ===== 相关文章 ===== */
.article-related { display: flex; flex-direction: column; gap: 14px; }
.related-card { padding: 18px 20px; border-radius: var(--radius-md); }
.related-title { font-weight: 700; font-size: 0.95rem; color: var(--c-text); display: block; margin-bottom: 6px; }
.related-title:hover { color: var(--c-link-hover); }
.related-desc { font-size: 0.83rem; color: var(--c-text-muted); margin-bottom: 6px; }

/* ===== 页面 Hero（通用内页） ===== */
.page-hero {
  padding: 40px 0 20px;
  border-bottom: 1px solid var(--c-glass-border);
  margin-bottom: 36px;
}
.page-hero h1 { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 700; color: #fff; margin-bottom: 12px; }
.page-hero .subtitle { font-size: 1rem; color: var(--c-text-muted); margin-bottom: 12px; }

/* ===== 关于页 ===== */
.about-header {
  position: relative;
  overflow: hidden;
  padding: 48px 0 28px;
  border-bottom: 1px solid var(--c-glass-border);
  margin-bottom: 40px;
}
.about-blob { position: absolute; right: 0; top: 0; width: 300px; opacity: 0.5; pointer-events: none; }
.about-header h1 { font-size: clamp(1.6rem, 3.5vw, 2.2rem); font-weight: 700; color: #fff; margin-bottom: 12px; position: relative; z-index: 2; }
.about-header .subtitle { position: relative; z-index: 2; }
.about-body { margin-bottom: 48px; }
.about-values h2 { margin-bottom: 8px; }
.values-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-top: 8px; }
.value-item { padding: 24px 20px; }
.value-icon {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.85rem;
  color: #c49dff;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
  background: rgba(86,34,139,0.20);
  border-radius: 8px;
  display: inline-block;
  padding: 4px 12px;
}
.value-text { font-size: 0.88rem; color: var(--c-text-muted); line-height: 1.6; }

/* ===== 隐私页 ===== */
.privacy-header {
  padding: 40px 0 28px;
  border-bottom: 1px solid var(--c-glass-border);
  margin-bottom: 36px;
}
.privacy-header h1 { font-size: clamp(1.4rem, 3vw, 2rem); font-weight: 700; color: #fff; margin-bottom: 12px; }
.privacy-updated { font-family: var(--font-mono); font-size: 0.82rem; color: var(--c-text-dim); margin-top: 10px; }
.privacy-toc { padding: 24px 28px; margin-bottom: 36px; }
.toc-list { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; list-style: none; }
.toc-list li {
  font-size: 0.9rem;
  color: var(--c-text-muted);
  padding-left: 16px;
  position: relative;
}
.toc-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--c-primary-light);
}

/* ===== 页脚 (footer > section×n) ===== */
footer {
  border-top: 1px solid var(--c-glass-border);
  background: var(--c-darker);
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 40px;
  padding: 56px 40px 40px;
  margin-top: auto;
}
.footer-brand-name {
  font-size: 2.4rem;
  font-weight: 700;
  color: rgba(86,34,139,0.35);
  line-height: 1;
  font-family: var(--font-mono);
  margin-bottom: 14px;
  word-break: break-all;
}
.footer-desc { font-size: 0.85rem; color: var(--c-text-dim); line-height: 1.6; }
.footer-links h3 { font-size: 0.9rem; font-weight: 600; color: var(--c-text-muted); margin-bottom: 14px; font-family: var(--font-mono); letter-spacing: 0.08em; }
.footer-links ul { display: flex; flex-direction: column; gap: 8px; }
.footer-links ul li a { font-size: 0.85rem; color: var(--c-text-dim); min-height: 32px; display: flex; align-items: center; }
.footer-links ul li a:hover { color: var(--c-link); }
.footer-copy { font-size: 0.82rem; color: var(--c-text-dim); margin-bottom: 10px; }
.footer-legal p { font-size: 0.82rem; color: var(--c-text-dim); margin-bottom: 8px; }
.footer-legal a { color: var(--c-text-dim); }
.footer-legal a:hover { color: var(--c-link); }
.footer-warning {
  font-size: 0.78rem;
  color: var(--c-accent);
  background: rgba(139,69,19,0.12);
  border: 1px solid rgba(139,69,19,0.25);
  border-radius: 8px;
  padding: 6px 10px;
  margin-top: 12px;
}

/* ===== 动效 ===== */
@media (prefers-reduced-motion: no-preference) {
  .glass-card {
    will-change: transform;
  }
  .sidebar nav ul li a {
    transition: background 0.2s ease, color 0.2s ease, padding-left 0.2s ease;
  }
  .sidebar nav ul li a:hover { padding-left: 22px; }
  .nav-link--active { padding-left: 22px; }
  .btn-primary, .btn-outline { will-change: transform; }
  .cat-card { transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease; }
  .cat-card:hover { transform: translateY(-4px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ===== 响应式 ===== */
@media (max-width: 900px) {
  :root { --sidebar-w: 220px; }
  footer { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 680px) {
  :root { --sidebar-w: 0px; }
  .sidebar {
    width: 100%;
    min-height: auto;
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 0;
    border-right: none;
    border-bottom: 1px solid var(--c-glass-border);
  }
  .sidebar-logo { padding: 12px 16px; border-bottom: none; margin-bottom: 0; border-right: 1px solid var(--c-glass-border); }
  .sidebar-announce { margin: 10px 12px; flex: 1; }
  .sidebar nav { width: 100%; border-top: 1px solid var(--c-glass-border); }
  .sidebar nav ul { flex-direction: row; flex-wrap: wrap; padding: 8px; gap: 4px; }
  .sidebar nav ul li a, .nav-link {
    padding: 10px 14px;
    font-size: 0.82rem;
    min-height: 40px;
    white-space: nowrap;
  }
  .content-wrap { margin-left: 0; }
  main { padding: 0 20px 32px; }
  .breadcrumb-bar { padding: 10px 20px; }
  .page-wrapper { flex-direction: column; }
  .home-hero { min-height: 42vh; padding: 36px 20px; margin-top: 20px; }
  .hero-blob { display: none; }
  footer { grid-template-columns: 1fr; gap: 28px; padding: 36px 20px 28px; }
  .footer-brand-name { font-size: 1.6rem; }
  .cat-hero { padding: 32px 20px; margin-top: 20px; }
  .article-header { margin-top: 20px; }
  .article-full { overflow: hidden; }
  .values-grid { grid-template-columns: 1fr; }
  .category-grid { grid-template-columns: 1fr; }
  .art-card { flex-direction: column; gap: 12px; }
  .art-card-img { width: 100%; }
  .art-card-img img { width: 100%; height: 160px; }
  .child-card { flex-direction: column; gap: 12px; }
}
