/* =====================================================
   ROBOTIC AI EYE CURSOR — CraftnexAI
   Big iris · spinning rings · bracket scanner
   Colors driven by lava-lamp picker via --lava-rgb / --lava-rgb-2
   ===================================================== */
:root {
  --lava-rgb: 0, 191, 255;
  --lava-rgb-2: 126, 243, 255;
  --lava-color-1: #00bfff;
  --lava-color-2: #7ef3ff;
}

@media (pointer: fine) {
  *, *::before, *::after { cursor: none !important; }
}

/* ── Zero-size fixed wrappers — JS drives transform ── */
.cx-core,
.cx-scan {
  position: fixed;
  top: 0; left: 0;
  width: 0; height: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}
.cx-core { z-index: 99999; }
.cx-scan  { z-index: 99998; }

/* ══════════════════════════════════════════════════════
   ROBOTIC EYE — layered iris + pupil
   ══════════════════════════════════════════════════════ */

/* Outer sclera shell */
.cx-eye {
  position: absolute;
  width: 32px; height: 32px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle at 38% 34%,
    rgba(var(--lava-rgb), 0.55) 0%,
    rgba(0, 6, 22, 0.97) 55%,
    rgba(0, 2, 10, 1) 100%);
  border: 2.5px solid rgba(var(--lava-rgb), 0.95);
  box-shadow:
    0 0 0 1px rgba(var(--lava-rgb), 0.25),
    0 0 14px rgba(var(--lava-rgb), 0.9),
    0 0 32px rgba(var(--lava-rgb), 0.45),
    0 0 56px rgba(var(--lava-rgb), 0.15),
    inset 0 0 10px rgba(var(--lava-rgb), 0.2);
  animation: cxEyeGlow 2.6s ease-in-out infinite;
  will-change: transform;
}

@keyframes cxEyeGlow {
  0%,100% {
    box-shadow:
      0 0 0 1px rgba(var(--lava-rgb), 0.2),
      0 0 14px rgba(var(--lava-rgb), 0.85),
      0 0 30px rgba(var(--lava-rgb), 0.35),
      inset 0 0 8px rgba(var(--lava-rgb), 0.15);
  }
  50% {
    box-shadow:
      0 0 0 1px rgba(var(--lava-rgb), 0.4),
      0 0 22px rgba(var(--lava-rgb), 1),
      0 0 50px rgba(var(--lava-rgb), 0.6),
      0 0 80px rgba(var(--lava-rgb), 0.2),
      inset 0 0 16px rgba(var(--lava-rgb), 0.35);
  }
}

/* ── Spinning iris ring (dashed segmented) ── */
.cx-eye-iris {
  position: absolute;
  width: 22px; height: 22px;
  border-radius: 50%;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) rotate(0deg);
  border: 1.5px dashed rgba(var(--lava-rgb), 0.7);
  animation: cxIrisSpin 3.5s linear infinite;
}

/* Counter-rotating inner ring */
.cx-eye-iris::before {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  border-radius: 50%;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) rotate(0deg);
  border: 1px solid rgba(var(--lava-rgb-2), 0.55);
  border-style: dashed;
  animation: cxIrisSpin 2s linear infinite reverse;
}

/* 4 tick marks on iris at 12/3/6/9 */
.cx-eye-iris::after {
  content: '';
  position: absolute;
  width: 100%; height: 100%;
  border-radius: 50%;
  top: 0; left: 0;
  background:
    radial-gradient(1.5px 4px at 50%  0%,   rgba(var(--lava-rgb), 0.85) 100%, transparent 100%),
    radial-gradient(1.5px 4px at 100% 50%,  rgba(var(--lava-rgb), 0.85) 100%, transparent 100%),
    radial-gradient(1.5px 4px at 50%  100%, rgba(var(--lava-rgb), 0.85) 100%, transparent 100%),
    radial-gradient(1.5px 4px at 0%   50%,  rgba(var(--lava-rgb), 0.85) 100%, transparent 100%);
}

