/*
 * 刘一川个人品牌网站·动效增强样式
 * 本文件只消费现有品牌变量，并由 motion-enhancements.js 驱动状态与 CSS 变量。
 */

:root {
  --accent: var(--color-signal-red);
  --accent-soft: rgba(var(--rgb-signal-red), 0.12);
  --accent-glow: rgba(var(--rgb-signal-red), 0.24);
  --border: rgba(var(--rgb-warm-ink), 0.16);
  --border-hover: rgba(var(--rgb-signal-red), 0.78);
  --border-focus: var(--color-signal-red);
  --text: var(--color-warm-ink);
  --text-secondary: rgba(var(--rgb-warm-ink), 0.78);
  --spotlight: rgba(var(--rgb-warm-ink), 0.14);

  --ease-cinema: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-signal: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-settle: cubic-bezier(0.22, 1, 0.36, 1);
  --duration-fast: 180ms;
  --duration-ui: 320ms;
  --duration-reveal: 760ms;
  --duration-scene: 1100ms;

  --shadow-trace: 6px 6px rgba(var(--rgb-signal-red), 0.12);
  --shadow-lift: 0 18px 48px rgba(var(--rgb-core-black), 0.34),
    0 0 0 1px rgba(var(--rgb-signal-red), 0.18);
  --shadow-stage: 0 32px 90px rgba(var(--rgb-core-black), 0.48),
    0 0 42px rgba(var(--rgb-signal-red), 0.18);
  --shadow-evidence: 0 12px 0 rgba(var(--rgb-signal-red), 0.14),
    0 30px 72px rgba(var(--rgb-core-black), 0.4),
    0 0 0 1px rgba(var(--rgb-signal-red), 0.24);
  --shadow-focus: 0 0 0 4px rgba(var(--rgb-signal-red), 0.15),
    0 18px 48px rgba(var(--rgb-core-black), 0.3);
}

/* 章节背景交接：在上一章节内部提前引入下一章节的底色与纹理。 */
main > section {
  --section-exit-height: clamp(112px, 12vw, 184px);
  --section-exit-solid: var(--surface-page);
  --section-exit-bg: var(--section-exit-solid);
  --section-exit-size: auto;
  --section-exit-position: 0 0;
  --section-exit-repeat: no-repeat;

  isolation: isolate;
}

/* 修正基础样式中 Hero 在 74% 位置的硬色阶，改为连续的章节退场。 */
.hero-section {
  background:
    linear-gradient(
      180deg,
      rgba(var(--rgb-core-black), 0.2) 0%,
      var(--color-core-black) 56%,
      var(--surface-hero-end) 100%
    ),
    var(--surface-page);
}

main > section::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: -1;
  height: var(--section-exit-height);
  content: "";
  pointer-events: none;
  background: linear-gradient(
    180deg,
    transparent 0%,
    var(--section-exit-solid) 100%
  );
}

@supports ((-webkit-mask-image: linear-gradient(#000, #000)) or (mask-image: linear-gradient(#000, #000))) {
  main > section::after {
    background: var(--section-exit-bg);
    background-position: var(--section-exit-position);
    background-repeat: var(--section-exit-repeat);
    background-size: var(--section-exit-size);
    -webkit-mask-image: linear-gradient(
      180deg,
      transparent 0%,
      rgba(0, 0, 0, 0.06) 14%,
      rgba(0, 0, 0, 0.38) 46%,
      rgba(0, 0, 0, 0.78) 74%,
      #000 100%
    );
    mask-image: linear-gradient(
      180deg,
      transparent 0%,
      rgba(0, 0, 0, 0.06) 14%,
      rgba(0, 0, 0, 0.38) 46%,
      rgba(0, 0, 0, 0.78) 74%,
      #000 100%
    );
  }
}

/* Hero / Experience → 纸面章节：底色与 38px 工程网格同步接入。 */
#top,
#experience {
  --section-exit-solid: var(--surface-section-paper);
  --section-exit-bg:
    linear-gradient(var(--paper-grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--paper-grid-line) 1px, transparent 1px),
    var(--surface-section-paper);
  --section-exit-size: 38px 38px, 38px 38px, auto;
  --section-exit-position: left bottom, left bottom, 0 0;
  --section-exit-repeat: repeat, repeat, no-repeat;
}

/* About → Experience：网格逐渐压暗，同时提前交接左侧信号红光。 */
#about {
  --section-exit-solid: var(--surface-section-dark);
  --section-exit-bg:
    linear-gradient(
      90deg,
      rgba(var(--rgb-signal-red), 0.22),
      transparent 18%
    ),
    var(--surface-section-dark);
}

