/* ==========================================================================
   OpenFold · 李运韬 个人主页 — 第一版（浅色主题）
   视觉语言参考 Apple 官网：SF Pro 字体栈、大标题、克制的动效
   保留修复：SVG 显式尺寸 / flex-shrink 保护 / 无大面积 blur / 项目链接按钮
   ========================================================================== */

:root {
  /* 色彩 */
  --c-text: #1d1d1f;
  --c-text-2: #6e6e73;
  --c-text-3: #86868b;
  --c-bg: #ffffff;
  --c-bg-alt: #f5f5f7;
  --c-accent: #0071e3;
  --c-accent-hover: #0077ed;
  --c-link: #0066cc;
  --c-hero-text: #f5f5f7;
  --c-hero-text-2: #a1a1a6;
  --c-card: #ffffff;
  --c-card-border: rgba(0, 0, 0, 0.08);
  --c-chip-bg: rgba(0, 113, 227, 0.08);
  --c-chip-text: #0071e3;
  --c-shadow-card: 0 4px 24px rgba(0, 0, 0, 0.04);

  /* 字体：系统栈（第一版方案；Anthropic 字体见 backups/v2-serif-deck-*） */
  --font-sans: "SF Pro SC", "SF Pro Text", "SF Pro Icons", "PingFang SC",
    "Helvetica Neue", Helvetica, Arial, sans-serif;

  /* 缓动（Apple 风格自定义曲线） */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);

  /* 布局 */
  --max-width: 1080px;
  --section-pad: clamp(72px, 10vw, 128px);
  --radius-card: 24px;
  --radius-btn: 980px;
}

/* ---------- 基础 ---------- */

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

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

/* 锚点落点避开悬浮导航栏 — Apple 同款方案：
   scroll-margin-top 设在目标上（scrollIntoView 与锚点跳转全兼容；
   52px 导航高 + 1px 边线 + 23px 呼吸空间）。注意不要同时在 html 上设
   scroll-padding，两者会叠加导致落点过低 */
section[id] { scroll-margin-top: 76px; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.65;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.015em; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
strong { font-weight: 600; }

img, svg { display: block; max-width: 100%; }

:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection { background: rgba(0, 113, 227, 0.18); }

.section-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 22px;
}

/* ---------- 眉标与标题 ---------- */

.eyebrow {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--c-accent);
  margin-bottom: 14px;
}

.section { padding: var(--section-pad) 0; background: var(--c-bg); }
.section-alt { background: var(--c-bg-alt); }
.section-contact { text-align: center; background: var(--c-bg-alt); }

.section-title {
  font-size: clamp(30px, 4.6vw, 48px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: clamp(32px, 5vw, 56px);
}

/* ---------- 顶部导航 ---------- */

.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  background: rgba(251, 251, 253, 0.8);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(0, 0, 0, 0);
  transition: border-color 0.36s var(--ease-out);
}

.nav-scrolled { border-bottom-color: rgba(0, 0, 0, 0.08); }

.nav-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 22px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.nav-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.nav-logo-mark { width: 20px; height: 20px; flex-shrink: 0; color: var(--c-accent); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
}

.nav-links a {
  display: inline-block;
  padding: 6px 12px;
  border-radius: var(--radius-btn);
  color: rgba(29, 29, 31, 0.82);
  transition: color 0.24s var(--ease-out), background-color 0.24s var(--ease-out);
}

.nav-links a:hover { color: var(--c-text); background: rgba(0, 0, 0, 0.05); }

.nav-links a:active { transform: scale(0.97); }

.nav-cta {
  background: var(--c-accent);
  color: #fff !important;
}

.nav-cta:hover { background: var(--c-accent-hover) !important; color: #fff !important; }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 8px;
  background: none;
  border: 0;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  height: 1.6px;
  width: 100%;
  background: var(--c-text);
  border-radius: 2px;
  transition: transform 0.32s var(--ease-out), opacity 0.32s var(--ease-out);
}

.menu-open .nav-toggle span:first-child { transform: translateY(3.3px) rotate(45deg); }
.menu-open .nav-toggle span:last-child { transform: translateY(-3.3px) rotate(-45deg); }

