/* ============================================================
   王有有 · 个人主页 v2 — Gallery Editorial
   白底 · 单色 · 衬线巨字 · 不对称网格 · 高级动效
   ============================================================ */

:root {
  --white: #ffffff;
  --paper: #fbfbfa;
  --ink: #101010;
  --ink-60: rgba(16,16,16,0.6);
  --ink-40: rgba(16,16,16,0.4);
  --ink-25: rgba(16,16,16,0.25);
  --ink-12: rgba(16,16,16,0.12);
  --ink-06: rgba(16,16,16,0.06);
  --accent: #2b3a8f; /* 群青，克制使用 */

  --serif: "Fraunces", "Noto Serif SC", "Songti SC", "STSong", Georgia, serif;
  --sans: "Inter", "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  --nav-h: 72px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
html.js { scroll-behavior: smooth; }

body {
  font-family: var(--serif);
  color: var(--ink);
  background: var(--white);
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--ink); color: var(--white); }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ============ 预加载 ============ */
#loader {
  position: fixed; inset: 0; z-index: 200;
  background: var(--ink); color: var(--white);
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: 5vw;
  transition: transform 1s var(--ease-expo);
}
#loader.done { transform: translateY(-101%); }
.loader-words {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.loader-word {
  display: inline-block; overflow: hidden;
  font-size: clamp(40px, 7vw, 96px); font-weight: 400; letter-spacing: 0.14em;
}
.loader-word > i { display: inline-block; font-style: normal; }
.loader-word.swap > i { animation: wordSwap 0.62s var(--ease-expo) both; }
@keyframes wordSwap {
  0% { transform: translateY(115%); opacity: 0; filter: blur(6px); }
  55% { opacity: 1; filter: blur(0); }
  100% { transform: translateY(0); opacity: 1; filter: blur(0); }
}
.loader-name { font-size: clamp(28px, 4vw, 44px); font-weight: 400; letter-spacing: 0.08em; overflow: hidden; }
.loader-name span { display: inline-block; transform: translateY(110%); animation: riseUp 0.9s var(--ease-expo) 0.15s forwards; }
.loader-count {
  font-family: var(--mono); font-size: clamp(56px, 9vw, 120px);
  line-height: 0.9; font-variant-numeric: tabular-nums; font-weight: 300;
}
@keyframes riseUp { to { transform: none; } }

/* ============ 通用 ============ */
.wrap { max-width: 1440px; margin: 0 auto; padding: 0 5vw; }

.label {
  font-family: var(--sans); font-size: 11px; font-weight: 500;
  letter-spacing: 0.22em; text-transform: uppercase; color: var(--ink-40);
}

.hairline { border: none; border-top: 1px solid var(--ink-12); }

/* 遮罩逐行/逐字入场 */
.mask-line { display: block; overflow: hidden; }
.mask-line > span { display: block; transform: translateY(110%); transition: transform 1s var(--ease-expo); }
.in .mask-line > span, .mask-line.in > span { transform: none; }
.mask-line > span:nth-child(1) { transition-delay: 0.05s; }

.reveal { opacity: 0; transform: translateY(36px); transition: opacity 0.9s ease, transform 0.9s var(--ease-out); }
.in .reveal, .reveal.in { opacity: 1; transform: none; }
html:not(.js) .reveal { opacity: 1; transform: none; }
html:not(.js) .mask-line > span { transform: none; }

section { position: relative; padding: 18vh 0; scroll-margin-top: var(--nav-h); }

/* 幽灵大序号 */
.ghost-num {
  position: absolute; top: 6vh; right: 2vw;
  font-family: var(--serif); font-weight: 300;
  font-size: clamp(140px, 24vw, 340px); line-height: 0.8;
  color: transparent; -webkit-text-stroke: 1px var(--ink-12);
  pointer-events: none; user-select: none;
  font-variant-numeric: tabular-nums;
}

/* 区块头 */
.sec-head { display: flex; align-items: baseline; gap: 24px; margin-bottom: 9vh; }
.sec-index { font-family: var(--mono); font-size: 12px; color: var(--ink-40); }
.sec-title {
  font-size: clamp(40px, 6.5vw, 96px); font-weight: 400; line-height: 1.02;
  letter-spacing: -0.01em;
}
.sec-title .thin { font-weight: 300; color: var(--ink-40); }

/* ============ 导航 ============ */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 5vw;
  transition: background 0.5s ease, box-shadow 0.5s ease, height 0.4s ease;
  mix-blend-mode: normal;
}
.nav.scrolled {
  height: 56px;
  background: rgba(255,255,255,0.75);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  backdrop-filter: blur(16px) saturate(1.2);
  box-shadow: inset 0 -1px 0 var(--ink-12);
}
.nav-logo { font-size: 15px; letter-spacing: 0.06em; font-weight: 500; }
.nav-logo em { font-style: normal; color: var(--ink-40); font-weight: 300; }
.nav-links { display: flex; gap: 6px; }
.nav-links a {
  position: relative; padding: 8px 14px;
  font-family: var(--sans); font-size: 12.5px; letter-spacing: 0.08em;
  color: var(--ink-60);
  transition: color 0.3s;
}
.nav-links a::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 4px;
  height: 1px; background: var(--ink);
  transform: scaleX(0); transform-origin: right;
  transition: transform 0.4s var(--ease-expo);
}
.nav-links a:hover { color: var(--ink); }
.nav-links a:hover::after { transform: scaleX(1); transform-origin: left; }
.nav-links a.active { color: var(--ink); }
.nav-links a.active::after { transform: scaleX(1); }

