/* ============================================================
   Cursor effect shapes + trails (shared)
   Used by the public cursor and the admin catalog previews.
   Driven by: --fx-size, --fx-color, --fx-glow, --fx-scale
   ============================================================ */

.fx-demo-core,
.cursor-fx-ring {
  box-sizing: border-box;
}

/* Base outline shape — every variant starts from this. */
.fx-demo[data-shape] .fx-demo-core,
.cursor-fx[data-shape] .cursor-fx-ring {
  width: calc(var(--fx-size, 34px) * var(--fx-scale, 1));
  height: calc(var(--fx-size, 34px) * var(--fx-scale, 1));
  border: 2px solid var(--fx-color, #e53935);
  border-radius: 50%;
  background: transparent;
  box-shadow: 0 0 14px var(--fx-glow, rgba(229, 57, 53, 0.5));
}

/* dot */
.fx-demo[data-shape="dot"] .fx-demo-core,
.cursor-fx[data-shape="dot"] .cursor-fx-ring {
  --fx-scale: 0.4;
  border: 0;
  background: var(--fx-color);
  box-shadow: 0 0 16px var(--fx-glow);
}

/* crosshair */
.fx-demo[data-shape="crosshair"] .fx-demo-core,
.cursor-fx[data-shape="crosshair"] .cursor-fx-ring {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.fx-demo[data-shape="crosshair"] .fx-demo-core::before,
.fx-demo[data-shape="crosshair"] .fx-demo-core::after,
.cursor-fx[data-shape="crosshair"] .cursor-fx-ring::before,
.cursor-fx[data-shape="crosshair"] .cursor-fx-ring::after {
  content: "";
  position: absolute;
  background: var(--fx-color);
  box-shadow: 0 0 8px var(--fx-glow);
}

.fx-demo[data-shape="crosshair"] .fx-demo-core::before,
.cursor-fx[data-shape="crosshair"] .cursor-fx-ring::before {
  left: 50%;
  top: 0;
  width: 1px;
  height: 100%;
  transform: translateX(-50%);
}

.fx-demo[data-shape="crosshair"] .fx-demo-core::after,
.cursor-fx[data-shape="crosshair"] .cursor-fx-ring::after {
  top: 50%;
  left: 0;
  width: 100%;
  height: 1px;
  transform: translateY(-50%);
}

/* diamond */
.fx-demo[data-shape="diamond"] .fx-demo-core,
.cursor-fx[data-shape="diamond"] .cursor-fx-ring {
  border: 0;
  border-radius: 0;
  background: var(--fx-color);
  box-shadow: 0 0 16px var(--fx-glow);
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}

/* square */
.fx-demo[data-shape="square"] .fx-demo-core,
.cursor-fx[data-shape="square"] .cursor-fx-ring {
  border-radius: 6px;
}

/* double outline */
.fx-demo[data-shape="outline"] .fx-demo-core,
.cursor-fx[data-shape="outline"] .cursor-fx-ring {
  border: 1px solid var(--fx-color);
  outline: 1px solid var(--fx-glow);
  outline-offset: 4px;
  box-shadow: none;
}

/* hexagon */
.fx-demo[data-shape="hex"] .fx-demo-core,
.cursor-fx[data-shape="hex"] .cursor-fx-ring {
  border: 0;
  border-radius: 0;
  background: var(--fx-color);
  box-shadow: 0 0 16px var(--fx-glow);
  clip-path: polygon(24% 5%, 76% 5%, 100% 50%, 76% 95%, 24% 95%, 0% 50%);
}

/* star */
.fx-demo[data-shape="star"] .fx-demo-core,
.cursor-fx[data-shape="star"] .cursor-fx-ring {
  border: 0;
  border-radius: 0;
  background: var(--fx-color);
  box-shadow: 0 0 16px var(--fx-glow);
  clip-path: polygon(
    50% 0%,
    61% 35%,
    98% 35%,
    68% 57%,
    79% 91%,
    50% 70%,
    21% 91%,
    32% 57%,
    2% 35%,
    39% 35%
  );
}

/* arrow */
.fx-demo[data-shape="arrow"] .fx-demo-core,
.cursor-fx[data-shape="arrow"] .cursor-fx-ring {
  border: 0;
  border-radius: 0;
  background: var(--fx-color);
  box-shadow: 0 0 16px var(--fx-glow);
  clip-path: polygon(12% 0%, 100% 50%, 12% 100%, 36% 50%);
}

/* pixel */
.fx-demo[data-shape="pixel"] .fx-demo-core,
.cursor-fx[data-shape="pixel"] .cursor-fx-ring {
  border: 0;
  border-radius: 0;
  background: var(--fx-color);
  box-shadow: 0 0 16px var(--fx-glow);
  clip-path: polygon(
    33% 0%,
    67% 0%,
    67% 33%,
    100% 33%,
    100% 67%,
    67% 67%,
    67% 100%,
    33% 100%,
    33% 67%,
    0% 67%,
    0% 33%,
    33% 33%
  );
}

/* heart */
.fx-demo[data-shape="heart"] .fx-demo-core,
.cursor-fx[data-shape="heart"] .cursor-fx-ring {
  border: 0;
  border-radius: 0;
  background: var(--fx-color);
  box-shadow: 0 0 16px var(--fx-glow);
  clip-path: polygon(
    50% 100%,
    8% 56%,
    0% 32%,
    8% 12%,
    25% 2%,
    42% 8%,
    50% 20%,
    58% 8%,
    75% 2%,
    92% 12%,
    100% 32%,
    92% 56%
  );
}

/* bolt */
.fx-demo[data-shape="bolt"] .fx-demo-core,
.cursor-fx[data-shape="bolt"] .cursor-fx-ring {
  border: 0;
  border-radius: 0;
  background: var(--fx-color);
  box-shadow: 0 0 16px var(--fx-glow);
  clip-path: polygon(58% 0%, 22% 55%, 47% 55%, 36% 100%, 80% 42%, 54% 42%, 68% 0%);
}

/* triangle */
.fx-demo[data-shape="triangle"] .fx-demo-core,
.cursor-fx[data-shape="triangle"] .cursor-fx-ring {
  border: 0;
  border-radius: 0;
  background: var(--fx-color);
  box-shadow: 0 0 16px var(--fx-glow);
  clip-path: polygon(50% 4%, 98% 92%, 2% 92%);
}

/* bubble */
.fx-demo[data-shape="bubble"] .fx-demo-core,
.cursor-fx[data-shape="bubble"] .cursor-fx-ring {
  border: 1.5px solid var(--fx-color);
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.9) 0 7%, transparent 9%),
    radial-gradient(circle at 50% 50%, transparent 54%, var(--fx-soft-glow) 72%, transparent 76%);
  box-shadow: 0 0 16px var(--fx-glow);
}