/* ---------- Hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  background: #000;
  color: var(--c-hero-text);
  padding: calc(var(--section-pad) + 72px) 0 var(--section-pad);
  text-align: center;
}

.hero-bg { position: absolute; inset: 0; pointer-events: none; }

.hero-glow {
  position: absolute;
  width: 60vmax;
  height: 60vmax;
  border-radius: 50%;
  opacity: 0.34;
  /* 无 filter:blur —— radial-gradient 自带渐隐；大面积模糊层是滚动卡顿首因 */
}

.hero-glow-a {
  top: -24vmax;
  left: -12vmax;
  background: radial-gradient(circle at center, #0a84ff 0%, transparent 62%);
  animation: drift-a 26s var(--ease-in-out) infinite alternate;
}

.hero-glow-b {
  bottom: -28vmax;
  right: -14vmax;
  background: radial-gradient(circle at center, #bf5af2 0%, transparent 62%);
  animation: drift-b 32s var(--ease-in-out) infinite alternate;
}

@keyframes drift-a { to { transform: translate(9vmax, 7vmax) scale(1.12); } }
@keyframes drift-b { to { transform: translate(-8vmax, -6vmax) scale(1.08); } }

.hero-fold {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.fold-path {
  stroke: rgba(255, 255, 255, 0.16);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-dasharray: 3000;
  stroke-dashoffset: 3000;
  animation: unfold 3.2s var(--ease-out) 0.25s forwards;
}

@keyframes unfold { to { stroke-dashoffset: 0; } }

.hero-inner { position: relative; }

.hero .eyebrow { color: #64d2ff; }

.hero-title {
  font-size: clamp(56px, 10vw, 108px);
  line-height: 1.06;
  letter-spacing: 0.01em;
  font-weight: 800;
  margin: 4px 0 18px;
  background: linear-gradient(180deg, #ffffff 30%, rgba(255, 255, 255, 0.62));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-sub {
  font-size: clamp(19px, 2.6vw, 26px);
  font-weight: 600;
  color: var(--c-hero-text);
  margin-bottom: 22px;
}

.hero-lede {
  font-size: clamp(16px, 1.8vw, 19px);
  line-height: 1.75;
  color: var(--c-hero-text-2);
  max-width: 620px;
  margin: 0 auto 36px;
}

.hero-br { display: inline; }

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

/* ---------- 按钮 ---------- */

.btn {
  display: inline-block;
  padding: 13px 28px;
  border-radius: var(--radius-btn);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: transform 0.24s var(--ease-out), background-color 0.24s var(--ease-out),
    border-color 0.24s var(--ease-out), box-shadow 0.24s var(--ease-out);
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--c-accent);
  color: #fff;
  box-shadow: 0 8px 24px rgba(0, 113, 227, 0.35);
}

.btn-primary:hover { background: var(--c-accent-hover); }

.btn-ghost {
  border: 1px solid rgba(255, 255, 255, 0.32);
  color: var(--c-hero-text);
}

.btn-ghost:hover { border-color: rgba(255, 255, 255, 0.6); }

/* ---------- 简介 ---------- */

.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 64px);
  align-items: start;
}

.about-text p + p { margin-top: 1.1em; }
.about-text { font-size: 18px; color: var(--c-text); }
.about-text strong { color: var(--c-accent); font-weight: 600; }

/* ---------- 兴趣与技能标签 ---------- */

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip-list li {
  padding: 7px 16px;
  border-radius: var(--radius-btn);
  background: var(--c-chip-bg);
  color: var(--c-chip-text);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}

#about .chip-list { margin-top: 10px; }

/* ---------- 研究项目 ---------- */

.project {
  background: var(--c-card);
  border: 1px solid var(--c-card-border);
  border-radius: var(--radius-card);
  padding: clamp(26px, 4vw, 40px);
  box-shadow: var(--c-shadow-card);
  transition: transform 0.4s var(--ease-out), box-shadow 0.4s var(--ease-out);
}

.project:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.08);
}