/* Project → Human Signals：纸面网格溶解为下一章的径向环境光。 */
#project {
  --section-exit-solid: var(--surface-section-dark);
  --section-exit-bg:
    radial-gradient(
      circle at 8% 100%,
      rgba(var(--rgb-signal-red), 0.14),
      transparent 30%
    ),
    var(--surface-section-dark);
}

/* Human Signals / Contact：收束局部光场，平滑回到页面基底。 */
main > .memory-section,
#contact {
  --section-exit-solid: var(--color-core-black);
  --section-exit-bg: var(--color-core-black);
}

@media (max-width: 760px) {
  main > section {
    --section-exit-height: clamp(56px, 18vw, 88px);
  }
}

/* 首屏序列每次会话只播放一次；锚点直达和 Reduced Motion 直接进入内容。 */
:root[data-motion-boot="skip"] .intro-wipe {
  display: none;
}

:root[data-motion-boot="skip"] .hero-copy h1 span {
  -webkit-clip-path: none;
  clip-path: none;
  animation: none;
}

/* 页面进度与 Header 状态 */
.scroll-trace {
  position: fixed;
  inset: 0 0 auto;
  z-index: 80;
  height: 2px;
  pointer-events: none;
  background: var(--accent);
  transform: scaleX(var(--page-progress, 0));
  transform-origin: left center;
  will-change: transform;
}

.site-header {
  transition:
    min-height 260ms var(--ease-cinema),
    background 260ms ease,
    border-color 260ms ease;
}

.site-nav a[aria-current="true"] {
  color: var(--text);
  background: var(--accent-soft);
}

.site-nav a[aria-current="true"]::after {
  transform: scaleX(1);
}

@media (min-width: 901px) {
  .site-header.is-scrolled {
    min-height: 64px;
    background: rgba(var(--rgb-core-black), 0.92);
    border-bottom-color: rgba(var(--rgb-signal-red), 0.36);
  }
}

/* 章节标题的 Mask Reveal 与 Eyebrow Signal Scan */
.motion-enabled .section-heading h2,
.motion-enabled .project-copy h2,
.motion-enabled .memory-heading h2:not(#memory-title) {
  -webkit-clip-path: inset(0 0 100% 0);
  clip-path: inset(0 0 100% 0);
}

/* Memory Decrypted Text：逐字还原后停留 1 秒，并在视口内持续循环。 */
#memory-title.memory-decrypted {
  -webkit-clip-path: none;
  clip-path: none;
}

.memory-decrypted__word {
  display: inline-block;
  height: 1lh;
  white-space: nowrap;
  vertical-align: top;
}

.memory-decrypted__word-inner {
  display: inline-block;
  height: 1lh;
  line-height: inherit;
  white-space: nowrap;
  transform-origin: left center;
  vertical-align: top;
}

.memory-decrypted__char {
  display: inline-block;
  height: 1lh;
  line-height: inherit;
  text-align: center;
  vertical-align: top;
  transition:
    color 120ms ease,
    text-shadow 180ms ease;
}

.memory-decrypted__char.is-encrypted {
  color: rgba(var(--rgb-signal-red), 0.82);
  text-shadow: 0 0 18px rgba(var(--rgb-signal-red), 0.28);
}

.memory-decrypted__char.is-revealed {
  color: inherit;
  text-shadow: none;
}

/* Contact Shuffle：参考 React Bits，字符带完成后停留 2 秒并持续循环。 */
#contact-title.contact-shuffle {
  overflow: visible;
}

#contact-title.contact-shuffle > span {
  min-width: 0;
}

.contact-shuffle__word {
  display: inline-block;
  height: 1lh;
  white-space: nowrap;
  vertical-align: top;
}

.contact-shuffle__word-inner {
  display: inline-block;
  height: 1lh;
  line-height: inherit;
  white-space: nowrap;
  transform-origin: left center;
  vertical-align: top;
}

.contact-shuffle__char {
  position: relative;
  display: inline-block;
  height: 1lh;
  overflow: hidden;
  vertical-align: top;
}

.contact-shuffle__strip {
  display: inline-flex;
  height: 1lh;
  white-space: nowrap;
  will-change: transform;
}

.contact-shuffle__glyph {
  display: inline-block;
  flex: 0 0 auto;
  line-height: inherit;
  text-align: center;
}

.contact-shuffle__glyph--scramble {
  color: rgba(var(--rgb-warm-ink), 0.6);
  opacity: 0.72;
}

.contact-shuffle__glyph--signal {
  color: var(--color-signal-red);
  opacity: 0.82;
  text-shadow: 0 0 12px rgba(var(--rgb-signal-red), 0.32);
}

