/*!
 * CoolFX v1.0.0 — 「大型动效」零依赖资产包 / zero-dependency large-scale ambient FX
 * ---------------------------------------------------------------------------
 * 移植自 design/21st/src_all/21st/source/ 下已抓取的 21st.dev 真实源码。
 * 所有动画参数（时长 / 缓动 / 数量 / 几何）取自源码与 tailwind.config.js，
 * 出处见 README.md；源码里判不出来的地方一律标注「未解析」，不臆造。
 *
 * 约定：
 *   1. 全部装饰层 pointer-events:none，由 JS 追加 aria-hidden="true"。
 *   2. 只动 transform / opacity，或用 canvas；不含铺满全屏的 filter: blur()。
 *   3. .coolfx 挂在宿主内的负 z-index 层，靠宿主的 isolation:isolate 兜住，
 *      永远压不到正文，也不会被正文压住。
 *   4. 命中 prefers-reduced-motion: reduce 时 JS 根本不建 DOM；本文件末尾
 *      再加一道 CSS 兜底。
 * ---------------------------------------------------------------------------
 */

/* ============================ 基座 ============================ */
.coolfx {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.coolfx,
.coolfx * {
  pointer-events: none !important;
  box-sizing: border-box;
}
.coolfx-cv {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  width: 100%;
  height: 100%;
}
.coolfx-dark {
  background: #000;
}

/* 1. aurora 极光背景 */
.coolfx-aurora {
  position: absolute;
  inset: -10px;
  opacity: 0.6;
  background-image:
    repeating-linear-gradient(100deg, #fff 0%, #fff 7%, transparent 10%, transparent 12%, #fff 16%),
    repeating-linear-gradient(100deg, #3b82f6 10%, #a5b4fc 15%, #93c5fd 20%, #ddd6fe 25%, #60a5fa 30%);
  background-size: 300%, 200%;
  background-position: 50% 50%, 50% 50%;
}
.coolfx-aurora-b {
  position: absolute;
  inset: -10px;
  opacity: 0.6;
  mix-blend-mode: var(--cfx-aurora-blend, screen);
  background-image:
    repeating-linear-gradient(100deg, #fff 0%, #fff 7%, transparent 10%, transparent 12%, #fff 16%),
    repeating-linear-gradient(100deg, #3b82f6 10%, #a5b4fc 15%, #93c5fd 20%, #ddd6fe 25%, #60a5fa 30%);
  background-size: 200%, 100%;
  background-position: 50% 50%, 50% 50%;
  animation: cfx-aurora 60s linear infinite;
}
.coolfx-aurora,
.coolfx-aurora-b {
  -webkit-mask-image: radial-gradient(ellipse at 100% 0%, #000 10%, transparent 70%);
  mask-image: radial-gradient(ellipse at 100% 0%, #000 10%, transparent 70%);
}
.coolfx-aurora-noMask {
  -webkit-mask-image: none;
  mask-image: none;
}
@keyframes cfx-aurora {
  0% { background-position: 50% 50%, 50% 50%; }
  100% { background-position: 350% 50%, 350% 50%; }
}

/* 2. beams 光束 */
.coolfx-beams {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-mask-size: 40px;
  mask-size: 40px;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}
.coolfx-beams svg {
  position: absolute;
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* 3. spotlight 聚光灯 */
.coolfx-spot {
  position: absolute;
  height: 169%;
  width: 138%;
  left: 50%;
  top: 0;
  opacity: 0;
  transform: translateX(-50%);
  animation: cfx-spot-in var(--cfx-spot-in, 0.9s) ease-out forwards;
}
@media (min-width: 1024px) {
  .coolfx-spot { width: 84%; }
}
@keyframes cfx-spot-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* 4. meteors 流星 */
.coolfx-meteors {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.coolfx-meteor {
  position: absolute;
  top: 0;
  left: 50%;
  width: 2px;
  height: 2px;
  border-radius: 9999px;
  background: var(--cfx-meteor-color, #64748b);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06);
  transform: rotate(215deg);
  animation: cfx-meteor var(--cfx-dur, 5s) linear var(--cfx-delay, 0s) infinite;
  will-change: transform, opacity;
}
.coolfx-meteor::before {
  content: "";
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: var(--cfx-tail, 50px);
  height: 1px;
  background: linear-gradient(to right, var(--cfx-meteor-color, #64748b), transparent);
}
@keyframes cfx-meteor {
  0% { transform: rotate(215deg) translateX(0); opacity: 1; }
  70% { opacity: 1; }
  100% { transform: rotate(215deg) translateX(calc(var(--cfx-tail, 50px) * -10)); opacity: 0; }
}

/* 5. retro-grid 透视网格 */
.coolfx-rg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  opacity: var(--cfx-rg-op, 0.8);
  perspective: 200px;
}
.coolfx-rg-inner {
  position: absolute;
  inset: 0;
  transform: rotateX(var(--cfx-rg-angle, 65deg));
}
.coolfx-rg-grid {
  position: absolute;
  inset: 0;
  height: 300vh;
  width: 600vw;
  margin-left: -50%;
  transform-origin: 100% 0 0;
  background-repeat: repeat;
  background-size: 60px 60px;
  background-image:
    linear-gradient(to right, var(--cfx-rg-line, rgba(255, 255, 255, 0.5)) 1px, transparent 0),
    linear-gradient(to bottom, var(--cfx-rg-line, rgba(255, 255, 255, 0.5)) 1px, transparent 0);
  animation: cfx-grid 15s linear infinite;
  will-change: transform;
}
.coolfx-rg-fade {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, var(--cfx-rg-fade, #000) 0%, transparent 62%);
}
@keyframes cfx-grid {
  0% { transform: translateY(-50%); }
  100% { transform: translateY(0); }
}

/* 6. warp 曲速 */
.coolfx-warp {
  position: absolute;
  inset: 0;
  overflow: hidden;
  clip-path: inset(0);
  perspective: var(--cfx-warp-persp, 100px);
  transform-style: preserve-3d;
}
.coolfx-warp-plane {
  position: absolute;
  transform-style: preserve-3d;
  background-color: transparent;
  background-image:
    linear-gradient(var(--cfx-warp-grid, rgba(255, 255, 255, 0.14)) 0 1px, transparent 1px var(--cfx-beam-size, 5%)),
    linear-gradient(90deg, var(--cfx-warp-grid, rgba(255, 255, 255, 0.14)) 0 1px, transparent 1px var(--cfx-beam-size, 5%));
  background-size: var(--cfx-beam-size, 5%) var(--cfx-beam-size, 5%);
  background-position: 50% -0.5px, 50% 50%;
}
.coolfx-warp-beam {
  position: absolute;
  top: 0;
  left: var(--cfx-x, 0%);
  width: var(--cfx-w, 5%);
  aspect-ratio: 1 / var(--cfx-ar, 4);
  background: linear-gradient(hsl(var(--cfx-hue, 200) 80% 60%), transparent);
  animation: cfx-warp var(--cfx-dur, 3s) linear var(--cfx-delay, 0s) infinite;
  will-change: transform;
}
@keyframes cfx-warp {
  0% { transform: translate(-50%, var(--cfx-plane-h, 600px)); }
  100% { transform: translate(-50%, -100%); }
}

/* 7. gradient 动态渐变 */
.coolfx-grad {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: linear-gradient(40deg, rgb(108, 0, 162), rgb(0, 17, 82));
}
.coolfx-grad-blob {
  position: absolute;
  width: var(--cfx-size, 80%);
  height: var(--cfx-size, 80%);
  top: calc(50% - var(--cfx-size, 80%) / 2);
  left: calc(50% - var(--cfx-size, 80%) / 2);
  mix-blend-mode: var(--cfx-blend, hard-light);
  will-change: transform;
}
.coolfx-grad-b1 {
  background: radial-gradient(circle at center,
    rgba(18, 113, 255, 0.95) 0%, rgba(18, 113, 255, 0.55) 34%, rgba(18, 113, 255, 0) 72%);
  transform-origin: center center;
  animation: cfx-moveVertical 30s ease infinite;
}
.coolfx-grad-b2 {
  background: radial-gradient(circle at center,
    rgba(221, 74, 255, 0.8) 0%, rgba(221, 74, 255, 0.42) 34%, rgba(221, 74, 255, 0) 72%);
  transform-origin: calc(50% - 400px);
  animation: cfx-moveInCircle 20s reverse infinite;
}
.coolfx-grad-b3 {
  background: radial-gradient(circle at center,
    rgba(100, 220, 255, 0.8) 0%, rgba(100, 220, 255, 0.42) 34%, rgba(100, 220, 255, 0) 72%);
  transform-origin: calc(50% + 400px);
  animation: cfx-moveInCircle 40s linear infinite;
}
.coolfx-grad-b4 {
  background: radial-gradient(circle at center,
    rgba(200, 50, 50, 0.8) 0%, rgba(200, 50, 50, 0.42) 34%, rgba(200, 50, 50, 0) 72%);
  transform-origin: calc(50% - 200px);
  animation: cfx-moveHorizontal 40s ease infinite;
  opacity: 0.7;
}
.coolfx-grad-b5 {
  background: radial-gradient(circle at center,
    rgba(180, 180, 50, 0.8) 0%, rgba(180, 180, 50, 0.42) 34%, rgba(180, 180, 50, 0) 72%);
  transform-origin: calc(50% - 800px) calc(50% + 800px);
  animation: cfx-moveInCircle 20s ease infinite;
}
.coolfx-grad-ptr {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  opacity: 0.7;
  mix-blend-mode: var(--cfx-blend, hard-light);
  background: radial-gradient(circle at center,
    rgba(140, 100, 255, 0.55) 0%, rgba(140, 100, 255, 0.25) 30%, rgba(140, 100, 255, 0) 62%);
  will-change: transform;
}
@keyframes cfx-moveVertical {
  0% { transform: translateY(-50%); }
  50% { transform: translateY(50%); }
  100% { transform: translateY(-50%); }
}
@keyframes cfx-moveHorizontal {
  0% { transform: translateX(-50%) translateY(-10%); }
  50% { transform: translateX(50%) translateY(10%); }
  100% { transform: translateX(-50%) translateY(-10%); }
}
@keyframes cfx-moveInCircle {
  0% { transform: rotate(0deg); }
  50% { transform: rotate(180deg); }
  100% { transform: rotate(360deg); }
}

/* 9. stars 发光星阵 */
.coolfx-stars {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-content: center;
  grid-template-columns: repeat(var(--cfx-cols, 18), var(--cfx-cell, 14px));
  gap: 1px;
  padding: 4px;
}
.coolfx-star-cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--cfx-cell, 14px);
}
.coolfx-star {
  position: relative;
  z-index: 2;
  width: 1px;
  height: 1px;
  border-radius: 9999px;
  background: #666;
  transition: background-color 0.25s linear, box-shadow 0.25s linear;
}
.coolfx-star.is-on {
  background: #fff;
  animation: cfx-star 2s easeInOut var(--cfx-delay, 0s);
  box-shadow: 0 0 7px 2px rgba(59, 130, 246, 0.85);
}
@keyframes cfx-star {
  0% { transform: scale(1); }
  20% { transform: scale(1.2); }
  45% { transform: scale(2.5); }
  70% { transform: scale(2.2); }
  100% { transform: scale(1.5); }
}

/* 15. shooting-stars 划星 */

/* ============================ reduced-motion 兜底 ============================ */
@media (prefers-reduced-motion: reduce) {
  .coolfx,
  .coolfx * {
    animation: none !important;
    transition: none !important;
  }
}

/* ===== 2026-09-18 按维护者要求：暂时关闭页面背景光效 =====
   原来是 data-coolfx="aurora" 的斜向极光 + 顶部光晕，维护者说暂时不需要。
   想恢复：删掉下面这一段即可（或把 display 改成原来的值）。 */
.fx-page-bg, .coolfx-aurora-wrap, .coolfx-aurora, .coolfx-aurora-b,
.coolfx-beams, .coolfx-spot-wrap, .coolfx-spot, .coolfx-meteors, .coolfx-meteor, .coolfx-rg {
  display: none !important;
}
/* fx-disabled-by-request */
