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

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

:root {
  --c-black: #000000;
  --c-white: #ffffff;
  --c-gray-100: #f5f5f5;
  --c-gray-200: #e8e8e8;
  --c-gray-400: #999999;
  --c-gray-600: #555555;
  --font-main: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --nav-h: 60px;
  --max-w: 1200px;
  --gap: 2rem;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-main);
  font-weight: 400;
  line-height: 1.7;
  color: var(--c-black);
  background: var(--c-white);
  overflow-x: hidden;
}

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

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

/* ============================================================
   全局工具
   ============================================================ */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}

/* ============================================================
   顶部导航
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--c-white);
  border-bottom: 2px solid var(--c-black);
  height: var(--nav-h);
}

.header-inner {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gap);
  height: 100%;
  gap: var(--gap);
}

.brand-link {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
  padding: 0.5rem 0;
  display: inline-block;
  min-height: 40px;
  line-height: 2.5;
}

.main-nav {
  display: flex;
  justify-content: flex-end;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  align-items: center;
}

.nav-links a {
  display: inline-block;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  padding: 0 1rem;
  min-height: 40px;
  line-height: 2.85;
  border-left: 1px solid var(--c-gray-200);
  transition: background 220ms ease, color 220ms ease;
  white-space: nowrap;
}

.nav-links a:first-child {
  border-left: none;
}

.nav-links a:hover,
.nav-links a:focus-visible {
  background: var(--c-black);
  color: var(--c-white);
  outline: none;
}

/* ============================================================
   Hero 区块
   ============================================================ */
.hero {
  position: relative;
  min-height: 45vh;
  display: flex;
  align-items: flex-end;
  background: var(--c-black);
  color: var(--c-white);
  overflow: hidden;
}

.hero-grid-bg {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle, rgba(255,255,255,0.18) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 3rem var(--gap) 3.5rem;
  text-align: right;
}

.hero-eyebrow {
  font-size: 0.75rem;
  font-weight: 300;
  letter-spacing: 0.18em;
  color: rgba(255,255,255,0.55);
  margin-bottom: 1rem;
  text-transform: none;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 4rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin-bottom: 1.25rem;
}

.hero-sub {
  font-size: 1rem;
  font-weight: 300;
  color: rgba(255,255,255,0.7);
  max-width: 480px;
  margin-left: auto;
  line-height: 1.7;
}

/* ============================================================
   页面主体：aside + main 网格
   ============================================================ */
.page-body {
  display: grid;
  grid-template-columns: 220px 1fr;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 3rem var(--gap);
  gap: var(--gap);
  align-items: start;
}

/* ============================================================
   侧边栏
   ============================================================ */
.sidebar {
  position: sticky;
  top: calc(var(--nav-h) + 1.5rem);
}

.sidebar-inner {
  border: 2px solid var(--c-black);
  padding: 1.5rem;
}

.sidebar-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--c-gray-400);
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--c-gray-200);
  padding-bottom: 0.5rem;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.sidebar-link {
  display: block;
  font-size: 0.875rem;
  font-weight: 400;
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid var(--c-gray-200);
  transition: background 200ms ease, padding-left 200ms ease;
  min-height: 40px;
  line-height: 1.6;
}

.sidebar-link:last-child {
  border-bottom: none;
}

.sidebar-link:hover,
.sidebar-link:focus-visible {
  background: var(--c-black);
  color: var(--c-white);
  padding-left: 1rem;
  outline: none;
}

.sidebar-dot-deco {
  margin-top: 1.5rem;
  height: 48px;
  background-image: radial-gradient(circle, var(--c-black) 1.5px, transparent 1.5px);
  background-size: 10px 10px;
  opacity: 0.15;
}

/* ============================================================
   主内容区
   ============================================================ */
.main-content {
  min-width: 0;
}

.content-article {
  /* div 直接子 article */
}

.content-section {
  /* article 承载 page.content */
}

/* article 内部的各 id 区块 */
.content-section > article {
  scroll-margin-top: calc(var(--nav-h) + 2rem);
  border-top: 2px solid var(--c-black);
  padding: 3rem 0 2.5rem;
}

.content-section > article:first-child {
  border-top: none;
  padding-top: 0;
}

/* 正文排版 */
.content-section h2 {
  font-size: clamp(1.4rem, 2.5vw, 2rem);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1.25rem;
  letter-spacing: -0.01em;
}

.content-section h2 > span {
  display: inline;
}