/* Experience Falling Text：实时 Matter 物理，视口底边作为持续下移的地板。 */
#experience-title.experience-title--bilingual {
  display: grid;
  gap: clamp(7px, 1vw, 12px);
  max-width: 100%;
  -webkit-clip-path: none;
  clip-path: none;
}

#experience-title .experience-title__line {
  display: block;
}

#experience-title .experience-title__line--en {
  color: rgba(var(--rgb-warm-ink), 0.64);
  font-family: var(--font-mono);
  font-size: clamp(17px, 2vw, 26px);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.025em;
}

#experience-title.falling-title {
  position: relative;
  display: block;
  width: 100%;
  height: clamp(190px, 19vw, 252px);
  overflow: hidden;
  contain: layout paint;
  cursor: default;
}

#experience-title.falling-title .falling-title__line {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  width: 100%;
}

#experience-title.falling-title .experience-title__line--en {
  gap: 0.34em;
  margin-top: clamp(7px, 1vw, 12px);
}

#experience-title .falling-title__token {
  display: inline-block;
  flex: 0 0 auto;
  white-space: nowrap;
  user-select: none;
  will-change: auto;
}

#experience-title .falling-title__token.is-physics-source {
  opacity: 0;
  pointer-events: none;
}

#experience > .experience-fall-layer {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 3;
  overflow: clip;
  contain: layout paint;
  pointer-events: none;
  user-select: none;
}

#experience > .binary-rail,
#experience > .section-grid {
  position: relative;
  z-index: 2;
}

#experience > .experience-fall-layer .falling-title__token.is-physics {
  position: absolute;
  top: 0;
  left: 0;
  display: inline-block;
  margin: 0;
  white-space: nowrap;
  transform: translate3d(0, 0, 0) translate(-50%, -50%);
  transform-origin: center;
  will-change: auto;
  backface-visibility: hidden;
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
}

#experience
  > .experience-fall-layer
  .falling-title__token.is-physics.is-dragged {
  z-index: 2;
  cursor: grabbing;
}

#experience > .experience-fall-layer.is-active .falling-title__token.is-physics {
  will-change: transform;
}

#experience > .experience-fall-layer.is-settled .falling-title__token {
  will-change: auto;
}

#experience-title .falling-title__token.is-physics {
  position: absolute;
  margin: 0;
  transform: translate(-50%, -50%);
  transform-origin: center;
  will-change: transform;
}

#experience-title.is-settled .falling-title__token {
  will-change: auto;
}

.motion-enabled .eyebrow {
  position: relative;
  width: fit-content;
}

.motion-enabled .eyebrow::after {
  position: absolute;
  right: 0;
  bottom: -7px;
  left: 0;
  height: 2px;
  content: "";
  pointer-events: none;
  background: var(--accent);
  transform: scaleX(var(--label-scan, 0));
  transform-origin: left center;
}

/* About Depth Field：整页仅跟随光场与底图产生微视差，正文仍保持稳定。 */
#about .section-grid.motion-depth-field {
  --about-mx: 68%;
  --about-my: 24%;
  --about-image-x: 0px;
  --about-image-y: 0px;

  position: relative;
  isolation: isolate;
}

#about .section-grid.motion-depth-field::before {
  position: absolute;
  inset: -48px;
  z-index: 0;
  content: "";
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(
    560px circle at var(--about-mx) var(--about-my),
    rgba(var(--rgb-signal-red), 0.14),
    rgba(var(--rgb-signal-red), 0.045) 36%,
    transparent 72%
  );
  transition: opacity 360ms ease;
}

#about .section-grid.motion-depth-field.is-active::before {
  opacity: 1;
}

#about .motion-depth-field > .section-heading,
#about .motion-depth-field > .section-body {
  position: relative;
  z-index: 1;
}

#about .motion-depth-field .about-visual img {
  transform: translate3d(var(--about-image-x), var(--about-image-y), 0)
    scale(1.035);
  transition: transform 480ms var(--ease-cinema);
  will-change: auto;
}

#about .motion-depth-field.is-active .about-visual img {
  will-change: transform;
}

/* 卡片深度系统：位置、倾斜、聚光均由共享指针调度器更新 */
.motion-card {
  --rx: 0deg;
  --ry: 0deg;
  --lift: 0px;
  --scroll-y: 0px;
  --scroll-ry: 0deg;
  --card-scale: 1;
  --mx: 50%;
  --my: 50%;
  --card-perspective: 960px;
  --card-lift: -8px;
  --card-scale-hover: 1.008;
  --spotlight-size: 260px;
  --card-spotlight: var(--spotlight);
  --card-shadow-hover: var(--shadow-lift);

  position: relative;
  isolation: isolate;
  transform-style: preserve-3d;
  transform: perspective(var(--card-perspective))
    translate3d(0, calc(var(--lift) + var(--scroll-y)), 0) rotateX(var(--rx))
    rotateY(calc(var(--ry) + var(--scroll-ry)))
    scale(var(--card-scale));
  transition:
    transform 520ms var(--ease-cinema),
    border-color 220ms ease,
    box-shadow 220ms ease,
    background 220ms ease;
}

