@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;800&display=swap');

/* =====================
   CSS 自定义属性
   ===================== */
:root {
  --c-bg: #ffffff;
  --c-surface: #f5f5f5;
  --c-ink: #1f1f1f;
  --c-ink-secondary: #555555;
  --c-border: #e0e0e0;
  --c-accent: #1f1f1f;
  --c-accent-hover: #333333;
  --c-card-shadow: 0 4px 6px rgba(0,0,0,0.05);
  --c-card-shadow-hover: 0 8px 24px rgba(0,0,0,0.10);
  --radius-card: 18px;
  --radius-sm: 10px;
  --radius-pill: 100px;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --transition-base: 0.22s cubic-bezier(0.4,0,0.2,1);
  --nav-h: 60px;
  --aside-w: 220px;
  --content-max: 1140px;
  --gap: 16px;
}

/* =====================
   重置 & 基础
   ===================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--c-bg);
  color: var(--c-ink);
  line-height: 1.65;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
img { display: block; max-width: 100%; height: auto; }

/* =====================
   页面骨架：左aside + 右主区
   ===================== */
.page-wrapper {
  display: flex;
  align-items: flex-start;
  max-width: var(--content-max);
  margin: 0 auto;
  padding-bottom: calc(var(--nav-h) + 24px);
  min-height: 100vh;
}

/* =====================
   侧边 aside（内容左侧）
   ===================== */
.site-aside {
  position: sticky;
  top: 0;
  width: var(--aside-w);
  min-width: var(--aside-w);
  max-height: 100vh;
  overflow-y: auto;
  padding: 28px 16px 120px 16px;
  background: var(--c-surface);
  border-right: 1px solid var(--c-border);
  display: flex;
  flex-direction: column;
  gap: 28px;
  z-index: 10;
}

.aside-nav-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.aside-nav-list li a {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--c-ink);
  transition: background var(--transition-base), color var(--transition-base);
  min-height: 40px;
  line-height: 1.4;
}

.aside-nav-list li a:hover {
  background: var(--c-ink);
  color: var(--c-bg);
}

.aside-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--c-ink-secondary);
  text-transform: uppercase;
  margin-bottom: 10px;
}

.aside-sibling-list li a,
.aside-related .aside-nav-list li a {
  font-size: 0.82rem;
  font-weight: 400;
}

.aside-tags,
.aside-related,
.aside-sibling-nav {
  padding-top: 16px;
  border-top: 1px solid var(--c-border);
}

.tag-pills-aside {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* =====================
   主区域
   ===================== */
.main-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* =====================
   底部固定导航条
   ===================== */
.site-bottom-nav {
  display: none; /* 通过 body hook 注入，模板不直接写 */
}

/* =====================
   Hero（首页）
   ===================== */
.hero-section {
  position: relative;
  width: 100%;
  height: 45vh;
  min-height: 260px;
  max-height: 480px;
  background: var(--c-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(31,31,31,0.92) 0%, rgba(31,31,31,0.70) 100%);
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 0 24px;
  max-width: 700px;
}

.hero-badges {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.hero-badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255,255,255,0.4);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  backdrop-filter: blur(6px);
}

.hero-h1 {
  font-size: clamp(1.6rem, 5vw, 2.8rem);
  font-weight: 800;
  color: #fff;
  line-height: 1.15;
  margin-bottom: 12px;
}

.hero-sub {
  color: rgba(255,255,255,0.75);
  font-size: 1rem;
  line-height: 1.6;
}

/* =====================
   频道 Hero
   ===================== */
.channel-hero {
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  padding: 36px 32px 28px;
}

.channel-eyebrow, .tag-eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--c-ink-secondary);
  text-transform: uppercase;
  margin-bottom: 10px;
}

.channel-h1, .tag-h1 {
  font-size: clamp(1.4rem, 3.5vw, 2.2rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 10px;
}

.channel-date {
  font-size: 0.85rem;
  color: var(--c-ink-secondary);
}

/* =====================
   标签 Hero
   ===================== */
.tag-hero {
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  padding: 36px 32px 28px;
}

/* =====================
   Main / Article
   ===================== */
main {
  padding: 32px 24px;
}

/* 正文容器：main > article > div */
.prose-section {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--c-ink);
  max-width: 720px;
}

