/* =========================================================
   文颜楼 · 文章站点样式
   设计语言复刻自 wenyanlou.com（一平方）视觉体系：
   - 浅蓝灰背景 #f2f6fb / 白卡片
   - 海军蓝主色 #0e344c → #1c6c9a 渐变
   - 大圆角卡片(1.5rem) + 柔和阴影
   - 胶囊搜索框 / 圆形分页 / 毛玻璃吸顶导航 / 深色页脚
   ========================================================= */

:root {
  --bg: #f2f6fb;
  --surface: #ffffff;
  --primary: #1a6d9b;
  --primary-dark: #0e344c;
  --primary-soft: #e3edf6;
  --grad: linear-gradient(130deg, #134b6b, #1c6c9a);
  --text: #132e44;
  --muted: #6e8faa;
  --muted-2: #819eb3;
  --border: #eaf0f6;
  --shadow-sm: 0 6px 14px rgba(0, 0, 0, 0.02), 0 0 0 1px rgba(0, 0, 0, 0.02);
  --shadow-card: 0 8px 16px -10px rgba(0, 0, 0, 0.05);
  --shadow-hover: 0 18px 38px -16px rgba(20, 60, 90, 0.22);
  --radius-card: 1.5rem;
  --radius-pill: 60px;
  --footer-bg: #0f1a2c;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica,
    'PingFang SC', 'Noto Sans SC', 'Microsoft YaHei', sans-serif;
  --serif: 'Noto Serif SC', 'Songti SC', 'STSong', Georgia, serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  font-family: var(--font);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

img {
  max-width: 100%;
  display: block;
}

.app {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* ============ 顶部导航 ============ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(242, 246, 251, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(234, 240, 246, 0.7);
  padding-bottom: 0.4rem;
}

.site-header .app {
  padding-top: 1rem;
  padding-bottom: 0.6rem;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.logo-icon {
  font-size: 1.7rem;
  line-height: 1;
}

.logo-text {
  font-size: 1.5rem;
  font-weight: 750;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -0.3px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 1.4rem;
}

.nav a {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--muted);
  transition: color 0.2s;
}

.nav a:hover,
.nav a.active {
  color: var(--primary);
}

/* 胶囊搜索框（复刻原站） */
.search-wrapper {
  background: var(--surface);
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  padding: 0.25rem 0.25rem 0.25rem 1.2rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
  margin: 0.2rem 0 0.3rem;
}

.search-wrapper:focus-within {
  box-shadow: 0 12px 22px -10px rgba(0, 0, 0, 0.08),
    0 0 0 2px rgba(28, 108, 154, 0.3);
}

.search-icon {
  font-size: 1.1rem;
  color: var(--muted-2);
  margin-right: 0.6rem;
}

.search-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 0.95rem;
  padding: 0.7rem 0;
  background: transparent;
  font-weight: 500;
  color: var(--text);
  font-family: var(--font);
}

.search-input::placeholder {
  color: #b8cfdf;
  font-weight: 400;
}

.clear-search {
  background: #eef3f9;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 40px;
  font-size: 1rem;
  color: #5c819f;
  cursor: pointer;
  transition: 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.clear-search:hover {
  background: #e0e9f2;
}

/* 分类筛选 chips */
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.3rem;
}

.chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.4rem 1rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.18s;
}

.chip:hover {
  color: var(--primary);
  border-color: rgba(28, 108, 154, 0.35);
}

.chip.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ============ 区块标题 ============ */
.section-head {
  padding: 1.6rem 0 1rem;
}

.section-head h1 {
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--primary-dark);
  letter-spacing: -0.5px;
}

.section-head .muted {
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 0.35rem;
}

.count-pill {
  display: inline-block;
  margin-top: 0.9rem;
  background: var(--primary-soft);
  padding: 0.3rem 1.1rem;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 600;
  color: #1e5f86;
}

.count-pill span {
  font-size: 1rem;
  font-weight: 800;
  color: #0b567c;
}