/* 与旧卡片 hover 规则同级，确保最终 transform 由变量合成式统一接管。 */
.motion-card.motion-card {
  transform: perspective(var(--card-perspective))
    translate3d(0, calc(var(--lift) + var(--scroll-y)), 0) rotateX(var(--rx))
    rotateY(calc(var(--ry) + var(--scroll-ry)))
    scale(var(--card-scale));
}

.motion-card::after {
  position: absolute;
  inset: 0;
  z-index: 0;
  content: "";
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(
    var(--spotlight-size) circle at var(--mx) var(--my),
    var(--card-spotlight),
    transparent 68%
  );
  transition:
    opacity 220ms ease,
    background-position 720ms var(--ease-cinema);
}

.motion-card > :not(.hero-panel__star) {
  position: relative;
  z-index: 1;
}

.motion-card > .hero-panel__star {
  position: absolute;
  z-index: 1;
}

.motion-card [data-depth="1"] {
  transform: translateZ(10px);
}

.motion-card [data-depth="2"] {
  transform: translateZ(18px);
}

.motion-card [data-depth="3"] {
  transform: translateZ(26px);
}

.metric-card.motion-card {
  --card-perspective: 900px;
  --card-lift: -10px;
  --card-scale-hover: 1.01;
  --spotlight-size: 400px;
  --card-spotlight: rgba(var(--rgb-signal-red), 0.2);
  --card-shadow-hover: var(--shadow-evidence);
}

.line-card.motion-card {
  --card-perspective: 1040px;
  --card-lift: -10px;
  --card-scale-hover: 1.01;
  --spotlight-size: 440px;
  --card-spotlight: rgba(var(--rgb-warm-ink), 0.16);
  --card-shadow-hover: var(--shadow-evidence);
}

/* React Bits SpotlightCard / GlareHover 思路的本地适配：不新增 DOM。 */
#about .metric-card.motion-card::after,
#about .line-card.motion-card::after {
  background:
    linear-gradient(
        112deg,
        transparent 24%,
        rgba(var(--rgb-warm-ink), 0.06) 40%,
        rgba(var(--rgb-signal-red), 0.2) 48%,
        rgba(var(--rgb-warm-ink), 0.11) 54%,
        transparent 72%
      )
      145% 50% / 250% 100% no-repeat,
    radial-gradient(
      var(--spotlight-size) circle at var(--mx) var(--my),
      var(--card-spotlight),
      transparent 68%
    );
}

#about .metric-card.motion-card > strong,
#about .metric-card.motion-card > p {
  transform: translateZ(16px);
}

#about .metric-card.motion-card > span {
  transform: translateZ(24px);
}

#about .line-card.motion-card > * {
  transform: translateZ(18px);
}

.timeline-card.motion-card {
  --card-perspective: 1080px;
  --card-lift: -8px;
  --card-spotlight: rgba(var(--rgb-warm-ink), 0.11);
  --card-shadow-hover: var(--shadow-lift);
}

.project-card.motion-card {
  --card-perspective: 1160px;
  --card-lift: -10px;
  --card-spotlight: rgba(var(--rgb-signal-red), 0.09);
  --card-shadow-hover: var(--shadow-stage);
}

.memory-object.motion-card {
  --card-perspective: 1120px;
  --card-lift: -8px;
  --card-spotlight: rgba(var(--rgb-warm-ink), 0.12);
  --card-shadow-hover: var(--shadow-lift);
}

.hero-panel.motion-card {
  --card-perspective: 1180px;
  --card-lift: -6px;
  --card-spotlight: rgba(var(--rgb-warm-ink), 0.1);
  --card-shadow-hover: var(--shadow-stage);
}

