/* ============================================================
   动画系统 — 借鉴参考站
   自定义鼠标 / 磁力按钮 / 滚动进度 / 跑马灯 / 入场动画 / 回到顶部
   ============================================================ */

/* ---------- 自定义鼠标（仅作可交互元素的辅助光环，不遮挡文字） ---------- */
.cursor-dot, .cursor-ring {
  position: fixed; top: 0; left: 0; pointer-events: none; z-index: 9999;
  transform: translate(-50%, -50%);
  transition: opacity .28s ease, width .3s cubic-bezier(.2,.8,.2,1),
              height .3s cubic-bezier(.2,.8,.2,1), background .28s ease, border-color .28s ease;
}
.cursor-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(26,26,28,.72);
  opacity: 0;
}
.cursor-dot.visible { opacity: 1; }
.cursor-dot.on-dark { background: rgba(255,255,255,.85); }
.cursor-ring {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1.5px solid rgba(178,107,224,.55);
  background: rgba(178,107,224,.02);
  opacity: 0;
}
.cursor-ring.visible { opacity: .6; }
.cursor-ring.hovering {
  width: 60px; height: 60px; opacity: 1;
  background: rgba(178,107,224,.10);
  border-color: rgba(178,107,224,.55);
}
.cursor-ring.on-dark { border-color: rgba(255,255,255,.5); background: rgba(255,255,255,.06); }
/* 自定义鼠标接管时，隐藏系统原生光标 */
@media (hover: hover) and (pointer: fine) {
  .has-cursor, .has-cursor * { cursor: none !important; }
}
@media (max-width: 768px) {
  .cursor-dot, .cursor-ring { display: none !important; }
}

/* ---------- 磁力按钮（data-magnetic） ---------- */
[data-magnetic] { position: relative; transition: transform .3s cubic-bezier(.2,.8,.2,1); will-change: transform; }

