/*
 * Andy Lab — Shared Design System
 * https://qinan.wang/shared/andy-lab.css
 *
 * 所有 Andy Lab 子页面引用此文件以保持视觉一致性。
 * 首页 (index.html) 为设计系统权威来源。
 * 最后更新: 2026-04-10
 */

/* ═══ 1. Design Tokens ═══ */
:root {
  /* 背景 */
  --bg: #FAF9F6;
  --bg-2: #F2F0EC;
  --bg-hover: #FFFFFF;

  /* 文字 */
  --ink: #1A1A1A;
  --ink-2: #4A4A4A;
  --ink-3: #7A7A7A;
  --ink-4: #ABABAB;

  /* 强调色 */
  --accent: #D4430A;
  --accent-light: #FFF0EB;
  --accent-glow: rgba(212,67,10,.08);
  --accent-gradient: linear-gradient(135deg, var(--accent), #FF6B3D);

  /* 分类色 */
  --c-research: var(--accent);
  --c-tool: #4A6A9C;
  --c-edu: #4A7C5F;

  /* 边框/分割 */
  --rule: #E5E3DF;
  --rule-light: #F0EDE8;

  /* 布局 */
  --max: 1080px;
  --max-narrow: 740px;
  --pad: clamp(20px, 5vw, 60px);
  --radius: 14px;

  /* 动效 */
  --ease: cubic-bezier(.16,1,.3,1);

  /* 字体族 */
  --font-display: 'Syne', sans-serif;
  --font-body: 'DM Sans', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

/* ═══ 2. Reset & Base ═══ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* 纸张纹理 */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  opacity: .25;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='.35'/%3E%3C/svg%3E");
  background-size: 200px 200px;
}

::selection { background: var(--accent); color: #fff; }
a { color: inherit; }

/* ═══ 3. Typography ═══ */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.2;
  color: var(--ink);
}

h1 { font-size: clamp(32px, 5vw, 52px); font-weight: 800; letter-spacing: -.035em; line-height: 1.08; }
h2 { font-size: clamp(22px, 3vw, 30px); }
h3 { font-size: clamp(16px, 2vw, 20px); font-weight: 600; }

code, .mono {
  font-family: var(--font-mono);
  font-size: 0.85em;
}

/* ═══ 4. Series Nav (子页面顶部导航条) ═══ */
.series-nav {
  position: sticky; top: 0; z-index: 200;
  background: rgba(250,249,246,.92);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border-bottom: 1px solid var(--rule);
}
.snav-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--pad);
  height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.snav-inner::-webkit-scrollbar { display: none; }

.snav-home {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: -.02em;
  transition: color .2s;
}
.snav-home:hover { color: var(--accent); }
.snav-home em { font-style: italic; color: var(--accent); font-weight: 400; }

.snav-sep {
  color: var(--accent);
  flex-shrink: 0;
  font-size: 14px;
}

.snav-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-3);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.snav-links {
  display: flex;
  list-style: none;
  gap: 0;
  margin-left: auto;
}
.snav-links a {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-4);
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
  transition: color .2s, background .2s;
}
.snav-links a:hover {
  color: var(--accent);
  background: var(--accent-glow);
}
.snav-links a.active {
  color: var(--accent);
  font-weight: 600;
  background: var(--accent-glow);
}

/* ═══ 5. Report Page Layout (报告页通用) ═══ */
.report-wrap {
  position: relative;
  z-index: 1;
  max-width: var(--max-narrow);
  margin: 0 auto;
  padding: 0 var(--pad);
}

/* Hero */
.report-hero {
  padding: clamp(48px, 8vh, 96px) 0 clamp(32px, 4vh, 48px);
  border-bottom: 1px solid var(--rule);
}
.report-hero-label {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 20px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.report-hero-label::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: labelPulse 2.5s ease-in-out infinite;
}
@keyframes labelPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .4; transform: scale(.7); }
}
.report-hero h1 { margin-bottom: 16px; }
.report-hero h1 em {
  font-style: italic;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.report-hero-lead {
  font-size: 16px;
  color: var(--ink-3);
  max-width: 560px;
  line-height: 1.8;
  margin-bottom: 24px;
}
.report-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.report-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  padding: 5px 14px;
  border-radius: 100px;
  border: 1px solid var(--rule);
  color: var(--ink-3);
  background: var(--bg);
}

