/* ============================================================
   fx.css — 逐项生效的质感增强
   每个效果由 body 上的类名控制，删类名即可单独回滚
   ============================================================ */

/* ------------------------------------------------------------
   01 噪点纹理  body.fx-noise
   作用：消除深色背景的"数字感"，增加胶片颗粒
   ------------------------------------------------------------ */
.fx-noise-layer {
  position: fixed;
  inset: 0;
  z-index: 9997;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.2s ease;
  background-image: url("../assets/noise.png");
  background-repeat: repeat;
  background-size: 128px 128px;
}

body.fx-noise .fx-noise-layer {
  opacity: 0.035;
}

/* ------------------------------------------------------------
   02 光标 + 磁性按钮  body.fx-cursor（由 JS 添加，JS 失败则原样）
   ------------------------------------------------------------ */
.fx-cursor-layer {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9996;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease;
}

body.fx-cursor .fx-cursor-layer {
  animation: fxCursorIn 0.28s ease forwards;
}

@keyframes fxCursorIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

body.fx-cursor,
body.fx-cursor a,
body.fx-cursor button,
body.fx-cursor input,
body.fx-cursor .tile,
body.fx-cursor .hx-metric {
  cursor: none;
}

.fx-cursor-layer i {
  position: absolute;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: #fff5dd;
  box-shadow:
    0 0 8px rgba(255, 245, 221, 0.95),
    0 0 18px rgba(212, 175, 55, 0.75),
    0 0 34px rgba(212, 175, 55, 0.4);
  transition: transform 0.22s ease, opacity 0.22s ease;
}

.fx-cursor-layer b {
  position: absolute;
  width: 30px;
  height: 30px;
  margin: -15px 0 0 -15px;
  border-radius: 50%;
  border: 1px solid rgba(212, 175, 55, 0.45);
  background: radial-gradient(circle, rgba(212, 175, 55, 0.1), transparent 70%);
  transition:
    transform 0.4s cubic-bezier(0.22, 1, 0.36, 1),
    width 0.28s ease,
    height 0.28s ease,
    margin 0.28s ease,
    border-color 0.28s ease,
    background 0.28s ease;
}

.fx-cursor-layer.is-hover i {
  transform: scale(0.2);
  opacity: 0.5;
}

.fx-cursor-layer.is-hover b {
  width: 56px;
  height: 56px;
  margin: -28px 0 0 -28px;
  border-color: rgba(255, 240, 205, 0.8);
  background: radial-gradient(circle, rgba(212, 175, 55, 0.16), transparent 72%);
}

/* 磁性按钮：用独立的 translate 属性，不覆盖已有的 transform */
body.fx-cursor .btn,
body.fx-cursor .nav-cta,
body.fx-cursor .hx-search button {
  transition:
    translate 0.18s ease-out,
    transform 0.2s,
    box-shadow 0.2s,
    background 0.2s;
  will-change: translate;
}

/* ------------------------------------------------------------
   03 卡片 3D 倾斜  body.fx-tilt
   用 CSS 变量承载角度，避免覆盖原有 hover transform
   ------------------------------------------------------------ */
body.fx-tilt .hx-metric,
body.fx-tilt .tile {
  transform:
    perspective(1000px)
    rotateX(var(--tx, 0deg))
    rotateY(var(--ty, 0deg))
    translateY(var(--lift, 0px));
  transition:
    transform 0.42s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.42s,
    border-color 0.42s;
  will-change: transform;
}

body.fx-tilt .hx-metric:hover { --lift: -6px; }
body.fx-tilt .tile:hover { --lift: -10px; }

