/* 星络·空间 —— 前台暗黑简约主题 */

:root {
  --bg: #0b0d10;
  --bg-glow: rgba(124, 156, 255, 0.05);
  --surface: #111419;
  --surface-2: #151920;
  --surface-3: #1a1f27;
  --border: #232a33;
  --border-soft: #1b212a;
  --text: #e8eaee;
  --text-dim: #99a2b0;
  --text-faint: #6a7482;
  --accent: #7c9cff;
  --accent-dim: rgba(124, 156, 255, 0.14);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
}

body {
  /* 纵向弹性布局：内容不足时把页脚压到屏幕下边缘 */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(760px 320px at 12% -8%, var(--bg-glow), transparent 70%),
    radial-gradient(620px 280px at 88% 4%, rgba(124, 156, 255, 0.035), transparent 72%);
  background-repeat: no-repeat;
}

a { color: inherit; text-decoration: none; }

/* ---------------------------------------------------- 顶栏 */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(11, 13, 16, 0.86);
  backdrop-filter: blur(10px);
}

.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.brand-mark {
  position: relative;
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 32%, #c9d7ff, var(--accent) 62%, #48548c);
  box-shadow: 0 0 12px rgba(124, 156, 255, 0.55);
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: -5px;
  border: 1px solid rgba(124, 156, 255, 0.28);
  border-radius: 50%;
}

.topbar-links {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 14px;
  color: var(--text-dim);
}

.topbar-links a { transition: color 0.15s ease; }
.topbar-links a:hover { color: var(--accent); }

/* 顶栏全文搜索：极简胶囊输入框 */
.search {
  flex: 0 1 240px;
  margin-left: auto;
}

.search-input {
  width: 100%;
  padding: 7px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.search-input::placeholder { color: var(--text-faint); }
.search-input:hover { border-color: var(--text-faint); }
.search-input:focus { outline: none; border-color: var(--accent); background: var(--surface-3); }

/* ---------------------------------------------------- 布局 */

.layout {
  flex: 1 0 auto;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 30px 24px 60px;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 78px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px 14px;
}

.sidebar-title {
  margin: 0 0 12px;
  padding: 0 8px;
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-faint);
}

.category-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.category-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-dim);
  border-left: 2px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.category-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.category-item.is-active {
  background: var(--accent-dim);
  border-left-color: var(--accent);
  color: var(--text);
  font-weight: 600;
}

.category-item.is-active .category-count { color: var(--accent); }

.category-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-count {
  flex: 0 0 auto;
  min-width: 22px;
  text-align: center;
  font-size: 12px;
  color: var(--text-faint);
  background: var(--surface-3);
  border-radius: 999px;
  padding: 1px 7px;
}

.sidebar-empty {
  margin: 4px 8px 0;
  font-size: 13px;
  color: var(--text-faint);
}

/* 侧栏底部的站内入口：沿用品牌样式，尺寸更小 */

.sidebar-links {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 16px;
  padding: 14px 8px 2px;
  border-top: 1px solid var(--border-soft);
}

.sidebar-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  transition: color 0.15s ease;
}

.sidebar-link:hover { color: var(--accent); }

.sidebar-link .brand-mark {
  width: 10px;
  height: 10px;
  box-shadow: 0 0 8px rgba(124, 156, 255, 0.5);
}

.sidebar-link .brand-mark::after { inset: -4px; }

/* ---------------------------------------------------- 内容区 */

.content-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-soft);
}

.content-head h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.4px;
}

.content-count {
  font-size: 13px;
  color: var(--text-faint);
}

.card-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card {
  display: block;
  padding: 18px 20px;
  border: 1px solid var(--border-soft);
  border-left: 2px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.card:hover {
  border-left-color: var(--accent);
  background: var(--surface-2);
  transform: translateX(2px);
}

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.card-title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.5;
}

.tag {
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--accent);
  background: var(--accent-dim);
  border-radius: 999px;
  padding: 1px 10px;
  white-space: nowrap;
}

.card-excerpt {
  margin: 0;
  font-size: 14px;
  color: var(--text-dim);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-excerpt.is-empty { color: var(--text-faint); font-style: italic; }

.card-meta {
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-faint);
}

.empty-state {
  padding: 70px 20px;
  text-align: center;
  color: var(--text-faint);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* ---------------------------------------------------- 文章详情 */

.article {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 32px 36px 28px;
}

.article-head {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 24px;
}

.article-title {
  margin: 0 0 12px;
  font-size: 26px;
  line-height: 1.4;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-faint);
}

