/* 知见 — 全站样式 */

/* ============ 变量 ============ */
:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --faint: #94a3b8;
  --accent: #4f46e5;
  --accent-dark: #4338ca;
  --accent-soft: rgba(79, 70, 229, 0.06);
  --border: #e2e8f0;
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "PingFang SC", "Microsoft YaHei",
          "Segoe UI", "Helvetica Neue", sans-serif;
}

/* ============ 基础 ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.container { max-width: 1280px; margin: 0 auto; padding: 0 24px; }

/* ============ 导航 ============ */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border-bottom: 1px solid var(--border);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 62px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: -0.3px; }
.logo-mark {
  width: 26px; height: 26px; border-radius: 6px;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800;
}
.nav-links { display: flex; align-items: center; gap: 28px; font-size: 14px; color: var(--muted); font-weight: 500; }
.nav-links a { transition: color .2s; }
.nav-links a:hover { color: var(--accent); }
.nav-links a.active { color: var(--accent); font-weight: 600; }
.menu-btn {
  display: none; flex-direction: column; justify-content: center; gap: 4px;
  width: 40px; height: 40px; padding: 9px;
  background: transparent; border: none; cursor: pointer;
}
.menu-btn span {
  display: block; width: 22px; height: 2px;
  background: var(--text); border-radius: 2px;
  transition: transform .25s, opacity .25s;
}
.menu-btn.active span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.menu-btn.active span:nth-child(2) { opacity: 0; }
.menu-btn.active span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
.mobile-menu {
  display: none; flex-direction: column;
  padding: 4px 24px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.mobile-menu a {
  padding: 13px 0; font-size: 15px; color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.mobile-menu a:last-child { border-bottom: none; }
.mobile-menu a:hover { color: var(--accent); }
.mobile-menu a.active { color: var(--accent); font-weight: 600; }

/* ============ 主体布局 ============ */
.layout { display: grid; grid-template-columns: 1fr 300px; gap: 44px; padding: 48px 0 88px; }
.main-col { min-width: 0; }
.sidebar { min-width: 0; }
.widget {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px; padding: 22px; margin-bottom: 18px;
}
.widget h4 { font-size: 12px; font-weight: 600; letter-spacing: 1px; color: var(--faint); text-transform: uppercase; margin-bottom: 15px; }
.widget.about p { font-size: 14px; color: var(--muted); line-height: 1.8; }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-family: var(--sans); font-size: 14px; font-weight: 600;
  padding: 10px 22px; border-radius: 8px; cursor: pointer;
  border: 1px solid transparent; background: transparent; color: var(--text);
  text-decoration: none;
  transition: transform .15s, box-shadow .2s, background .2s, border-color .2s, color .2s;
}
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 4px 14px rgba(79, 70, 229, 0.25); }
.btn-primary:hover { background: var(--accent-dark); transform: translateY(-1px); }
.btn-ghost { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--accent); border-color: var(--accent); }
.btn-link { background: none; border: none; color: var(--faint); cursor: pointer; }
.btn-link:hover { color: var(--accent); }

/* ============ 标签 ============ */
.tags, .side-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  font-size: 12px; color: var(--muted);
  background: var(--bg); border: 1px solid var(--border);
  padding: 4px 12px; border-radius: 6px; transition: all .2s;
}
a.tag:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

/* ============ 页脚 ============ */
.footer { border-top: 1px solid var(--border); padding: 34px 0; }
.footer-inner {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--faint);
}
.footer-inner--center { justify-content: center; }
.footer-links { display: flex; gap: 20px; }
.footer-links a:hover { color: var(--accent); }

/* ============ 首页 ============ */
.featured {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 34px;
  transition: box-shadow .25s, transform .25s, border-color .25s;
}
.featured:hover { box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08); transform: translateY(-2px); border-color: #cbd5e1; }
.featured .thumb { display: block; width: 100%; height: auto; aspect-ratio: 2 / 1; object-fit: cover; }
.featured-body { padding: 26px 30px 28px; }
.kicker { display: inline-flex; font-size: 12px; font-weight: 600; letter-spacing: 0.5px; color: var(--accent); background: var(--accent-soft); padding: 3px 10px; border-radius: 5px; margin-bottom: 14px; }
.featured h2 { font-size: 24px; font-weight: 700; letter-spacing: -0.5px; line-height: 1.4; margin-bottom: 12px; }
.featured p { color: var(--muted); font-size: 15px; }
.featured .meta { margin-top: 18px; font-size: 13px; color: var(--faint); }

