:root {
  /* 色板 */
  --color-dark: #141838;
  --color-paper: #FCFCFD;
  --color-text: #151723;
  --color-brand: #142CEB;
  --color-accent: #6EAFED;
  /* 结构性约束 */
  --radius-card: 8px;
  --radius-btn: 6px;
  --card-border: 0;
  --card-shadow: none;
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 1120px;
  --line-height-body: 1.75;
  --font-weight-title: 800;
  --letter-spacing-title: -0.02em;
  --lh-title: 1.1;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  font-size: 16px;
  line-height: var(--line-height-body);
  color: var(--color-text);
  background-color: var(--color-paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 排版基础 */
h1, h2, h3, h4 { font-weight: var(--font-weight-title); letter-spacing: var(--letter-spacing-title); line-height: var(--lh-title); color: inherit; }
h1 { font-size: clamp(2.4rem, 6vw, 4.5rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: var(--gap); }
h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); margin-bottom: 1rem; }
p { max-width: 38em; margin-bottom: 1.2em; }
a { color: var(--color-brand); text-decoration: underline; text-underline-offset: 2px; }
ul, ol { margin-left: 1.5rem; margin-bottom: 1.2em; }
li { margin-bottom: 0.5em; }

/* 面与卡片 */
.dark-face { background-color: var(--color-dark); }
.dark-face h1, .dark-face h2, .dark-face h3, .dark-face p, .dark-face li, .dark-face td, .dark-face th { color: var(--color-paper); }
.dark-face a { color: var(--color-accent); }
.paper-card {
  background-color: rgba(255, 255, 255, 0.65);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  border: var(--card-border);
  box-shadow: var(--card-shadow);
}
.light-paper { background-color: #F4F5F7; }

/* 容器与区块 */
.container { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--gap); }
section { padding-top: var(--section-y); padding-bottom: var(--section-y); }

/* 眉标与高亮 */
.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
}
.paper-face .eyebrow { color: var(--color-brand); }
.dark-face .eyebrow { color: var(--color-accent); }
.hl { color: var(--color-brand); }
.dark-face .hl { color: var(--color-accent); }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 1.25rem;
  height: 48px;
  border-radius: var(--radius-btn);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
  border: none;
}
.btn-primary { background-color: var(--color-accent); color: var(--color-dark); }
.btn-secondary { background: transparent; border: 1px solid var(--color-text); color: var(--color-text); }
.dark-face .btn-secondary { border-color: var(--color-paper); color: var(--color-paper); }
.btn:hover { transform: translateY(-2px); }
.btn:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* 网格布局 */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); }

/* 表格 */
table { width: 100%; max-width: 100%; table-layout: fixed; border-collapse: collapse; margin: 1.5rem 0; font-size: 0.95rem; }
th, td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid rgba(0,0,0,0.1); word-break: break-word; overflow-wrap: anywhere; }
th { font-weight: 700; }
.dark-face th, .dark-face td { border-color: rgba(255,255,255,0.12); }
td:first-child { font-weight: 600; }

/* FAQ */
details { margin-bottom: 1rem; border-bottom: 1px solid rgba(0,0,0,0.1); padding-bottom: 1rem; }
summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; align-items: center; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font-size: 1.2rem; transition: transform 0.2s; }
details[open] summary::after { transform: rotate(45deg); }
.dark-face details { border-color: rgba(255,255,255,0.15); }
details > div { margin-top: 0.75rem; line-height: 1.7; }

/* 页头页脚 */
header { position: sticky; top: 0; z-index: 100; background: var(--color-paper); border-bottom: 1px solid rgba(0,0,0,0.06); }
.header-inner { display: flex; justify-content: space-between; align-items: center; height: 64px; }
.logo-img { height: 32px; width: auto; display: block; }
nav ul { display: flex; gap: 1.5rem; list-style: none; }
nav a { color: var(--color-text); text-decoration: none; font-weight: 500; }
nav a[aria-current="page"] { color: var(--color-brand); }
footer { background: var(--color-dark); color: var(--color-paper); padding: 2rem 0; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; }
.footer-links { display: flex; gap: 1.5rem; list-style: none; }
.footer-links a { color: var(--color-paper); text-decoration: none; opacity: 0.85; }
.footer-links a:hover { opacity: 1; }