/* ============ Hero ============ */
#home {
  min-height: 100vh;
  padding: calc(var(--nav-h) + 6vh) 0 10vh;
  display: flex; flex-direction: column; justify-content: center;
}
.hero-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 4vh; }
.hero-meta { max-width: 240px; font-family: var(--sans); font-size: 12.5px; line-height: 1.8; color: var(--ink-60); }
.hero-meta b { font-weight: 500; color: var(--ink); }

.hero-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4vw;
}
.hero-name {
  font-size: clamp(80px, 12.5vw, 190px);
  font-weight: 400; line-height: 0.95; letter-spacing: 0.02em;
  white-space: nowrap;
}
.hero-name-en {
  margin-top: 2vh;
  display: flex; align-items: center; gap: 3vw;
}
.hero-name-en .line { flex: 0 1 220px; height: 1px; background: var(--ink); transform: scaleX(0); transform-origin: left; transition: transform 1.2s var(--ease-expo) 0.9s; }
body.loaded .hero-name-en .line { transform: none; }
.hero-name-en .en {
  white-space: nowrap;
  font-size: clamp(18px, 2.6vw, 36px); font-weight: 300; letter-spacing: 0.28em;
  color: var(--ink-60); text-transform: uppercase;
}

.hero-photo {
  position: relative; z-index: 0;
  width: clamp(220px, 24vw, 340px);
  margin-top: -4vh;
  clip-path: inset(0 0 100% 0);
  transition: clip-path 1.3s var(--ease-expo) 0.5s;
}
body.loaded .hero-photo { clip-path: inset(0 0 0% 0); }
.hero-photo img, .hero-photo video { width: 100%; aspect-ratio: 4/5; object-fit: contain; filter: saturate(0.92); }
.hero-photo figcaption {
  margin-top: 10px; display: flex; justify-content: space-between;
  font-family: var(--mono); font-size: 11px; color: var(--ink-40);
}

.hero-bottom {
  margin-top: 7vh;
  display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 32px;
}
.hero-tag { max-width: 380px; font-size: 16px; line-height: 1.9; color: var(--ink-60); }
.hero-cta { display: flex; gap: 14px; }