@media (hover: hover) and (pointer: fine) {
  .motion-card:hover {
    --lift: var(--card-lift);
    --card-scale: var(--card-scale-hover);
    border-color: var(--border-hover);
    box-shadow: var(--card-shadow-hover);
  }

  .motion-card:hover::after {
    opacity: 1;
  }

  #about .metric-card.motion-card:hover::after,
  #about .line-card.motion-card:hover::after {
    background-position:
      -62% 50%,
      0 0;
  }

  .motion-card.is-tracking {
    will-change: transform;
    transition-duration: 90ms, 220ms, 220ms, 220ms;
    transition-timing-function: linear, ease, ease, ease;
  }

  /* 覆盖 memory-activities.css 中 Human Signals hover 的 transform: none。 */
  .memory-section[data-memory-variant="human-signals"]
    .memory-object.motion-card:hover {
    transform: perspective(var(--card-perspective))
      translate3d(0, calc(var(--lift) + var(--scroll-y)), 0) rotateX(var(--rx))
      rotateY(calc(var(--ry) + var(--scroll-ry)))
      scale(var(--card-scale));
  }
}

/* Hero 与 Contact CTA 共享明确浮起；精细指针再叠加局部磁吸。 */
.motion-float-button,
.motion-magnetic {
  --magnet-x: 0px;
  --magnet-y: 0px;
  --button-lift: 0px;
  --button-scale: 1;
  transform: translate3d(
      var(--magnet-x),
      calc(var(--magnet-y) + var(--button-lift)),
      0
    )
    scale(var(--button-scale));
  transition:
    transform 360ms var(--ease-cinema),
    color 180ms var(--ease-out),
    border-color 180ms var(--ease-out),
    background 180ms var(--ease-out),
    box-shadow 180ms var(--ease-out);
}

.motion-magnetic {
  will-change: transform;
}

.motion-magnetic:active {
  --button-scale: 0.98;
}

.hero-actions .button.motion-float-button,
.contact-actions .button.motion-float-button {
  transform: translate3d(
      var(--magnet-x),
      calc(var(--magnet-y) + var(--button-lift)),
      0
    )
    scale(var(--button-scale));
}

.hero-actions .button.motion-float-button,
.hero-actions .button.motion-float-button:hover,
.hero-actions .button.motion-float-button:focus-visible,
.contact-actions .button.motion-float-button,
.contact-actions .button.motion-float-button:hover,
.contact-actions .button.motion-float-button:focus-visible {
  color: var(--color-warm-ink);
}

.hero-actions .button.motion-float-button:focus-visible,
.contact-actions .button.motion-float-button:focus-visible {
  --button-lift: -5px;
  --button-scale: 1.01;
  border-color: var(--color-signal-red);
  background: rgba(var(--rgb-blood-panel), 0.88);
  box-shadow: 0 9px 0 rgba(var(--rgb-signal-red), 0.16),
    0 22px 46px rgba(var(--rgb-core-black), 0.42), var(--shadow-red);
}

@media (hover: hover) and (pointer: fine) {
  .hero-actions .button.motion-float-button:hover,
  .contact-actions .button.motion-float-button:hover {
    --button-lift: -7px;
    --button-scale: 1.018;
    border-color: var(--color-signal-red);
    background: rgba(var(--rgb-core-black), 0.88);
    box-shadow: 0 9px 0 rgba(var(--rgb-signal-red), 0.16),
      0 24px 48px rgba(var(--rgb-core-black), 0.48), var(--shadow-red);
  }

  .hero-actions .button--primary.motion-float-button:hover,
  .contact-actions .button--primary.motion-float-button:hover {
    background: var(--color-blood-panel);
  }

  .hero-actions .button.motion-float-button:active,
  .contact-actions .button.motion-float-button:active {
    --button-lift: -2px;
    --button-scale: 0.985;
  }
}

.motion-card:focus-visible,
.motion-card:focus-within {
  --lift: -6px;
  --rx: 0deg;
  --ry: 0deg;
  outline: 2px solid var(--border-focus);
  outline-offset: 4px;
  border-color: var(--border-focus);
  box-shadow: var(--shadow-focus);
}

.motion-card:active,
.motion-card[data-selected="true"] {
  --lift: -4px;
  --card-scale: 0.995;
  border-color: var(--accent);
}

.motion-card[aria-disabled="true"] {
  opacity: 0.48;
  pointer-events: none;
  transform: none;
  box-shadow: none;
}

.memory-wall .memory-object.motion-ready {
  animation: none;
}

/* Experience：左侧 Sticky，右侧经历卡沿轨迹逐张激活 */
.motion-enabled #experience .timeline {
  --trace-progress: 0;
  position: relative;
}

.motion-enabled #experience .timeline::before,
.motion-enabled #experience .timeline::after {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 34px;
  z-index: 0;
  width: 1px;
  content: "";
  pointer-events: none;
}

.motion-enabled #experience .timeline::before {
  background: var(--border);
}

.motion-enabled #experience .timeline::after {
  background: var(--accent);
  transform: scaleY(var(--trace-progress));
  transform-origin: top center;
  will-change: transform;
}