.project-featured {
  margin-bottom: 24px;
  background: linear-gradient(135deg, #ffffff 0%, #f2f7fd 100%);
  border-color: rgba(0, 113, 227, 0.14);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.project-meta {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--c-accent);
  margin-bottom: 10px;
}

.project-title {
  font-size: clamp(19px, 2.2vw, 23px);
  line-height: 1.35;
  letter-spacing: -0.015em;
  margin-bottom: 16px;
}

.project-points { display: grid; gap: 10px; }

.project-points li {
  position: relative;
  padding-left: 20px;
  font-size: 15.5px;
  line-height: 1.7;
  color: var(--c-text-2);
}

.project-points li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.62em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c-accent);
  opacity: 0.55;
}

.project-points strong { color: var(--c-text); font-weight: 600; }

/* ---------- 项目链接按钮（浅色） ---------- */

.card-link-row { margin-top: 24px; }

.card-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-btn);
  font-size: 14px;
  font-weight: 500;
  color: var(--c-accent);
  background: var(--c-chip-bg);
  box-shadow: inset 0 0 0 1px rgba(0, 113, 227, 0.22);
  transition: background-color 0.24s var(--ease-out), box-shadow 0.24s var(--ease-out),
    transform 0.16s ease-out;
}

.card-link:hover {
  background: rgba(0, 113, 227, 0.14);
  box-shadow: inset 0 0 0 1px rgba(0, 113, 227, 0.38);
}

.card-link:active { transform: scale(0.97); }

.card-link svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  transition: transform 0.28s var(--ease-out);
}

.card-link:hover svg { transform: translate(2px, -2px); }

/* ---------- 教育时间线 ---------- */

.timeline {
  position: relative;
  max-width: 720px;
  padding-left: 30px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 10px;
  bottom: 10px;
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--c-accent), rgba(0, 113, 227, 0.12));
}

.timeline-item { position: relative; padding: 0 0 40px 18px; }
.timeline-item:last-child { padding-bottom: 0; }

.timeline-dot {
  position: absolute;
  left: -30px;
  top: 7px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--c-bg);
  border: 3px solid var(--c-accent);
}

.timeline-period {
  font-size: 14px;
  font-weight: 600;
  color: var(--c-text-3);
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.timeline-title { font-size: 20px; margin-bottom: 6px; letter-spacing: -0.01em; }

.timeline-desc { color: var(--c-text-2); font-size: 16px; }

/* ---------- 荣誉 ---------- */

.honors-list { display: grid; gap: 14px; max-width: 820px; }

.honor {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  align-items: baseline;
  gap: 18px;
  padding: 20px 26px;
  background: var(--c-card);
  border: 1px solid var(--c-card-border);
  border-radius: 18px;
  transition: transform 0.36s var(--ease-out), box-shadow 0.36s var(--ease-out);
}

.honor:hover { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06); }

.honor-year { font-size: 15px; font-weight: 700; color: var(--c-text-3); }

.honor-name { font-size: 16.5px; }

.honor-grade {
  font-size: 14px;
  font-weight: 600;
  color: var(--c-chip-text);
  background: var(--c-chip-bg);
  padding: 4px 14px;
  border-radius: var(--radius-btn);
  white-space: nowrap;
}

/* ---------- 技能 ---------- */

.skills-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.skill-group {
  background: var(--c-card);
  border: 1px solid var(--c-card-border);
  border-radius: var(--radius-card);
  padding: 28px 30px;
  box-shadow: var(--c-shadow-card);
}

.skill-group-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--c-text-2);
  margin-bottom: 16px;
}

/* ---------- 联系 ---------- */

.section-contact .section-title { margin-bottom: 12px; }

.contact-lede {
  color: var(--c-text-2);
  font-size: 17px;
  max-width: 480px;
  margin: 0 auto clamp(32px, 5vw, 48px);
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  max-width: 720px;
  margin: 0 auto;
}

.contact-card {
  display: grid;
  gap: 6px;
  padding: 26px 24px;
  background: var(--c-card);
  border: 1px solid var(--c-card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--c-shadow-card);
  transition: transform 0.36s var(--ease-out), box-shadow 0.36s var(--ease-out),
    border-color 0.36s var(--ease-out);
}

.contact-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.08);
  border-color: rgba(0, 113, 227, 0.3);
}

.contact-card:active { transform: scale(0.98); }

/* 联系区（第一版：系统 Sans） */
.contact-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-accent);
}