/* 磁吸按钮 */
.btn {
  position: relative; display: inline-flex; align-items: center; gap: 10px;
  padding: 16px 30px; border-radius: 999px;
  font-family: var(--sans); font-size: 13px; font-weight: 500; letter-spacing: 0.1em;
  cursor: pointer; overflow: hidden;
  transition: color 0.35s ease;
  will-change: transform;
}
.btn span { position: relative; z-index: 1; }
.btn::before {
  content: ""; position: absolute; inset: 0; border-radius: 999px;
  transform: scaleY(0); transform-origin: bottom;
  transition: transform 0.45s var(--ease-expo);
}
.btn:hover::before { transform: scaleY(1); }
.btn-dark { background: var(--ink); color: var(--white); border: 1px solid var(--ink); }
.btn-dark::before { background: var(--white); }
.btn-dark:hover { color: var(--ink); }
.btn-line { background: transparent; color: var(--ink); border: 1px solid var(--ink-25); }
.btn-line::before { background: var(--ink); }
.btn-line:hover { color: var(--white); }

/* 跑马灯 */
.marquee {
  overflow: hidden; white-space: nowrap;
  border-top: 1px solid var(--ink-12); border-bottom: 1px solid var(--ink-12);
  padding: 18px 0;
}
.marquee-track { display: inline-flex; gap: 56px; animation: marquee 26s linear infinite; will-change: transform; }
.marquee-track span {
  font-size: 15px; letter-spacing: 0.3em; text-transform: uppercase;
  font-family: var(--sans); color: var(--ink-40);
  display: inline-flex; align-items: center; gap: 56px;
}
.marquee-track span::after { content: "·"; color: var(--ink-25); }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ============ 实习 ============ */
.intern-row {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 4vw; align-items: baseline;
  padding: 5vh 0;
  border-top: 1px solid var(--ink-12);
  position: relative;
  transition: padding-left 0.5s var(--ease-expo);
}
.intern-row:last-of-type { border-bottom: 1px solid var(--ink-12); }
.intern-row::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 0;
  background: var(--paper); z-index: -1;
  transition: width 0.5s var(--ease-expo);
}
.intern-row:hover { padding-left: 24px; }
.intern-row:hover::before { width: 100%; }
.intern-idx { font-family: var(--mono); font-size: 13px; color: var(--ink-40); }
.intern-title { font-size: clamp(24px, 3.4vw, 44px); font-weight: 400; line-height: 1.15; transition: transform 0.5s var(--ease-expo); }
.intern-row:hover .intern-title { transform: translateX(8px); }
.intern-desc { margin-top: 10px; max-width: 560px; font-family: var(--sans); font-size: 13.5px; line-height: 1.8; color: var(--ink-60); }
.intern-time { font-family: var(--mono); font-size: 12.5px; color: var(--ink-40); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ============ 项目 ============ */
#projects { padding-left: 0; padding-right: 0; }
#projects .sec-head { padding: 0 5vw; }
.proj-rail {
  display: flex; gap: 3vw;
  overflow-x: auto; scroll-snap-type: x mandatory;
  padding: 2vh 5vw 5vh;
  scrollbar-width: none; cursor: grab;
}
.proj-rail::-webkit-scrollbar { display: none; }
.proj-rail.dragging { cursor: grabbing; scroll-snap-type: none; }
.proj-card {
  flex: 0 0 min(340px, 76vw);
  scroll-snap-align: start;
  display: block; position: relative;
  user-select: none;
}
.proj-card:nth-child(even) { transform: translateY(6vh); }
.proj-frame {
  position: relative; aspect-ratio: 3/4; overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--ink-12);
}
.proj-frame svg.art { position: absolute; inset: 0; width: 100%; height: 100%; transition: transform 0.8s var(--ease-expo), filter 0.8s ease; filter: grayscale(1); }
.proj-card:hover svg.art { transform: scale(1.05); filter: grayscale(0); }
.proj-no {
  position: absolute; top: 16px; left: 18px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.15em; color: var(--ink-40);
  background: rgba(255,255,255,0.8); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  padding: 4px 10px; border: 1px solid var(--ink-12);
}
.proj-info { display: flex; justify-content: space-between; align-items: baseline; margin-top: 18px; gap: 16px; }
.proj-title { font-size: clamp(20px, 2.2vw, 27px); font-weight: 400; }
.proj-sub { margin-top: 6px; font-family: var(--sans); font-size: 12.5px; color: var(--ink-60); line-height: 1.7; }
.proj-arrow {
  flex: 0 0 44px; height: 44px; border: 1px solid var(--ink-25); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.35s, color 0.35s, transform 0.5s var(--ease-expo);
  font-size: 16px;
}
.proj-card:hover .proj-arrow { background: var(--ink); color: var(--white); transform: rotate(45deg); }
.rail-progress { margin: 0 5vw; height: 1px; background: var(--ink-12); position: relative; }
.rail-progress i { position: absolute; left: 0; top: -0.5px; height: 2px; width: 20%; background: var(--ink); transition: width 0.2s linear, left 0.2s linear; }