.content-section h3 {
  font-size: 1.125rem;
  font-weight: 700;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.content-section h3 > span {
  display: inline;
}

.content-section p {
  font-size: 1rem;
  line-height: 1.8;
  margin-bottom: 1.1rem;
  color: #111;
}

.content-section ul,
.content-section ol {
  padding-left: 1.5rem;
  margin-bottom: 1.1rem;
}

.content-section li {
  font-size: 1rem;
  line-height: 1.75;
  margin-bottom: 0.4rem;
}

.content-section strong {
  font-weight: 700;
}

.content-section blockquote {
  border-left: 4px solid var(--c-black);
  padding: 0.75rem 1.25rem;
  margin: 1.5rem 0;
  background: var(--c-gray-100);
  font-style: normal;
}

.content-section table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.content-section th,
.content-section td {
  border: 1px solid var(--c-black);
  padding: 0.6rem 0.8rem;
  text-align: left;
}

.content-section th {
  background: var(--c-black);
  color: var(--c-white);
  font-weight: 700;
}

.content-section a {
  border-bottom: 1px solid var(--c-black);
  transition: background 200ms ease, color 200ms ease;
}

.content-section a:hover {
  background: var(--c-black);
  color: var(--c-white);
}

/* ============================================================
   页脚
   ============================================================ */
.site-footer {
  border-top: 2px solid var(--c-black);
  background: var(--c-black);
  color: var(--c-white);
  padding: 1.5rem var(--gap);
}

.footer-inner {
  display: flex;
  align-items: center;
  max-width: var(--max-w);
  margin: 0 auto;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.footer-brand {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
  flex-shrink: 0;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  flex: 1;
}

.footer-nav a {
  font-size: 0.8rem;
  font-weight: 400;
  padding: 0.5rem 0.75rem;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  opacity: 0.7;
  border-right: 1px solid rgba(255,255,255,0.15);
  transition: opacity 200ms ease;
  white-space: nowrap;
}

.footer-nav a:last-child {
  border-right: none;
}

.footer-nav a:hover,
.footer-nav a:focus-visible {
  opacity: 1;
  outline: none;
}

.footer-copy {
  font-size: 0.75rem;
  font-weight: 300;
  opacity: 0.5;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ============================================================
   动效：列表交错淡入 + 悬停微交互
   ============================================================ */
@media (prefers-reduced-motion: no-preference) {
  .content-section > article {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 400ms ease, transform 400ms ease;
  }

  .content-section > article.is-visible {
    opacity: 1;
    transform: none;
  }

  .sidebar-link {
    transition: background 200ms ease, padding-left 200ms ease, color 200ms ease;
  }

  .nav-links a {
    transition: background 220ms ease, color 220ms ease;
  }

  .footer-nav a {
    transition: opacity 200ms ease;
  }
}

@media (prefers-reduced-motion: reduce) {
  .content-section > article {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ============================================================
   移动端断点
   ============================================================ */
@media (max-width: 900px) {
  .page-body {
    grid-template-columns: 1fr;
    padding: 2rem 1rem;
  }

  .sidebar {
    position: static;
    order: -1;
  }

  .sidebar-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .sidebar-label {
    grid-column: 1 / -1;
  }

  .sidebar nav {
    grid-column: 1 / -1;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .sidebar-link {
    flex: 1 1 auto;
    min-width: 120px;
    border-bottom: none;
    border: 1px solid var(--c-gray-200);
  }

  .sidebar-dot-deco {
    grid-column: 1 / -1;
  }

  .hero-inner {
    text-align: left;
    padding: 2rem 1rem 2.5rem;
  }

  .hero-sub {
    margin-left: 0;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .footer-nav {
    gap: 0;
  }
}

@media (max-width: 600px) {
  :root {
    --gap: 1rem;
  }

  .header-inner {
    grid-template-columns: auto 1fr;
    gap: 0.5rem;
    padding: 0 1rem;
  }

  .nav-links a {
    font-size: 0.78rem;
    padding: 0 0.6rem;
    letter-spacing: 0;
  }

  .hero {
    min-height: 40vh;
  }

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

  .content-section h2 {
    font-size: 1.25rem;
  }

  .content-section > article {
    padding: 2rem 0 1.5rem;
  }

  .sidebar-inner {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   scroll-margin-top 用于 article[id]（单页锚点补偿）
   ============================================================ */
article[id] {
  scroll-margin-top: calc(var(--nav-h) + 1.5rem);
}
