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

/* ===== 基础重置 ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --c-black: #000000;
  --c-white: #ffffff;
  --c-border: #000000;
  --c-muted: #555555;
  --c-bg: #ffffff;
  --c-card-bg: #ffffff;
  --c-eyebrow: #333333;
  --radius: 18px;
  --nav-h: 64px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --max-w: 1200px;
  --gap: 2rem;
}

html {
  font-size: 16px;
  line-height: 1.6;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--c-bg);
  color: var(--c-black);
  padding-bottom: calc(var(--nav-h) + 1rem);
  -webkit-font-smoothing: antialiased;
}

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

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

ul, ol {
  list-style: none;
}

/* ===== 固定底部导航 ===== */
footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--c-black);
  color: var(--c-white);
  display: flex;
  flex-direction: column;
}

footer > div {
  display: none;
}

footer > div.footer-brand {
  display: none;
}

footer > div.footer-nav-section {
  display: block;
}

footer > div.footer-copy {
  display: none;
}

footer > div.footer-nav-section nav dl {
  display: flex;
  align-items: center;
  height: var(--nav-h);
  padding: 0 1rem;
  gap: 0.5rem;
  overflow-x: auto;
  scrollbar-width: none;
}

footer > div.footer-nav-section nav dl::-webkit-scrollbar {
  display: none;
}

footer > div.footer-nav-section nav dl dt {
  display: none;
}

footer > div.footer-nav-section nav dl dd {
  flex-shrink: 0;
}

footer > div.footer-nav-section nav dl dd a {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 1rem;
  border: 1.5px solid var(--c-white);
  border-radius: 9999px;
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
  color: var(--c-white);
  transition: background 0.22s, color 0.22s;
}

footer > div.footer-nav-section nav dl dd a:hover {
  background: var(--c-white);
  color: var(--c-black);
}

/* 桌面端：品牌居中显示逻辑 */
@media (min-width: 768px) {
  footer > div.footer-nav-section nav dl {
    justify-content: center;
    gap: 0.75rem;
  }
}

/* ===== 页面主包装：侧边栏 + 主内容 ===== */
.page-wrapper {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: var(--gap);
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2rem 1.5rem;
  min-height: calc(100vh - var(--nav-h) - 4rem);
}

@media (max-width: 767px) {
  .page-wrapper {
    grid-template-columns: 1fr;
    padding: 1.25rem 1rem;
  }
}

/* ===== 侧边栏 ===== */
.sidebar {
  position: sticky;
  top: 2rem;
  align-self: start;
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.sidebar-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-muted);
  margin-bottom: 0.75rem;
}

.sidebar-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.sidebar-list li a {
  display: block;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 400;
  transition: background 0.2s;
  min-height: 40px;
  display: flex;
  align-items: center;
}

.sidebar-list li a:hover {
  background: #f2f2f2;
}

@media (max-width: 767px) {
  .sidebar {
    position: static;
    order: 2;
  }
}

/* ===== main > section.wrap > div > article ===== */
main {
  min-width: 0;
}

