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

/* ============================================================
   CSS 自定义属性 & 重置
   ============================================================ */
:root {
  --c-bg: #1f1f1f;
  --c-surface: #2a2a2a;
  --c-surface-2: #333333;
  --c-white: #ffffff;
  --c-off-white: #f5f5f5;
  --c-text: #e8e8e8;
  --c-text-muted: #999999;
  --c-border: rgba(255,255,255,0.08);
  --c-accent: #ffffff;
  --c-glass: rgba(255,255,255,0.06);
  --c-glass-border: rgba(255,255,255,0.12);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.5), 0 2px 4px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.6), 0 4px 8px rgba(0,0,0,0.4);
  --shadow-xl: 0 20px 60px rgba(0,0,0,0.7), 0 8px 16px rgba(0,0,0,0.5);
  --radius: 10px;
  --header-h: 64px;
  --topbar-h: 36px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --transition: 0.25s cubic-bezier(0.4,0,0.2,1);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
  background: var(--c-bg);
  color: var(--c-text);
}

body {
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--c-bg);
}

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

a {
  color: var(--c-white);
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

/* ============================================================
   滚动锚点补偿
   ============================================================ */
section[id] {
  scroll-margin-top: calc(var(--header-h) + var(--topbar-h) + 8px);
}

/* ============================================================
   站点外层
   ============================================================ */
.site-wrapper {
  position: relative;
  z-index: 1;
}

/* ============================================================
   顶部公告条
   ============================================================ */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--topbar-h);
  background: rgba(20,20,20,0.95);
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.topbar-text {
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  color: var(--c-text-muted);
  text-align: center;
  padding: 0 16px;
}

/* ============================================================
   顶部导航
   ============================================================ */
.site-header {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  right: 0;
  z-index: 99;
  height: var(--header-h);
  background: rgba(31,31,31,0.92);
  border-bottom: 1px solid var(--c-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-md);
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  gap: 16px;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.header-nav--right {
  justify-content: flex-end;
}

.nav-anchor {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--c-text-muted);
  padding: 8px 10px;
  min-height: 40px;
  display: flex;
  align-items: center;
  border-radius: 6px;
  letter-spacing: 0.03em;
  transition: color var(--transition), background var(--transition);
  white-space: nowrap;
}

.nav-anchor:hover {
  color: var(--c-white);
  background: var(--c-glass);
}

.header-brand {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-link {
  display: flex;
  align-items: center;
}

.brand-logo {
  height: 36px;
  width: auto;
}

.brand-text {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--c-white);
  letter-spacing: 0.05em;
  white-space: nowrap;
}

/* 汉堡按钮 */
.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  background: var(--c-glass);
  border: 1px solid var(--c-glass-border);
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition);
}

.hamburger:hover {
  background: rgba(255,255,255,0.1);
}

.ham-line {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--c-white);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}

/* ============================================================
   全屏遮罩菜单
   ============================================================ */
.fullscreen-menu {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(10,10,10,0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.fullscreen-menu.is-open {
  opacity: 1;
  pointer-events: all;
}

.menu-close {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  background: var(--c-glass);
  border: 1px solid var(--c-glass-border);
  border-radius: 50%;
  color: var(--c-white);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}

.menu-close:hover {
  background: rgba(255,255,255,0.15);
}

.menu-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 480px;
  padding: 0 24px;
}

.menu-link {
  display: block;
  width: 100%;
  text-align: center;
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--c-text);
  padding: 16px 24px;
  min-height: 52px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  background: var(--c-glass);
  letter-spacing: 0.04em;
  transition: color var(--transition), background var(--transition), border-color var(--transition), transform var(--transition);
}

.menu-link:hover {
  color: var(--c-white);
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.2);
  transform: translateY(-2px);
}

/* ============================================================
   Hero
   ============================================================ */
.hero {
  position: relative;
  width: 100%;
  height: 45vh;
  min-height: 280px;
  margin-top: calc(var(--topbar-h) + var(--header-h));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 30% 50%, rgba(80,80,80,0.3) 0%, transparent 60%),
    radial-gradient(ellipse at 70% 30%, rgba(60,60,60,0.2) 0%, transparent 50%),
    linear-gradient(160deg, #2a2a2a 0%, #1a1a1a 50%, #111 100%);
  z-index: 1;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(31,31,31,0.3) 0%, rgba(31,31,31,0.6) 100%);
  z-index: 2;
}

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

