/* =====================================================================
   顾圣杰 · 学术主页 —— 精致排版 + 灵动光效的融合界面
   设计语言：白底 / 专业字体层级 / 青蓝紫粉渐变
   动效：流动光斑 / 鼠标柔光 / 渐变流光 / 3D 倾斜 / 错峰入场 / 数字滚动
   ===================================================================== */

:root {
  --bg: #FFFFFF;
  --bg-soft: #F6F8FC;
  --card: #FFFFFF;
  --line: #E4E8F0;
  --line-strong: #C9D2E3;
  --text: #0F172A;
  --text-dim: #475569;
  --text-faint: #94A3B8;
  --cyan: #06B6D4;
  --indigo: #6366F1;
  --violet: #A855F7;
  --pink: #EC4899;
  --grad: linear-gradient(120deg, #06B6D4 0%, #6366F1 55%, #A855F7 100%);
}

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

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Noto Sans SC', 'Space Grotesk', -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
::selection { background: rgba(99, 102, 241, .18); }

/* 背景网格（极淡） */
body::before {
  content: "";
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    linear-gradient(rgba(15, 23, 42, .04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, .04) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 30%, transparent 100%);
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 30%, transparent 100%);
}

/* 顶部氛围光晕（缓慢流动） */
body::after {
  content: "";
  position: fixed; top: -220px; left: 50%; transform: translateX(-50%);
  width: 900px; height: 480px; pointer-events: none; z-index: 0;
  background: radial-gradient(closest-side, rgba(99, 102, 241, .13), rgba(6, 182, 212, .10) 55%, transparent);
  filter: blur(40px);
  animation: haloFloat 16s ease-in-out infinite;
}
@keyframes haloFloat {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(24px); }
}