.motion-enabled #experience .timeline-card {
  opacity: 0.48;
  transition:
    opacity 420ms ease,
    transform 220ms var(--ease-out),
    border-color 220ms var(--ease-out),
    background 220ms var(--ease-out),
    box-shadow 220ms var(--ease-out);
}

.motion-enabled #experience .timeline-card.is-active {
  opacity: 1;
  border-color: var(--border-hover);
  background: rgba(var(--rgb-blood-panel), 0.24);
}

@media (min-width: 1024px) {
  #experience .section-grid {
    align-items: start;
  }

  #experience .section-heading {
    position: sticky;
    top: calc(var(--header-height) + 48px);
    align-self: start;
  }

  #experience .timeline-card {
    min-height: min(64vh, 620px);
  }
}

/* Project Array：两套系统一次进入视野，无 Pin、无逐节点等待。 */
#project .project-layout.project-showcase {
  align-items: start;
  gap: clamp(18px, 2vw, 28px);
}

#project .project-showcase__intro {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: clamp(20px, 3vw, 44px);
  align-items: end;
  padding-bottom: clamp(28px, 4vw, 48px);
  border-bottom: 1px solid var(--line-on-paper);
}

#project .project-showcase__intro > .eyebrow {
  grid-column: 1 / -1;
  margin-bottom: 0;
}

#project .project-showcase__intro > h2 {
  grid-column: 1 / span 6;
  max-width: 10ch;
  font-size: clamp(44px, 6.2vw, 82px);
}

#project .project-showcase__intro > .lead {
  grid-column: 7 / -1;
  align-self: end;
  margin: 0 0 6px;
}

#project .project-showcase__intro > .skill-strip {
  display: none;
}

#project .project-showcase > .project-card {
  grid-column: auto;
  display: flex;
  flex-direction: column;
  min-height: 670px;
  padding: clamp(26px, 3.4vw, 44px);
  overflow: hidden;
}

#project .project-showcase > .project-card--ordering {
  grid-column: 1 / span 7;
}

#project .project-showcase > .project-card--solar {
  grid-column: 8 / -1;
  margin-top: 64px;
  background:
    radial-gradient(
      circle at 84% 16%,
      rgba(var(--rgb-signal-red), 0.13),
      transparent 30%
    ),
    var(--surface-card-paper);
}

#project .project-card__header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line-on-paper);
}

#project .project-card__index {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
}

#project .project-card__period,
#project .project-card__location,
#project .project-card__type {
  color: var(--text-on-paper-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

#project .project-card__location {
  text-align: right;
}

#project .project-card__type {
  margin: clamp(28px, 3vw, 40px) 0 8px;
  color: var(--accent);
}

#project .project-card h3 {
  margin: 0;
  max-width: 15ch;
  font-family: var(--font-serif);
  font-size: clamp(30px, 3.5vw, 50px);
  line-height: 1.08;
}

#project .project-card__summary {
  margin-top: 20px;
  color: var(--text-on-paper-muted);
  font-size: 15px;
  line-height: 1.8;
}

#project .project-flow {
  position: relative;
  isolation: isolate;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 28px 0 24px;
  padding: 12px 0;
  overflow: hidden;
  border-top: 1px solid var(--line-on-paper);
  border-bottom: 1px solid var(--line-on-paper);
}

#project .project-flow::before {
  position: absolute;
  inset: 8px auto 8px 0;
  z-index: 0;
  width: 22%;
  content: "";
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(var(--rgb-signal-red), 0.3),
    transparent
  );
  transform: translateX(-150%);
}

#project .project-flow span {
  z-index: 1;
  min-height: 62px;
  opacity: 0.76;
  transition:
    opacity 220ms ease,
    color 220ms ease,
    border-color 220ms ease,
    background 220ms ease,
    box-shadow 220ms ease;
}

#project .project-card ul {
  display: grid;
  gap: 10px;
  margin-top: 0;
}

#project .project-card li {
  margin-top: 0;
  opacity: 1;
  transform: none;
}

#project .project-tags {
  margin-top: auto;
  padding-top: 24px;
  border-top: 1px solid var(--line-on-paper);
}

@media (hover: hover) and (pointer: fine) {
  #project .project-card:hover .project-flow::before {
    opacity: 1;
    animation: projectSignalSweep 620ms var(--ease-signal) both;
  }

  #project .project-card:hover .project-flow span {
    color: var(--text-on-paper);
    opacity: 1;
    border-color: var(--accent);
    background: var(--accent-soft);
    box-shadow: 0 0 18px var(--accent-glow);
  }
}