.list-head { font-size: 12px; font-weight: 600; letter-spacing: 1px; color: var(--faint); text-transform: uppercase; margin-bottom: 6px; }
.post-item {
  display: flex; align-items: center; gap: 22px;
  padding: 22px 0; border-bottom: 1px solid var(--border);
}
.post-item:last-child { border-bottom: none; }
.post-item .post-content { flex: 1; min-width: 0; }
.post-item h3 { font-size: 18px; font-weight: 700; letter-spacing: -0.3px; line-height: 1.5; transition: color .2s; margin-bottom: 6px; }
.post-item:hover h3 { color: var(--accent); }
.post-item p { color: var(--muted); font-size: 14px; }
.post-item .meta { margin-top: 10px; font-size: 13px; color: var(--faint); }
.post-item .thumb {
  flex: 0 0 260px; width: 260px; height: auto; aspect-ratio: 2 / 1;
  object-fit: cover; border-radius: 8px; border: 1px solid var(--border);
}
.meta .sep { margin: 0 8px; color: var(--border); }
.cat-list { list-style: none; }
.cat-list li { display: flex; justify-content: space-between; padding: 8px 0; font-size: 14px; color: var(--muted); }
.cat-list li a { transition: color .2s; }
.cat-list li a:hover { color: var(--accent); }
.cat-list li .count { color: var(--faint); font-size: 13px; font-variant-numeric: tabular-nums; }

/* ============ 文章详情 ============ */
.article-head { padding-bottom: 24px; }
.breadcrumb { font-size: 13px; color: var(--faint); margin-bottom: 18px; }
.breadcrumb a:hover { color: var(--accent); }
.article-head h1 { font-size: 32px; font-weight: 800; letter-spacing: -0.8px; line-height: 1.35; margin-bottom: 16px; }
.article-meta { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 13px; color: var(--faint); }
.article-meta .cat { color: var(--accent); font-weight: 600; }

.article-body { padding: 8px 0 36px; font-size: 16px; color: #334155; line-height: 1.9; }
.article-body p { margin-bottom: 22px; }
.article-body strong { color: var(--text); }
.article-body h2 { font-size: 21px; font-weight: 700; letter-spacing: -0.4px; color: var(--text); margin: 40px 0 14px; }
.article-body ul { margin: 0 0 22px; padding-left: 22px; }
.article-body li { margin-bottom: 10px; }
.article-body blockquote {
  margin: 28px 0; padding: 16px 22px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  color: #475569; font-size: 15px; border-radius: 0 8px 8px 0;
}
.article-body .cover {
  margin: 4px 0 28px; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--border);
  aspect-ratio: 16 / 8;
  background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 50%, #a5b4fc 100%);
  display: flex; align-items: center; justify-content: center;
  color: #3730a3; font-weight: 600; font-size: 14px; letter-spacing: 1px;
}
.article-end { padding: 20px 0 0; }
.article-end .tags { margin-bottom: 32px; }
.prev-next {
  display: flex; justify-content: space-between; gap: 20px;
  border-top: 1px solid var(--border); padding-top: 22px;
  font-size: 14px; color: var(--muted);
}
.prev-next a { transition: color .2s; }
.prev-next a:hover { color: var(--accent); }
.related-list { list-style: none; }
.related-list li { padding: 9px 0; border-bottom: 1px solid var(--border); }
.related-list li:last-child { border-bottom: none; }
.related-list a { font-size: 14px; color: var(--muted); line-height: 1.5; transition: color .2s; display: block; }
.related-list a:hover { color: var(--accent); }

