/* ============================================================
   智典 AI · 洞察 — 博客主题（对齐 zhidianai.site 官网设计语言）
   墨色 ink / 纸色 paper / 朱砂 cinnabar + Noto Serif SC 衬线
   ============================================================ */

:root {
  --ink: #0B0D0E;
  --ink2: #101315;
  --paper: #E9E4D8;
  --paper2: #CFC9BA;
  --cinnabar: #E63B2E;
  --cinnabar2: #FF5142;
  --hairline: rgba(233, 228, 216, 0.10);
  --hairline2: rgba(233, 228, 216, 0.18);
  --muted: rgba(233, 228, 216, 0.5);
  --muted2: rgba(233, 228, 216, 0.3);
  --serif: 'Noto Serif SC', Fraunces, 'Songti SC', serif;
  --display: Fraunces, 'Noto Serif SC', 'Songti SC', serif;
  --sans: 'Noto Sans SC', 'PingFang SC', sans-serif;
  --mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { background: var(--ink); scroll-behavior: smooth; }

body {
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  line-height: 1.7;
}

::selection { background: var(--cinnabar); color: var(--ink); }

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--ink); }
::-webkit-scrollbar-thumb { background: #2a2f31; border: 2px solid var(--ink); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--cinnabar); }

/* 噪点（对齐官网 .grain） */
.grain::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 60; opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* 网格底纹 */
.bg-grid {
  background-image:
    linear-gradient(to right, rgba(233, 228, 216, 0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(233, 228, 216, 0.04) 1px, transparent 1px);
  background-size: 80px 80px;
}

.container { max-width: 1320px; margin: 0 auto; padding: 0 1.5rem; }
@media (min-width: 768px) { .container { padding: 0 2.5rem; } }

/* ============ 顶栏 ============ */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  border-bottom: 1px solid var(--hairline);
  background: rgba(11, 13, 14, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.site-header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.5rem;
  max-width: 1320px; margin: 0 auto;
}
@media (min-width: 768px) { .site-header-inner { padding: 1.1rem 2.5rem; } }

.brand { display: flex; align-items: center; gap: 0.75rem; text-decoration: none; color: var(--paper); }
.seal {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.25rem; height: 2.25rem;
  background: var(--cinnabar); color: var(--paper);
  font-family: var(--serif); font-weight: 700; font-size: 13px; line-height: 1;
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(230, 59, 46, 0.35), 0 8px 30px -8px rgba(230, 59, 46, 0.4);
}
.brand-name { font-family: var(--mono); font-size: 11px; line-height: 1; letter-spacing: 0.18em; color: var(--muted); }

.main-nav { display: none; align-items: center; gap: 2rem; font-family: var(--mono); font-size: 11px; line-height: 1; letter-spacing: 0.18em; }
@media (min-width: 768px) { .main-nav { display: flex; } }
.main-nav a { color: var(--muted); text-decoration: none; transition: color 0.3s; display: inline-flex; align-items: center; line-height: 1; }
.main-nav a:hover { color: var(--paper); }

.u-sweep {
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1px; background-repeat: no-repeat; background-position: 0 100%;
  transition: background-size 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.u-sweep:hover { background-size: 100% 1px; }

.nav-cta {
  border: 1px solid var(--cinnabar); color: var(--cinnabar);
  padding: 0.5rem 1rem; text-decoration: none;
  display: inline-flex; align-items: center; line-height: 1;
  transition: all 0.3s;
}
.nav-cta:hover { background: var(--cinnabar); color: var(--ink); }

/* ============ Hero ============ */
.hero {
  position: relative;
  padding: 11rem 0 4rem;
  border-bottom: 1px solid var(--hairline);
  overflow: hidden;
}
.hero .bg-grid { position: absolute; inset: 0; pointer-events: none; }
.hero-glow {
  position: absolute; left: 50%; top: 0; width: 60vw; height: 60vw;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(230, 59, 46, 0.10), transparent);
  filter: blur(80px);
  pointer-events: none;
}
.hero-meta {
  display: flex; align-items: center; gap: 1rem;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.22em;
  color: var(--cinnabar);
  margin-bottom: 2.5rem;
  position: relative;
}
.hero-meta::before { content: ''; display: block; width: 3rem; height: 1px; background: var(--cinnabar); }
.pulse-dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--cinnabar);
  animation: pulseDot 1.6s ease-in-out infinite;
}
@keyframes pulseDot { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.5; transform: scale(1.4); } }

