/* =========================================================
   Chip Vortex — HUD Reticle Cursor  (v2.5.9)
   Avionics-style targeting cursor: instant cyan core dot +
   trailing reticle ring that "locks on" to interactive elements.

   - Desktop / fine-pointer only. Touch devices are untouched.
   - Native cursor is hidden ONLY when JS adds .cv-cursor-on,
     so if JS fails the normal arrow always comes back.
   - Honours prefers-reduced-motion (no spin, no lag).
   ========================================================= */

.cv-cursor,
.cv-cursor-dot { display: none; }

@media (hover: hover) and (pointer: fine) {

  /* ---- hide the native arrow (JS-gated) ---- */
  html.cv-cursor-on,
  html.cv-cursor-on * { cursor: none !important; }

  /* ---- layers ---- */
  .cv-cursor,
  .cv-cursor-dot {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 99999;          /* above header(50), dropdown(70), progress(60) */
    pointer-events: none;
    will-change: transform;
    opacity: 0;
    transition: opacity .22s ease;
  }
  html.cv-cursor-ready .cv-cursor,
  html.cv-cursor-ready .cv-cursor-dot { opacity: 1; }
  html.cv-cursor-out .cv-cursor,
  html.cv-cursor-out .cv-cursor-dot { opacity: 0; }

  /* ---------- CORE DOT (zero lag) ---------- */
  .cv-cursor-dot i {
    position: absolute;
    left: 0; top: 0;
    width: 7px; height: 7px;
    margin: -3.5px 0 0 -3.5px;
    border-radius: 50%;
    background: var(--cyan, #00D4FF);
    box-shadow: 0 0 10px rgba(0, 212, 255, .85);
    transition: width .18s ease, height .18s ease, margin .18s ease,
                border-radius .18s ease, background .18s ease,
                box-shadow .18s ease;
  }

  /* ---------- RETICLE RING (trails behind) ---------- */
  .cv-cursor svg {
    position: absolute;
    left: 0; top: 0;
    width: 60px; height: 60px;
    margin: -30px 0 0 -30px;
    overflow: visible;
    transition: transform .26s cubic-bezier(.22, 1, .36, 1), opacity .2s ease;
  }
  .cv-cursor .cv-ring-c {
    fill: none;
    stroke: var(--cyan, #00D4FF);
    stroke-width: 1.4;
    opacity: .55;
    transition: stroke .2s ease, opacity .2s ease, stroke-width .2s ease;
  }
  .cv-cursor .cv-ring-ticks line {
    stroke: var(--cyan, #00D4FF);
    stroke-width: 1.6;
    stroke-linecap: round;
    opacity: .75;
    transition: stroke .2s ease, opacity .2s ease;
  }
  .cv-cursor .cv-ring-ticks {
    transform-origin: 30px 30px;
    animation: cvReticleSpin 14s linear infinite;
    transition: transform .3s cubic-bezier(.22, 1, .36, 1);
  }
  @keyframes cvReticleSpin {
    to { transform: rotate(360deg); }
  }

  /* ---------- STATE: hovering a link / button (LOCK ON) ---------- */
  html.cv-cur-link .cv-cursor svg { transform: scale(1.45); }
  html.cv-cur-link .cv-cursor .cv-ring-c {
    stroke: var(--cv-lock, var(--green, #39FF14));
    stroke-width: 1.1;
    opacity: .9;
  }
  html.cv-cur-link .cv-cursor .cv-ring-ticks line {
    stroke: var(--cv-lock, var(--green, #39FF14));
    opacity: 1;
  }
  html.cv-cur-link .cv-cursor .cv-ring-ticks {
    animation-play-state: paused;
    transform: rotate(45deg);
  }
  html.cv-cur-link .cv-cursor-dot i {
    width: 4px; height: 4px;
    margin: -2px 0 0 -2px;
    background: var(--cv-lock, var(--green, #39FF14));
    box-shadow: 0 0 12px var(--cv-lock-glow, rgba(57,255,20,.9));
  }

  /* ---------- STATE: text field / editable (caret bar) ---------- */
  html.cv-cur-text .cv-cursor svg { transform: scale(.5); opacity: 0; }
  html.cv-cur-text .cv-cursor-dot i {
    width: 2px; height: 22px;
    margin: -11px 0 0 -1px;
    border-radius: 1px;
    background: var(--cyan, #00D4FF);
    box-shadow: 0 0 10px rgba(0, 212, 255, .7);
  }

  /* ---------- STATE: mouse down (fire) ---------- */
  html.cv-cur-down .cv-cursor svg { transform: scale(.78); }
  html.cv-cur-down.cv-cur-link .cv-cursor svg { transform: scale(1.15) rotate(45deg); }
  html.cv-cur-down .cv-cursor-dot i {
    box-shadow: 0 0 18px rgba(0, 212, 255, 1);
  }

  /* ---------- OPTIONAL LABEL ----------
     Add data-cursor-label="READ" to any element to show a tag
     under the reticle while hovering it. */
  .cv-cursor-label {
    position: absolute;
    left: 50%; top: 50%;
    transform: translate(-50%, 30px);
    font-family: var(--display, 'Orbitron', monospace);
    font-size: .52rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--cv-lock, var(--green, #39FF14));
    background: rgba(10, 14, 26, .85);
    border: 1px solid var(--cv-lock-soft, rgba(57,255,20,.45));
    border-radius: 3px;
    padding: 3px 7px;
    opacity: 0;
    transition: opacity .18s ease, transform .18s ease;
  }
  html.cv-cur-labelled .cv-cursor-label {
    opacity: 1;
    transform: translate(-50%, 34px);
  }

  /* ---------- reduced motion: keep it, calm it ---------- */
  @media (prefers-reduced-motion: reduce) {
    .cv-cursor .cv-ring-ticks { animation: none; }
    .cv-cursor svg,
    .cv-cursor-dot i,
    .cv-cursor-label { transition: none; }
  }
}

/* Never let the cursor layers affect print or the block editor canvas */
@media print {
  .cv-cursor, .cv-cursor-dot { display: none !important; }
}