.hero-title {
  font-size: clamp(1.8rem, 5vw, 3rem);
  font-weight: 600;
  color: var(--c-white);
  letter-spacing: 0.04em;
  line-height: 1.2;
  margin-bottom: 12px;
  text-shadow: 0 2px 20px rgba(0,0,0,0.8);
}

.hero-sub {
  font-size: clamp(0.9rem, 2vw, 1.05rem);
  color: rgba(255,255,255,0.7);
  margin-bottom: 28px;
  font-weight: 300;
  line-height: 1.6;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 36px;
  background: var(--c-white);
  color: var(--c-bg);
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius);
  letter-spacing: 0.05em;
  box-shadow: var(--shadow-lg);
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
}

.hero-cta:hover {
  background: var(--c-off-white);
  transform: translateY(-3px) translateZ(0);
  box-shadow: var(--shadow-xl);
}

/* ============================================================
   主体布局
   ============================================================ */
.site-main {
  position: relative;
  z-index: 2;
  padding: 48px 0 80px;
}

.wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

.content-section {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 32px;
  align-items: start;
}

/* ============================================================
   侧边栏（内容左侧）
   ============================================================ */
.sidebar {
  position: sticky;
  top: calc(var(--topbar-h) + var(--header-h) + 24px);
  z-index: 3;
}

.sidebar-inner {
  background: var(--c-glass);
  border: 1px solid var(--c-glass-border);
  border-radius: var(--radius);
  padding: 24px 20px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: var(--shadow-md);
  transform: translateZ(0);
}

.aside-eyebrow {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--c-text-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.sidebar-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--c-white);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--c-border);
}

.sidebar-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 6px 10px;
  font-size: 0.82rem;
  color: var(--c-text-muted);
  border-radius: 6px;
  transition: color var(--transition), background var(--transition);
}

.sidebar-link:hover {
  color: var(--c-white);
  background: rgba(255,255,255,0.07);
}

.sidebar-tip {
  margin-top: 20px;
  padding: 14px;
  background: rgba(255,255,255,0.04);
  border-radius: 8px;
  border: 1px solid var(--c-border);
}

.sidebar-tip p {
  font-size: 0.78rem;
  color: var(--c-text-muted);
  line-height: 1.5;
  margin-top: 4px;
}

/* ============================================================
   主文章区
   ============================================================ */
.main-article {
  min-width: 0;
  position: relative;
  z-index: 2;
}

.page-content {
  position: relative;
}

/* page.content 内部通用样式 */
.page-content h2 {
  font-size: clamp(1.2rem, 2.5vw, 1.6rem);
  font-weight: 600;
  color: var(--c-white);
  margin: 48px 0 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--c-border);
  letter-spacing: 0.02em;
}

.page-content h2:first-child {
  margin-top: 0;
}

.page-content h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--c-off-white);
  margin: 32px 0 12px;
}

.page-content p {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--c-text);
  margin-bottom: 16px;
}

.page-content ul, .page-content ol {
  padding-left: 0;
  margin-bottom: 20px;
}

.page-content ul li, .page-content ol li {
  list-style: none;
  padding: 6px 0 6px 20px;
  font-size: 0.95rem;
  color: var(--c-text);
  line-height: 1.7;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  position: relative;
}

.page-content ul li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--c-text-muted);
  font-weight: 300;
}

.page-content a {
  color: rgba(255,255,255,0.85);
  border-bottom: 1px solid rgba(255,255,255,0.2);
  transition: border-color var(--transition), color var(--transition);
}

.page-content a:hover {
  color: var(--c-white);
  border-bottom-color: var(--c-white);
}

.page-content section {
  margin-bottom: 56px;
  padding: 32px;
  background: var(--c-glass);
  border: 1px solid var(--c-glass-border);
  border-radius: var(--radius);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: var(--shadow-md);
  position: relative;
  z-index: 2;
  transform: translateZ(0);
  transition: box-shadow var(--transition), transform var(--transition);
}

.page-content section:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px) translateZ(0);
}

.page-content section:last-child {
  margin-bottom: 0;
}

.page-content strong {
  color: var(--c-white);
  font-weight: 600;
}

.page-content em {
  color: var(--c-text-muted);
  font-style: italic;
}

.page-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
  font-size: 0.9rem;
}

