/* ============================================================
   RICH-EFFECTS: リッチUI演出エンジン (vanilla JS/CSS, no deps)
   全クラス接頭辞 fx- で統一。既存スタイルへの影響を最小化。
   ============================================================ */

/* ── Scroll progress bar ── */
.fx-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 3000;
  transform: scaleX(0);
  transform-origin: left;
  background: var(--fx-grad, linear-gradient(90deg, #2f6bff, #7b56ff, #ff77aa));
  pointer-events: none;
  will-change: transform;
}

/* ── Custom cursor ── */
.fx-cursor-dot {
  position: fixed;
  top: 0;
  left: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--fx-cursor, #101012);
  z-index: 4000;
  pointer-events: none;
  will-change: transform;
  opacity: 0;
}
.fx-cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid color-mix(in srgb, var(--fx-cursor, #101012) 40%, transparent);
  z-index: 4000;
  pointer-events: none;
  will-change: transform;
  transition: opacity 0.2s ease, background 0.25s ease;
  opacity: 0;
}
.fx-cursor-ring.fx-hover {
  transform: translate(-50%, -50%) scale(1.6);
  background: color-mix(in srgb, var(--fx-cursor, #101012) 8%, transparent);
}

@media (pointer: fine) {
  body.fx-cursor-on,
  body.fx-cursor-on * {
    cursor: none;
  }
}

/* ── Tilt / glare ── */
.fx-tilt {
  transform-style: preserve-3d;
}
.fx-glare {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at var(--gx, 50%) var(--gy, 50%), rgba(255, 255, 255, 0.22), transparent 60%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.fx-tilt:hover .fx-glare {
  opacity: 1;
}

/* ── Aurora background ── */
.fx-aurora {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.fx-aurora canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* ── Cross-document View Transitions ── */
@view-transition {
  navigation: auto;
}
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.35s;
}

/* ── Reduced motion: disable all fx ── */
@media (prefers-reduced-motion: reduce) {
  .fx-progress {
    display: none !important;
  }
  .fx-cursor-dot,
  .fx-cursor-ring {
    display: none !important;
  }
  body.fx-cursor-on,
  body.fx-cursor-on * {
    cursor: auto !important;
  }
  .fx-glare {
    display: none !important;
  }
  .fx-aurora {
    display: none !important;
  }
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none !important;
  }
}
