/**
 * 全站交互特效 — 鼠标光晕 / 选中 / 悬停 / 点击涟漪
 * 在 style.css 之后加载（见 partials/site-theme.ejs）
 */

:root {
  --fx-mx: 0.5;
  --fx-my: 0.5;
  --fx-shift-x: 0px;
  --fx-shift-y: 0px;
  --fx-shift-x2: 0px;
  --fx-shift-y2: 0px;
}

html::before {
  translate: var(--fx-shift-x) var(--fx-shift-y);
  transition: translate 0.45s var(--fx-ease);
}

.site-bg-mesh {
  translate: calc(var(--fx-shift-x) * 0.6) calc(var(--fx-shift-y) * 0.6);
  transition: translate 0.5s var(--fx-ease);
}

.site-bg-orb--1 {
  translate: var(--fx-shift-x) var(--fx-shift-y);
  transition: translate 0.4s var(--fx-ease);
}

.site-bg-orb--2 {
  translate: var(--fx-shift-x2) var(--fx-shift-y2);
  transition: translate 0.45s var(--fx-ease);
}

.site-bg-orb--3 {
  translate: calc(var(--fx-shift-x) * -0.5) calc(var(--fx-shift-y) * -0.5);
  transition: translate 0.42s var(--fx-ease);
}

.site-cursor-glow {
  position: fixed;
  top: 0;
  left: 0;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
  opacity: 0.5;
  mix-blend-mode: soft-light;
  background: radial-gradient(
    circle,
    color-mix(in srgb, var(--brand-cyan) 16%, transparent) 0%,
    color-mix(in srgb, var(--brand-indigo) 8%, transparent) 42%,
    transparent 72%
  );
  will-change: transform;
  transition: opacity 0.35s ease;
}

body.site-cursor-idle .site-cursor-glow {
  opacity: 0;
}

[data-theme="light"] .site-cursor-glow,
.theme-light .site-cursor-glow {
  opacity: 0.38;
  mix-blend-mode: multiply;
  background: radial-gradient(
    circle,
    color-mix(in srgb, var(--brand-cyan) 12%, transparent) 0%,
    color-mix(in srgb, var(--brand-indigo) 6%, transparent) 45%,
    transparent 72%
  );
}

::selection {
  background: color-mix(in srgb, var(--brand-indigo) 32%, transparent);
  color: inherit;
}

::-moz-selection {
  background: color-mix(in srgb, var(--brand-indigo) 32%, transparent);
  color: inherit;
}

[data-theme="light"] ::selection,
.theme-light ::selection {
  background: color-mix(in srgb, var(--brand-indigo) 22%, #e0e7ff);
  color: #1e1b4b;
}

[data-theme="light"] ::-moz-selection,
.theme-light ::-moz-selection {
  background: color-mix(in srgb, var(--brand-indigo) 22%, #e0e7ff);
  color: #1e1b4b;
}

a {
  transition: color 0.2s ease, opacity 0.2s ease, border-color 0.2s ease;
}

.global-footer a:hover,
.footer-links a:hover {
  color: var(--brand-cyan);
}

.tools-index-card,
.tool-hub-card,
.guide-hub-card {
  transition:
    transform 0.22s var(--fx-ease),
    box-shadow 0.22s var(--fx-ease),
    border-color 0.22s ease,
    background 0.22s ease;
}

.tools-index-card:hover,
.tool-hub-card:hover,
.guide-hub-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--brand-indigo) 22%, transparent);
  box-shadow:
    0 8px 24px color-mix(in srgb, var(--brand-indigo) 8%, transparent),
    0 0 0 1px color-mix(in srgb, var(--brand-cyan) 8%, transparent);
}

.tools-index-jump-pill,
.nav-ctrl-btn,
.quick-help-toggle,
.quick-help-demo-btn,
.hero-tutorial-link {
  transition:
    transform 0.2s var(--fx-ease),
    box-shadow 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease;
}

.tools-index-jump-pill:hover,
.nav-ctrl-btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