.contact-value { font-size: 16px; font-weight: 500; word-break: break-all; }

/* ---------- 页脚（含备案号） ---------- */

.footer {
  background: var(--c-bg-alt);
  border-top: 1px solid rgba(0, 0, 0, 0.07);
  padding: 28px 0;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--c-text-3);
}

.footer-copy { margin: 0; }

/* 两个备案号并排，整行与版权文字同高对齐 */
.footer-icp {
  margin: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px;
}

.footer-icp a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--c-text-3);
  transition: color 0.24s var(--ease-out);
}

.footer-icp a:hover { color: var(--c-link); }

/* 备案徽标：内联于编号前，与文字视觉居中 */
.icp-badge {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  display: block;
}

/* ---------- 滚动显现 ---------- */

.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* 逐项错峰 */
.hero .reveal:nth-child(2) { transition-delay: 0.08s; }
.hero .reveal:nth-child(3) { transition-delay: 0.16s; }
.hero .reveal:nth-child(4) { transition-delay: 0.24s; }
.hero .reveal:nth-child(5) { transition-delay: 0.32s; }

.project-grid .reveal:nth-child(2) { transition-delay: 0.1s; }
.skills-grid .reveal:nth-child(2) { transition-delay: 0.08s; }
.skills-grid .reveal:nth-child(3) { transition-delay: 0.16s; }
.skills-grid .reveal:nth-child(4) { transition-delay: 0.24s; }
.contact-grid .reveal:nth-child(2) { transition-delay: 0.1s; }
.timeline .reveal:nth-child(2) { transition-delay: 0.12s; }

/* ---------- 响应式 ---------- */

@media (max-width: 900px) {
  .about-grid { grid-template-columns: 1fr; }
  .project-grid { grid-template-columns: 1fr; }
  .skills-grid { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
}

@media (max-width: 734px) {
  body { font-size: 16px; }

  /* Apple 移动端规范：内容列 420px + 20px 边距（--global-content-max-width 实测值） */
  .section-inner { max-width: 420px; margin: 0 auto; padding: 0 20px; }

  /* 导航 48px（Apple globalnav 移动端实测高度） */
  .nav-inner { height: 48px; padding: 0 20px; }

  .nav-toggle {
    display: flex;
    width: 44px;                                   /* Apple HIG 触控目标 ≥44px */
    height: 44px;
  }

  .nav-links {
    position: absolute;
    top: 48px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    padding: 8px 20px 16px;
    background: rgba(251, 251, 253, 0.96);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    font-size: 15px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.32s var(--ease-out), transform 0.32s var(--ease-out),
      visibility 0.32s;
  }

  .menu-open .nav-links {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .nav-links a { padding: 12px 14px; min-height: 44px; display: flex; align-items: center; }
  .nav-cta { text-align: center; margin-top: 6px; justify-content: center; }

  /* 分区纵向节奏收紧（Apple 移动端 section padding） */
  .section { padding: 72px 0; }
  .section-title { font-size: clamp(28px, 8.4vw, 34px); }

  .hero { padding: calc(72px + 48px) 0 72px; }
  .hero-title { font-size: clamp(44px, 13vw, 56px); }
  .hero-sub { font-size: 19px; }
  .hero-br { display: none; }
  .hero-lede { font-size: 16px; margin-bottom: 30px; }
  .btn { width: 100%; max-width: 320px; }

  .about-text { font-size: 17px; }

  .project { padding: 22px 20px; }
  .project-featured { margin-bottom: 16px; }
  .project-grid { gap: 16px; }

  .timeline { padding-left: 24px; }
  .timeline-item { padding-bottom: 28px; }

  .honor { grid-template-columns: 1fr; gap: 8px; padding: 18px 20px; }
  .honor-grade { justify-self: start; }

  .skill-group { padding: 22px 20px; }

  .contact-card { padding: 22px 20px; }

  .footer-inner { justify-content: center; text-align: center; padding: 0 20px; }
}

/* ---------- 减少动态 ---------- */

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

  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .hero-glow { animation: none; }
  .fold-path { animation: none; stroke-dashoffset: 0; }

  .btn, .project, .honor, .contact-card, .nav, .nav-links a,
  .card-link, .card-link svg {
    transition: none;
  }
}
