/* 团子游戏屋 · 高级交互组件样式
   对应 React Bits 的 Magnet / SpotlightCard / TiltedCard / ClickSpark / PixelTransition，
   用原生 CSS + JS 重写。所有类名 .fx-*、变量 --fx-*，不与站内现有样式冲突。
   引入顺序：base.css / landing.css / lobby.css 之后（需要覆盖卡片 :hover 的 transform）。 */

/* ---------- 1. Magnet ---------- */
.fx-magnet {
  will-change: transform;
  touch-action: manipulation;
}
/* 触摸设备：只做 0.96 的按压回弹 */
.fx-magnet.fx-press {
  transform: translate3d(0, 0, 0) scale(.96) !important;
  transition: transform .18s var(--bounce, cubic-bezier(.34, 1.56, .64, 1));
}

/* ---------- 2. SpotlightCard / 3. TiltedCard ---------- */
.fx-spot,
.fx-tilt {
  position: relative;
  transform-style: preserve-3d;
  transform: var(--fx-tilt, none);
  /* 卡片原来的 transform 过渡交给 rAF，其余（阴影/描边）保持平滑 */
  transition: box-shadow .2s var(--ease, ease), border-color .2s ease, background-color .2s ease;
}
/* 覆盖 lobby.css / landing.css 里卡片 :hover 的 transform；本文件需后加载 */
.fx-spot:hover,
.fx-spot:active,
.fx-tilt:hover,
.fx-tilt:active {
  transform: var(--fx-tilt, none);
}

/* 柔光：位置由 --fx-light 控制（JS 每帧只更新这个值），透明度 .10–.16 */
.fx-spot::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 6;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity .28s ease;
  background: radial-gradient(circle 240px at var(--fx-light, 50% 50%),
      var(--fx-glow, rgba(200, 22, 30, .16)) 0%,
      rgba(200, 22, 30, .10) 42%,
      rgba(200, 22, 30, 0) 70%);
}
.fx-spot:hover::before {
  opacity: 1;
}

/* ---------- 4. ClickSpark ---------- */
.fx-spark {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 9990;
  pointer-events: none;
  contain: paint;
}

/* ---------- 5. PixelTransition ---------- */
.fx-pixel,
.fx-fade {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 9995;
  pointer-events: auto; /* 转场期间挡住误触 */
  touch-action: none;
}
.fx-fade {
  opacity: 0;
  will-change: opacity;
}

/* 减动效：柔光不做淡入淡出，直接显隐 */
@media (prefers-reduced-motion: reduce) {
  .fx-magnet { will-change: auto; }
  .fx-magnet.fx-press { transform: none !important; }
  .fx-spot::before { transition: none; }
}

/* ================================================================== *
   自测页 site/fx-demo-b.html 的排版；全部 .fx-demo* 前缀，
   正式页面不会命中这些选择器。
 * ================================================================== */
.fx-demo { padding-top: clamp(18px, 3vw, 30px); }
.fx-demo__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px 20px;
  margin-bottom: 18px;
}
.fx-demo__head h1 { font-size: clamp(26px, 4vw, 40px); letter-spacing: -.03em; margin-top: 6px; }
.fx-demo__head p { color: var(--ink-2); font-size: 13px; }
.fx-demo__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(14px, 2vw, 22px); }
.fx-demo__card {
  border: 2.5px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--paper);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  color: inherit;
}
.fx-demo__art {
  position: relative;
  aspect-ratio: 16 / 10;
  border-bottom: 2.5px solid var(--line);
  overflow: hidden;
  background:
    radial-gradient(95% 75% at 50% 112%, var(--wash), transparent 72%),
    linear-gradient(180deg, #FFFDF8, var(--wash));
}
.fx-demo__art::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background-image: radial-gradient(rgba(43, 33, 27, .1) 1px, transparent 1.2px);
  background-size: 15px 15px;
  opacity: .5;
}
.fx-demo__art img {
  position: absolute;
  left: 50%;
  top: 56%;
  z-index: 2;
  width: 52%;
  transform: translate(-50%, -50%) rotate(-4deg);
  filter: drop-shadow(0 8px 10px rgba(43, 33, 27, .16));
}
.fx-demo__no {
  position: absolute;
  top: 9px;
  left: 12px;
  z-index: 3;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .14em;
  color: var(--ink-3);
}
.fx-demo__tag {
  position: absolute;
  top: 9px;
  right: 10px;
  z-index: 3;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 2px 8px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
}
.fx-demo__body { padding: 13px 15px 15px; display: flex; flex-direction: column; gap: 4px; }
.fx-demo__body h3 { font-size: 16.5px; }
.fx-demo__body p { font-size: 12px; color: var(--ink-2); line-height: 1.55; }
.fx-demo__meta {
  margin-top: 6px;
  font-size: 10.5px;
  font-weight: 900;
  color: var(--fx-demo-accent, var(--red));
  letter-spacing: .02em;
}
.fx-demo__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: clamp(22px, 4vw, 34px); }
.fx-demo__hint { margin-top: 14px; font-size: 12.5px; color: var(--ink-3); line-height: 1.8; }
.fx-demo__hint code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11.5px;
  background: var(--paper-2);
  border: 1px solid var(--paper-4);
  border-radius: 6px;
  padding: 1px 5px;
}
@media (max-width: 900px) {
  .fx-demo__grid { grid-template-columns: 1fr; }
  .fx-demo__art { aspect-ratio: 16 / 7; }
}
@media (max-width: 640px) {
  .fx-demo-page .topbar .chip { display: none; }
  .fx-demo__actions .btn { flex: 1 1 auto; }
}