/* ============ 文章卡片网格 ============ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  padding-bottom: 1rem;
}

@media (min-width: 720px) {
  .card-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1024px) {
  .card-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1400px) {
  .card-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.post-card {
  background: var(--surface);
  border-radius: var(--radius-card);
  overflow: hidden;
  transition: all 0.28s ease;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

.post-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.card-cover {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--g, var(--grad));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.card-cover .cover-emoji {
  font-size: 2.6rem;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.18));
}

.card-cover .cover-cat {
  position: absolute;
  top: 0.7rem;
  left: 0.7rem;
  background: rgba(255, 255, 255, 0.9);
  color: var(--primary-dark);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.18rem 0.7rem;
  border-radius: var(--radius-pill);
}

.card-body {
  padding: 0.9rem 0.95rem 1.05rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.post-title {
  font-size: 1.05rem;
  font-weight: 750;
  color: var(--primary-dark);
  line-height: 1.35;
  margin-bottom: 0.45rem;
}

.post-title a:hover {
  color: var(--primary);
}

.post-excerpt {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 0.85rem;
  flex: 1;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.74rem;
  color: var(--muted-2);
}

.post-meta .avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--grad);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.post-meta .author {
  font-weight: 600;
  color: #4a6c86;
}

.post-meta .dot {
  opacity: 0.6;
}

.empty-placeholder {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1rem;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 2rem;
  color: var(--muted);
}

/* ============ 分页（圆形，复刻原站） ============ */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin: 2rem 0;
  flex-wrap: wrap;
}

.page-item {
  min-width: 34px;
  height: 34px;
  padding: 0 0.4rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid var(--border);
  color: #2d607f;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
}

.page-item:hover {
  border-color: rgba(28, 108, 154, 0.4);
  color: var(--primary);
}

.page-item.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.page-item.disabled {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

.page-item.ellipsis {
  cursor: default;
  border-color: transparent;
  background: transparent;
}

/* ============ 页脚 ============ */
.site-footer {
  background: var(--footer-bg);
  color: #b0c4de;
  text-align: center;
  padding: 32px 1rem;
  font-size: 13px;
  margin-top: 2rem;
  line-height: 1.8;
}

.site-footer a {
  color: #8fa6c4;
}

.site-footer .footer-sub {
  margin-top: 6px;
  font-size: 12px;
  color: #7d92b0;
}

/* =========================================================
   文章内容页
   ========================================================= */
.article-page {
  padding-top: 1.4rem;
  padding-bottom: 2rem;
}

.breadcrumb {
  font-size: 0.82rem;
  color: var(--muted-2);
  margin-bottom: 1.2rem;
}

.breadcrumb a:hover {
  color: var(--primary);
}

.breadcrumb .sep {
  margin: 0 0.4rem;
  opacity: 0.6;
}

.article-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.6rem;
}

@media (min-width: 1024px) {
  .article-layout {
    grid-template-columns: minmax(0, 1fr) 300px;
    align-items: start;
  }
}

.article-main {
  background: var(--surface);
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  padding: 2rem 1.6rem 2.4rem;
}

@media (min-width: 720px) {
  .article-main {
    padding: 2.6rem 2.6rem 3rem;
  }
}

.article-cat {
  display: inline-block;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.85rem;
  border-radius: var(--radius-pill);
  margin-bottom: 0.9rem;
}

.article-title {
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--primary-dark);
  line-height: 1.3;
  letter-spacing: -0.3px;
}

@media (min-width: 720px) {
  .article-title {
    font-size: 2.3rem;
  }
}

.article-sub {
  color: var(--muted);
  font-size: 1rem;
  margin-top: 0.7rem;
  line-height: 1.6;
}

.article-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 1.3rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--muted-2);
}

.article-meta .avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--grad);
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}

.article-meta .author {
  font-weight: 700;
  color: #3c5d77;
}

.article-meta .dot {
  opacity: 0.55;
}

.article-cover {
  margin: 1.6rem 0;
  aspect-ratio: 21 / 9;
  border-radius: 1.2rem;
  background: var(--g, var(--grad));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.4rem;
  box-shadow: var(--shadow-card);
}

