@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&display=swap');

/* ── 变量 ── */
:root {
  --c-bg: #ffffff;
  --c-bg2: #f5f5f5;
  --c-ink: #1f1f1f;
  --c-ink2: #3a3a3a;
  --c-ink3: #666666;
  --c-border: #1f1f1f;
  --c-border-light: #d8d8d8;
  --c-accent: #1f1f1f;
  --c-card-bg: #1f1f1f;
  --c-card-fg: #ffffff;
  --font: 'DM Sans', system-ui, -apple-system, sans-serif;
  --aside-w: 260px;
  --nav-w: 240px;
  --max-prose: 780px;
  --gap: 24px;
  --radius: 0px;
  --announce-h: 36px;
  --nav-top: 0px;
  --elev1: 0 1px 3px rgba(0,0,0,.08);
  --elev2: 0 4px 12px rgba(0,0,0,.12);
  --elev3: 0 8px 24px rgba(0,0,0,.16);
  --elev4: 0 16px 40px rgba(0,0,0,.22);
}

/* ── 重置 ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
  color: var(--c-ink);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
a:hover { opacity: .75; }
ul, ol { list-style: none; }
h1, h2, h3, h4 { line-height: 1.25; font-weight: 700; }
h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); }
h2 { font-size: clamp(1.2rem, 3vw, 1.6rem); }
h3 { font-size: 1.1rem; }
hr {
  border: none;
  border-top: 2px solid var(--c-ink);
  margin: 0 0 var(--gap);
}

/* ── 公告条 ── */
.announce-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: var(--announce-h);
  background: var(--c-ink);
  color: var(--c-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 500;
  letter-spacing: .03em;
}

/* ── 布局包 ── */
.site-wrapper {
  display: flex;
  min-height: 100vh;
  padding-top: var(--announce-h);
}

/* ── 侧边导航 aside ── */
.site-aside {
  position: fixed;
  top: var(--announce-h);
  left: 0;
  bottom: 0;
  width: var(--nav-w);
  background: var(--c-bg2);
  border-right: 2px solid var(--c-border);
  z-index: 50;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: var(--gap);
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: calc(var(--gap) * 1.5);
  padding-bottom: var(--gap);
  border-bottom: 1px solid var(--c-border-light);
}

.brand-mark {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.brand-mark-text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--c-ink);
  color: var(--c-bg);
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .02em;
}

.brand-name {
  font-size: .85rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--c-ink);
  line-height: 1.3;
}

.site-aside nav ul {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.site-aside nav ul li a {
  display: block;
  padding: 10px 12px;
  font-size: .82rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--c-ink2);
  border: 1px solid transparent;
  transition: background .15s, border-color .15s, color .15s;
  min-height: 40px;
  display: flex;
  align-items: center;
}

.site-aside nav ul li a:hover,
.site-aside nav ul li a[aria-current="page"] {
  background: var(--c-ink);
  color: var(--c-bg);
  border-color: var(--c-ink);
  opacity: 1;
}

