/* ============================================================
   LiteCMS 前台样式 v1.0.0
   纯原生 CSS，无任何框架依赖
   ============================================================ */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --ink: #16181d;
  --ink-2: #4a5058;
  --ink-3: #8b939e;
  --line: #e5e8ec;
  --brand: #2f5bea;
  --brand-soft: #eef2ff;
  --accent: #f59e0b;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-md: 0 6px 24px -8px rgba(16, 24, 40, .14);
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--brand); }
img { max-width: 100%; height: auto; }

.container {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 0 24px;
}

.muted { color: var(--ink-3); }

/* ---------------------------------------------------------- 顶部导航 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 68px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(140deg, #4d7cff, #2f5bea 60%, #1e3fbe);
  color: #fff;
  font-weight: 800;
  font-size: 18px;
  box-shadow: 0 4px 12px -4px rgba(47, 91, 234, .7);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 15px; letter-spacing: -.01em; }
.brand-text small { font-size: 11.5px; color: var(--ink-3); }

.search {
  display: flex;
  align-items: center;
  flex: 1;
  max-width: 320px;
  margin-left: auto;
  background: #f1f3f6;
  border: 1px solid transparent;
  border-radius: 10px;
  overflow: hidden;
  transition: border-color .18s, background .18s;
}

.search:focus-within {
  background: #fff;
  border-color: #c7d2fe;
  box-shadow: 0 0 0 3px rgba(47, 91, 234, .1);
}

.search input {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 9px 12px;
  font-size: 13.5px;
  color: var(--ink);
  outline: none;
  font-family: inherit;
}

.search button {
  border: 0;
  background: transparent;
  color: var(--ink-2);
  padding: 9px 13px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
.search button:hover { color: var(--brand); }

.top-nav { display: flex; align-items: center; gap: 4px; }

.top-nav a {
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--ink-2);
  transition: background .15s, color .15s;
}

.top-nav a:hover { background: #f1f3f6; color: var(--ink); }
.top-nav a.on { color: var(--brand); background: var(--brand-soft); font-weight: 600; }

.top-nav a.ghost {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-2);
}
.top-nav a.ghost:hover { border-color: #c7d2fe; color: var(--brand); background: #fff; }

/* ---------------------------------------------------------- 分类条 */
.cat-bar {
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.cat-inner {
  display: flex;
  gap: 8px;
  padding-top: 12px;
  padding-bottom: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.cat-inner::-webkit-scrollbar { display: none; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  padding: 5px 12px;
  border-radius: 999px;
  background: #f3f4f7;
  font-size: 13px;
  color: var(--ink-2);
  white-space: nowrap;
  transition: all .15s;
}
.chip em {
  font-style: normal;
  font-size: 11px;
  color: var(--ink-3);
  background: #fff;
  border-radius: 999px;
  padding: 0 5px;
  line-height: 1.6;
}
.chip:hover { background: #e8ebf0; color: var(--ink); }
.chip.on { background: var(--ink); color: #fff; }
.chip.on em { background: rgba(255,255,255,.18); color: #fff; }

/* ---------------------------------------------------------- 主体 */
.site-main { padding-top: 32px; padding-bottom: 64px; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 16px;
}
.section-head h2 {
  margin: 0;
  font-size: 17px;
  letter-spacing: -.01em;
}

/* ---------------------------------------------------------- 精选区 */
.featured-zone { margin-bottom: 40px; }

.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.feature-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px;
  border-radius: var(--radius);
  background: linear-gradient(160deg, #ffffff, #fbfcff);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  transition: transform .18s, box-shadow .18s, border-color .18s;
  position: relative;
  overflow: hidden;
}

.feature-item::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, #4d7cff, #a78bfa 60%, #f59e0b);
  opacity: .9;
}

.feature-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #dbe3ff;
}

.feature-cat {
  font-size: 11.5px;
  color: var(--brand);
  font-weight: 600;
  letter-spacing: .02em;
}

.feature-item strong {
  font-size: 15.5px;
  line-height: 1.5;
  letter-spacing: -.01em;
}

.feature-meta { font-size: 12px; color: var(--ink-3); margin-top: auto; }

/* ---------------------------------------------------------- 文章卡片 */
.card-list { display: flex; flex-direction: column; gap: 14px; }

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: border-color .18s, box-shadow .18s, transform .18s;
}

.card:hover {
  border-color: #d7dde5;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.card-body { padding: 20px 22px; }

.card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12.5px;
  color: var(--ink-3);
  margin-bottom: 8px;
}

.card-meta .cat { color: var(--brand); font-weight: 600; }
.card-meta .dot { color: #cbd2db; }

.card-title {
  margin: 0 0 8px;
  font-size: 19px;
  line-height: 1.45;
  letter-spacing: -.015em;
}
.card-title a { transition: color .15s; }

.card-excerpt {
  margin: 0 0 14px;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.75;
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.tags { display: flex; flex-wrap: wrap; gap: 6px; }

.tags a {
  font-size: 12px;
  color: var(--ink-2);
  background: #f4f5f8;
  border-radius: 6px;
  padding: 2px 8px;
  transition: background .15s, color .15s;
}
.tags a:hover { background: var(--brand-soft); color: var(--brand); }

.read-more { font-size: 13px; color: var(--brand); font-weight: 600; white-space: nowrap; }
.read-more:hover { color: #1e3fbe; }

.badge-featured {
  position: absolute;
  top: -8px;
  right: 18px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  box-shadow: 0 3px 10px -3px rgba(245, 158, 11, .8);
}

/* ---------------------------------------------------------- 分页 */
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 32px;
  flex-wrap: wrap;
}

.pager a, .pager span {
  min-width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 11px;
  border-radius: 9px;
  font-size: 13.5px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink-2);
}

.pager a:hover { border-color: #c7d2fe; color: var(--brand); }
.pager .current { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 600; }
.pager .disabled { color: #c3c9d1; background: #fafbfc; }
.pager .total { border: 0; background: transparent; color: var(--ink-3); font-size: 12.5px; margin-left: 6px; }

/* ---------------------------------------------------------- 文章详情 */
.article-single {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 40px 46px 36px;
  box-shadow: var(--shadow-sm);
}

.breadcrumb { font-size: 12.5px; color: var(--ink-3); margin-bottom: 14px; display: flex; gap: 6px; }
.breadcrumb a:hover { color: var(--brand); }

.article-head h1 {
  margin: 0 0 14px;
  font-size: 30px;
  line-height: 1.35;
  letter-spacing: -.025em;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 12.5px;
  color: var(--ink-3);
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.article-summary {
  margin: 24px 0 4px;
  padding: 16px 18px;
  background: #f7f9ff;
  border-left: 3px solid var(--brand);
  border-radius: 0 10px 10px 0;
  color: var(--ink-2);
  font-size: 14.5px;
}

.article-content { padding-top: 8px; font-size: 16px; line-height: 1.9; color: #22262c; }
.article-content h2 { font-size: 20px; margin: 1.8em 0 .6em; letter-spacing: -.015em; }
.article-content h3 { font-size: 17px; margin: 1.6em 0 .5em; }
.article-content p { margin: 0 0 1.1em; }
.article-content ul, .article-content ol { padding-left: 1.4em; margin: 0 0 1.1em; }
.article-content li { margin-bottom: .35em; }
.article-content code {
  font-family: var(--mono);
  font-size: .87em;
  background: #f1f3f6;
  padding: 2px 6px;
  border-radius: 5px;
  color: #b4326b;
}
.article-content pre {
  background: #1b1e24;
  color: #e6e9ef;
  padding: 16px 18px;
  border-radius: 12px;
  overflow-x: auto;
  font-size: 13.5px;
  line-height: 1.65;
}
.article-content pre code { background: none; color: inherit; padding: 0; }
.article-content blockquote {
  margin: 1.2em 0;
  padding: 12px 18px;
  border-left: 3px solid #c7d2fe;
  background: #f9faff;
  color: var(--ink-2);
  border-radius: 0 8px 8px 0;
}
.article-content blockquote p:last-child { margin-bottom: 0; }
.article-content table { width: 100%; border-collapse: collapse; margin: 1.2em 0; font-size: 14px; }
.article-content th, .article-content td { border: 1px solid var(--line); padding: 9px 12px; text-align: left; }
.article-content th { background: #f7f8fa; font-weight: 600; }
.article-content a { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.article-content img { border-radius: 10px; margin: 1em 0; }

.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.article-tags a {
  font-size: 12.5px;
  padding: 4px 11px;
  border-radius: 999px;
  background: #f4f5f8;
  color: var(--ink-2);
}
.article-tags a:hover { background: var(--brand-soft); color: var(--brand); }

.neighbors {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 22px;
}

.neighbors a, .neighbors > span {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  transition: border-color .18s, background .18s;
}
.neighbors a:hover { border-color: #c7d2fe; background: #fbfcff; }
.neighbors small { font-size: 11.5px; color: var(--ink-3); }
.neighbors strong { font-size: 13.5px; font-weight: 600; line-height: 1.5; }
.neighbors .next { text-align: right; }
.neighbors .disabled { color: var(--ink-3); background: #fafbfc; }
.neighbors .disabled strong { font-weight: 400; color: var(--ink-3); }

.related { margin-top: 36px; }

/* ---------------------------------------------------------- 页面头 */
.page-head { margin-bottom: 24px; }
.page-head h1 { margin: 0 0 6px; font-size: 26px; letter-spacing: -.025em; }
.page-head p { margin: 0; font-size: 13.5px; }

/* ---------------------------------------------------------- 空状态 / 按钮 */
.empty {
  text-align: center;
  padding: 56px 24px;
  background: #fff;
  border: 1px dashed #d7dde5;
  border-radius: var(--radius);
  color: var(--ink-3);
}
.empty p { margin: 0 0 16px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 13.5px;
  color: var(--ink-2);
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
}
.btn:hover { border-color: #c7d2fe; color: var(--brand); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: #2549c9; border-color: #2549c9; color: #fff; }

/* ---------------------------------------------------------- 404 */
.notfound { text-align: center; padding: 70px 24px 90px; }
.notfound .code {
  font-size: 96px;
  font-weight: 800;
  letter-spacing: -.05em;
  line-height: 1;
  background: linear-gradient(140deg, #4d7cff, #a78bfa);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.notfound h1 { font-size: 22px; margin: 10px 0 8px; }
.notfound .actions { margin-top: 24px; display: flex; gap: 10px; justify-content: center; }

/* ---------------------------------------------------------- 关于页 */
.prose {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px 38px;
  font-size: 15px;
  line-height: 1.85;
}
.prose h2 { font-size: 18px; margin: 1.7em 0 .5em; }
.prose h2:first-child { margin-top: 0; }
.prose table { width: 100%; border-collapse: collapse; margin: 1em 0; font-size: 14px; }
.prose th, .prose td { border: 1px solid var(--line); padding: 9px 12px; text-align: left; }
.prose th { background: #f7f8fa; }
.prose code { font-family: var(--mono); background: #f1f3f6; padding: 1px 6px; border-radius: 4px; font-size: .9em; }

/* ---------------------------------------------------------- 页脚 */
.site-footer {
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 40px 0 34px;
}

.footer-inner {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 32px;
}

.footer-col h4 { margin: 0 0 10px; font-size: 13px; color: var(--ink); }
.footer-col p { margin: 0 0 6px; font-size: 12.5px; color: var(--ink-3); }
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { margin-bottom: 6px; font-size: 12.5px; }
.footer-col li a { color: var(--ink-3); }
.footer-col li a:hover { color: var(--brand); }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px 10px; }

/* ---------------------------------------------------------- 响应式 */
@media (max-width: 820px) {
  .header-inner { height: auto; padding-top: 14px; padding-bottom: 14px; flex-wrap: wrap; gap: 12px; }
  .search { order: 3; max-width: none; width: 100%; margin-left: 0; }
  .top-nav { margin-left: auto; }
  .brand-text small { display: none; }
  .article-single { padding: 26px 20px; }
  .article-head h1 { font-size: 23px; }
  .article-content { font-size: 15.5px; }
  .neighbors { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; gap: 22px; }
  .prose { padding: 22px 20px; }
  .card-body { padding: 16px 17px; }
  .card-title { font-size: 17px; }
}

/* ============================================================
   评论区 v1.1.0
   ============================================================ */

.alert {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  margin-bottom: 18px;
  border: 1px solid transparent;
}
.alert-success { background: #e7f6ee; border-color: #bfe5cf; color: #0b6b3d; }
.alert-error { background: #fdecea; border-color: #f6c7c3; color: #a3201a; }
.alert-error div + div { margin-top: 4px; }
.alert-info { background: #eef2ff; border-color: #c7d2fe; color: #23398f; }

.to-comments { color: var(--ink-3); }
.to-comments:hover { color: var(--brand); }

.comments {
  margin-top: 26px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px 34px 30px;
  box-shadow: var(--shadow-sm);
}

.comments-head { margin-bottom: 18px; }
.comments-head h2 {
  margin: 0;
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.comments-head .count {
  font-size: 12px;
  font-weight: 600;
  background: var(--brand-soft);
  color: var(--brand);
  border-radius: 999px;
  padding: 1px 9px;
}
.comments-head .notice {
  margin: 6px 0 0;
  font-size: 12.5px;
  color: var(--ink-3);
}

.comments-off,
.comments-empty {
  padding: 26px 0;
  text-align: center;
  color: var(--ink-3);
  font-size: 13.5px;
  border-top: 1px solid #f2f4f7;
}

/* ---------------------------------------------------------- 评论列表 */
.comment-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.comment {
  display: flex;
  gap: 12px;
  padding: 18px 0;
  border-top: 1px solid #f2f4f7;
}

.cm-avatar {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  user-select: none;
}
.cm-avatar.small { width: 30px; height: 30px; font-size: 12.5px; }

.cm-main { flex: 1; min-width: 0; }

.cm-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.cm-author { font-weight: 600; font-size: 13.5px; }
.cm-time { font-size: 11.5px; color: var(--ink-3); }
.cm-to { font-size: 11.5px; color: var(--brand); }

.cm-body {
  font-size: 14px;
  line-height: 1.8;
  color: #2c323a;
  word-break: break-word;
}
.cm-body a { color: var(--brand); text-decoration: underline; text-underline-offset: 2px; }

.cm-actions { margin-top: 6px; }

.reply-btn {
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 12px;
  font-family: inherit;
  color: var(--ink-3);
  cursor: pointer;
  transition: color .15s;
}
.reply-btn:hover { color: var(--brand); }

.comment-replies {
  list-style: none;
  margin: 14px 0 0;
  padding: 0 0 0 2px;
}
.comment-replies > li {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  background: #fafbfc;
  border-radius: 10px;
  margin-bottom: 8px;
}
.comment-replies > li:last-child { margin-bottom: 0; }

/* ---------------------------------------------------------- 评论表单 */
.comment-form-wrap {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.form-title { margin: 0 0 14px; font-size: 15px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.comment-form .field { display: block; margin-bottom: 14px; }
.comment-form .field > .label {
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 6px;
}
.comment-form .hint { font-weight: 400; color: var(--ink-3); font-size: 11.5px; }
.comment-form .req { color: #d93025; font-style: normal; }

.comment-form input[type=text],
.comment-form input[type=email],
.comment-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 12px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.comment-form textarea { resize: vertical; min-height: 110px; line-height: 1.75; }
.comment-form input:focus,
.comment-form textarea:focus {
  border-color: #a5b8f5;
  box-shadow: 0 0 0 3px rgba(47, 91, 234, .1);
}

.counter {
  display: block;
  text-align: right;
  font-size: 11.5px;
  color: var(--ink-3);
  margin-top: 4px;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.reply-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--brand-soft);
  border: 1px solid #c7d2fe;
  color: #23398f;
  font-size: 12.5px;
  padding: 7px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
}
.reply-hint button {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: var(--brand);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  text-decoration: underline;
}

@media (max-width: 820px) {
  .comments { padding: 20px 16px 22px; }
  .form-row { grid-template-columns: 1fr; gap: 0; }
  .cm-avatar { width: 32px; height: 32px; font-size: 13px; }
}