.wrap {
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

.wrap > div {
  border-top: 1.5px solid var(--c-border);
  padding-top: 2rem;
}

.wrap > div:first-child {
  border-top: none;
  padding-top: 0;
}

.wrap > div > article {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ===== h1 ===== */
h1 {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(1.2rem, 3vw, 1.7rem);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.3;
}

h3 {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
}

/* ===== h2 + p.subtitle ===== */
p.subtitle {
  font-size: 0.92rem;
  color: var(--c-muted);
  line-height: 1.55;
  margin-top: 0.3rem;
}

/* ===== 正文 ===== */
.prose {
  font-size: 1rem;
  line-height: 1.75;
  max-width: 72ch;
}

.prose p { margin-bottom: 1em; }
.prose h2 { margin: 1.5em 0 0.5em; }
.prose h3 { margin: 1.25em 0 0.4em; }
.prose ul, .prose ol { padding-left: 1.4em; margin-bottom: 1em; list-style: disc; }
.prose ol { list-style: decimal; }
.prose a { border-bottom: 1px solid currentColor; }
.prose a:hover { opacity: 0.7; }
.prose blockquote { border-left: 3px solid var(--c-black); padding-left: 1em; color: var(--c-muted); margin: 1em 0; }
.prose code { font-size: 0.88em; background: #f0f0f0; padding: 0.1em 0.35em; border-radius: 4px; }
.prose pre { background: #111; color: #eee; padding: 1rem; border-radius: 10px; overflow-x: auto; margin-bottom: 1em; }
.prose pre code { background: none; padding: 0; }
.prose table { width: 100%; border-collapse: collapse; margin-bottom: 1em; }
.prose th, .prose td { border: 1px solid #ddd; padding: 0.5em 0.75em; text-align: left; }
.prose th { background: #f5f5f5; font-weight: 600; }

/* ===== 日期 ===== */
.entry-date {
  font-size: 0.8rem;
  color: var(--c-muted);
  letter-spacing: 0.03em;
}

.entry-dates {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ===== 面包屑 ===== */
.breadcrumb {
  font-size: 0.8rem;
  color: var(--c-muted);
  border-bottom: 1px solid currentColor;
}

.breadcrumb:hover {
  color: var(--c-black);
}

/* ===== Eyebrow ===== */
.eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  border: 1.5px solid var(--c-black);
  border-radius: 9999px;
  padding: 0.2em 0.85em;
  margin-bottom: 0.75rem;
}

/* ===== 按钮 ===== */
.btn-pill {
  display: inline-flex;
  align-items: center;
  height: 44px;
  padding: 0 1.5rem;
  background: var(--c-black);
  color: var(--c-white);
  border-radius: 9999px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: opacity 0.22s;
  align-self: flex-start;
}

.btn-pill:hover {
  opacity: 0.75;
}

/* ===== Hero（首页）===== */
.layout-home .hero {
  position: relative;
  min-height: 70vh;
  display: flex;
  align-items: center;
  overflow: hidden;
  border-bottom: 1.5px solid var(--c-border);
  background-color: var(--c-black);
  background-image:
    radial-gradient(circle, rgba(255,255,255,0.15) 1px, transparent 1px);
  background-size: 24px 24px;
}

.layout-home .hero-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 4rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3rem;
  width: 100%;
}

.layout-home .hero-text {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  color: var(--c-white);
  max-width: 560px;
}

.layout-home .hero-text h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  color: var(--c-white);
  margin-bottom: 0.75rem;
}

.layout-home .hero-desc {
  font-size: 1rem;
  line-height: 1.65;
  color: rgba(255,255,255,0.8);
  margin-bottom: 1.5rem;
  max-width: 42ch;
}

.layout-home .hero-text .btn-pill {
  background: var(--c-white);
  color: var(--c-black);
}

.layout-home .hero-text .btn-pill:hover {
  opacity: 0.85;
}

.layout-home .hero-text .eyebrow {
  border-color: rgba(255,255,255,0.5);
  color: rgba(255,255,255,0.7);
}

.layout-home .hero-media img {
  border-radius: var(--radius);
  max-height: 380px;
  object-fit: cover;
}

.hero-dot-deco {
  width: 220px;
  height: 220px;
  border: 1.5px solid rgba(255,255,255,0.2);
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
}

.hero-dot-deco::after {
  content: '';
  position: absolute;
  inset: 20px;
  border: 1.5px solid rgba(255,255,255,0.12);
  border-radius: 50%;
}

@media (max-width: 767px) {
  .layout-home .hero {
    min-height: 65vh;
  }

  .layout-home .hero-inner {
    flex-direction: column-reverse;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 2.5rem 1rem;
    gap: 1.5rem;
  }

  .layout-home .hero-text {
    align-items: center;
    text-align: center;
  }

  .hero-dot-deco {
    width: 120px;
    height: 120px;
  }
}

/* ===== 栏目 Hero ===== */
.layout-category .cat-hero {
  background: var(--c-black);
  color: var(--c-white);
  padding: 4rem 1.5rem 3rem;
  border-bottom: 1.5px solid var(--c-border);
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 23px, rgba(255,255,255,0.05) 23px, rgba(255,255,255,0.05) 24px),
    repeating-linear-gradient(90deg, transparent, transparent 23px, rgba(255,255,255,0.05) 23px, rgba(255,255,255,0.05) 24px);
}

.layout-category .cat-hero-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
}

.layout-category .cat-hero-inner .eyebrow {
  border-color: rgba(255,255,255,0.4);
  color: rgba(255,255,255,0.6);
}

.layout-category .cat-hero-inner h1 {
  color: var(--c-white);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
}

.layout-category .cat-desc {
  color: rgba(255,255,255,0.75);
  font-size: 0.95rem;
  max-width: 55ch;
  line-height: 1.6;
}

/* ===== 分类卡片 ===== */
.section-cats {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.section-cats h2,
.section-cats p.subtitle {
  display: block;
}

.cat-card {
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.22s;
}

.cat-card:hover {
  transform: translateY(-2px);
}

.cat-card a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
}

.cat-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
}

.cat-card p.subtitle {
  font-size: 0.85rem;
  color: var(--c-muted);
  flex: 1;
  margin-top: 0;
}

.cat-count {
  font-size: 0.75rem;
  border: 1.5px solid var(--c-border);
  border-radius: 9999px;
  padding: 0.15em 0.7em;
  white-space: nowrap;
  flex-shrink: 0;
  font-weight: 500;
}

/* ===== 最新条目列表 ===== */
.section-entries {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.entry-item {
  border-bottom: 1px solid #e8e8e8;
  transition: background 0.18s;
}

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

.entry-item a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 0.25rem;
  gap: 1rem;
  min-height: 44px;
}

.entry-item a:hover .entry-title {
  text-decoration: underline;
}

.entry-title {
  font-size: 0.95rem;
  font-weight: 500;
}

.entry-item time {
  font-size: 0.78rem;
  color: var(--c-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ===== 栏目子页卡片 ===== */
.section-children {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.child-card {
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius);
  transition: background 0.2s, transform 0.2s;
}

.child-card:hover {
  background: #fafafa;
  transform: translateY(-2px);
}

.child-card a {
  display: block;
  padding: 1.25rem 1.5rem;
}

.child-card h3 {
  margin-bottom: 0.35rem;
}

.child-card time {
  display: inline-block;
  font-size: 0.78rem;
  color: var(--c-muted);
  margin-top: 0.5rem;
}

/* ===== 文章 Hero 图 ===== */
.entry-hero {
  margin: 0.5rem 0 1rem;
}

.entry-hero-img {
  border-radius: var(--radius);
  max-height: 420px;
  object-fit: cover;
  width: 100%;
}

/* ===== 相关卡片 ===== */
.section-related {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.related-card {
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius);
  transition: transform 0.2s;
}

.related-card:hover {
  transform: translateY(-2px);
}

.related-card a {
  display: block;
  padding: 1rem 1.25rem;
}

.related-card h3 {
  margin-bottom: 0.25rem;
}

/* ===== About / Privacy 附加卡片 ===== */
.section-about-links,
.section-privacy-nav {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.about-link-card {
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius);
  transition: background 0.2s;
}

.about-link-card:hover {
  background: #fafafa;
}

.about-link-card a {
  display: block;
  padding: 1rem 1.25rem;
}

.about-link-card h3 {
  margin-bottom: 0.25rem;
}

.privacy-link-card {
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius);
  transition: background 0.2s;
}

.privacy-link-card:hover {
  background: #fafafa;
}

.privacy-link-card a {
  display: flex;
  align-items: center;
  padding: 0.9rem 1.25rem;
  min-height: 48px;
  font-weight: 500;
  font-size: 0.95rem;
}

/* ===== 空状态 ===== */
.empty-tip {
  font-size: 0.9rem;
  color: var(--c-muted);
  padding: 1rem 0;
}

/* ===== 全站页脚（展开版，滚动到底时覆盖固定底栏） ===== */
/* 真实页脚内容在 .layout-home 等 pages 的 footer 里，但由于是固定定位，
   我们用 padding-bottom 留白，品牌与版权区块通过展开响应处理 */

/* 大屏幕显示完整页脚 */
@media (min-width: 1024px) {
  footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    flex-direction: row;
    align-items: center;
    height: var(--nav-h);
  }

  footer > div.footer-nav-section {
    flex: 1;
  }

  footer > div.footer-nav-section nav dl {
    height: var(--nav-h);
    justify-content: center;
  }
}

/* ===== 动效：prefers-reduced-motion ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}

/* ===== Stagger list 动效 ===== */
@media (prefers-reduced-motion: no-preference) {
  .section-cats .cat-card,
  .section-children .child-card,
  .section-entries .entry-item,
  .section-related .related-card {
    opacity: 0;
    transform: translateY(12px);
    animation: fadeUp 0.38s ease forwards;
  }

  .section-cats .cat-card:nth-child(1),
  .section-children .child-card:nth-child(1),
  .section-entries .entry-item:nth-child(1),
  .section-related .related-card:nth-child(1) { animation-delay: 0.05s; }

  .section-cats .cat-card:nth-child(2),
  .section-children .child-card:nth-child(2),
  .section-entries .entry-item:nth-child(2),
  .section-related .related-card:nth-child(2) { animation-delay: 0.1s; }

  .section-cats .cat-card:nth-child(3),
  .section-children .child-card:nth-child(3),
  .section-entries .entry-item:nth-child(3),
  .section-related .related-card:nth-child(3) { animation-delay: 0.15s; }

  .section-cats .cat-card:nth-child(4),
  .section-children .child-card:nth-child(4),
  .section-entries .entry-item:nth-child(4),
  .section-related .related-card:nth-child(4) { animation-delay: 0.2s; }

  .section-cats .cat-card:nth-child(n+5),
  .section-children .child-card:nth-child(n+5),
  .section-entries .entry-item:nth-child(n+5),
  .section-related .related-card:nth-child(n+5) { animation-delay: 0.25s; }

  @keyframes fadeUp {
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}

/* ===== 移动端修正 ===== */
@media (max-width: 767px) {
  footer > div.footer-nav-section nav dl {
    gap: 0.4rem;
    padding: 0 0.75rem;
  }

  footer > div.footer-nav-section nav dl dd a {
    font-size: 0.75rem;
    padding: 0 0.75rem;
  }

  .cat-card a {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }

  .sidebar {
    display: none;
  }

  .layout-home .sidebar {
    display: block;
  }
}

/* ===== 无横向滚动保障 ===== */
body, .page-wrapper, main, .wrap {
  overflow-x: hidden;
}