.prose-section h2 { font-size: 1.3rem; font-weight: 700; margin: 1.8em 0 0.6em; }
.prose-section h3 { font-size: 1.1rem; font-weight: 600; margin: 1.4em 0 0.4em; }
.prose-section p { margin-bottom: 1em; }
.prose-section ul, .prose-section ol { padding-left: 1.4em; margin-bottom: 1em; list-style: disc; }
.prose-section ol { list-style: decimal; }
.prose-section li { margin-bottom: 0.4em; }
.prose-section a { color: var(--c-ink); text-decoration: underline; text-underline-offset: 3px; }
.prose-section strong { font-weight: 700; }
.prose-section blockquote {
  border-left: 3px solid var(--c-ink);
  padding-left: 1em;
  color: var(--c-ink-secondary);
  font-style: italic;
  margin: 1.2em 0;
}

/* =====================
   div 分隔线 hr
   ===================== */
hr {
  border: none;
  border-top: 1px solid var(--c-border);
  margin: 12px 0 24px;
}

/* =====================
   div 标题
   ===================== */
.section-heading {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-bottom: 10px;
}

.content-section { margin-bottom: 40px; }
.channels-section { margin-bottom: 40px; }
.bento-section { margin-bottom: 40px; }
.channel-children-section { margin-bottom: 40px; }
.tag-articles-section { margin-bottom: 40px; }
.related-section { margin-bottom: 40px; }
.about-links-section { margin-bottom: 40px; }
.privacy-footer-links-section { margin-bottom: 40px; }

/* =====================
   Bento Grid
   ===================== */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 200px;
  gap: var(--gap);
}

.bento-card {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 20px;
  background: var(--c-surface);
  border-radius: var(--radius-card);
  box-shadow: var(--c-card-shadow);
  border-bottom: 3px solid var(--c-ink);
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-base), box-shadow var(--transition-base);
  cursor: pointer;
}

.bento-card:hover {
  transform: scale(1.02);
  box-shadow: var(--c-card-shadow-hover);
}

.bento-card.card-1x1 {
  grid-column: span 1;
  grid-row: span 1;
}

.bento-card.card-2x1 {
  grid-column: span 2;
  grid-row: span 1;
}

.bento-card.card-2x2 {
  grid-column: span 2;
  grid-row: span 2;
}

.card-title {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 6px;
  color: var(--c-ink);
}

.card-2x2 .card-title { font-size: 1.3rem; }

.card-desc {
  display: block;
  font-size: 0.82rem;
  color: var(--c-ink-secondary);
  line-height: 1.5;
  margin-bottom: 8px;
}

.card-date {
  display: block;
  font-size: 0.75rem;
  color: var(--c-ink-secondary);
  margin-bottom: 4px;
}

.card-arrow {
  position: absolute;
  top: 18px;
  right: 20px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--c-ink);
  opacity: 0.4;
  transition: opacity var(--transition-base), transform var(--transition-base);
}

.bento-card:hover .card-arrow {
  opacity: 1;
  transform: translateX(4px);
}

/* =====================
   频道卡片 Grid
   ===================== */
.channel-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--gap);
}

.channel-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 24px;
  background: var(--c-surface);
  border-radius: var(--radius-card);
  border-bottom: 3px solid var(--c-ink);
  box-shadow: var(--c-card-shadow);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.channel-card:hover {
  transform: scale(1.02);
  box-shadow: var(--c-card-shadow-hover);
}

.channel-name {
  font-size: 1.05rem;
  font-weight: 700;
}

.channel-desc {
  font-size: 0.85rem;
  color: var(--c-ink-secondary);
  line-height: 1.5;
}

/* =====================
   面包屑
   ===================== */
.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 16px 24px 0;
  font-size: 0.82rem;
  color: var(--c-ink-secondary);
}

.bc-link { color: var(--c-ink-secondary); }
.bc-link:hover { text-decoration: underline; }
.bc-sep { opacity: 0.4; }
.bc-current { font-weight: 600; color: var(--c-ink); }

/* =====================
   文章页
   ===================== */
.article-h1 {
  font-size: clamp(1.5rem, 3.5vw, 2.2rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 12px;
}

.article-header-section { margin-bottom: 24px; }

.article-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--c-ink-secondary);
}

