/* ==========================================================================
   REUSABLE CUSTOM TRAILING CURSOR
   Black & White Theme - High Performance 60fps LERP Cursor
   ========================================================================== */

/* Hide native cursor ONLY on fine-pointer devices (desktop mouse/trackpad) when custom cursor is active */
@media (pointer: fine) {
  body.custom-cursor-active,
  body.custom-cursor-active * {
    cursor: none !important;
  }
}

/* Cursor Container */
.cursor-container,
#cur {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  z-index: 9999999;
  pointer-events: none;
  display: none;
  mix-blend-mode: difference;
  will-change: transform;
}

@media (pointer: fine) {
  body.custom-cursor-active .cursor-container,
  body.custom-cursor-active #cur {
    display: block;
  }
}

/* 8px Inner Dot */
.cursor-container .cursor-dot,
#cur i {
  position: fixed;
  top: 0;
  left: 0;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  background: #ffffff;
  pointer-events: none;
  transform: translate3d(-100px, -100px, 0);
  will-change: transform;
  transition: opacity 0.2s ease, scale 0.2s ease;
}

/* 44px Outer Ring */
.cursor-container .cursor-ring,
#cur b {
  position: fixed;
  top: 0;
  left: 0;
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  border-radius: 50%;
  border: 1.5px solid #ffffff;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
  transform: translate3d(-100px, -100px, 0);
  will-change: transform, width, height, margin, background;
  box-sizing: border-box;
  transition: width 0.3s cubic-bezier(0.25, 1, 0.5, 1),
              height 0.3s cubic-bezier(0.25, 1, 0.5, 1),
              margin 0.3s cubic-bezier(0.25, 1, 0.5, 1),
              background 0.22s ease,
              border-color 0.22s ease,
              opacity 0.2s ease,
              scale 0.15s ease;
}

/* Center label inside outer ring */
.cursor-container .cursor-label,
#cur b #cl,
#cur b span {
  font-family: 'Space Mono', 'DM Mono', ui-monospace, Menlo, monospace;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #000000;
  opacity: 0;
  scale: 0.7;
  transition: opacity 0.2s ease, scale 0.2s cubic-bezier(0.25, 1, 0.5, 1);
  pointer-events: none;
  white-space: nowrap;
  user-select: none;
}

/* Hover state: Outer ring expands to 88px and fills with white */
body.cursor-hover .cursor-container .cursor-ring,
body.cursor-hover #cur b,
body.hov #cur b {
  width: 88px;
  height: 88px;
  margin: -44px 0 0 -44px;
  background: #ffffff;
  border-color: #ffffff;
}

/* When hover has a custom label, display text cleanly */
body.cursor-hover.cursor-has-label .cursor-container .cursor-label,
body.cursor-hover #cur b #cl,
body.cursor-hover #cur b span,
body.hov #cur b #cl,
body.hov #cur b span {
  opacity: 1;
  scale: 1;
}

/* Fade out inner dot on hover so center label is completely readable */
body.cursor-hover .cursor-container .cursor-dot,
body.cursor-hover #cur i,
body.hov #cur i {
  opacity: 0;
  scale: 0.2;
}

/* Active click state: slight ring compression */
body.cursor-active .cursor-container .cursor-ring,
body.cursor-active #cur b {
  scale: 0.88;
}

/* Hidden state when pointer leaves window */
.cursor-container.is-hidden,
#cur.is-hidden {
  opacity: 0;
  visibility: hidden;
}

/* Magnetic Elements Support */
.magnetic,
.mag {
  will-change: transform;
  transition: transform 0.25s cubic-bezier(0.25, 1, 0.5, 1);
}

/* Reduced Motion Preference: disable scaling & spring delays */
@media (prefers-reduced-motion: reduce) {
  .cursor-container,
  #cur,
  .cursor-container .cursor-ring,
  #cur b,
  .magnetic,
  .mag {
    transition: none !important;
    animation: none !important;
  }
}
