/* Cursor interactions. Everything here only applies when js/cursor.js has
   switched it on (.cursor-fx on <html>): mouse/trackpad, no reduced motion. */

@property --rx { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@property --ry { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@property --lift { syntax: "<length>"; inherits: false; initial-value: 0px; }

/* Trailing ink ring (kept above every layer, including full-screen modes like /ship) */
.cursor-ring {
  position: fixed; left: 0; top: 0; z-index: 2147483600; width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid color-mix(in oklab, var(--ink) 38%, transparent);
  background: transparent; pointer-events: none; opacity: 0; will-change: transform, opacity;
  transition: border-color .35s, background-color .35s;
}
/* Over always-dark surfaces (spaceship, photo lightbox) the ring turns light. */
.cursor-ring.on-dark { border-color: rgb(236 228 215 / .5); }
.cursor-ring.hot {
  border-color: color-mix(in oklab, var(--accent) 70%, transparent);
  background: color-mix(in oklab, var(--accent) 9%, transparent);
}

/* Exact-position dot that stands in for the hidden system cursor */
.cursor-dot {
  position: fixed; left: 0; top: 0; z-index: 2147483601; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); pointer-events: none; opacity: 0; will-change: transform;
  transition: opacity .2s;
}

/* Hide the system cursor while the custom one is showing. Text fields, games
   and embeds keep their own cursor (the script hides the dot and ring there). */
.cursor-fx.cursor-hide,
.cursor-fx.cursor-hide *:not(input, textarea, select, [contenteditable], [contenteditable] *, .game-canvas, iframe) {
  cursor: none !important;
}

/* Warm lantern glow behind the content */
.cursor-glow {
  position: fixed; left: 0; top: 0; z-index: 0; width: 640px; height: 640px; border-radius: 50%;
  pointer-events: none; opacity: 0; will-change: transform, opacity;
  background: radial-gradient(closest-side, color-mix(in oklab, var(--accent) 11%, transparent), transparent);
}
[data-theme-active="dark"] .cursor-glow {
  background: radial-gradient(closest-side, color-mix(in oklab, var(--accent) 9%, transparent), transparent);
}

/* Cards: tilt toward the cursor with a soft sheen */
.cursor-fx .card.tilt-ready {
  transform: perspective(1100px) translateY(var(--lift)) rotateX(var(--rx)) rotateY(var(--ry));
  transition: --lift .55s var(--ease), --rx .5s var(--ease), --ry .5s var(--ease),
    box-shadow .55s var(--ease), border-color .4s, background-color .6s;
  transition-delay: 0s;
}
.cursor-fx .card.tilt-ready:hover { --lift: -5px; }
.cursor-fx .card.tilt-ready:active { --lift: -2px; }
.cursor-fx .card::after {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; border-radius: inherit;
  background: radial-gradient(380px circle at var(--mx, 50%) var(--my, 50%), color-mix(in oklab, var(--wood) 16%, transparent), transparent 65%);
  opacity: 0; transition: opacity .5s var(--ease);
}
.cursor-fx .card:hover::after { opacity: 1; }

/* Photos: image drifts gently inside its frame */
.cursor-fx .photo:hover img { transform: scale(1.06) translate(var(--px, 0), var(--py, 0)); }

/* Hero ensō: smooth out the JS-driven parallax on enter/leave */
.cursor-fx .hero-art, .cursor-fx .vertical-word { will-change: translate, rotate; }