.motion-enabled
  #project
  .project-showcase.project-motion-ready:not(.is-presented)
  > .project-card {
  opacity: 0;
  -webkit-clip-path: inset(0 0 18% 0);
  clip-path: inset(0 0 18% 0);
}

.motion-enabled
  #project
  .project-showcase.project-motion-ready.is-presented
  > .project-card {
  animation: projectCardAssemble 760ms var(--ease-cinema) both;
}

.motion-enabled
  #project
  .project-showcase.project-motion-ready.is-presented
  > .project-card--solar {
  animation-delay: 90ms;
}

#project .project-showcase.is-settled > .project-card {
  opacity: 1;
  -webkit-clip-path: none;
  clip-path: none;
  animation: none;
}

@keyframes projectCardAssemble {
  0% {
    opacity: 0;
    -webkit-clip-path: inset(0 0 18% 0);
    clip-path: inset(0 0 18% 0);
  }

  100% {
    opacity: 1;
    -webkit-clip-path: inset(0 0 0 0);
    clip-path: inset(0 0 0 0);
  }
}

@keyframes projectSignalSweep {
  0% {
    transform: translateX(-150%);
  }

  100% {
    transform: translateX(560%);
  }
}

/* Contact 成功反馈：视觉信号与 live region 同步，但不改变按钮文案逻辑。 */
.motion-status {
  position: fixed;
  right: clamp(14px, 3vw, 32px);
  bottom: clamp(14px, 3vw, 30px);
  z-index: 90;
  max-width: min(82vw, 380px);
  padding: 10px 14px;
  border: 1px solid var(--border-hover);
  color: var(--color-warm-ink);
  background: rgba(var(--rgb-core-black), 0.94);
  box-shadow: var(--shadow-lift);
  font: 700 12px/1.45 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  pointer-events: none;
  opacity: 0;
  transform: translate3d(0, 10px, 0);
  transition:
    opacity 220ms ease,
    transform 420ms var(--ease-cinema);
}

.motion-status.is-visible {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

#contact.is-signal-locked .contact-actions {
  position: relative;
}

#contact.is-signal-locked .contact-actions::after {
  position: absolute;
  inset: -10px;
  content: "";
  pointer-events: none;
  border: 1px solid var(--accent);
  opacity: 0;
  animation: signalLockedPulse 900ms var(--ease-cinema) both;
}

@keyframes signalLockedPulse {
  0% {
    opacity: 0.72;
    transform: scale(0.98);
  }

  100% {
    opacity: 0;
    transform: scale(1.04);
  }
}

/* 中等屏幕与触屏：回到自然文档流，保证内容先于特效 */
@media (max-width: 1023px) {
  #experience .section-heading {
    position: static;
  }

  #experience .timeline-card {
    min-height: 0;
  }

  .motion-enabled #experience .timeline-card {
    opacity: 1;
  }

  #project .project-showcase__intro > h2,
  #project .project-showcase__intro > .lead {
    grid-column: 1 / -1;
  }

  #project .project-showcase > .project-card--ordering,
  #project .project-showcase > .project-card--solar {
    grid-column: 1 / -1;
    min-height: 0;
    margin-top: 0;
  }

  #project .project-showcase > .project-card--solar {
    margin-top: 8px;
  }
}

@media (max-width: 760px), (hover: none), (pointer: coarse) {
  #experience-title.falling-title {
    height: clamp(160px, 46vw, 210px);
  }

  .motion-card,
  .motion-card:hover,
  .memory-section[data-memory-variant="human-signals"]
    .memory-object.motion-card:hover {
    --rx: 0deg;
    --ry: 0deg;
    --lift: 0px;
    --card-scale: 1;
    transform: none;
    box-shadow: none;
  }

  .motion-card:active {
    border-color: var(--accent);
    transform: scale(0.99);
  }

  .motion-card::after,
  .scroll-trace {
    display: none;
  }

  .motion-magnetic,
  .motion-float-button,
  .hero-actions .button.motion-float-button {
    --magnet-x: 0px;
    --magnet-y: 0px;
    --button-lift: 0px;
    --button-scale: 1;
    transform: none !important;
    will-change: auto;
  }

  #about .motion-depth-field::before {
    display: none;
  }

  #about .motion-depth-field .about-visual img,
  #about .metric-card.motion-card > *,
  #about .line-card.motion-card > * {
    transform: none;
    will-change: auto;
  }

  .motion-enabled #experience .timeline::before,
  .motion-enabled #experience .timeline::after {
    display: none;
  }

  #project .project-flow {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #project .project-flow span::after,
  #project .project-flow::before {
    display: none;
  }

  #project .project-showcase > .project-card {
    padding: 22px;
  }
}

@media (max-width: 420px) {
  .motion-enabled .eyebrow::after {
    right: 28%;
  }
}