.page-content th {
  background: rgba(255,255,255,0.06);
  color: var(--c-white);
  font-weight: 600;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--c-border);
}

.page-content td {
  padding: 9px 14px;
  color: var(--c-text);
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

/* small 眉题紧邻 h2/h3 */
.page-content small + h2,
.page-content small + h3 {
  margin-top: 4px;
}

.page-content > small,
.page-content section > small {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--c-text-muted);
  text-transform: uppercase;
  margin-top: 32px;
}

/* ============================================================
   页脚
   ============================================================ */
.site-footer {
  position: relative;
  z-index: 2;
  background: rgba(15,15,15,0.95);
  border-top: 1px solid var(--c-border);
  padding: 40px 24px 32px;
  text-align: center;
}

/* footer 导航 dl 结构（契约要求：footer > nav > dl > dt/dd > a） */
.footer-nav-dl {
  margin-bottom: 28px;
}

.footer-dl {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 0;
  max-width: 800px;
  margin: 0 auto;
}

.footer-dl dt {
  display: inline;
}

.footer-dl-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 14px;
  font-size: 0.8rem;
  color: var(--c-text-muted);
  border-radius: 6px;
  transition: color var(--transition), background var(--transition);
  letter-spacing: 0.03em;
}

.footer-dl-link:hover {
  color: var(--c-white);
  background: var(--c-glass);
}

.footer-copy {
  font-size: 0.82rem;
  color: var(--c-text-muted);
  margin-bottom: 8px;
}

.footer-note {
  display: block;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.3);
  line-height: 1.5;
  max-width: 560px;
  margin: 0 auto;
}

/* ============================================================
   深度层叠装饰（Dimensional Layering）
   ============================================================ */
.site-wrapper::before {
  content: '';
  position: fixed;
  top: -20%;
  right: -10%;
  width: 60vw;
  height: 60vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(80,80,80,0.06) 0%, transparent 70%);
  z-index: 0;
  pointer-events: none;
  transform: translateZ(0);
}

.site-wrapper::after {
  content: '';
  position: fixed;
  bottom: -10%;
  left: -10%;
  width: 50vw;
  height: 50vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(60,60,60,0.05) 0%, transparent 70%);
  z-index: 0;
  pointer-events: none;
  transform: translateZ(0);
}

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 900px) {
  .content-section {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .sidebar-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }

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

  .aside-eyebrow:first-child {
    grid-column: 1 / -1;
  }

  .sidebar-list {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .sidebar-link {
    font-size: 0.8rem;
    padding: 5px 10px;
  }

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

  .header-nav {
    display: none;
  }
}

@media (max-width: 600px) {
  :root {
    --header-h: 56px;
    --topbar-h: 32px;
  }

  .header-inner {
    padding: 0 16px;
  }

  .hero {
    height: 45vh;
    min-height: 260px;
  }

  .hero-title {
    font-size: 1.6rem;
  }

  .hero-sub {
    font-size: 0.88rem;
  }

  .wrap {
    padding: 0 16px;
  }

  .site-main {
    padding: 32px 0 60px;
  }

  .page-content section {
    padding: 20px 16px;
  }

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

  .footer-dl {
    gap: 0;
  }

  .footer-dl-link {
    padding: 8px 10px;
    font-size: 0.75rem;
  }

  .menu-link {
    font-size: 1.05rem;
    padding: 14px 20px;
  }
}

/* ============================================================
   视差 & 动效（prefers-reduced-motion 安全）
   ============================================================ */
@media (prefers-reduced-motion: no-preference) {
  .page-content section {
    animation: fadeUp 0.5s ease both;
  }

  .page-content section:nth-child(2) { animation-delay: 0.05s; }
  .page-content section:nth-child(3) { animation-delay: 0.1s; }
  .page-content section:nth-child(4) { animation-delay: 0.15s; }
  .page-content section:nth-child(5) { animation-delay: 0.2s; }
  .page-content section:nth-child(6) { animation-delay: 0.25s; }
  .page-content section:nth-child(7) { animation-delay: 0.3s; }

  @keyframes fadeUp {
    from {
      opacity: 0;
      transform: translateY(20px) translateZ(0);
    }
    to {
      opacity: 1;
      transform: translateY(0) translateZ(0);
    }
  }

  .hero-content {
    animation: heroIn 0.7s ease both;
  }

  @keyframes heroIn {
    from {
      opacity: 0;
      transform: translateY(30px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
