/* ---------------------------------------------------------------------------
   Meowming 博客 — 浅色简洁，去 AI 化
   - 人类字号、行高、断字
   - 不依赖渐变/光晕/玻璃态
   - 中文为西文 1.05em / 东亚系 sans-serif
   - 主色调：墨黑 / 米白 / 砖红 (one accent color only)
---------------------------------------------------------------------------- */

:root {
  --fg: #1c1917;
  --fg-mute: #57534e;
  --fg-faint: #a8a29e;
  --bg: #fafaf9;
  --bg-card: #ffffff;
  --bg-soft: #f5f5f4;
  --border: #e7e5e4;
  --border-soft: #f0eeec;
  --accent: #b91c1c;
  --accent-soft: #fef2f2;
  --link: #1d4ed8;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC",
               sans-serif;
  --font-serif: Georgia, "Source Han Serif SC", "Noto Serif CJK SC",
                "Songti SC", "SimSun", serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", "Source Code Pro",
               Menlo, Consolas, "Courier New", monospace;
  --w-prose: 720px;
  --w-page: 880px;
  --radius: 4px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ----- Header / Nav ----- */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}
.nav-container {
  max-width: var(--w-page);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.nav-logo {
  font-size: 16px;
  font-weight: 600;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: 0.2px;
}
.nav-logo:hover { color: var(--accent); }
.nav-menu {
  display: flex;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  align-items: center;
}
.nav-menu a {
  display: inline-block;
  padding: 6px 12px;
  color: var(--fg-mute);
  text-decoration: none;
  font-size: 14px;
  border-radius: var(--radius);
}
.nav-menu a:hover {
  color: var(--fg);
  background: var(--bg-soft);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  padding: 6px 8px;
  margin-right: -8px;
}
.nav-toggle span {
  display: block;
  width: 20px;
  height: 1.5px;
  background: var(--fg);
}

/* ----- Main / Sections ----- */
.main-content {
  max-width: var(--w-page);
  margin: 0 auto;
  padding: 32px 24px 80px 24px;
}

/* ----- Hero ----- */
.hero {
  padding: 64px 0 56px 0;
  text-align: left;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 56px;
}
.hero-title {
  font-family: var(--font-serif);
  font-size: 38px;
  font-weight: 500;
  letter-spacing: -0.5px;
  line-height: 1.25;
  margin: 0 0 12px 0;
  color: var(--fg);
}
.hero-subtitle {
  font-size: 17px;
  color: var(--fg-mute);
  margin: 0;
  line-height: 1.6;
  max-width: 560px;
}

/* ----- Section title ----- */
.section-title {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 500;
  margin: 0 0 24px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  color: var(--fg);
}

/* ----- Posts grid ----- */
.posts-section { margin-bottom: 64px; }
.posts-grid { display: flex; flex-direction: column; gap: 0; }

/* ----- Filter bar (首页搜索 + 栏目导航) ----- */
.filter-bar {
  margin: 0 0 32px 0;
  padding: 0 0 24px 0;
  border-bottom: 1px solid var(--border-soft);
}
.filter-bar-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}
.filter-search {
  position: relative;
  flex: 1;
  max-width: 420px;
}
.filter-search-input {
  width: 100%;
  font: inherit;
  font-size: 14px;
  padding: 8px 12px 8px 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--fg);
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
  -webkit-appearance: none;
}
.filter-search-input::placeholder { color: var(--fg-faint); }
.filter-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
/* 去掉搜索框右侧的 X (Chrome) */
.filter-search-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  height: 14px;
  width: 14px;
  background: var(--fg-faint);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M19 6.4L17.6 5 12 10.6 6.4 5 5 6.4 10.6 12 5 17.6 6.4 19 12 13.4 17.6 19 19 17.6 13.4 12z'/></svg>") no-repeat center;
  cursor: pointer;
}
.filter-search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--fg-faint);
  font-size: 15px;
  pointer-events: none;
}
.filter-result-count {
  font-size: 12.5px;
  color: var(--fg-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.filter-result-count.has-result { color: var(--fg-mute); }
.filter-result-count.zero-result { color: var(--accent); }

/* ----- Category nav (栏目筛选 chips) ----- */
.category-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.category-pill {
  font: inherit;
  font-size: 13px;
  color: var(--fg-mute);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 120ms ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1.4;
  white-space: nowrap;
}
.category-pill:hover {
  color: var(--fg);
  border-color: var(--fg-faint);
  background: var(--bg-soft);
}
.category-pill.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}
.category-pill.active .cat-count {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}
.category-pill-child {
  margin-left: 18px;
  font-size: 12.5px;
  color: var(--fg-mute);
}
.category-pill-child:hover { background: var(--bg-soft); }
.category-pill-orphan {
  border-style: dashed;
  color: var(--fg-faint);
}
.cat-count {
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  background: var(--bg-soft);
  color: var(--fg-faint);
  padding: 0 6px;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
}

/* ----- Cards 筛选态 (隐藏非匹配) ----- */
.post-card.is-hidden { display: none; }
.posts-empty {
  padding: 48px 0;
  text-align: center;
  color: var(--fg-faint);
  font-size: 15px;
}
.posts-empty p { margin: 0; }

/* ----- Card 高亮 (搜索时匹配词高亮) ----- */
.post-card mark.search-hit {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 0 1px;
  border-radius: 2px;
}

.post-card {
  border-bottom: 1px solid var(--border-soft);
  padding: 20px 0 22px 0;
}
.post-card:last-child { border-bottom: none; }
.post-card-link {
  display: block;
  text-decoration: none;
  color: inherit;
}
.post-card-link:hover .post-card-title { color: var(--accent); }
.post-card-title {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 500;
  margin: 0 0 6px 0;
  color: var(--fg);
  line-height: 1.4;
  transition: color 120ms ease;
}
.post-card-summary {
  font-size: 14.5px;
  color: var(--fg-mute);
  margin: 0 0 10px 0;
  line-height: 1.6;
}
.post-card-meta {
  font-size: 12.5px;
  color: var(--fg-faint);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.meta-sep { color: var(--border); }
.post-card-tags { display: inline-flex; gap: 6px; margin-left: 4px; }
.post-card-tags .tag {
  color: var(--fg-mute);
  font-size: 12px;
  padding: 1px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
}

/* ----- About ----- */
.about-section { margin-bottom: 0; }
.about-card {
  font-size: 15px;
  line-height: 1.75;
  color: var(--fg-mute);
}
.about-card p { margin: 0 0 14px 0; }

/* ----- Post detail ----- */
.post-detail {
  max-width: var(--w-prose);
  margin: 0 auto;
}
.post-header { margin-bottom: 36px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.post-title {
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.3px;
  margin: 0 0 14px 0;
  color: var(--fg);
}
.post-meta {
  font-size: 13px;
  color: var(--fg-faint);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.post-content {
  font-size: 17px;
  line-height: 1.85;
  color: var(--fg);
}
.post-content > * { margin: 0 0 20px 0; }
.post-content > :first-child { margin-top: 0; }
.post-content > :last-child { margin-bottom: 0; }

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4 {
  font-family: var(--font-serif);
  font-weight: 500;
  letter-spacing: -0.2px;
  line-height: 1.4;
  color: var(--fg);
}
.post-content h2 {
  font-size: 23px;
  margin: 40px 0 16px 0;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-soft);
}
.post-content h3 { font-size: 19px; margin: 32px 0 12px 0; }
.post-content h4 { font-size: 17px; margin: 24px 0 10px 0; }

.post-content p { margin: 0 0 18px 0; }

.post-content ul,
.post-content ol {
  margin: 0 0 20px 0;
  padding-left: 22px;
}
.post-content li { margin-bottom: 6px; }

.post-content blockquote {
  margin: 24px 0;
  padding: 4px 0 4px 16px;
  border-left: 3px solid var(--accent);
  color: var(--fg-mute);
  font-style: normal;
}
.post-content blockquote p { margin-bottom: 8px; }
.post-content blockquote p:last-child { margin-bottom: 0; }

.post-content code {
  font-family: var(--font-mono);
  font-size: 14.5px;
  padding: 1px 6px;
  background: var(--bg-soft);
  border-radius: 3px;
  color: #b91c1c;
}
.post-content pre {
  margin: 20px 0;
  padding: 14px 16px;
  background: #1c1917;
  color: #e7e5e4;
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: 13.5px;
  line-height: 1.65;
}
.post-content pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  font-size: inherit;
}

.post-content a {
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.post-content a:hover { border-bottom-color: var(--link); }

.post-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 32px 0;
}

.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 14.5px;
}
.post-content th,
.post-content td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.post-content th {
  font-weight: 600;
  background: var(--bg-soft);
}
.post-content strong { font-weight: 600; color: var(--fg); }
.post-content em { font-style: italic; }

.post-footer {
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.back-link {
  color: var(--fg-mute);
  text-decoration: none;
  font-size: 14px;
}
.back-link:hover { color: var(--accent); }

/* ----- Tag cloud (标签筛选) ----- */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 0 16px 0;
  margin: 0 0 28px 0;
  border-bottom: 1px solid var(--border-soft);
}
.tag-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 4px 12px;
  font-size: 13px;
  color: var(--fg-mute);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  text-decoration: none;
  transition: all 120ms ease;
  line-height: 1.4;
}
.tag-pill:hover {
  background: var(--bg-card);
  border-color: var(--fg-mute);
  color: var(--fg);
}
.tag-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}
.tag-pill-count {
  font-size: 11px;
  color: var(--fg-faint);
  font-weight: 500;
}
.tag-pill.active .tag-pill-count {
  color: rgba(255, 255, 255, 0.85);
}