.article-foot {
  margin-top: 32px;
  padding-top: 18px;
  border-top: 1px solid var(--border-soft);
}

.back-link {
  font-size: 14px;
  color: var(--text-dim);
  transition: color 0.15s ease;
}

.back-link:hover { color: var(--accent); }

/* ---------------------------------------------------- 正文排版 */

.article-content {
  font-size: 15px;
  line-height: 1.85;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.article-content > *:first-child { margin-top: 0; }
.article-content > *:last-child { margin-bottom: 0; }

.article-content p { margin: 0 0 14px; }

.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4 {
  margin: 26px 0 12px;
  font-weight: 600;
  line-height: 1.45;
}

.article-content h1 { font-size: 22px; }
.article-content h2 { font-size: 19px; }
.article-content h3 { font-size: 17px; }

.article-content a {
  color: var(--accent);
  border-bottom: 1px solid rgba(124, 156, 255, 0.35);
}

.article-content strong { font-weight: 700; }

.article-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
  display: block;
  margin: 16px 0;
}

/* 手动缩放过的图片（带 width 设定）按设定尺寸渲染，其余随栏宽自适应 */
.article-content img[width] { max-width: none; }

.article-content ul,
.article-content ol {
  margin: 0 0 14px;
  padding-left: 24px;
}

.article-content li { margin: 4px 0; }

.article-content blockquote,
.article-content .ql-blockquote {
  margin: 16px 0;
  padding: 10px 16px;
  border-left: 3px solid var(--accent);
  background: var(--surface-2);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-dim);
}

/* 行内代码与代码块：高对比度 */
.article-content code {
  font-family: "JetBrains Mono", "Cascadia Mono", Consolas, "Courier New", monospace;
  font-size: 0.9em;
  padding: 2px 6px;
  border-radius: 5px;
  background: #eef2ff;
  color: #10131a;
  border: 1px solid #c9d3f0;
}

.article-content pre,
.article-content .ql-code-block-container {
  margin: 16px 0;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: #0a0c10;
  border: 1px solid var(--border);
  overflow-x: auto;
}

.article-content pre code,
.article-content .ql-code-block {
  background: transparent;
  border: none;
  padding: 0;
  color: #e8eaee;
  font-size: 13.5px;
  line-height: 1.7;
}

/* 表格 */
.article-content table {
  width: 100%;
  margin: 16px 0;
  border-collapse: collapse;
  font-size: 14px;
}

.article-content th,
.article-content td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
  min-width: 40px;
}

.article-content th {
  background: var(--surface-3);
  font-weight: 600;
}

.article-content tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.015);
}

/* 表格 BlockEmbed 容器在正文中的表现 */
.article-content .ql-table-embed {
  margin: 16px 0;
  overflow-x: auto;
}

/* 对齐格式（Quill class 形式） */
.article-content .ql-align-center { text-align: center; }
.article-content .ql-align-right { text-align: right; }
.article-content .ql-align-justify { text-align: justify; }

/* ---------------------------------------------------- 页脚 */

.footer {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 24px 0;
  border-top: 1px solid var(--border-soft);
  font-size: 12.5px;
  color: var(--text-faint);
  text-align: center;
}

/* 备案信息：两个备案号同行排列 */
.footer-beian {
  display: inline-block;
  font-size: 11.5px;
  color: #565e6a;
  letter-spacing: 0.3px;
  transition: color 0.15s ease;
}

.footer-beian + .footer-beian { margin-left: 14px; }

.footer-beian:hover { color: var(--accent); }

/* ---------------------------------------------------- 响应式 */

@media (max-width: 860px) {
  /* 顶栏收成两行：第一行品牌与导航，第二行整宽的搜索框 */
  .topbar-inner {
    flex-wrap: wrap;
    row-gap: 10px;
    padding: 12px 16px;
  }

  .search {
    order: 3;
    flex: 1 1 100%;
    margin-left: 0;
  }

  .search-input { font-size: 16px; }   /* 16px 以下 iOS 聚焦时会自动放大页面 */

  .layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    padding: 20px 16px 48px;
  }

  .sidebar {
    position: static;
  }

  .category-list {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .category-item { border-left: none; border-bottom: 2px solid transparent; }
  .category-item.is-active { border-bottom-color: var(--accent); }

  .article { padding: 22px 18px; }
  .article-title { font-size: 21px; }
}