/* ── 页面主体 ── */
.page-body {
  margin-left: var(--nav-w);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ── 点阵底纹 ── */
.dot-grid {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, #c8c8c8 1px, transparent 1px);
  background-size: 20px 20px;
  opacity: .5;
  pointer-events: none;
}

/* ── Hero（首页） ── */
.hero-section {
  position: relative;
  min-height: 45vh;
  background: var(--c-bg2);
  border-bottom: 2px solid var(--c-border);
  display: flex;
  align-items: center;
  overflow: hidden;
  padding: calc(var(--gap) * 2) calc(var(--gap) * 2);
}

.hero-inner {
  position: relative;
  z-index: 2;
  max-width: 640px;
}

.hero-eyebrow {
  display: inline-block;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  border: 1.5px solid var(--c-ink);
  padding: 3px 10px;
  margin-bottom: 16px;
}

.hero-h1 {
  margin-bottom: 16px;
  color: var(--c-ink);
}

.hero-sub {
  font-size: 1rem;
  color: var(--c-ink2);
  margin-bottom: 28px;
  max-width: 520px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 22px;
  background: var(--c-ink);
  color: var(--c-bg);
  font-weight: 700;
  font-size: .9rem;
  text-decoration: none;
  border: 2px solid var(--c-ink);
  transition: background .15s, color .15s, transform .1s;
}

.btn-primary:hover {
  background: var(--c-bg);
  color: var(--c-ink);
  opacity: 1;
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 22px;
  background: transparent;
  color: var(--c-ink);
  font-weight: 700;
  font-size: .9rem;
  text-decoration: none;
  border: 2px solid var(--c-ink);
  transition: background .15s, color .15s;
}

.btn-outline:hover {
  background: var(--c-ink);
  color: var(--c-bg);
  opacity: 1;
}

/* 装饰层 */
.hero-deco {
  position: absolute;
  right: -20px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
  pointer-events: none;
}

.deco-layer {
  position: absolute;
  border: 2px solid var(--c-border-light);
  border-radius: 0;
}

.deco-l1 {
  width: 180px;
  height: 180px;
  right: 60px;
  top: -90px;
  background: rgba(255,255,255,.7);
  box-shadow: var(--elev2);
  transform: translateZ(0) rotate(6deg);
  z-index: 1;
}

.deco-l2 {
  width: 140px;
  height: 140px;
  right: 30px;
  top: -50px;
  background: rgba(245,245,245,.8);
  box-shadow: var(--elev3);
  transform: translateZ(0) rotate(-4deg);
  z-index: 2;
}

.deco-l3 {
  width: 90px;
  height: 90px;
  right: 10px;
  top: -20px;
  background: var(--c-ink);
  box-shadow: var(--elev4);
  transform: translateZ(0) rotate(10deg);
  z-index: 3;
}

/* ── Topic Hero ── */
.topic-hero, .tag-hero {
  position: relative;
  padding: calc(var(--gap) * 1.5) calc(var(--gap) * 2);
  background: var(--c-bg2);
  border-bottom: 2px solid var(--c-border);
  overflow: hidden;
  min-height: 160px;
  display: flex;
  align-items: center;
}

.topic-hero-inner, .tag-hero-inner {
  position: relative;
  z-index: 2;
}

.topic-hero h1, .tag-hero h1 {
  margin: 8px 0;
}

.topic-desc {
  color: var(--c-ink2);
  font-size: .95rem;
  max-width: 600px;
}

/* ── 内页 Hero ── */
.inner-hero {
  position: relative;
  padding: calc(var(--gap) * 1.5) calc(var(--gap) * 2);
  background: var(--c-bg2);
  border-bottom: 2px solid var(--c-border);
  overflow: hidden;
  min-height: 140px;
  display: flex;
  align-items: center;
}

.inner-hero--compact {
  min-height: 110px;
}

.inner-hero-content {
  position: relative;
  z-index: 2;
}

.inner-hero h1 { margin-top: 8px; }

/* ── 面包屑 ── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .8rem;
  color: var(--c-ink3);
  margin-bottom: 6px;
}

.breadcrumb a {
  color: var(--c-ink3);
  text-decoration: none;
}

.breadcrumb a:hover { color: var(--c-ink); opacity: 1; }

/* ── 主内容区布局 ── */
.topic-layout,
.article-layout,
.tag-layout,
.about-layout,
.privacy-layout {
  display: grid;
  grid-template-columns: 1fr var(--aside-w);
  gap: 0;
  flex: 1;
  align-items: start;
}

main {
  min-width: 0;
  border-right: 2px solid var(--c-border);
}

.wrap {
  padding: calc(var(--gap) * 1.5) calc(var(--gap) * 2);
  max-width: var(--max-prose);
}

/* ── 内容侧边栏 ── */
.content-aside {
  padding: calc(var(--gap) * 1.5) var(--gap);
  position: sticky;
  top: calc(var(--announce-h) + 16px);
}

.aside-block {
  margin-bottom: calc(var(--gap) * 1.5);
  padding-bottom: calc(var(--gap) * 1.5);
  border-bottom: 1px solid var(--c-border-light);
}

.aside-block:last-child {
  border-bottom: none;
}

.aside-block h3 {
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: 12px;
  color: var(--c-ink);
}

.aside-block ul {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-link {
  display: block;
  padding: 7px 10px;
  font-size: .83rem;
  color: var(--c-ink2);
  text-decoration: none;
  border: 1px solid transparent;
  min-height: 40px;
  display: flex;
  align-items: center;
  transition: background .12s, border-color .12s;
}

.sidebar-link:hover {
  background: var(--c-bg2);
  border-color: var(--c-border-light);
  opacity: 1;
}

/* ── 正文区块 ── */
.content-section {
  margin-bottom: calc(var(--gap) * 1.5);
}

.prose-content {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--c-ink2);
}

.prose-content h2 {
  color: var(--c-ink);
  margin: 2em 0 .25em;
}

.prose-content h3 {
  color: var(--c-ink);
  margin: 1.5em 0 .25em;
}

.prose-content p {
  margin-bottom: 1.2em;
}

.prose-content ul, .prose-content ol {
  list-style: disc;
  padding-left: 1.4em;
  margin-bottom: 1.2em;
}

.prose-content ol { list-style: decimal; }

.prose-content li { margin-bottom: .4em; }

.prose-content a {
  color: var(--c-ink);
  font-weight: 500;
}

.prose-content blockquote {
  border-left: 3px solid var(--c-ink);
  padding-left: 1em;
  color: var(--c-ink3);
  margin: 1.5em 0;
}

.prose-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5em;
  font-size: .9rem;
}