/* 杂志长文侧栏 */
.magazine-layout { display: grid; grid-template-columns: 1fr 240px; gap: var(--gap); }
.toc-nav { position: sticky; top: 80px; align-self: start; }
.toc-nav h4 { font-size: 0.9rem; font-weight: 700; margin-bottom: 0.75rem; opacity: 0.7; }
.toc-nav ul { list-style: none; margin: 0; }
.toc-nav li { margin-bottom: 0.6rem; }
.toc-nav a { color: var(--color-text); text-decoration: none; font-size: 0.9rem; }
.toc-nav a:hover { color: var(--color-brand); }
.dark-face .toc-nav a { color: var(--color-paper); }

/* 时间线 */
.timeline { position: relative; padding-left: 2rem; border-left: 2px solid rgba(0,0,0,0.1); }
.dark-face .timeline { border-color: rgba(255,255,255,0.15); }
.timeline-item { position: relative; margin-bottom: 2rem; }
.timeline-item::before {
  content: attr(data-step);
  position: absolute; left: -2.6rem; top: 0;
  width: 28px; height: 28px;
  background: var(--color-accent); color: var(--color-dark);
  border-radius: 6px; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem;
}

/* 提示框 */
.callout {
  border-left: 4px solid var(--color-brand);
  background: rgba(20, 44, 235, 0.06);
  padding: 1rem 1.25rem;
  border-radius: 0 var(--radius-card) var(--radius-card) 0;
  margin: 1.5rem 0;
}
.dark-face .callout { border-left-color: var(--color-accent); background: rgba(110, 175, 237, 0.1); }

/* SVG 基础与动效 */
svg { width: 100%; height: auto; max-width: 100%; overflow: visible; }
.anim-float { animation: float 6s ease-in-out infinite; }
.anim-pulse { animation: pulse 4s ease-in-out infinite; }
.anim-slide-in { animation: slideIn 5s ease-in-out infinite; }
.anim-draw-line { pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; animation: drawDash 4s ease-in-out infinite; }
.anim-twinkle { animation: twinkle 5s ease-in-out infinite; }
.anim-breathe { animation: breathe 4s ease-in-out infinite; }

@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes pulse { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }
@keyframes slideIn { 0%, 10% { transform: translateX(0); opacity: 0; } 15%, 85% { transform: translateX(0); opacity: 1; } 90%, 100% { transform: translateX(10px); opacity: 0; } }
@keyframes drawDash { 0% { stroke-dashoffset: 1; } 100% { stroke-dashoffset: 0; } }
@keyframes twinkle { 0%, 100% { opacity: 0.2; } 50% { opacity: 0.8; } }
@keyframes breathe { 0%, 100% { transform: scale(1); opacity: 0.6; } 50% { transform: scale(1.05); opacity: 1; } }

/* 旋转/缩放子元素修正 */
svg g, svg circle, svg rect, svg path { transform-box: fill-box; transform-origin: center; }

/* 减少动态效果 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* 响应式适配 */
@media (max-width: 900px) {
  .magazine-layout { grid-template-columns: 1fr; }
  .toc-nav { display: none; }
}
@media (max-width: 768px) {
  .header-inner { flex-direction: column; height: auto; padding: 0.75rem 0; gap: 0.5rem; }
  nav ul { gap: 1rem; flex-wrap: wrap; justify-content: center; }
  h1 { font-size: 2.2rem; }
  section { padding-top: calc(var(--section-y) * 0.7); padding-bottom: calc(var(--section-y) * 0.7); }
}