/* 让 post-card 内的 tag 也是可点 link */
.post-card-tags a.tag {
  color: var(--fg-mute);
  font-size: 12px;
  padding: 1px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  text-decoration: none;
  transition: all 120ms ease;
}
.post-card-tags a.tag:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* tag 子页面 */
.tag-page {
  margin-bottom: 40px;
}
.section-title .tag-count {
  font-size: 13px;
  color: var(--fg-faint);
  font-weight: 400;
  margin-left: 8px;
}

/* ----- Footer ----- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}
.site-footer p {
  max-width: var(--w-page);
  margin: 0 auto;
  padding: 24px;
  text-align: center;
  font-size: 13px;
  color: var(--fg-faint);
}

/* ----- Mobile ----- */
@media (max-width: 720px) {
  .nav-container { padding: 12px 16px; }
  .main-content { padding: 24px 16px 60px 16px; }
  .hero { padding: 36px 0 32px 0; margin-bottom: 36px; }
  .hero-title { font-size: 28px; }
  .hero-subtitle { font-size: 15.5px; }
  .post-title { font-size: 26px; }
  .post-content { font-size: 16px; line-height: 1.8; }

  .nav-toggle { display: flex; }
  .nav-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    flex-direction: column;
    padding: 6px;
    align-items: stretch;
    gap: 0;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
    z-index: 10;
  }
  .nav-menu.active { display: flex; }
  .nav-menu a { padding: 8px 14px; border-radius: 0; }
  .nav-container { position: relative; }
}

/* ----- Print ----- */
@media print {
  .site-header, .site-footer, .nav-toggle, .post-footer { display: none; }
  body { font-size: 12pt; color: #000; background: #fff; }
  .post-content a { color: #000; text-decoration: underline; }
}