/* 正文排版 */
.article-content {
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.95;
  color: #1c3245;
  margin-top: 0.5rem;
}

.article-content h2 {
  font-family: var(--font);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--primary-dark);
  margin: 2.2rem 0 1rem;
  padding-left: 0.85rem;
  border-left: 4px solid var(--primary);
}

.article-content h3 {
  font-family: var(--font);
  font-size: 1.15rem;
  font-weight: 750;
  color: var(--primary-dark);
  margin: 1.6rem 0 0.7rem;
}

.article-content p {
  margin: 1rem 0;
}

.article-content a.inline-link {
  color: var(--primary);
  border-bottom: 1px solid rgba(26, 109, 155, 0.4);
}

.article-content strong {
  color: var(--primary-dark);
  font-weight: 700;
}

.article-content ul,
.article-content ol {
  margin: 1rem 0;
  padding-left: 1.4rem;
}

.article-content li {
  margin: 0.5rem 0;
}

.article-content blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.3rem;
  background: var(--primary-soft);
  border-left: 4px solid var(--primary);
  border-radius: 0 0.8rem 0.8rem 0;
  color: #2c4d68;
  font-style: italic;
}

.article-content code {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
  background: #eef3f9;
  color: #b3483f;
  padding: 0.12rem 0.45rem;
  border-radius: 6px;
  font-size: 0.92em;
}

.article-content pre {
  background: #0f1f33;
  color: #d6e6f5;
  padding: 1.2rem 1.3rem;
  border-radius: 0.9rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  font-size: 0.9rem;
  line-height: 1.7;
}

.article-content pre code {
  background: transparent;
  color: inherit;
  padding: 0;
}

.article-content img {
  width: 100%;
  border-radius: 1rem;
  margin: 1.5rem 0;
  box-shadow: var(--shadow-card);
}

.article-content .figure-note {
  text-align: center;
  font-size: 0.82rem;
  color: var(--muted);
  font-family: var(--font);
  margin-top: -1rem;
  margin-bottom: 1.5rem;
}

/* 标签 + 分享 */
.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 2.2rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--border);
}

.tag {
  background: var(--primary-soft);
  color: #1e5f86;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.35rem 0.9rem;
  border-radius: var(--radius-pill);
}

/* 作者卡片 */
.author-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1.8rem;
  padding: 1.3rem;
  background: linear-gradient(135deg, #eef4fa, #f6f9fc);
  border-radius: 1.2rem;
  border: 1px solid var(--border);
}

.author-card .avatar-lg {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--grad);
  color: #fff;
  font-weight: 800;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.author-card .ac-name {
  font-weight: 800;
  color: var(--primary-dark);
  font-size: 1rem;
}

.author-card .ac-bio {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.2rem;
  line-height: 1.5;
}

/* 侧边栏 */
.article-side {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  position: sticky;
  top: 90px;
}

.side-block {
  background: var(--surface);
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  padding: 1.3rem 1.3rem 1.5rem;
}

.side-block h4 {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--primary-dark);
  margin-bottom: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.toc {
  list-style: none;
  padding: 0;
  font-size: 0.85rem;
}

.toc li {
  margin: 0;
}

.toc a {
  display: block;
  padding: 0.4rem 0.6rem;
  border-radius: 0.5rem;
  color: var(--muted);
  border-left: 2px solid transparent;
  transition: all 0.18s;
  line-height: 1.4;
}

.toc a:hover,
.toc a.active {
  color: var(--primary);
  background: var(--primary-soft);
  border-left-color: var(--primary);
}

.toc a.sub {
  padding-left: 1.4rem;
  font-size: 0.8rem;
}

.related-item {
  display: flex;
  gap: 0.7rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.related-item:last-child {
  border-bottom: none;
}

.related-thumb {
  width: 64px;
  height: 64px;
  border-radius: 0.7rem;
  flex-shrink: 0;
  background: var(--g, var(--grad));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.related-title {
  font-size: 0.85rem;
  font-weight: 650;
  color: var(--primary-dark);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.related-meta {
  font-size: 0.72rem;
  color: var(--muted-2);
  margin-top: 0.3rem;
}