/* ============ 书籍 ============ */
.books { padding: 48px 0 96px; }
.book {
  display: grid; grid-template-columns: 220px 1fr; gap: 36px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 32px;
  margin-bottom: 28px;
  transition: box-shadow .25s, border-color .25s;
}
.book:hover { box-shadow: 0 12px 36px rgba(15, 23, 42, 0.08); border-color: #cbd5e1; }
.book-cover {
  aspect-ratio: 3 / 4.2;
  border-radius: 8px;
  background: linear-gradient(160deg, #4f46e5 0%, #4338ca 60%, #312e81 100%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 20px; color: #fff;
  box-shadow: 0 10px 30px rgba(79, 70, 229, 0.28);
}
.book-cover .c-title { font-size: 22px; font-weight: 800; letter-spacing: 2px; line-height: 1.4; }
.book-cover .c-author { margin-top: 16px; font-size: 12px; opacity: 0.85; letter-spacing: 1px; }
.book-info { display: flex; flex-direction: column; }
.book-info h2 { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; margin-bottom: 8px; }
.book-info .subtitle { color: var(--accent); font-weight: 600; font-size: 15px; margin-bottom: 16px; }
.book-info .desc { color: var(--muted); font-size: 15px; margin-bottom: 20px; }
.book-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.book-actions { display: flex; gap: 12px; margin-top: auto; }
.book.placeholder { grid-template-columns: 1fr; text-align: center; border-style: dashed; padding: 48px 32px; }
.book.placeholder .p-title { font-size: 20px; font-weight: 700; color: var(--muted); }
.book.placeholder .p-sub { margin-top: 8px; font-size: 14px; color: var(--faint); }

/* ============ 产品 ============ */
.products { padding: 48px 0 96px; }
.product-item {
  display: flex; gap: 26px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  margin-bottom: 20px;
  transition: box-shadow .25s, border-color .25s;
}
.product-item:hover { box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08); border-color: #cbd5e1; }
.p-logo {
  width: 64px; height: 64px; border-radius: 14px;
  background: linear-gradient(160deg, #4f46e5 0%, #4338ca 100%);
  color: #fff; font-size: 28px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 8px 22px rgba(79, 70, 229, 0.25);
}
.product-info { flex: 1; min-width: 0; }
.product-title { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.product-title h2 { font-size: 22px; font-weight: 800; letter-spacing: -0.5px; }
.product-title .tagline { color: var(--accent); font-weight: 600; font-size: 14px; }
.product-info .desc { color: var(--muted); font-size: 14px; margin: 12px 0 16px; }
.product-info .tags { margin-bottom: 20px; }
.product-actions { display: flex; gap: 12px; }

/* ============ 发布页 ============ */
.editor-wrap { padding: 48px 0 88px; }
.editor {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 32px;
}
.editor-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 26px; }
.editor-head h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.4px; }
.editor-head .status { font-size: 13px; color: var(--faint); }

.field { margin-bottom: 24px; }
.field > label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.field .req { color: #ef4444; margin-left: 2px; }
.field .hint { font-size: 12px; color: var(--faint); margin-top: 6px; }

.input, .select {
  width: 100%; font-family: var(--sans); font-size: 15px; color: var(--text);
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  height: 44px; padding: 0 14px; line-height: 42px;
  transition: border-color .2s, box-shadow .2s;
}
.textarea {
  width: 100%; font-family: var(--sans); font-size: 15px; color: var(--text);
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 14px; line-height: 1.8; resize: vertical;
  transition: border-color .2s, box-shadow .2s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.field-title .input { font-size: 20px; font-weight: 600; }

.field-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.field-head label { font-size: 13px; font-weight: 600; color: var(--muted); }
.fullscreen-btn {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--sans); font-size: 12px; color: var(--muted);
  background: none; border: 1px solid var(--border); border-radius: 6px;
  padding: 4px 10px; cursor: pointer; transition: all .2s;
}
.fullscreen-btn:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.field-body.fullscreen {
  position: fixed; inset: 0; z-index: 1000;
  background: var(--surface); margin: 0;
  padding: 20px 24px; display: flex; flex-direction: column;
}
.field-body.fullscreen .field-head { margin-bottom: 12px; }
.field-body.fullscreen .textarea { flex: 1; resize: none; font-size: 17px; }

.meta-grid { display: grid; grid-template-columns: 1fr 420px; gap: 24px; align-items: start; }
.tag-input-wrap {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  min-height: 44px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px;
  transition: border-color .2s, box-shadow .2s;
}
.tag-input-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tag-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 13px; padding: 3px 10px; border-radius: 6px;
}
.tag-chip button { border: none; background: none; color: var(--accent); cursor: pointer; font-size: 15px; line-height: 1; padding: 0; }
.tag-chip button:hover { opacity: .7; }
.tag-input-wrap input {
  border: none; outline: none; flex: 1; min-width: 140px;
  font-size: 14px; font-family: var(--sans); color: var(--text);
  padding: 0; line-height: 26px;
}

.thumb-drop {
  position: relative; display: block; cursor: pointer;
  max-width: 420px; aspect-ratio: 2 / 1;
  border: 2px dashed var(--border); border-radius: 10px; overflow: hidden;
  background: var(--bg);
  transition: border-color .2s, background .2s;
}
.thumb-drop:hover { border-color: var(--accent); background: var(--accent-soft); }
.thumb-drop-body {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px;
  color: var(--faint); text-align: center; padding: 12px;
}
.thumb-drop-body .icon { font-size: 30px; line-height: 1; }
.thumb-drop-body .main { font-size: 14px; color: var(--muted); font-weight: 500; }
.thumb-drop-body .sub { font-size: 12px; }
.thumb-drop img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.actions { display: flex; align-items: center; gap: 12px; padding-top: 6px; }

.toast {
  position: fixed; left: 50%; bottom: 32px; z-index: 100;
  transform: translateX(-50%) translateY(20px);
  background: var(--text); color: #fff;
  padding: 12px 20px; border-radius: 8px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .3s, transform .3s;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.3);
  max-width: calc(100vw - 48px); text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============ 登录 / 后台 ============ */
.login-wrap { max-width: 400px; margin: 80px auto; padding: 0 24px; }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 32px; }
.login-card h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.4px; }
.login-card .sub { color: var(--muted); font-size: 14px; margin: 8px 0 24px; }