/* ============ 能力 Show ============ */
.skill-row { border-top: 1px solid var(--ink-12); }
.skill-row:last-child { border-bottom: 1px solid var(--ink-12); }
.skill-head {
  width: 100%; display: grid; grid-template-columns: 80px 1fr auto; gap: 4vw; align-items: center;
  padding: 4.5vh 0; background: none; border: none; cursor: pointer; text-align: left;
}
.skill-idx { font-family: var(--mono); font-size: 13px; color: var(--ink-40); }
.skill-name {
  font-size: clamp(26px, 4vw, 52px); font-weight: 300; line-height: 1.1;
  color: var(--ink-40);
  transition: color 0.4s ease, transform 0.5s var(--ease-expo);
}
.skill-row:hover .skill-name, .skill-row.open .skill-name { color: var(--ink); transform: translateX(12px); }
.skill-plus {
  width: 46px; height: 46px; border: 1px solid var(--ink-25); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 300; color: var(--ink-60);
  transition: transform 0.55s var(--ease-expo), background 0.35s, color 0.35s;
}
.skill-row.open .skill-plus { transform: rotate(225deg); background: var(--ink); color: var(--white); }
.skill-body { max-height: 0; overflow: hidden; transition: max-height 0.7s var(--ease-expo); }
.skill-body-in {
  display: grid; grid-template-columns: 80px 1fr; gap: 4vw;
  padding-bottom: 5vh;
}
.skill-body-in::before { content: ""; }
.skill-body-content { max-width: 640px; font-family: var(--sans); font-size: 14px; line-height: 1.9; color: var(--ink-60); }
.skill-body-content ul { list-style: none; margin-top: 14px; }
.skill-body-content li { padding: 10px 0; border-top: 1px solid var(--ink-06); }
.skill-body-content li b { font-weight: 500; color: var(--ink); }

/* ============ 联系我 ============ */
#contact { padding-bottom: 8vh; }
.contact-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0;
  border-top: 1px solid var(--ink-12); border-left: 1px solid var(--ink-12);
}
.contact-cell {
  padding: 32px 28px; border-right: 1px solid var(--ink-12); border-bottom: 1px solid var(--ink-12);
  transition: background 0.4s ease;
}
.contact-cell:hover { background: var(--paper); }
.contact-cell .label { display: block; margin-bottom: 14px; }
.contact-cell .val { font-size: 17px; font-variant-numeric: tabular-nums; }
.contact-resume {
  margin-top: 6vh; display: flex; justify-content: space-between; align-items: center; gap: 24px;
  background: var(--ink); color: var(--white); padding: 5vh 4vw;
  position: relative; overflow: hidden;
}
.contact-resume .t { font-size: clamp(22px, 3vw, 34px); font-weight: 300; position: relative; z-index: 1; }
.contact-resume .s { margin-top: 8px; font-family: var(--sans); font-size: 12.5px; color: rgba(255,255,255,0.55); position: relative; z-index: 1; }
.contact-resume .dl {
  position: relative; z-index: 1;
  flex: 0 0 auto; width: 72px; height: 72px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.4);
  display: flex; align-items: center; justify-content: center; font-size: 20px;
  transition: background 0.4s, color 0.4s, transform 0.5s var(--ease-expo);
}
.contact-resume:hover .dl { background: var(--white); color: var(--ink); transform: rotate(360deg); }