/* TOC */
.report-toc {
  padding: 32px 0;
  border-bottom: 1px solid var(--rule);
}
.report-toc-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-4);
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: 16px;
}
.report-toc a {
  font-size: 14px;
  color: var(--ink-3);
  display: block;
  padding: 6px 0;
  text-decoration: none;
  transition: color .15s;
}
.report-toc a:hover { color: var(--accent); }
.report-toc a span {
  font-family: var(--font-mono);
  color: var(--ink-4);
  margin-right: 8px;
  font-size: 11px;
}

/* Section */
.report-section {
  padding: clamp(32px, 4vh, 48px) 0;
  border-bottom: 1px solid var(--rule);
}
.report-section:last-child { border-bottom: none; }

.report-section-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.report-section h2 { margin-bottom: 16px; }
.report-section p {
  font-size: 15px;
  color: var(--ink-2);
  line-height: 1.8;
  margin-bottom: 16px;
}

/* Callout / Highlight */
.report-callout {
  background: var(--bg-2);
  border-left: 3px solid var(--accent);
  padding: 16px 20px;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 20px 0;
}
.report-callout p {
  font-size: 14px;
  color: var(--ink-2);
  margin-bottom: 0;
}

/* Code Block */
.report-code {
  background: var(--ink);
  color: #E8E6E0;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  padding: 20px 24px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 16px 0;
}
.report-code .comment { color: #7A7A7A; }
.report-code .keyword { color: #FF6B3D; }
.report-code .string { color: #4A7C5F; }
.report-code .function { color: #4A6A9C; }

/* Table */
.report-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 14px;
}
.report-table th {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink-3);
  text-align: left;
  padding: 10px 16px;
  border-bottom: 2px solid var(--rule);
}
.report-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--rule-light);
  color: var(--ink-2);
}
.report-table tr:hover td { background: var(--accent-glow); }

/* Inline code */
.report-section code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-2);
  padding: 2px 7px;
  border-radius: 4px;
  color: var(--accent);
}

/* ═══ 6. Footer ═══ */
.report-footer {
  padding: clamp(32px, 4vh, 48px) 0;
  border-top: 1px solid var(--rule);
  text-align: center;
}
.report-footer p {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-4);
  line-height: 2;
}
.report-footer a {
  color: var(--ink-3);
  text-decoration: none;
  transition: color .15s;
}
.report-footer a:hover { color: var(--accent); }

/* ═══ 7. Utility Classes ═══ */
.fade-in {
  opacity: 0; transform: translateY(20px);
  transition: opacity .6s var(--ease), transform .6s var(--ease);
}
.fade-in.in { opacity: 1; transform: none; }
.fade-in-d1 { transition-delay: .05s; }
.fade-in-d2 { transition-delay: .1s; }
.fade-in-d3 { transition-delay: .15s; }

/* Back to Top */
.back-to-top {
  position: fixed; bottom: 28px; right: 28px; z-index: 90;
  width: 40px; height: 40px;
  background: var(--bg); border: 1px solid var(--rule); border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-3); cursor: pointer;
  opacity: 0; transform: translateY(12px);
  transition: all .3s var(--ease);
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
  text-decoration: none;
}
.back-to-top.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.back-to-top:hover {
  color: var(--accent); border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(212,67,10,.1);
}

/* Scroll Progress */
.scroll-progress {
  position: fixed; top: 0; left: 0; z-index: 300;
  height: 2px; width: 0%;
  background: var(--accent-gradient);
  transition: width .05s linear;
}

/* ═══ 8. Responsive ═══ */
@media (max-width: 860px) {
  .snav-inner { padding: 0 16px; }
  .snav-label { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ═══ 9. Common JS Helpers (data attributes) ═══ */
/*
 * 共享 JS: 滚动进度条 + 回到顶部 + fade-in 观察器
 * 在页面底部引入 /shared/andy-lab.js 即可自动激活
 */