/* Filled shapes do not need the precision center dot. */
.cursor-fx[data-shape="dot"] .cursor-fx-dot,
.cursor-fx[data-shape="diamond"] .cursor-fx-dot,
.cursor-fx[data-shape="hex"] .cursor-fx-dot,
.cursor-fx[data-shape="star"] .cursor-fx-dot,
.cursor-fx[data-shape="arrow"] .cursor-fx-dot,
.cursor-fx[data-shape="pixel"] .cursor-fx-dot,
.cursor-fx[data-shape="heart"] .cursor-fx-dot,
.cursor-fx[data-shape="bolt"] .cursor-fx-dot,
.cursor-fx[data-shape="triangle"] .cursor-fx-dot {
  opacity: 0;
}

/* Hover / press / label states must win over the shape rules above. */
.cursor-fx.is-hover[data-shape] .cursor-fx-ring {
  width: calc(var(--fx-size, 34px) * var(--fx-scale, 1) * 1.4);
  height: calc(var(--fx-size, 34px) * var(--fx-scale, 1) * 1.4);
}

.cursor-fx.is-down[data-shape] .cursor-fx-ring {
  width: calc(var(--fx-size, 34px) * var(--fx-scale, 1) * 0.72);
  height: calc(var(--fx-size, 34px) * var(--fx-scale, 1) * 0.72);
}

.cursor-fx.is-label[data-shape] .cursor-fx-ring {
  width: 68px;
  height: 68px;
  border: 1px solid var(--fx-color);
  border-radius: 50%;
  background: rgba(11, 18, 32, 0.78);
  clip-path: none;
  outline: none;
  box-shadow: 0 0 22px var(--fx-glow);
}

.cursor-fx.is-label[data-shape] .cursor-fx-ring::before,
.cursor-fx.is-label[data-shape] .cursor-fx-ring::after {
  display: none;
}

/* ── Outside effects (ambient animations) ─────────────────── */
.cursor-fx-ambient {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--fx-ambient-size, 18px);
  height: var(--fx-ambient-size, 18px);
  border-radius: 50%;
  pointer-events: none;
  opacity: var(--fx-ambient-opacity, 0.3);
  will-change: transform, opacity;
}