.hero-title {
  font-family: var(--serif); font-weight: 900;
  font-size: clamp(44px, 7vw, 92px);
  line-height: 1.02; letter-spacing: -0.01em;
  position: relative;
}
.hero-title .accent { color: var(--cinnabar); }
.hero-title .outline {
  color: transparent;
  -webkit-text-stroke: 1px rgba(233, 228, 216, 0.25);
}
.hero-sub {
  margin-top: 1.75rem;
  font-family: var(--serif); font-size: clamp(19px, 2.4vw, 28px);
  color: var(--muted);
  max-width: 40rem;
  line-height: 1.6;
  position: relative;
}
.hero-sub strong { color: var(--paper); font-weight: 500; }
.hero-stats {
  display: flex; flex-wrap: wrap; gap: 2.5rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--hairline);
  position: relative;
}
.hero-stat .k { font-family: var(--mono); font-size: 10px; letter-spacing: 0.22em; color: var(--muted2); }
.hero-stat .v { font-family: var(--display); font-size: 2rem; color: var(--paper); margin-top: 0.25rem; }
.hero-stat .v em { font-style: normal; color: var(--cinnabar); font-size: 0.7em; }

/* ============ 章节标题 ============ */
.section {
  padding: 5rem 0;
  border-bottom: 1px solid var(--hairline);
}
@media (min-width: 768px) { .section { padding: 6.5rem 0; } }

.sec-head {
  display: flex; align-items: center; gap: 1rem;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.22em;
  color: var(--muted);
  margin-bottom: 3rem;
}
.sec-head::before { content: ''; display: block; width: 3rem; height: 1px; background: rgba(233, 228, 216, 0.3); }

.sec-title {
  font-family: var(--serif); font-weight: 900;
  font-size: clamp(30px, 4.4vw, 56px);
  line-height: 1.1; letter-spacing: -0.01em;
  margin-bottom: 0.5rem;
}
.sec-title .accent { color: var(--cinnabar); }
.sec-desc { color: var(--muted); font-family: var(--serif); max-width: 42rem; }

/* ============ 文章卡片 ============ */
.post-list { display: flex; flex-direction: column; }
.post-list + .post-list { margin-top: 4rem; }

.post-row {
  display: grid; gap: 1rem 2.5rem;
  grid-template-columns: auto 1fr auto;
  padding: 1.75rem 0;
  border-bottom: 1px solid var(--hairline);
  color: inherit;
  transition: padding-left 0.3s, background 0.3s;
  position: relative;
}
/* stretched-link：整行可点的透明覆盖链接（避免 a 内嵌块级元素的解析问题） */
.post-row-link {
  position: absolute; inset: 0; z-index: 1;
  text-decoration: none; color: inherit;
}
.post-row:hover { padding-left: 1.25rem; }
.post-row:hover .post-arrow { opacity: 1; transform: translateX(0); }
.post-row:hover .post-title { color: var(--cinnabar); }

.post-idx {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.22em;
  color: var(--muted2);
  padding-top: 0.4rem;
  min-width: 3.5rem;
  position: relative; z-index: 0;
}
.post-body { display: flex; flex-direction: column; gap: 0.6rem; min-width: 0; }
.post-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.25rem;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.18em;
  color: var(--muted2);
}
.post-meta .cat { color: var(--cinnabar); text-decoration: none; position: relative; z-index: 2; }
.post-meta .cat:hover { color: var(--cinnabar2); }
.post-title {
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(19px, 2.4vw, 26px);
  line-height: 1.45;
  color: var(--paper);
  transition: color 0.3s;
}
.post-desc { color: var(--muted); font-size: 14px; line-height: 1.8; max-width: 60rem; }
.post-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tag-chip {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em;
  color: var(--muted); border: 1px solid var(--hairline2);
  padding: 0.2rem 0.6rem; text-decoration: none;
  transition: all 0.3s;
  position: relative; z-index: 2;
}
.tag-chip:hover { color: var(--cinnabar); border-color: var(--cinnabar); }