.prose-content th, .prose-content td {
  border: 1px solid var(--c-border-light);
  padding: 8px 12px;
  text-align: left;
}

.prose-content th {
  background: var(--c-bg2);
  font-weight: 700;
}

/* ── 文章元数据 ── */
.article-meta-top {
  margin-bottom: var(--gap);
  padding-bottom: var(--gap);
  border-bottom: 2px solid var(--c-border);
}

.article-dateline {
  display: flex;
  gap: 16px;
  margin-top: 10px;
  font-size: .82rem;
  color: var(--c-ink3);
}

.article-hero-wrap {
  margin-bottom: var(--gap);
  border: 1px solid var(--c-border-light);
  overflow: hidden;
}

.article-hero-img {
  width: 100%;
  height: auto;
  display: block;
}

.article-body {
  position: relative;
  z-index: 1;
}

/* ── 日期格式 ── */
time { font-size: .82rem; color: var(--c-ink3); }

/* ── Topic Grid (DL) ── */
.topics-section, .children-section {
  margin-bottom: calc(var(--gap) * 2);
}

.topics-section h2, .children-section h2,
.articles-section h2, .tags-section h2,
.tag-articles-section h2, .about-stats h2 {
  margin-bottom: 12px;
}

.topic-grid, .children-list {
  display: grid;
  gap: var(--gap);
}

.topic-grid dt, .children-list dt {
  margin-bottom: 0;
}

.topic-grid dt a, .children-list dt a {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--c-bg);
  background: var(--c-card-bg);
  padding: 14px 16px;
  border: 2px solid var(--c-ink);
  position: relative;
  z-index: 2;
  transition: box-shadow .15s, transform .15s;
}

.topic-grid dt a:hover, .children-list dt a:hover {
  box-shadow: var(--elev2);
  transform: translateY(-2px);
  opacity: 1;
}

.topic-grid dd, .children-list dd {
  background: var(--c-bg2);
  border: 1px solid var(--c-border-light);
  border-top: none;
  padding: 14px 16px;
  position: relative;
  z-index: 1;
  margin-bottom: var(--gap);
}

.card-img, .child-img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  margin-bottom: 10px;
}

.card-desc, .child-desc {
  font-size: .88rem;
  color: var(--c-ink2);
  display: block;
  line-height: 1.5;
}

.child-date {
  display: block;
  margin-top: 8px;
}

/* ── 文章列表 ── */
.articles-section {
  margin-bottom: calc(var(--gap) * 2);
}

.article-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--gap);
}

.article-item {
  position: relative;
}

.article-link {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px;
  background: var(--c-bg2);
  border: 1.5px solid var(--c-border);
  text-decoration: none;
  color: inherit;
  height: 100%;
  transition: box-shadow .15s, transform .15s;
  position: relative;
  z-index: 1;
}

.article-link:hover {
  box-shadow: var(--elev3);
  transform: translateY(-3px);
  opacity: 1;
}

.article-tag {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--c-ink3);
  border: 1px solid var(--c-border-light);
  padding: 2px 7px;
  align-self: flex-start;
}

.article-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--c-ink);
  line-height: 1.35;
}

.article-desc {
  font-size: .83rem;
  color: var(--c-ink3);
  flex: 1;
}

.article-date {
  font-size: .78rem;
  color: var(--c-ink3);
  margin-top: 4px;
}

/* ── 标签 ── */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 6px 16px;
  border: 1.5px solid var(--c-ink);
  font-size: .83rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--c-ink);
  background: var(--c-bg);
  transition: background .12s, color .12s;
}

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

.tag-list-aside {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tag-list-aside .tag-pill {
  display: flex;
  width: 100%;
}

/* ── 标签文章列表 ── */
.tag-article-list {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.tag-article-item {}

.tag-article-link {
  display: block;
  padding: 18px;
  background: var(--c-bg2);
  border: 1.5px solid var(--c-border);
  text-decoration: none;
  color: inherit;
  transition: box-shadow .15s, transform .15s;
}

.tag-article-link:hover {
  box-shadow: var(--elev2);
  transform: translateY(-2px);
  opacity: 1;
}

.tag-article-cat {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  border: 1px solid var(--c-border-light);
  padding: 2px 7px;
  margin-bottom: 8px;
  color: var(--c-ink3);
}

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

.tag-article-desc {
  display: block;
  font-size: .85rem;
  color: var(--c-ink3);
  line-height: 1.55;
  margin-bottom: 8px;
}

/* ── About 统计 ── */
.about-stats {
  margin-bottom: calc(var(--gap) * 2);
}

.stats-row {
  display: flex;
  gap: var(--gap);
  flex-wrap: wrap;
}

.stat-card {
  flex: 1;
  min-width: 100px;
  background: var(--c-card-bg);
  color: var(--c-card-fg);
  border: 2px solid var(--c-ink);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
  position: relative;
  z-index: 1;
  box-shadow: var(--elev2);
}

.stat-num {
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1;
}

.stat-label {
  font-size: .82rem;
  color: rgba(255,255,255,.7);
  font-weight: 500;
}

/* ── Privacy ── */
.privacy-date {
  display: block;
  margin-top: 8px;
  font-size: .82rem;
  color: var(--c-ink3);
}

/* ── 页脚 ── */
.site-footer {
  background: var(--c-ink);
  color: var(--c-bg);
  margin-top: auto;
}

.footer-inner {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: calc(var(--gap) * 2);
  padding: calc(var(--gap) * 2) calc(var(--gap) * 2);
  border-bottom: 1px solid rgba(255,255,255,.12);
}

.footer-brand {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--c-bg);
}

.footer-address {
  font-style: normal;
  font-size: .83rem;
  color: rgba(255,255,255,.65);
  line-height: 1.6;
}

.footer-heading {
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255,255,255,.5);
  margin-bottom: 14px;
}