/* ============ 页脚 ============ */
footer {
  padding: 6vh 5vw 5vh;
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px;
  border-top: 1px solid var(--ink-12);
  font-family: var(--sans); font-size: 12px; color: var(--ink-40); letter-spacing: 0.08em;
}

/* ============ 详情页 ============ */
.detail-hero { padding-top: calc(var(--nav-h) + 10vh); }
.detail-back { font-family: var(--sans); font-size: 12.5px; letter-spacing: 0.1em; color: var(--ink-40); transition: color 0.3s; }
.detail-back:hover { color: var(--ink); }
.detail-title { margin-top: 4vh; font-size: clamp(44px, 8vw, 110px); font-weight: 400; line-height: 1.02; }
.detail-meta { margin-top: 2vh; font-family: var(--mono); font-size: 12px; color: var(--ink-40); letter-spacing: 0.1em; }
.detail-art { margin: 7vh 0; aspect-ratio: 21/9; overflow: hidden; border: 1px solid var(--ink-12); background: var(--paper); }
.detail-art svg { width: 100%; height: 100%; }
.detail-body { display: grid; grid-template-columns: 1fr 1fr; gap: 6vw 4vw; padding-bottom: 10vh; }
.detail-block h3 { font-family: var(--sans); font-size: 12px; font-weight: 500; letter-spacing: 0.22em; text-transform: uppercase; color: var(--ink-40); margin-bottom: 18px; }
.detail-block p, .detail-block li { font-size: 15px; line-height: 2; color: var(--ink-60); font-family: var(--sans); }
.detail-block ul { list-style: none; }
.detail-block li { padding: 12px 0; border-top: 1px solid var(--ink-06); }

/* ============ 响应式 ============ */
@media (max-width: 900px) {
  /* Hero 移动端整体居中，避免右侧留白 */
  .hero-top { flex-direction: column; gap: 16px; align-items: center; text-align: center; }
  .hero-main { grid-template-columns: 1fr; justify-items: center; }
  .hero-name { white-space: normal; text-align: center; }
  .hero-name-en { justify-content: center; }
  .hero-name-en .en { font-size: 15px; letter-spacing: 0.18em; }
  .hero-name-en .line { flex: 0 1 64px; }
  .hero-photo { margin: 6vh 0 0; }
  .hero-bottom { flex-direction: column; align-items: center; text-align: center; gap: 24px; }

  /* 实习描述横向拉伸，右边缘对齐日期列 */
  .intern-row, .skill-head { grid-template-columns: 44px 1fr auto; gap: 5vw; }
  .intern-desc { max-width: none; }

  /* 项目卡片移动端改为纵向排列 */
  .proj-rail { flex-direction: column; overflow-x: visible; scroll-snap-type: none; gap: 7vh; padding: 2vh 5vw 0; cursor: default; }
  .proj-card { flex: 0 0 auto; width: 100%; scroll-snap-align: none; }
  .proj-card:nth-child(even) { transform: none; }
  .rail-progress { display: none; }

  .skill-body-in { grid-template-columns: 44px 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
  .detail-body { grid-template-columns: 1fr; }
  .nav-links a { padding: 8px 8px; font-size: 11.5px; }
  .nav-logo { display: none; }
  .nav { justify-content: center; }
  section { padding: 12vh 0; }
  .ghost-num { font-size: 32vw; top: 2vh; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
}

/* 打印 / 截图验证兜底 */
@media print {
  #loader { display: none !important; }
  .nav { position: absolute; }
  #home { min-height: auto; }
  .mask-line > span { transform: none !important; transition: none !important; }
  .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
  .hero-photo { clip-path: none !important; }
  .hero-name-en .line { transform: none !important; }
  .proj-card:nth-child(even) { transform: none; }
}