/* ---------- 滚动进度条 ---------- */
.scroll-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0%;
  background: var(--grad, linear-gradient(118deg, #B26BE0, #E05FA9));
  z-index: 9998; transition: width .1s linear;
}

/* ---------- 跑马灯 ---------- */
.marquee {
  overflow: hidden; white-space: nowrap; position: relative;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.marquee-track {
  display: inline-flex; gap: 60px; padding-left: 60px;
  animation: marquee-run 32s linear infinite;
}
.marquee-track:hover { animation-play-state: paused; }
.marquee-track span {
  font-family: var(--font-serif, serif); font-style: italic;
  font-size: clamp(28px, 3vw, 46px);
  color: var(--ink-2, #54545A);
  display: inline-flex; align-items: center; gap: 60px;
}
.marquee-track span::after {
  content: "✦"; font-size: .5em; color: var(--purple, #B794E8);
}
@keyframes marquee-run {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ---------- 入场动画（电影感开场） ---------- */
.intro {
  position: fixed; inset: 0; z-index: 10000;
  color: #fff; overflow: hidden;
  display: grid; place-items: center;
  pointer-events: auto;
}
.intro.done { pointer-events: none; }

/* 五片式帘幕：既作背景，也负责退场 */
.intro-panels { position: absolute; inset: 0; display: flex; z-index: 0; }
.intro-panels i {
  flex: 1; background: #101012;
  transform: translateY(0);
  transition: transform .85s cubic-bezier(.76,0,.24,1);
  transition-delay: calc(var(--i) * 75ms);
}
.intro.done .intro-panels i { transform: translateY(-101%); }

/* 退场时内容层先行淡出 */
.intro-orbs, .intro-grain, .intro-scan, .intro-corners,
.intro-meta, .intro-bgword, .intro-foot, .intro-count { transition: opacity .45s ease; }
.intro.done .intro-orbs, .intro.done .intro-grain, .intro.done .intro-scan,
.intro.done .intro-corners, .intro.done .intro-meta, .intro.done .intro-bgword,
.intro.done .intro-foot, .intro.done .intro-count { opacity: 0; }

/* 巨型幽灵计数 */
.intro-count {
  position: absolute; right: 34px; bottom: 46px; z-index: 1;
  font-family: "Space Grotesk", ui-monospace, monospace; font-weight: 700;
  font-size: clamp(96px, 15vw, 180px); line-height: .8; letter-spacing: -.04em;
  color: transparent; -webkit-text-stroke: 1.5px rgba(255,255,255,.15);
  pointer-events: none; font-variant-numeric: tabular-nums;
}

/* 轮换身份词 */
.intro-roles { margin-top: 20px; height: 22px; overflow: hidden; }
.ir-track { display: flex; flex-direction: column; animation: ir-roll 8.5s cubic-bezier(.76,0,.24,1) infinite; }
.ir-track i {
  font-style: normal; height: 22px; line-height: 22px;
  font-size: 12.5px; letter-spacing: .44em; text-indent: .44em;
  color: rgba(255,255,255,.55); text-transform: uppercase; white-space: nowrap;
}
@keyframes ir-roll {
  0%, 18% { transform: translateY(0); }
  25%, 43% { transform: translateY(-22px); }
  50%, 68% { transform: translateY(-44px); }
  75%, 93% { transform: translateY(-66px); }
  100% { transform: translateY(-88px); }
}

/* 幕布未拉开前，首屏文案保持待机，拉开时再入场 */
body.intro-hold .hero-note,
body.intro-hold .hero-eyebrow,
body.intro-hold .hero h1 .l1,
body.intro-hold .hero h1 .l2,
body.intro-hold .hero-sub,
body.intro-hold .hero-cta { animation-play-state: paused; }

.intro-orbs { position: absolute; inset: 0; filter: blur(70px); pointer-events: none; }
.intro-orb {
  position: absolute; left: var(--x); top: var(--y);
  width: 340px; height: 340px; border-radius: 50%;
  background: radial-gradient(circle at 42% 42%, var(--c), transparent 68%);
  opacity: .5; transform: translate(-50%, -50%);
  animation: orb-drift var(--t) ease-in-out infinite alternate;
}
@keyframes orb-drift {
  from { transform: translate(-50%, -50%) scale(1); }
  to   { transform: translate(calc(-50% + 70px), calc(-50% - 56px)) scale(1.2); }
}
.intro-grain {
  position: absolute; inset: -40%; pointer-events: none; opacity: .05;
  background-image: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='n'/%3E%3C/svg%3E");
  animation: grain-shift .7s steps(3) infinite;
}
@keyframes grain-shift {
  0% { transform: translate(0, 0); }
  33% { transform: translate(-8px, 6px); }
  66% { transform: translate(6px, -8px); }
  100% { transform: translate(0, 0); }
}

.intro-stage { position: relative; text-align: center; transition: transform .75s cubic-bezier(.76,0,.24,1), opacity .6s ease; }
.intro.done .intro-stage { transform: translateY(-26px) scale(.975); opacity: 0; }

.intro-signwrap { position: relative; display: flex; justify-content: center; }
.intro-signwrap img {
  width: min(300px, 42vw); height: auto; display: block;
  filter: drop-shadow(0 0 26px rgba(255,255,255,.16));
  clip-path: inset(0 100% 0 0);
  animation: sign-draw 1.25s cubic-bezier(.66,0,.34,1) .12s forwards;
}
@keyframes sign-draw { to { clip-path: inset(0 0 0 0); } }
.intro-signline {
  position: absolute; bottom: -12px; left: 50%; transform: translateX(-50%);
  height: 1px; width: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.8), transparent);
  animation: line-grow 1.1s cubic-bezier(.2,.8,.2,1) .8s forwards;
}
@keyframes line-grow { to { width: min(380px, 62vw); } }

.intro-kicker {
  margin-top: 30px; display: flex; align-items: center; justify-content: center; gap: 14px;
  font-size: 11px; letter-spacing: .34em; text-transform: uppercase; color: rgba(255,255,255,.42);
  opacity: 0; transform: translateY(10px);
  animation: fade-up .8s cubic-bezier(.2,.8,.2,1) .8s forwards;
}
.intro-kicker i { width: 16px; height: 1px; background: rgba(255,255,255,.28); }
@keyframes fade-up { to { opacity: 1; transform: none; } }

.intro-words { margin-top: 26px; display: flex; flex-direction: column; gap: 4px; }
.iw { display: block; overflow: hidden; }
.iw em {
  display: block; font-style: normal;
  font-family: var(--font-serif, serif);
  font-size: clamp(19px, 2.2vw, 30px); line-height: 1.5;
  color: rgba(255,255,255,.92);
  transform: translateY(112%);
}
.iw:nth-child(1) em { animation: word-up .95s cubic-bezier(.2,.8,.2,1) 1s forwards; }
.iw:nth-child(2) em { animation: word-up .95s cubic-bezier(.2,.8,.2,1) 1.14s forwards; }
.iw u {
  text-decoration: none; font-family: var(--font-sans, sans-serif); font-weight: 700;
  background: linear-gradient(100deg, #C89BF0, #F2A0C4 55%, #F0978B);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
@keyframes word-up { to { transform: none; } }

.intro-meter {
  margin-top: 32px; display: flex; align-items: center; justify-content: center; gap: 14px;
  opacity: 0; animation: fade-up .8s ease 1.25s forwards;
}
.im-bar {
  width: min(220px, 40vw); height: 1px; background: rgba(255,255,255,.16);
  position: relative; overflow: hidden;
}
.im-bar i {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, #B26BE0, #E05FA9, #F0978B);
  transform-origin: left; transform: scaleX(0);
  animation: bar-fill 1.5s cubic-bezier(.4,0,.2,1) 1.3s forwards;
}
@keyframes bar-fill { to { transform: scaleX(1); } }
.im-num {
  font-size: 11px; letter-spacing: .2em; color: rgba(255,255,255,.5);
  font-variant-numeric: tabular-nums;
}

/* 扫描线 */
.intro-scan {
  position: absolute; left: 0; right: 0; top: -22%; height: 22%;
  background: linear-gradient(180deg, transparent, rgba(255,255,255,.055) 45%, rgba(183,148,232,.10) 55%, transparent);
  animation: scan-sweep 1.5s .15s cubic-bezier(.4,0,.6,1) forwards;
  pointer-events: none;
}
@keyframes scan-sweep { to { transform: translateY(560%); } }

/* 取景框四角 */
.intro-corners i {
  position: absolute; width: 26px; height: 26px; opacity: 0;
  border: 0 solid rgba(255,255,255,.55);
  animation: corner-in .6s cubic-bezier(.2,.8,.2,1) forwards;
}
.intro-corners .c1 { top: 22px; left: 22px; border-top-width: 1.5px; border-left-width: 1.5px; animation-delay: .05s; }
.intro-corners .c2 { top: 22px; right: 22px; border-top-width: 1.5px; border-right-width: 1.5px; animation-delay: .12s; }
.intro-corners .c3 { bottom: 22px; left: 22px; border-bottom-width: 1.5px; border-left-width: 1.5px; animation-delay: .19s; }
.intro-corners .c4 { bottom: 22px; right: 22px; border-bottom-width: 1.5px; border-right-width: 1.5px; animation-delay: .26s; }
@keyframes corner-in {
  from { opacity: 0; transform: scale(1.6); }
  to { opacity: 1; transform: none; }
}

/* 顶部信息行 */
.intro-meta {
  position: absolute; top: 32px; left: 62px; right: 62px;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 10px; letter-spacing: .3em; color: rgba(255,255,255,.38);
  text-transform: uppercase;
  opacity: 0; animation: fade-up .7s ease .3s forwards;
}
.im-blink { color: rgba(240,151,139,.85); letter-spacing: .22em; animation: im-blink 1.1s steps(1) infinite; }
@keyframes im-blink { 50% { opacity: .15; } }

/* 背景描边大字 */
.intro-bgword {
  position: absolute; inset: 0; display: grid; place-items: center;
  overflow: hidden; pointer-events: none;
}
.intro-bgword span {
  font-family: "Space Grotesk", sans-serif; font-weight: 700;
  font-size: clamp(90px, 17vw, 250px); letter-spacing: .04em;
  color: transparent; -webkit-text-stroke: 1.5px rgba(255,255,255,.07);
  transform: translateY(14%); opacity: 0; white-space: nowrap;
  animation: bgword-in 1.4s cubic-bezier(.16,1,.3,1) .3s forwards;
}
@keyframes bgword-in { to { transform: none; opacity: 1; } }

/* 底部提示 */
.intro-foot {
  position: absolute; bottom: 30px; left: 0; right: 0;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  font-size: 9px; letter-spacing: .34em; color: rgba(255,255,255,.34);
  text-transform: uppercase;
  opacity: 0; animation: fade-up .7s ease 1s forwards;
}
.if-dots { display: flex; gap: 6px; }
.if-dots i { width: 4px; height: 4px; border-radius: 50%; background: rgba(255,255,255,.4); animation: dot-pulse 1.2s ease-in-out infinite; }
.if-dots i:nth-child(2) { animation-delay: .15s; }
.if-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot-pulse { 0%,100% { opacity: .25; transform: scale(1); } 50% { opacity: 1; transform: scale(1.5); } }

@media (prefers-reduced-motion: reduce) {
  .intro-orb, .intro-grain, .intro-signline, .intro-scan, .if-dots i, .im-blink, .ir-track { animation: none !important; }
  .intro-signwrap img { clip-path: none; }
  .iw em { transform: none; }
}

/* ---------- 回到顶部 ---------- */
.back-top {
  position: fixed; right: 28px; bottom: 28px; z-index: 90;
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--ink, #1A1A1C); color: #fff;
  display: grid; place-items: center;
  opacity: 0; visibility: hidden; transform: translateY(16px);
  transition: all .35s cubic-bezier(.2,.8,.2,1);
  box-shadow: 0 8px 24px rgba(26,26,28,.25);
}
.back-top.show { opacity: 1; visibility: visible; transform: none; }
.back-top:hover { transform: translateY(-4px); background: var(--grad); }

/* ---------- Hero 逐字显现 ---------- */
.ht-line { display: block; overflow: hidden; }
.ht-line .ch {
  display: inline-block;
  transform: translateY(110%);
  transition: transform 1s cubic-bezier(.2,.8,.2,1);
}
body.hero-revealed .ht-line .ch { transform: translateY(0); }

/* ---------- 列表式作品展示（借鉴参考站） ---------- */
.works-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 72px;
  align-items: start;
}
.works-side { position: sticky; top: 118px; }
.works-title {
  font-family: var(--font-serif); font-weight: 400;
  font-size: clamp(30px, 2.9vw, 40px);
  line-height: 1.14; letter-spacing: -0.02em;
  margin-top: 16px;
  clip-path: inset(0 0 100% 0);
  transform: translateY(24px);
  transition: clip-path 1s cubic-bezier(.2,.8,.2,1), transform 1s cubic-bezier(.2,.8,.2,1);
}
.works.in .works-title { clip-path: inset(0 0 0 0); transform: none; }
.works-title em { color: var(--accent, #B794E8); font-style: italic; }
.works-side .lead { margin-top: 20px; font-size: 14.5px; color: var(--ink-2); line-height: 1.7; }
.works-count {
  margin-top: 30px; font-size: 12px; letter-spacing: .2em;
  color: var(--ink-3); text-transform: uppercase;
}
.works-count b {
  font-family: var(--font-serif); font-size: 26px; font-weight: 400;
  color: var(--purple); letter-spacing: 0;
  margin-right: 6px; vertical-align: -3px;
}
.works-side-note {
  margin-top: 46px; font-size: 11px; letter-spacing: .26em;
  text-transform: uppercase; color: var(--ink-3);
  display: flex; align-items: center; gap: 12px;
}
.works-side-note::before { content: ""; width: 34px; height: 1px; background: var(--ink-3); opacity: .5; }

.works-main { min-width: 0; }
.works-list { position: relative; }
.work-row {
  display: grid; grid-template-columns: 56px 1fr 44px;
  align-items: start; gap: 26px; padding: 30px 8px;
  border-top: 1px solid var(--line);
  cursor: pointer; position: relative;
  opacity: 0; transform: translateY(34px);
  transition: opacity .7s ease, transform .8s cubic-bezier(.2,.8,.2,1), background .35s ease;
  transition-delay: calc(var(--i) * 90ms);
}
.works.in .work-row { opacity: 1; transform: none; }
.works-list.hovering .work-row:not(:hover) { opacity: .3; }
.work-row:last-child { border-bottom: 1px solid var(--line); }
.work-row:hover { background: rgba(255,255,255,.5); }
.work-row::after {
  content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px;
  height: 1px; background: var(--purple);
  transform: scaleX(0); transform-origin: left;
  transition: transform .6s cubic-bezier(.2,.8,.2,1);
}
.work-row:hover::after { transform: scaleX(1); }

.work-idx {
  font-family: var(--font-serif); font-size: 15px;
  color: var(--ink-3); letter-spacing: .12em;
  padding-top: 6px; transition: color .25s ease;
}
.work-row:hover .work-idx { color: var(--purple); }

.work-name {
  display: flex; flex-direction: column; align-items: flex-start;
  gap: 8px; min-width: 0;
  transition: transform .5s cubic-bezier(.2,.8,.2,1);
}
.work-row:hover .work-name { transform: translateX(14px); }
.wn-zh {
  font-family: var(--font-serif); font-size: clamp(24px, 2.6vw, 38px);
  line-height: 1.12; letter-spacing: -0.01em;
}
.wn-en {
  font-size: 10px; font-weight: 600; letter-spacing: .22em;
  text-transform: uppercase; color: var(--ink-3);
}
.work-tags { display: flex; align-items: center; gap: 10px; margin-top: 6px; flex-wrap: wrap; }
.work-arrow {
  width: 40px; height: 40px; border: 1px solid var(--line);
  border-radius: 50%; display: grid; place-items: center;
  font-size: 14px; line-height: 1; color: var(--ink-3);
  transition: background .3s, border-color .3s, color .3s, transform .45s cubic-bezier(.2,.8,.2,1);
}
.work-row:hover .work-arrow {
  background: var(--purple); border-color: var(--purple); color: #fff;
  transform: translate(4px, -4px);
}

/* 悬停跟随预览卡 */
.work-preview {
  position: fixed; left: 0; top: 0; width: 300px; z-index: 95;
  pointer-events: none; opacity: 0; visibility: hidden;
  transition: opacity .28s ease, visibility .28s ease;
  will-change: transform;
}
.work-preview.show { opacity: 1; visibility: visible; }
.wp-cover {
  height: 176px; border-radius: 14px; overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: 0 18px 50px rgba(40,24,40,.16);
  background: #fff;
}
.wp-cover canvas, .wp-art canvas { width: 100%; height: 100%; display: block; }
.wp-art { width: 100%; height: 100%; }
.wp-shot { width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; }
.wp-info {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 10px 6px 0; font-size: 12.5px; color: var(--ink-2);
}
.wp-status { font-weight: 600; }
.wp-hint { color: var(--purple); font-weight: 600; }

@media (max-width: 1024px) {
  .works-layout { grid-template-columns: 1fr; gap: 44px; }
  .works-side { position: static; max-width: 560px; }
}
@media (max-width: 760px) {
  .work-row { grid-template-columns: 38px 1fr auto; gap: 14px; padding: 22px 4px; }
  .work-name .work-tags { display: none; }
  .work-preview { display: none; }
  .work-arrow { width: 34px; height: 34px; font-size: 12px; }
}