.footer-col ul {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.footer-col ul li a {
  font-size: .83rem;
  color: rgba(255,255,255,.75);
  text-decoration: none;
  min-height: 40px;
  display: flex;
  align-items: center;
  padding: 4px 0;
  transition: color .12s;
}

.footer-col ul li a:hover {
  color: #fff;
  opacity: 1;
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px calc(var(--gap) * 2);
}

.footer-copy {
  font-size: .8rem;
  color: rgba(255,255,255,.45);
}

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

.footer-bottom-links li a {
  font-size: .8rem;
  color: rgba(255,255,255,.55);
  text-decoration: none;
  min-height: 40px;
  display: flex;
  align-items: center;
  transition: color .12s;
}

.footer-bottom-links li a:hover {
  color: #fff;
  opacity: 1;
}

/* ── 首页布局特殊处理 ── */
.page-home .page-body main {
  border-right: none;
}

.page-home main .wrap {
  max-width: 100%;
  padding: calc(var(--gap) * 2);
}

/* ── 滚动揭示动效 ── */
.reveal-item {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .5s ease, transform .5s ease;
}

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

@media (prefers-reduced-motion: reduce) {
  .reveal-item {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .btn-primary, .btn-outline,
  .article-link, .tag-article-link,
  .topic-grid dt a, .children-list dt a,
  .sidebar-link {
    transition: none;
  }
}

/* ── 响应式 ── */
@media (max-width: 1100px) {
  :root { --nav-w: 200px; --aside-w: 220px; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .footer-col:first-child { grid-column: 1/-1; }
}

@media (max-width: 860px) {
  :root { --nav-w: 0px; }

  .site-aside {
    position: fixed;
    top: var(--announce-h);
    left: -260px;
    width: 260px;
    transition: left .25s ease;
    z-index: 200;
  }

  .site-aside.is-open {
    left: 0;
    box-shadow: var(--elev4);
  }

  .page-body {
    margin-left: 0;
  }

  .topic-layout,
  .article-layout,
  .tag-layout,
  .about-layout,
  .privacy-layout {
    grid-template-columns: 1fr;
  }

  .content-aside {
    position: static;
    border-top: 2px solid var(--c-border);
    padding: var(--gap) calc(var(--gap) * 1.5);
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--gap);
  }

  .aside-block {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
  }

  main { border-right: none; }

  .wrap {
    padding: var(--gap) calc(var(--gap) * 1.5);
  }

  .hero-section { padding: var(--gap) calc(var(--gap) * 1.5); min-height: 50vw; }
  .hero-deco { display: none; }

  .topic-hero, .tag-hero, .inner-hero {
    padding: var(--gap) calc(var(--gap) * 1.5);
  }

  .footer-inner {
    grid-template-columns: 1fr;
    gap: var(--gap);
    padding: var(--gap) calc(var(--gap) * 1.5);
  }

  .footer-col:first-child { grid-column: auto; }

  .footer-bottom {
    padding: 14px calc(var(--gap) * 1.5);
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  /* 移动端导航切换按钮 */
  .nav-toggle {
    display: flex;
    position: fixed;
    top: calc(var(--announce-h) + 8px);
    left: 8px;
    z-index: 300;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    background: var(--c-ink);
    color: var(--c-bg);
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
  }

  .article-list {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 861px) {
  .nav-toggle { display: none; }
}

@media (max-width: 480px) {
  body { font-size: 16px; }
  .hero-h1 { font-size: 1.5rem; }
  .stats-row { flex-direction: column; }
  .topic-grid, .children-list { grid-template-columns: 1fr; }
  .wrap { padding: var(--gap); }
  .hero-section { padding: var(--gap); }
  .content-aside { padding: var(--gap); display: block; }
}