/* 倾斜时给卡片内部一点纵深：图标和 logo 浮起来 */
body.fx-tilt .tile .ico,
body.fx-tilt .tile-logo {
  transform: translateZ(24px);
  transition: transform 0.42s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ------------------------------------------------------------
   04 标题逐字入场  body.fx-split
   JS 只负责拆字，动画完全由 CSS 驱动；JS 失败则原文显示
   ------------------------------------------------------------ */
.hx-left h1 .l1 {
  display: block;
  white-space: nowrap;
}

body.fx-split .hx-left h1 {
  animation: none;
}

body.fx-split .hx-left h1 .l1 .ch {
  display: inline-block;
  animation: chIn 0.72s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--i, 0) * 38ms + 120ms);
}

body.fx-split .hx-left h1 .l2 {
  animation: rise 0.9s cubic-bezier(0.22, 1, 0.36, 1) both 0.52s;
}

@keyframes chIn {
  from {
    opacity: 0;
    transform: translateY(0.55em);
    filter: blur(6px);
  }
  to {
    opacity: 1;
    transform: none;
    filter: blur(0);
  }
}

/* ------------------------------------------------------------
   05 滚动进度条  body.fx-scrollbar
   ------------------------------------------------------------ */
.fx-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 10000;
  pointer-events: none;
  background: rgba(212, 175, 55, 0.07);
  opacity: 0;
  transition: opacity 0.5s ease;
}

body.fx-scrollbar .fx-progress {
  opacity: 1;
}

.fx-progress i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, rgba(140, 110, 50, 0.5), #c8a45c 55%, #e8d5b0 88%, #f5e6c4);
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.75), 0 0 20px rgba(212, 175, 55, 0.35);
  transition: width 0.08s linear;
}

/* ------------------------------------------------------------
   06 页面过场
   优先用原生 View Transition（零等待、不白屏）；
   不支持时才退回 JS 遮罩，且时长压到 240ms
   ------------------------------------------------------------ */
@view-transition {
  navigation: auto;
}

::view-transition-old(root) {
  animation: vtOut 0.22s cubic-bezier(0.4, 0, 1, 1) both;
}

::view-transition-new(root) {
  animation: vtIn 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes vtOut {
  to { opacity: 0; }
}

@keyframes vtIn {
  from { opacity: 0; }
}

/* JS 兜底遮罩（仅在浏览器不支持 View Transition 时使用） */
.page-loader.is-on .pl-bar i {
  animation: plFill 0.24s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.pl-mark {
  position: relative;
  width: 108px;
  height: 108px;
  margin: 0 auto 26px;
  display: grid;
  place-items: center;
}

.pl-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.pl-arc {
  stroke-dasharray: 289;
  stroke-dashoffset: 289;
  filter: drop-shadow(0 0 6px rgba(212, 175, 55, 0.7));
}

.page-loader.is-on .pl-arc {
  animation: ringFill 0.24s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes ringFill {
  to { stroke-dashoffset: 0; }
}

.pl-mark img {
  width: 52px;
  height: 52px;
  opacity: 0;
  transform: scale(0.82);
}

.page-loader.is-on .pl-mark img {
  animation: markIn 0.34s cubic-bezier(0.22, 1, 0.36, 1) 0.04s forwards;
}

@keyframes markIn {
  to { opacity: 1; transform: scale(1); }
}

.pl-brand {
  font-size: 11px;
  letter-spacing: 7px;
  color: rgba(212, 175, 55, 0.62);
  margin-bottom: 12px;
  text-indent: 7px;
}

.pl-word {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 9px;
  text-indent: 9px;
  margin-bottom: 0;
}

/* ------------------------------------------------------------
   07 平滑滚动  body.fx-smooth
   只接管滚轮，不碰滚动条/键盘/触控，保证不失控
   ------------------------------------------------------------ */
html {
  scroll-behavior: smooth;
}

body.fx-smooth {
  overscroll-behavior-y: none;
}

/* ------------------------------------------------------------
   08 分区视差  body.fx-parallax
   背景光晕下移、右侧轨道上浮，产生纵深
   ------------------------------------------------------------ */
body.fx-parallax .hx-glow {
  will-change: translate;
}

body.fx-parallax .hx-right {
  will-change: translate;
}