/* 漂浮光斑 */
.bg-blobs { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.blob {
  position: absolute; border-radius: 50%; filter: blur(100px); opacity: .3;
  animation: blobFloat 22s ease-in-out infinite;
}
.blob-1 { width: 480px; height: 480px; top: -12%; left: -6%; background: linear-gradient(135deg, #22d3ee, #6366f1); }
.blob-2 { width: 420px; height: 420px; top: 30%; right: -10%; background: linear-gradient(135deg, #a855f7, #ec4899); animation-delay: -8s; }
.blob-3 { width: 460px; height: 460px; bottom: -14%; left: 20%; background: linear-gradient(135deg, #6366f1, #22d3ee); animation-delay: -15s; }
@keyframes blobFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(44px, -32px) scale(1.1); }
  66% { transform: translate(-34px, 26px) scale(.95); }
}

/* 鼠标跟随柔光 */
.cursor-glow {
  position: fixed; top: 0; left: 0; width: 420px; height: 420px; border-radius: 50%;
  background: radial-gradient(circle, rgba(99, 102, 241, .12), transparent 70%);
  pointer-events: none; z-index: 0;
}

.wrap { position: relative; z-index: 1; max-width: 1080px; margin: 0 auto; padding: 0 28px; }

/* ===== 视图 ===== */
.view { display: none; padding: 56px 0 80px; }
.view.active { display: block; }

/* 错峰入场 */
.reveal { animation: fadeUp .55s cubic-bezier(.22, .61, .36, 1) both; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: none; }
}

/* 渐变流光 */
@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* ===== 导航 ===== */
nav {
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, .8);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: 1080px; margin: 0 auto; padding: 14px 28px;
  display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: var(--grad); color: #fff; font-size: 16px; font-weight: 600;
  box-shadow: 0 4px 14px rgba(99, 102, 241, .28);
  animation: pulse 3.2s ease-in-out infinite;
}
.brand-name { font-size: 15px; font-weight: 600; font-family: 'Space Grotesk', 'Noto Sans SC', sans-serif; }
.brand-name .s { color: var(--text-faint); font-weight: 400; margin-left: 8px; font-size: 12.5px; font-family: 'JetBrains Mono', monospace; }
.nav-links { display: flex; gap: 4px; align-items: center; }
.nav-links a {
  padding: 7px 14px; border-radius: 8px; font-size: 14px; color: var(--text-dim);
  transition: color .2s, background .2s; font-family: 'Space Grotesk', 'Noto Sans SC', sans-serif;
}
.nav-links a:hover { color: var(--text); background: rgba(15, 23, 42, .04); }
.nav-links a.active { color: #fff; background: var(--grad); font-weight: 500; box-shadow: 0 4px 14px rgba(99, 102, 241, .3); }
.nav-toggle { display: none; background: #fff; border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 8px 14px; cursor: pointer; font-size: 15px; }

/* ===== Hero ===== */
.hero { padding: 24px 0 40px; display: grid; grid-template-columns: auto 1fr; gap: 32px; align-items: start; }
.avatar {
  position: relative;
  width: 110px; height: 110px; border-radius: 28px; background: var(--grad);
  background-size: 200% 200%;
  display: grid; place-items: center;
  box-shadow: 0 12px 30px rgba(99, 102, 241, .28), inset 0 1px 1px rgba(255, 255, 255, .4);
  animation: gradientShift 5s ease infinite, pulse 3.2s ease-in-out infinite;
}
.avatar::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, .3), transparent 55%);
  pointer-events: none;
}
.avatar svg { width: 58px; height: 58px; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 12px 30px rgba(99, 102, 241, .28); }
  50% { box-shadow: 0 14px 46px rgba(99, 102, 241, .5); }
}
.hero .eyebrow {
  font-family: 'JetBrains Mono', monospace; font-size: 12.5px; color: var(--indigo);
  letter-spacing: 1.5px; margin-bottom: 14px; display: inline-flex; align-items: center; gap: 8px;
}
.hero .eyebrow::before { content: ""; width: 24px; height: 1.5px; background: var(--indigo); }
.hero h1 {
  font-family: 'Space Grotesk', 'Noto Sans SC', sans-serif;
  font-size: clamp(32px, 5vw, 52px); line-height: 1.15; font-weight: 700; letter-spacing: -.5px;
  margin-bottom: 18px; color: var(--text);
}
.hero h1 .grad {
  background: linear-gradient(120deg, #06B6D4, #6366F1, #A855F7, #EC4899);
  background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: gradientShift 5s ease infinite;
}
.hero .lede { font-size: 16.5px; color: var(--text-dim); max-width: 640px; margin-bottom: 26px; }
.hero .lede strong { color: var(--text); font-weight: 600; }
.cta-row { display: flex; gap: 12px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 20px; border-radius: 9px;
  font-size: 14px; font-weight: 500; border: 1px solid var(--line); cursor: pointer;
  background: #fff; color: var(--text); transition: all .2s; font-family: inherit;
}
.btn.primary {
  background: var(--grad); background-size: 200% 100%; color: #fff; border: none; font-weight: 600;
  box-shadow: 0 6px 18px rgba(99, 102, 241, .3); transition: background-position .4s, transform .2s, box-shadow .2s;
}
.btn.primary:hover { background-position: 100% 0; transform: translateY(-1px); box-shadow: 0 10px 26px rgba(99, 102, 241, .42); }
.btn:hover { border-color: var(--line-strong); background: var(--bg-soft); }

/* 统计条（数字滚动） */
.stats-row { display: flex; gap: 12px; margin: 30px 0 12px; flex-wrap: wrap; }
.stat-card {
  flex: 1; min-width: 128px; background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 12px; padding: 18px 20px; cursor: pointer;
  transition: transform .25s, border-color .25s, box-shadow .25s;
}
.stat-card:hover { transform: translateY(-3px); border-color: var(--indigo); box-shadow: 0 10px 26px rgba(99, 102, 241, .14); }
.stat-card .num {
  font-family: 'JetBrains Mono', monospace; font-size: 28px; font-weight: 600; line-height: 1.1;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat-card .label { font-family: 'JetBrains Mono', monospace; font-size: 11.5px; color: var(--text-faint); letter-spacing: .5px; margin-top: 4px; }

/* ===== bio / meta / timeline / tags ===== */
.bio {
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 14px;
  padding: 26px 28px; margin: 30px 0 8px;
}
.bio p { color: var(--text-dim); font-size: 14.5px; line-height: 1.8; margin-bottom: 14px; }
.bio p:last-child { margin-bottom: 0; }
.bio p strong { color: var(--text); font-weight: 600; }

.meta-strip {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin: 30px 0;
}
.meta-cell { background: #fff; padding: 18px 22px; }
.meta-cell .k { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text-faint); letter-spacing: .8px; margin-bottom: 6px; }
.meta-cell .v { font-size: 14.5px; color: var(--text); font-weight: 500; }

h2.section {
  font-family: 'Space Grotesk', 'Noto Sans SC', sans-serif; font-size: 21px; font-weight: 600;
  margin: 44px 0 22px; display: flex; align-items: center; gap: 12px;
  background: linear-gradient(90deg, #0F172A, #6366F1, #A855F7);
  background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: gradientShift 7s ease infinite;
}
h2.section::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.page-intro { color: var(--text-dim); max-width: 680px; margin-bottom: 28px; }

.timeline { display: grid; grid-template-columns: 120px 24px 1fr; row-gap: 24px; align-items: start; }
.tl-time { font-family: 'JetBrains Mono', monospace; font-size: 12.5px; color: var(--text-faint); padding-top: 3px; text-align: right; }
.tl-axis { position: relative; justify-self: center; width: 100%; height: 100%; }
.tl-dot { width: 11px; height: 11px; border-radius: 50%; background: #fff; border: 2.5px solid var(--indigo); justify-self: center; margin-top: 6px; position: relative; z-index: 1; }
.tl-line { position: absolute; left: 50%; top: 18px; bottom: -24px; width: 1.5px; background: var(--line-strong); }
.tl-body { padding-bottom: 6px; }
.tl-body .t { font-size: 15px; font-weight: 600; color: var(--text); }
.tl-body .d { font-size: 13.5px; color: var(--text-dim); margin-top: 4px; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.tag {
  font-family: 'JetBrains Mono', monospace; font-size: 12px; padding: 5px 11px; border-radius: 6px;
  background: rgba(6, 182, 212, .08); border: 1px solid rgba(6, 182, 212, .25); color: #0E7490;
  transition: transform .2s, background .2s;
}
.tag:hover { transform: translateY(-2px); }
.tag.v { background: rgba(99, 102, 241, .08); border-color: rgba(99, 102, 241, .25); color: #4338CA; }
.tag.f { background: rgba(168, 85, 247, .08); border-color: rgba(168, 85, 247, .25); color: #7E22CE; }

/* ===== 卡片 ===== */
.card-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-top: 8px; }
.card-grid .reveal { height: 100%; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 26px;
  position: relative; transition: box-shadow .3s, border-color .3s, transform .2s ease;
  will-change: transform; height: 100%;
}
.card::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px;
  background: linear-gradient(135deg, #06B6D4, #6366F1, #A855F7, #EC4899);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0; transition: opacity .3s; pointer-events: none;
}
.card:hover { border-color: transparent; box-shadow: 0 14px 40px rgba(99, 102, 241, .18); }
.card:hover::before { opacity: 1; }
.card.clickable { cursor: pointer; }
.card.clickable:hover h3 { color: var(--indigo); }
.card .icon {
  width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; margin-bottom: 16px;
  background: linear-gradient(135deg, rgba(6, 182, 212, .1), rgba(168, 85, 247, .1));
  transition: transform .3s;
}
.card:hover .icon { transform: scale(1.08) rotate(-3deg); }
.card .icon svg { width: 20px; height: 20px; stroke: url(#g1); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.card h3 { font-size: 16.5px; font-weight: 600; margin-bottom: 4px; font-family: 'Space Grotesk', 'Noto Sans SC', sans-serif; color: var(--text); }
.card .sub { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--indigo); margin-bottom: 10px; letter-spacing: .5px; }
.card p { font-size: 14px; color: var(--text-dim); line-height: 1.7; }
.card .foot { margin-top: 18px; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.card .link {
  font-family: 'JetBrains Mono', monospace; font-size: 12.5px; color: var(--indigo); font-weight: 500;
  display: inline-flex; align-items: center; gap: 5px;
}
.card .link:hover { text-decoration: underline; }

/* Projects */
.proj-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.proj-head .year { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--text-faint); }
.proj-cover {
  height: 140px; border-radius: 10px; margin: 14px 0 16px;
  background: linear-gradient(135deg, #F1F5F9, #EEF2FF 60%, #F5F3FF);
  border: 1px dashed var(--line-strong);
  display: grid; place-items: center; color: var(--text-faint); font-size: 13px;
  font-family: 'JetBrains Mono', monospace; overflow: hidden;
}
.proj-cover img { width: 100%; height: 100%; object-fit: cover; }

/* Services */
.price { font-family: 'JetBrains Mono', monospace; font-size: 12.5px; color: var(--violet); font-weight: 500; }

/* ===== 详情视图 ===== */
.back {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: 'JetBrains Mono', monospace; font-size: 13px; color: var(--text-dim);
  margin-bottom: 28px; transition: color .2s;
}
.back:hover { color: var(--indigo); }
.detail { max-width: 760px; margin: 0 auto; }
.detail-cover {
  border-radius: 14px; overflow: hidden; margin-bottom: 26px; min-height: 200px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #F1F5F9, #EEF2FF 60%, #F5F3FF);
  border: 1px dashed var(--line-strong); color: var(--text-faint);
  font-family: 'JetBrains Mono', monospace; font-size: 14px;
}
.detail-cover img { width: 100%; display: block; }
.detail-meta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.detail-meta .year { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--text-faint); }
.detail h1 {
  font-family: 'Space Grotesk', 'Noto Sans SC', sans-serif;
  font-size: 32px; line-height: 1.2; font-weight: 700; letter-spacing: -.5px; margin-bottom: 18px;
}
.detail .summary {
  font-size: 16.5px; color: var(--text-dim); margin-bottom: 26px;
  padding: 18px 22px; background: var(--bg-soft); border: 1px solid var(--line);
  border-left: 3px solid var(--indigo); border-radius: 0 10px 10px 0;
}
.detail .summary strong { color: var(--text); }
.detail-content p { font-size: 15px; color: var(--text-dim); line-height: 1.85; margin-bottom: 16px; }
.gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin: 26px 0; }
.gallery figure { border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.gallery img { width: 100%; display: block; }
.detail-links { display: flex; gap: 12px; margin-top: 26px; flex-wrap: wrap; }

/* ===== 联系信息 / 弹窗 ===== */
.contact-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 9px;
  background: var(--bg-soft); border: 1px solid var(--line);
  font-family: 'JetBrains Mono', monospace; font-size: 13.5px; color: var(--text);
}
.contact-chip .k { font-size: 10px; color: var(--text-faint); letter-spacing: .8px; }

.link-btn {
  border: none; background: none; padding: 0; cursor: pointer;
  font-family: 'JetBrains Mono', monospace; font-size: 12.5px; color: var(--indigo); font-weight: 500;
  display: inline-flex; align-items: center; gap: 5px;
}
.link-btn:hover { text-decoration: underline; }

.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(15, 23, 42, .4);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal-card {
  position: relative; width: min(420px, 100%);
  background: #fff; border-radius: 18px; padding: 34px 30px 28px;
  box-shadow: 0 30px 80px rgba(15, 23, 42, .28);
  transform: translateY(16px) scale(.97); transition: transform .25s ease;
  overflow: hidden;
}
.modal-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: var(--grad);
}
.modal-overlay.open .modal-card { transform: translateY(0) scale(1); }
.modal-close {
  position: absolute; top: 14px; right: 14px; width: 32px; height: 32px;
  border-radius: 8px; border: 1px solid var(--line); background: #fff;
  color: var(--text-dim); cursor: pointer; font-size: 18px; line-height: 1;
  display: grid; place-items: center; transition: all .2s;
}
.modal-close:hover { background: var(--bg-soft); color: var(--text); }
.modal-title {
  font-family: 'Space Grotesk', 'Noto Sans SC', sans-serif; font-size: 22px; font-weight: 700;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  margin-bottom: 6px;
}
.modal-sub { color: var(--text-dim); font-size: 14px; margin-bottom: 22px; }
.modal-item {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px;
}
.modal-item .k { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--text-faint); letter-spacing: .8px; min-width: 44px; }
.modal-item .v { font-family: 'JetBrains Mono', monospace; font-size: 14.5px; color: var(--text); flex: 1; word-break: break-all; }
.copy-btn {
  font-family: 'JetBrains Mono', monospace; font-size: 12px; padding: 6px 12px; border-radius: 7px;
  border: 1px solid var(--line); background: #fff; color: var(--indigo); cursor: pointer;
  transition: all .2s; white-space: nowrap;
}
.copy-btn:hover { border-color: var(--indigo); background: rgba(99, 102, 241, .06); }

/* ===== 页脚 ===== */
footer { border-top: 1px solid var(--line); padding: 28px 0; color: var(--text-faint); font-size: 13px; background: var(--bg-soft); }
.foot-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.foot-links { display: flex; gap: 18px; }
.foot-links a { color: var(--text-dim); }
.foot-links a:hover { color: var(--indigo); }

/* ===== 响应式 ===== */
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; gap: 20px; }
  .avatar { width: 80px; height: 80px; border-radius: 22px; }
  .avatar svg { width: 42px; height: 42px; }
  .nav-links {
    display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column;
    background: #fff; border-bottom: 1px solid var(--line); padding: 10px 16px; gap: 4px;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 11px 14px; }
  .nav-toggle { display: block; }
  .meta-strip { grid-template-columns: 1fr; }
  .card-grid { grid-template-columns: 1fr; }
  .stats-row { flex-direction: column; }
  .timeline { grid-template-columns: 90px 20px 1fr; }
  .gallery { grid-template-columns: 1fr; }
  .wrap { padding: 0 20px; }
  .view { padding: 36px 0 60px; }
  .blob { width: 300px; height: 300px; }
}