/* =====================
   相关文章
   ===================== */
.related-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--gap);
}

.related-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  background: var(--c-surface);
  border-radius: var(--radius-card);
  border-bottom: 3px solid var(--c-ink);
  box-shadow: var(--c-card-shadow);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
  font-size: 0.9rem;
}

.related-card strong { font-weight: 700; font-size: 0.95rem; }
.related-card span { color: var(--c-ink-secondary); font-size: 0.82rem; line-height: 1.5; }

.related-card:hover {
  transform: scale(1.02);
  box-shadow: var(--c-card-shadow-hover);
}

/* =====================
   关于页
   ===================== */
.about-h1 {
  font-size: clamp(1.6rem, 4vw, 2.5rem);
  font-weight: 800;
  margin-bottom: 12px;
}

.about-sub {
  font-size: 1.05rem;
  color: var(--c-ink-secondary);
  margin-bottom: 28px;
  max-width: 560px;
}

.about-hero-section { padding: 40px 0 16px; margin-bottom: 32px; }

.about-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap);
  margin-bottom: 8px;
}

.stat-card {
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 120px;
}

.stat-value {
  display: block;
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 6px;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--c-ink-secondary);
  font-weight: 600;
}

.about-nav-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap);
}

.about-nav-card {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  background: var(--c-surface);
  border-radius: var(--radius-card);
  border-bottom: 3px solid var(--c-ink);
  box-shadow: var(--c-card-shadow);
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.about-nav-card:hover {
  transform: scale(1.02);
  box-shadow: var(--c-card-shadow-hover);
}

/* =====================
   隐私页
   ===================== */
.privacy-h1 {
  font-size: clamp(1.5rem, 3.5vw, 2.2rem);
  font-weight: 800;
  margin-bottom: 10px;
}

.privacy-header-section { margin-bottom: 28px; }

.privacy-date {
  font-size: 0.85rem;
  color: var(--c-ink-secondary);
}

.privacy-prose {
  max-width: 680px;
}

.privacy-related {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.privacy-rel-link {
  display: flex;
  align-items: center;
  padding: 16px 24px;
  background: var(--c-surface);
  border-radius: var(--radius-card);
  border-bottom: 3px solid var(--c-ink);
  box-shadow: var(--c-card-shadow);
  font-weight: 700;
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.privacy-rel-link:hover {
  transform: scale(1.02);
  box-shadow: var(--c-card-shadow-hover);
}

/* =====================
   标签 Pill
   ===================== */
.tag-pill {
  display: inline-block;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--c-ink);
  transition: background var(--transition-base), color var(--transition-base);
  min-height: 32px;
  line-height: 1.6;
}

.tag-pill:hover {
  background: var(--c-ink);
  color: var(--c-bg);
}

/* =====================
   Footer
   ===================== */
.site-footer {
  background: var(--c-surface);
  border-top: 1px solid var(--c-border);
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  padding: 0;
}

/* footer > div×n */
.site-footer > div {
  padding: 36px 32px;
}

.footer-brand-section {
  width: 100%;
  border-bottom: 1px solid var(--c-border);
  padding: 40px 32px 28px;
}

.footer-brand-text {
  font-size: clamp(2.2rem, 6vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 10px;
}

.footer-brand-desc {
  font-size: 0.9rem;
  color: var(--c-ink-secondary);
}

.footer-col {
  flex: 1 1 180px;
  min-width: 160px;
  border-right: 1px solid var(--c-border);
}

.footer-col:last-of-type { border-right: none; }

.footer-col-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-ink-secondary);
  margin-bottom: 16px;
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-links a {
  font-size: 0.875rem;
  color: var(--c-ink-secondary);
  transition: color var(--transition-base);
  padding: 2px 0;
}

.footer-links a:hover { color: var(--c-ink); }

.footer-bottom-section {
  width: 100%;
  border-top: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 20px 32px;
  font-size: 0.82rem;
  color: var(--c-ink-secondary);
}

.footer-bottom-links {
  display: flex;
  gap: 20px;
}

.footer-bottom-links a {
  color: var(--c-ink-secondary);
  transition: color var(--transition-base);
}

.footer-bottom-links a:hover { color: var(--c-ink); }

/* =====================
   Scroll Reveal 动效
   ===================== */
@media (prefers-reduced-motion: no-preference) {
  .reveal-item {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.45s cubic-bezier(0.4,0,0.2,1), transform 0.45s cubic-bezier(0.4,0,0.2,1);
  }

  .reveal-item.is-visible {
    opacity: 1;
    transform: translateY(0);
  }

  .reveal-item:nth-child(2) { transition-delay: 0.06s; }
  .reveal-item:nth-child(3) { transition-delay: 0.12s; }
  .reveal-item:nth-child(4) { transition-delay: 0.18s; }
  .reveal-item:nth-child(5) { transition-delay: 0.24s; }
  .reveal-item:nth-child(6) { transition-delay: 0.30s; }
  .reveal-item:nth-child(7) { transition-delay: 0.36s; }
  .reveal-item:nth-child(8) { transition-delay: 0.42s; }
}

@media (prefers-reduced-motion: reduce) {
  .reveal-item { opacity: 1; transform: none; }
}

/* =====================
   空提示
   ===================== */
.empty-tip {
  color: var(--c-ink-secondary);
  font-size: 0.9rem;
  padding: 20px 0;
}

/* =====================
   响应式 — 中等屏
   ===================== */
@media (max-width: 1024px) {
  .bento-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .bento-card.card-2x2 {
    grid-column: span 2;
    grid-row: span 1;
  }

  .about-stat-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .about-nav-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 860px) {
  :root { --aside-w: 180px; }

  .bento-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .bento-card.card-2x2 {
    grid-column: span 2;
    grid-row: span 1;
  }

  .bento-card.card-2x1 {
    grid-column: span 2;
  }

  .channel-grid {
    grid-template-columns: 1fr;
  }
}

/* =====================
   响应式 — 移动端 ≤640px
   ===================== */
@media (max-width: 640px) {
  :root {
    --aside-w: 0px;
    --gap: 12px;
  }

  .page-wrapper {
    flex-direction: column;
  }

  .site-aside {
    position: static;
    width: 100%;
    min-width: 100%;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--c-border);
    padding: 16px 16px 16px 16px;
    flex-direction: row;
    flex-wrap: wrap;
    overflow-x: auto;
    overflow-y: visible;
  }

  .site-aside > nav {
    flex: 0 0 auto;
    min-width: 0;
  }

  .aside-nav-list {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
  }

  .aside-nav-list li a {
    white-space: nowrap;
    font-size: 0.82rem;
    padding: 10px 14px;
    min-height: 40px;
  }

  .aside-sibling-nav,
  .aside-related,
  .aside-tags {
    display: none;
  }

  .main-area {
    width: 100%;
  }

  main {
    padding: 20px 16px;
  }

  .hero-section {
    height: 50vh;
    min-height: 240px;
  }

  .hero-h1 {
    font-size: 1.5rem;
  }

  .bento-grid {
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: 160px;
  }

  .bento-card.card-2x2 {
    grid-column: span 2;
    grid-row: span 1;
  }

  .bento-card.card-2x1 {
    grid-column: span 2;
  }

  .bento-card.card-1x1 {
    grid-column: span 1;
  }

  .channel-grid {
    grid-template-columns: 1fr;
  }

  .related-grid {
    grid-template-columns: 1fr;
  }

  .about-stat-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .about-nav-cards {
    grid-template-columns: 1fr 1fr;
  }

  .channel-hero,
  .tag-hero {
    padding: 24px 16px 20px;
  }

  .footer-brand-text {
    font-size: 2rem;
  }

  .footer-col {
    flex: 1 1 140px;
  }

  .site-footer > div {
    padding: 24px 16px;
  }

  .footer-bottom-section {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 16px;
  }

  .breadcrumb {
    padding: 12px 16px 0;
    font-size: 0.78rem;
  }

  .privacy-related {
    flex-direction: column;
  }

  .article-h1, .about-h1, .privacy-h1 {
    font-size: 1.4rem;
  }

  /* 移动端底部 tap 区保证 40px */
  .aside-nav-list li a,
  .footer-links a,
  .footer-bottom-links a,
  .tag-pill,
  .bento-card,
  .channel-card,
  .related-card,
  .about-nav-card,
  .privacy-rel-link {
    min-height: 40px;
  }
}