.cursor-fx-ambient[data-kind="echo"] {
  border: 1px solid var(--fx-color);
  box-shadow: 0 0 10px var(--fx-glow);
}

.cursor-fx-ambient[data-kind="light"] {
  background: radial-gradient(circle, #fff 0%, var(--fx-color) 38%, transparent 72%);
  filter: blur(2px);
  mix-blend-mode: screen;
  animation: fxLightPulse 2.2s ease-in-out infinite;
}

.cursor-fx-ambient[data-kind="fire"] {
  background: radial-gradient(
    circle at 50% 62%,
    #fff7c2 0%,
    #ffb020 42%,
    rgba(249, 115, 22, 0.85) 68%,
    transparent 74%
  );
  filter: blur(1.2px);
  mix-blend-mode: screen;
  animation: fxFlicker 0.55s ease-in-out infinite alternate;
}

.cursor-fx-ambient[data-kind="water"] {
  border: 1px solid var(--fx-color);
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.55) 0 8%, transparent 10%);
  box-shadow: 0 0 12px var(--fx-glow), inset 0 0 8px var(--fx-soft-glow);
  animation: fxWaterPulse 1.6s ease-out infinite;
}

.cursor-fx-ambient[data-kind="spark"] {
  background: var(--fx-color);
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  filter: drop-shadow(0 0 6px var(--fx-glow));
  mix-blend-mode: screen;
  animation: fxSpark 1.1s steps(2) infinite;
}

.cursor-fx-ambient[data-kind="smoke"] {
  background: radial-gradient(circle, rgba(210, 220, 235, 0.6), transparent 68%);
  filter: blur(7px);
  animation: fxSmoke 2.6s ease-in-out infinite;
}

.cursor-fx-ambient[data-kind="comet"] {
  background: var(--fx-color);
  box-shadow: 0 0 16px var(--fx-glow);
}

.cursor-fx-ambient[data-kind="aurora"] {
  background: conic-gradient(from 0deg, var(--fx-color), #38bdf8, #a78bfa, var(--fx-color));
  filter: blur(6px);
  mix-blend-mode: screen;
  opacity: calc(var(--fx-ambient-opacity, 0.3) * 0.8);
  animation: fxAurora 4s ease-in-out infinite;
}

@keyframes fxLightPulse {
  0%,
  100% {
    opacity: 0.25;
    filter: blur(2px);
  }
  50% {
    opacity: 0.6;
    filter: blur(3px);
  }
}

@keyframes fxFlicker {
  from {
    opacity: 0.55;
    filter: blur(1px) brightness(1);
  }
  to {
    opacity: 0.9;
    filter: blur(2px) brightness(1.3);
  }
}

@keyframes fxWaterPulse {
  0% {
    box-shadow: 0 0 0 0 var(--fx-glow);
    opacity: 0.2;
  }
  70% {
    box-shadow: 0 0 0 9px transparent;
    opacity: 0.42;
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
    opacity: 0.12;
  }
}

@keyframes fxSpark {
  0%,
  100% {
    opacity: 0.35;
  }
  50% {
    opacity: 1;
  }
}

@keyframes fxSmoke {
  0%,
  100% {
    opacity: 0.12;
    filter: blur(6px);
  }
  50% {
    opacity: 0.3;
    filter: blur(9px);
  }
}

@keyframes fxAurora {
  0%,
  100% {
    opacity: 0.25;
    filter: blur(6px);
  }
  50% {
    opacity: 0.5;
    filter: blur(9px);
  }
}

/* ── Admin preview shapes ─────────────────────────────────── */
.fx-demo {
  position: relative;
}

.fx-demo .cursor-fx-ambient {
  left: 50%;
  top: 50%;
}

.fx-demo-core {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.fx-demo-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 4px;
  margin: -2px 0 0 -2px;
  border-radius: 50%;
  background: #fff;
  opacity: 0.85;
}

.fx-demo[data-shape="dot"] .fx-demo-dot,
.fx-demo[data-shape="diamond"] .fx-demo-dot,
.fx-demo[data-shape="hex"] .fx-demo-dot,
.fx-demo[data-shape="star"] .fx-demo-dot,
.fx-demo[data-shape="arrow"] .fx-demo-dot,
.fx-demo[data-shape="pixel"] .fx-demo-dot {
  opacity: 0;
}