.admin-wrap { padding: 48px 0 88px; }
.admin-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.admin-head h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.5px; }
.admin-list { list-style: none; }
.admin-item { display: flex; align-items: center; justify-content: space-between; gap: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px 20px; margin-bottom: 12px; }
.admin-info { min-width: 0; }
.a-title { font-weight: 600; font-size: 16px; margin-bottom: 4px; }
.a-title a:hover { color: var(--accent); }
.a-meta { color: var(--faint); font-size: 13px; }
.admin-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.btn-danger { background: #fff; color: #dc2626; border: 1px solid #fecaca; }
.btn-danger:hover { background: #fef2f2; border-color: #dc2626; color: #dc2626; }

/* ============ 标签页 ============ */
.tag-head { margin-bottom: 20px; }
.tag-head h1 { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; margin-bottom: 4px; }
.tag-head p { color: var(--faint); font-size: 14px; }
.article-meta .cat:hover { text-decoration: underline; }

/* ============ 动态内容 ============ */
.thumb-ph { background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%); }
.article-cover { display: block; width: 100%; aspect-ratio: 2 / 1; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); margin: 4px 0 28px; }
.article-content { font-size: 16px; line-height: 1.9; color: #334155; }

/* Markdown 正文元素 */
.article-content h1, .article-content h2, .article-content h3,
.article-content h4, .article-content h5, .article-content h6 {
  color: var(--text); font-weight: 700; line-height: 1.4;
  margin: 34px 0 14px; letter-spacing: -0.4px;
}
.article-content h1 { font-size: 26px; }
.article-content h2 { font-size: 22px; }
.article-content h3 { font-size: 19px; }
.article-content h4, .article-content h5, .article-content h6 { font-size: 17px; }
.article-content p { margin-bottom: 20px; }
.article-content strong { color: var(--text); }
.article-content a { color: var(--accent); text-decoration: underline; }
.article-content a:hover { color: var(--accent-dark); }
.article-content ul, .article-content ol { margin: 0 0 20px; padding-left: 24px; }
.article-content li { margin-bottom: 8px; }
.article-content blockquote {
  margin: 24px 0; padding: 14px 20px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft); color: #475569; border-radius: 0 8px 8px 0;
}
.article-content code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.9em; background: var(--bg); border: 1px solid var(--border);
  padding: 2px 6px; border-radius: 4px;
}
.article-content pre {
  background: #0f172a; color: #e2e8f0; padding: 16px 18px; border-radius: 8px;
  overflow-x: auto; margin: 0 0 20px; font-size: 14px; line-height: 1.6;
}
.article-content pre code { background: none; border: none; padding: 0; font-size: inherit; color: inherit; }
.article-content img { max-width: 100%; border-radius: 8px; margin: 8px 0 20px; display: block; }
.article-content hr { border: none; border-top: 1px solid var(--border); margin: 32px 0; }
.article-content table { width: 100%; border-collapse: collapse; margin: 0 0 20px; font-size: 15px; }
.article-content th, .article-content td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.article-content th { background: var(--bg); font-weight: 600; }
.form-error { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; padding: 12px 16px; border-radius: 8px; font-size: 14px; margin-bottom: 24px; }
.empty { text-align: center; padding: 60px 0; color: var(--muted); }
.empty h2 { font-size: 22px; margin-bottom: 8px; color: var(--text); }
.empty p { margin-bottom: 24px; }

/* ============ 分页 ============ */
.pagination { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 24px 0 8px; }
.page-link { font-size: 14px; color: var(--muted); border: 1px solid var(--border); border-radius: 6px; padding: 6px 13px; transition: all .2s; }
.page-link:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.page-current { font-size: 14px; color: #fff; background: var(--accent); border: 1px solid var(--accent); border-radius: 6px; padding: 6px 13px; font-weight: 600; }

/* ============ 响应式 ============ */
@media (max-width: 820px) {
  .nav-links { display: none; }
  .menu-btn { display: flex; }
  .mobile-menu.open { display: flex; }
  .layout { grid-template-columns: 1fr; }
  .sidebar { order: 2; }
  .article-head h1 { font-size: 27px; }
  .post-item .thumb { flex: 0 0 200px; width: 200px; }
  .book { grid-template-columns: 1fr; }
  .book-cover { max-width: 200px; }
  .product-item { flex-direction: column; }
  .meta-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .post-item { flex-direction: column; align-items: stretch; gap: 14px; }
  .post-item .thumb { flex: none; width: 100%; aspect-ratio: 2 / 1; }
}
