/* =====================================================
   Interactive DevOps Cyber Cursor
   Sleek custom pointer with magnetic lag ring,
   target lock brackets, click ripples & particles.
===================================================== */

/* Hide default cursor once custom cursor initializes on devices with mouse */
@media (hover: hover) and (pointer: fine) {
  body.has-custom-cursor,
  body.has-custom-cursor a,
  body.has-custom-cursor button,
  body.has-custom-cursor [role="button"],
  body.has-custom-cursor input,
  body.has-custom-cursor textarea,
  body.has-custom-cursor select {
    cursor: none !important;
  }
}

/* Cursor container */
#custom-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 99999;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.35s ease;
}

#custom-cursor.active {
  opacity: 1;
}

/* Sharp inner pointer dot (instant response) */
.cursor-dot {
  position: fixed;
  top: 0;
  left: 0;
  width: 8px;
  height: 8px;
  margin-top: -4px;
  margin-left: -4px;
  border-radius: 50%;
  background: var(--amber, #ffb454);
  box-shadow: 0 0 8px rgba(255, 180, 84, 0.9), 0 0 16px rgba(255, 180, 84, 0.4);
  pointer-events: none;
  z-index: 100001;
  transform: translate3d(0, 0, 0);
  transition: width 0.2s cubic-bezier(0.18, 0.89, 0.32, 1.28),
              height 0.2s cubic-bezier(0.18, 0.89, 0.32, 1.28),
              background 0.2s ease,
              box-shadow 0.2s ease;
  will-change: transform;
}

/* Fluid outer follower ring (eased lag response) */
.cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  width: 36px;
  height: 36px;
  margin-top: -18px;
  margin-left: -18px;
  border-radius: 50%;
  border: 1.5px solid rgba(94, 234, 212, 0.55);
  background: rgba(94, 234, 212, 0.03);
  box-shadow: 0 0 14px rgba(94, 234, 212, 0.2);
  pointer-events: none;
  z-index: 100000;
  transform: translate3d(0, 0, 0);
  transition: width 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28),
              height 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28),
              border-color 0.25s ease,
              background 0.25s ease,
              border-radius 0.3s ease,
              box-shadow 0.25s ease;
  will-change: transform;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 4 corner brackets on the ring for cyber/tech aesthetic */
.cursor-corner {
  position: absolute;
  width: 5px;
  height: 5px;
  border-color: var(--cyan, #5eead4);
  border-style: solid;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.cursor-corner.top-left {
  top: -2px;
  left: -2px;
  border-width: 1.5px 0 0 1.5px;
}

.cursor-corner.top-right {
  top: -2px;
  right: -2px;
  border-width: 1.5px 1.5px 0 0;
}

.cursor-corner.bottom-left {
  bottom: -2px;
  left: -2px;
  border-width: 0 0 1.5px 1.5px;
}

.cursor-corner.bottom-right {
  bottom: -2px;
  right: -2px;
  border-width: 0 1.5px 1.5px 0;
}

/* Contextual mini badge label */
.cursor-badge {
  position: absolute;
  top: -26px;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: rgba(16, 21, 28, 0.94);
  border: 1px solid rgba(94, 234, 212, 0.5);
  color: var(--cyan, #5eead4);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.62rem;
  letter-spacing: 0.8px;
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

/* =====================================================
   Interactive Hover States
===================================================== */

/* 1. Clickable links and buttons */
#custom-cursor.state-hover .cursor-dot {
  width: 6px;
  height: 6px;
  margin-top: -3px;
  margin-left: -3px;
  background: #ffffff;
  box-shadow: 0 0 10px #ffffff;
}

#custom-cursor.state-hover .cursor-ring {
  width: 54px;
  height: 54px;
  margin-top: -27px;
  margin-left: -27px;
  border-color: rgba(94, 234, 212, 0.85);
  background: rgba(94, 234, 212, 0.08);
  box-shadow: 0 0 24px rgba(94, 234, 212, 0.35);
}

/* 2. Target lock / Card mode */
#custom-cursor.state-card .cursor-ring {
  width: 60px;
  height: 60px;
  margin-top: -30px;
  margin-left: -30px;
  border-radius: 12px;
  border-color: rgba(255, 180, 84, 0.7);
  background: rgba(255, 180, 84, 0.05);
  box-shadow: 0 0 25px rgba(255, 180, 84, 0.25);
}

#custom-cursor.state-card .cursor-corner {
  opacity: 1;
  border-color: var(--amber, #ffb454);
}

#custom-cursor.state-card .cursor-badge {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  border-color: rgba(255, 180, 84, 0.5);
  color: var(--amber, #ffb454);
}

/* 3. Terminal code mode */
#custom-cursor.state-terminal .cursor-ring {
  width: 52px;
  height: 52px;
  margin-top: -26px;
  margin-left: -26px;
  border-radius: 6px;
  border-color: var(--cyan, #5eead4);
  background: rgba(94, 234, 212, 0.06);
}

#custom-cursor.state-terminal .cursor-badge {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* 4. Avatar interaction mode */
#custom-cursor.state-avatar .cursor-ring {
  width: 64px;
  height: 64px;
  margin-top: -32px;
  margin-left: -32px;
  border-color: var(--amber, #ffb454);
  background: rgba(255, 180, 84, 0.12);
  box-shadow: 0 0 30px rgba(255, 180, 84, 0.45);
}

#custom-cursor.state-avatar .cursor-badge {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  border-color: var(--amber, #ffb454);
  color: var(--amber, #ffb454);
}

/* 5. Active click / press down */
#custom-cursor.state-clicking .cursor-dot {
  transform: scale(0.6);
}

#custom-cursor.state-clicking .cursor-ring {
  transform: scale(0.85);
  border-color: #ffffff;
  background: rgba(255, 255, 255, 0.15);
}

/* Shockwave ripple ring on click */
.cursor-ripple {
  position: fixed;
  top: 0;
  left: 0;
  width: 20px;
  height: 20px;
  margin-top: -10px;
  margin-left: -10px;
  border-radius: 50%;
  border: 2px solid var(--amber, #ffb454);
  pointer-events: none;
  z-index: 99998;
  animation: cursorShockwave 0.55s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}

@keyframes cursorShockwave {
  0% {
    transform: scale(0.5);
    opacity: 0.95;
    border-color: var(--amber, #ffb454);
  }
  50% {
    border-color: var(--cyan, #5eead4);
  }
  100% {
    transform: scale(3.5);
    opacity: 0;
    border-color: var(--cyan, #5eead4);
  }
}

/* Micro click sparks */
.cursor-spark {
  position: fixed;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 99998;
  will-change: transform, opacity;
}

/* Canvas trail wrap */
#cursor-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 99997;
}

/* =====================================================
   Fallback & Accessibility
===================================================== */
@media (hover: none) or (pointer: coarse) {
  #custom-cursor,
  #cursor-canvas {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  #custom-cursor,
  #cursor-canvas {
    display: none !important;
  }
  body.has-custom-cursor {
    cursor: auto !important;
  }
}