.post-arrow {
  font-family: var(--display); font-size: 1.75rem; color: var(--cinnabar);
  opacity: 0; transform: translateX(-8px);
  transition: opacity 0.3s, transform 0.3s;
  align-self: center;
  position: relative; z-index: 2;
}
.post-row:hover .post-arrow { opacity: 1; transform: translateX(0); }

/* 卡片网格（分类/标签列表用） */
.post-grid {
  display: grid; gap: 1.5rem;
  grid-template-columns: 1fr;
}
@media (min-width: 768px) { .post-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .post-grid { grid-template-columns: repeat(3, 1fr); } }

.post-card {
  border: 1px solid var(--hairline); background: var(--ink2);
  padding: 1.75rem;
  color: inherit;
  display: flex; flex-direction: column; gap: 0.75rem;
  transition: border-color 0.35s, transform 0.35s;
  position: relative;
}
.post-card:hover { border-color: rgba(230, 59, 46, 0.5); transform: translateY(-4px); }
.post-card .post-title { font-size: 19px; }
.post-card .post-desc { font-size: 13px; }
.post-card .post-meta { margin-top: auto; padding-top: 0.5rem; }

/* ============ 分页 ============ */
.pagination {
  display: flex; align-items: center; justify-content: center; gap: 0.75rem;
  margin-top: 4rem;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.18em;
}
.pagination a, .pagination span {
  min-width: 2.5rem; height: 2.5rem;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--hairline2); text-decoration: none; color: var(--muted);
  transition: all 0.3s;
}
.pagination a:hover { border-color: var(--cinnabar); color: var(--cinnabar); }
.pagination .current { border-color: var(--cinnabar); color: var(--cinnabar); background: rgba(230, 59, 46, 0.08); }

/* ============ 页脚 ============ */
.site-footer {
  padding: 4rem 0 3rem;
  border-top: 1px solid var(--hairline);
}
.footer-grid {
  display: grid; gap: 2.5rem;
  grid-template-columns: 1fr;
}
@media (min-width: 768px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr; } }
.footer-brand { display: flex; flex-direction: column; gap: 1rem; }
.footer-slogan { font-family: var(--serif); color: var(--muted); font-size: 15px; line-height: 1.9; }
.footer-col h4 {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.22em;
  color: var(--muted2); font-weight: 400;
  margin-bottom: 1.25rem;
}
.footer-col a {
  display: block; color: var(--muted); text-decoration: none;
  font-size: 14px; padding: 0.3rem 0;
  transition: color 0.3s;
}
.footer-col a:hover { color: var(--cinnabar); }
.footer-bottom {
  margin-top: 3rem; padding-top: 1.5rem;
  border-top: 1px solid var(--hairline);
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.18em;
  color: var(--muted2);
}

/* ============ 404 ============ */
.notfound {
  min-height: 70vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 1.5rem;
  padding: 8rem 1.5rem 4rem;
}
.notfound .code {
  font-family: var(--display); font-size: clamp(90px, 18vw, 200px);
  line-height: 1; color: transparent;
  -webkit-text-stroke: 1px rgba(230, 59, 46, 0.6);
}
.notfound h1 { font-family: var(--serif); font-size: clamp(22px, 3vw, 34px); font-weight: 700; }
.notfound p { color: var(--muted); max-width: 30rem; }
.notfound .back {
  border: 1px solid var(--cinnabar); color: var(--cinnabar);
  padding: 0.6rem 1.5rem; text-decoration: none;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.18em;
  transition: all 0.3s;
}
.notfound .back:hover { background: var(--cinnabar); color: var(--ink); }

/* ============ 入场动画 ============ */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1), transform 0.7s cubic-bezier(0.22, 1, 0.36, 1); }
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
}