/* 低性能预算：不隐藏内容，只取消 Tilt、Sticky 与 Pin 所需变换 */
html[data-motion-budget="light"] .motion-card,
html[data-motion-budget="light"] .motion-card:hover,
html[data-motion-budget="light"]
  .memory-section[data-memory-variant="human-signals"]
  .memory-object.motion-card:hover {
  --rx: 0deg;
  --ry: 0deg;
  --lift: 0px;
  --card-scale: 1;
  transform: none;
  box-shadow: none;
}

html[data-motion-budget="light"] #experience .section-heading,
html[data-motion-budget="light"] #project .project-layout {
  position: static !important;
  transform: none !important;
}

html[data-motion-budget="light"] #experience .timeline-card {
  opacity: 1 !important;
  transform: none !important;
}

html[data-motion-budget="light"] #project .project-showcase > .project-card {
  opacity: 1 !important;
  -webkit-clip-path: none !important;
  clip-path: none !important;
  animation: none !important;
}

html[data-motion-budget="light"] #project .project-flow::before {
  display: none;
}

html[data-motion-budget="light"] .motion-magnetic,
html[data-motion-budget="light"] .motion-float-button,
html[data-motion-budget="light"] .hero-actions .button.motion-float-button {
  --magnet-x: 0px;
  --magnet-y: 0px;
  --button-lift: 0px;
  --button-scale: 1;
  transform: none !important;
  will-change: auto;
}

html[data-motion-budget="light"] #about .motion-depth-field::before {
  display: none;
}

html[data-motion-budget="light"] #about .motion-depth-field .about-visual img,
html[data-motion-budget="light"] #about .metric-card.motion-card > *,
html[data-motion-budget="light"] #about .line-card.motion-card > * {
  transform: none;
  will-change: auto;
}

/* 系统降级：Reduced Motion 下保留完整内容和状态，移除位移与持续动画 */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto !important;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .intro-wipe,
  .scroll-trace,
  .motion-status,
  #contact.is-signal-locked .contact-actions::after {
    display: none !important;
  }

  .motion-magnetic,
  .motion-magnetic:hover,
  .motion-magnetic:focus-visible,
  .motion-magnetic:active,
  .motion-float-button,
  .motion-float-button:hover,
  .motion-float-button:focus-visible,
  .motion-float-button:active,
  .hero-actions .button.motion-float-button {
    --magnet-x: 0px !important;
    --magnet-y: 0px !important;
    --button-lift: 0px !important;
    --button-scale: 1 !important;
    transform: none !important;
  }

  [data-reveal],
  .section-heading h2,
  .project-copy h2,
  .memory-heading h2,
  .contact-inner h2 {
    opacity: 1 !important;
    -webkit-clip-path: none !important;
    clip-path: none !important;
    transform: none !important;
  }

  .contact-shuffle__strip {
    transform: none !important;
    will-change: auto !important;
  }

  .contact-shuffle__glyph:not(:first-child) {
    display: none !important;
  }

  #experience-title.falling-title {
    display: grid;
    height: auto;
    min-height: 0;
    overflow: visible;
    contain: none;
  }

  #experience-title.falling-title .experience-title__line--en {
    margin-top: 0;
  }

  #experience-title .falling-title__token,
  #experience-title .falling-title__token.is-physics {
    position: static;
    left: auto !important;
    top: auto !important;
    transform: none !important;
    will-change: auto !important;
  }

  #experience > .experience-fall-layer {
    display: none !important;
  }

  #experience-title .falling-title__token.is-physics-source {
    opacity: 1 !important;
  }

  .motion-card,
  .motion-card:hover,
  .motion-card:focus-within,
  .memory-section[data-memory-variant="human-signals"]
    .memory-object.motion-card:hover {
    --rx: 0deg !important;
    --ry: 0deg !important;
    --lift: 0px !important;
    --card-scale: 1 !important;
    transform: none !important;
  }

  .motion-card::after,
  #about .motion-depth-field::before,
  .motion-enabled #experience .timeline::after {
    display: none !important;
  }

  #about .motion-depth-field .about-visual img,
  #about .metric-card.motion-card > *,
  #about .line-card.motion-card > * {
    transform: none !important;
    will-change: auto !important;
  }

  #experience .section-heading,
  #project .project-layout {
    position: static !important;
    transform: none !important;
  }

  #experience .timeline-card,
  #project .project-showcase > .project-card {
    opacity: 1 !important;
    -webkit-clip-path: none !important;
    clip-path: none !important;
    transform: none !important;
    animation: none !important;
  }

  #project .project-flow::before {
    display: none !important;
  }
}