input:not([type="hidden"]):not(:disabled),
textarea:not(:disabled),
select:not(:disabled) {
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
}

input:not([type="hidden"]):not(:disabled):hover,
textarea:not(:disabled):hover,
select:not(:disabled):hover {
  border-color: color-mix(in srgb, var(--brand-indigo) 24%, var(--glass-border-bright));
}

.fx-ripple-host,
.fx-ripple-host-static {
  position: relative;
  overflow: hidden;
}

.fx-ripple-host-static {
  position: relative !important;
}

.fx-click-burst {
  position: fixed;
  top: 0;
  left: 0;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 100001;
  border: 1.5px solid color-mix(in srgb, var(--brand-cyan) 62%, transparent);
  background: radial-gradient(
    circle,
    color-mix(in srgb, var(--brand-cyan) 22%, transparent) 0%,
    transparent 68%
  );
  animation: fxClickBurst 0.52s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  will-change: transform, opacity;
}

@keyframes fxClickBurst {
  0% {
    transform: scale(0.4);
    opacity: 0.9;
  }
  100% {
    transform: scale(2.6);
    opacity: 0;
  }
}

.fx-click-ripple {
  position: absolute;
  left: var(--fx-r-x, 50%);
  top: var(--fx-r-y, 50%);
  width: var(--fx-r-size, 96px);
  height: var(--fx-r-size, 96px);
  margin: calc(var(--fx-r-size, 96px) / -2) 0 0 calc(var(--fx-r-size, 96px) / -2);
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(
    circle,
    color-mix(in srgb, #fff 52%, transparent) 0%,
    color-mix(in srgb, var(--brand-cyan) 28%, transparent) 38%,
    transparent 72%
  );
  transform: scale(0);
  opacity: 0.55;
  animation: fxClickRipple 0.62s cubic-bezier(0.22, 0.85, 0.32, 1) forwards;
  will-change: transform, opacity;
}

@keyframes fxClickRipple {
  0% {
    transform: scale(0);
    opacity: 0.55;
  }
  35% {
    opacity: 0.32;
  }
  100% {
    transform: scale(1);
    opacity: 0;
  }
}

@keyframes fxClickPop {
  0% { transform: scale(1); }
  38% { transform: scale(0.972); }
  72% { transform: scale(1.012); }
  100% { transform: scale(1); }
}

.fx-click-pop {
  animation: fxClickPop 0.34s cubic-bezier(0.34, 1.25, 0.64, 1) !important;
}

.fx-click-pressing {
  transition: transform 0.1s cubic-bezier(0.22, 1, 0.36, 1) !important;
  transform: scale(0.978) !important;
}

[data-theme="light"] .fx-click-burst,
.theme-light .fx-click-burst {
  border-color: color-mix(in srgb, var(--brand-indigo) 45%, transparent);
  background: radial-gradient(
    circle,
    color-mix(in srgb, var(--brand-indigo) 16%, transparent) 0%,
    transparent 68%
  );
}

[data-theme="light"] .fx-click-ripple,
.theme-light .fx-click-ripple {
  background: radial-gradient(
    circle,
    color-mix(in srgb, #fff 75%, transparent) 0%,
    color-mix(in srgb, var(--brand-indigo) 22%, transparent) 42%,
    transparent 72%
  );
}

.nav-pill.fx-click-pressing,
.nav-ctrl-btn.fx-click-pressing,
.primary-btn.fx-click-pressing,
.secondary-btn.fx-click-pressing,
.hero-generate-btn.fx-click-pressing {
  filter: brightness(1.04);
}

@media (prefers-reduced-motion: reduce) {
  html::before,
  .site-bg-mesh,
  .site-bg-orb--1,
  .site-bg-orb--2,
  .site-bg-orb--3 {
    translate: none !important;
    transition: none !important;
  }

  .site-cursor-glow,
  .fx-click-ripple,
  .fx-click-burst {
    display: none !important;
  }

  .fx-click-pop,
  .fx-click-pressing {
    animation: none !important;
    transform: none !important;
  }
}