@keyframes cxIrisSpin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ── Glowing pupil ── */
.cx-eye-pupil {
  position: absolute;
  width: 10px; height: 10px;
  border-radius: 50%;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle,
    #ffffff 0%,
    var(--lava-color-2) 30%,
    var(--lava-color-1) 60%,
    rgba(var(--lava-rgb), 0.6) 100%);
  box-shadow:
    0 0 8px var(--lava-color-1),
    0 0 18px rgba(var(--lava-rgb), 0.85),
    0 0 32px rgba(var(--lava-rgb), 0.4);
  animation: cxPupilBeat 2.6s ease-in-out infinite;
}

@keyframes cxPupilBeat {
  0%,100% { transform: translate(-50%,-50%) scale(1); }
  50%      { transform: translate(-50%,-50%) scale(1.25);
             box-shadow: 0 0 12px #fff, 0 0 24px var(--lava-color-1), 0 0 44px rgba(var(--lava-rgb), 0.6); }
}

/* ══════════════════════════════════════════════════════
   SCANNER — large corner-bracket reticle
   ══════════════════════════════════════════════════════ */
.cx-scan-frame {
  position: absolute;
  width: 66px; height: 66px;
  transform: translate(-50%, -50%);
  transition:
    width  0.24s cubic-bezier(0.22, 1, 0.36, 1),
    height 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.cx-sf-tl, .cx-sf-tr, .cx-sf-bl, .cx-sf-br {
  position: absolute;
  width: 18px; height: 18px;
  transition: border-color 0.2s, box-shadow 0.2s, width 0.24s, height 0.24s;
}
.cx-sf-tl {
  top: 0; left: 0;
  border-top:  2.5px solid rgba(var(--lava-rgb), 0.85);
  border-left: 2.5px solid rgba(var(--lava-rgb), 0.85);
  border-top-left-radius: 3px;
}
.cx-sf-tr {
  top: 0; right: 0;
  border-top:   2.5px solid rgba(var(--lava-rgb), 0.85);
  border-right: 2.5px solid rgba(var(--lava-rgb), 0.85);
  border-top-right-radius: 3px;
}
.cx-sf-bl {
  bottom: 0; left: 0;
  border-bottom: 2.5px solid rgba(var(--lava-rgb), 0.85);
  border-left:   2.5px solid rgba(var(--lava-rgb), 0.85);
  border-bottom-left-radius: 3px;
}
.cx-sf-br {
  bottom: 0; right: 0;
  border-bottom: 2.5px solid rgba(var(--lava-rgb), 0.85);
  border-right:  2.5px solid rgba(var(--lava-rgb), 0.85);
  border-bottom-right-radius: 3px;
}

/* Faint crosshair */
.cx-scan-cross {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 28px; height: 28px;
  opacity: 0.22;
}
.cx-scan-cross::before,
.cx-scan-cross::after {
  content: '';
  position: absolute;
  background: rgba(var(--lava-rgb), 0.8);
  border-radius: 1px;
}
.cx-scan-cross::before { width: 100%; height: 1px; top: 50%; transform: translateY(-50%); }
.cx-scan-cross::after  { height: 100%; width: 1px; left: 50%; transform: translateX(-50%); }

/* ── Orbiting node ── */
.cx-scan-orbit {
  position: absolute;
  width: 82px; height: 82px;
  top: -41px; left: -41px;
  animation: cxOrbitSpin 3s linear infinite;
}
.cx-scan-orbit::before {
  content: '';
  position: absolute;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: rgb(var(--lava-rgb-2));
  top: 0; left: 50%;
  transform: translateX(-50%);
  box-shadow:
    0 0 10px rgb(var(--lava-rgb-2)),
    0 0 22px rgba(var(--lava-rgb-2), 0.6),
    0 0 36px rgba(var(--lava-rgb-2), 0.25);
}
.cx-scan-orbit::after {
  content: '';
  position: absolute;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: rgba(var(--lava-rgb-2), 0.45);
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  box-shadow: 0 0 8px rgba(var(--lava-rgb-2), 0.4);
}
@keyframes cxOrbitSpin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════════════
   HOVER — target locked
   ══════════════════════════════════════════════════════ */
.cx-scan.is-hovered .cx-scan-frame {
  width: 46px; height: 46px;
}
.cx-scan.is-hovered .cx-sf-tl,
.cx-scan.is-hovered .cx-sf-tr,
.cx-scan.is-hovered .cx-sf-bl,
.cx-scan.is-hovered .cx-sf-br {
  border-color: rgba(var(--lava-rgb), 1);
  box-shadow: 0 0 10px rgba(var(--lava-rgb), 0.8), 0 0 20px rgba(var(--lava-rgb), 0.35);
}
.cx-scan.is-hovered .cx-scan-orbit { animation-duration: 1.1s; }

.cx-core.is-hovered .cx-eye {
  transform: translate(-50%, -50%) scale(1.2);
  border-color: rgba(var(--lava-rgb-2), 1);
  box-shadow:
    0 0 0 2px rgba(var(--lava-rgb), 0.35),
    0 0 24px rgba(var(--lava-rgb), 1),
    0 0 50px rgba(var(--lava-rgb), 0.7),
    inset 0 0 18px rgba(var(--lava-rgb), 0.35);
  animation: none;
}
.cx-core.is-hovered .cx-eye-iris { animation-duration: 1s; }

/* ══════════════════════════════════════════════════════
   CLICK — agent fires
   ══════════════════════════════════════════════════════ */
.cx-core.is-clicking .cx-eye {
  transform: translate(-50%, -50%) scale(0.72);
  border-color: #fff;
  background: radial-gradient(circle, rgba(var(--lava-rgb), 0.6) 0%, rgba(0, 8, 26, 1) 80%);
  box-shadow:
    0 0 0 2px rgba(255,255,255,0.4),
    0 0 28px rgba(var(--lava-rgb), 1),
    0 0 60px rgba(var(--lava-rgb), 0.8),
    inset 0 0 20px rgba(var(--lava-rgb), 0.5);
  animation: none;
}
.cx-scan.is-clicking .cx-scan-frame { width: 26px; height: 26px; }
.cx-scan.is-clicking .cx-sf-tl,
.cx-scan.is-clicking .cx-sf-tr,
.cx-scan.is-clicking .cx-sf-bl,
.cx-scan.is-clicking .cx-sf-br {
  border-color: #fff;
  box-shadow: 0 0 12px rgba(255,255,255,0.8);
}
.cx-scan.is-clicking .cx-scan-orbit { animation-duration: 0.3s; }

/* ══════════════════════════════════════════════════════
   CLICK FX
   ══════════════════════════════════════════════════════ */
.cx-ripple,
.cx-ripple-b {
  position: fixed;
  top: 0; left: 0;
  border-radius: 50%;
  pointer-events: none;
  z-index: 99996;
}
.cx-ripple {
  width: 70px; height: 70px;
  border: 1.5px solid rgba(var(--lava-rgb), 0.65);
  margin: -35px 0 0 -35px;
  animation: cxRippleOut 0.65s cubic-bezier(0.22,1,0.36,1) forwards;
}
.cx-ripple-b {
  width: 44px; height: 44px;
  border: 2px solid rgba(var(--lava-rgb-2), 0.5);
  margin: -22px 0 0 -22px;
  animation: cxRippleOut 0.45s cubic-bezier(0.22,1,0.36,1) 0.055s forwards;
}
@keyframes cxRippleOut {
  from { opacity: 0.9; transform: scale(0.18); }
  to   { opacity: 0;   transform: scale(1.8); }
}

.cx-scan-line {
  position: fixed;
  pointer-events: none;
  z-index: 99997;
  width: 140px; height: 2px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(var(--lava-rgb), 0.9) 25%,
    rgba(var(--lava-rgb-2), 0.7) 75%,
    transparent 100%);
  filter: blur(0.5px);
  transform: translateX(-50%);
  animation: cxScanSwipe 0.4s ease-out forwards;
}
@keyframes cxScanSwipe {
  from { opacity: 1; transform: translateX(-50%) scaleX(0.3); }
  to   { opacity: 0; transform: translateX(-50%) scaleX(1.8); }
}
