/* ──────────────────────────────────────────────────────────────────────────
   Custom Pulsing Cursor
   ──────────────────────────────────────────────────────────────────────────
   A high-contrast, round white circle cursor with pulsing animation.
   The cursor follows the mouse position and provides visual feedback
   for user interaction.
*/

/* Hide the default cursor when custom cursor is active */
.custom-cursor-active,
.custom-cursor-active * {
  cursor: none !important;
}

/* Restore cursor for interactive elements that need specific cursors */
.custom-cursor-active a,
.custom-cursor-active button,
.custom-cursor-active [role="button"],
.custom-cursor-active input,
.custom-cursor-active textarea,
.custom-cursor-active select,
.custom-cursor-active [tabindex]:not([tabindex="-1"]) {
  cursor: none !important;
}

/* Main cursor element */
.custom-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 24px;
  height: 24px;
  pointer-events: none;
  z-index: 99999;
  mix-blend-mode: difference;
  transform: translate(-50%, -50%);
  will-change: transform, opacity;
  opacity: 0;
  transition: opacity 0.15s ease-out;
}

.custom-cursor--visible {
  opacity: 1;
}

/* The white circle with high contrast outline */
.custom-cursor__dot {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #ffffff;
  box-shadow:
    0 0 0 2px #000000,
    0 0 0 4px #ffffff,
    0 0 8px 2px rgba(255, 255, 255, 0.5);
  animation: cursor-pulse 1.5s ease-in-out infinite;
}

/* Pulsing animation */
@keyframes cursor-pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow:
      0 0 0 2px #000000,
      0 0 0 4px #ffffff,
      0 0 8px 2px rgba(255, 255, 255, 0.5);
  }
  50% {
    transform: scale(1.15);
    box-shadow:
      0 0 0 2px #000000,
      0 0 0 4px #ffffff,
      0 0 16px 4px rgba(255, 255, 255, 0.7);
  }
}

/* Hover state - cursor grows slightly when over interactive elements */
.custom-cursor--hover .custom-cursor__dot {
  animation: cursor-pulse-hover 1s ease-in-out infinite;
}

@keyframes cursor-pulse-hover {
  0%, 100% {
    transform: scale(1.2);
    box-shadow:
      0 0 0 2px #000000,
      0 0 0 4px #ffffff,
      0 0 12px 4px rgba(255, 255, 255, 0.6);
  }
  50% {
    transform: scale(1.4);
    box-shadow:
      0 0 0 2px #000000,
      0 0 0 4px #ffffff,
      0 0 20px 6px rgba(255, 255, 255, 0.8);
  }
}

/* Click/active state - quick shrink effect */
.custom-cursor--active .custom-cursor__dot {
  animation: cursor-click 0.15s ease-out forwards;
}

@keyframes cursor-click {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(0.8);
  }
  100% {
    transform: scale(1);
  }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .custom-cursor__dot {
    animation: none;
  }

  .custom-cursor--hover .custom-cursor__dot {
    animation: none;
    transform: scale(1.2);
  }

  .custom-cursor--active .custom-cursor__dot {
    animation: none;
    transform: scale(0.9);
  }
}

/* Hide custom cursor on touch devices */
@media (pointer: coarse) {
  .custom-cursor {
    display: none !important;
  }

  .custom-cursor-active,
  .custom-cursor-active * {
    cursor: auto !important;
  }
}

/* Hide cursor when it leaves the viewport */
.custom-cursor--hidden {
  opacity: 0 !important;
}
