/* KORAX Analytics · cursor.css
   Site-wide reticle cursor, a small taste of the KORAX app (Global Radar reticle).
   The operating system draws the pointer (real cursor image, no script in the loop);
   states come from CSS on the element under the pointer; the only script effect is a
   short click ping at the click point (transform and opacity only).

   Images (assets/cursor/v1/, rendered from _build/cursor/src/*.svg by _build/cursor/export_cursors.py):
     idle   28 x 28 CSS px, PNG 1x 28 / 2x 56 / 3x 84 px
     lockon 28 x 28 CSS px, same densities (links, buttons, other controls)
   HOTSPOT: 14 14 (CSS px of the 1x image) for every state and density = the exact centre of the reticle.

   Rules: only with a precise hovering pointer; off in forced-colors mode; off when the visitor
   opted out (html[data-cursor="off"], set by cursor.js from localStorage "kx-cursor", footer toggle);
   text inputs keep the system text cursor; disabled controls keep not-allowed.
   Fallback order: plain url() for old browsers, -webkit-image-set for old Safari, image-set, then a keyword. */

@media (hover: hover) and (pointer: fine) and (forced-colors: none) {
  html:not([data-cursor="off"]) {
    cursor: url("/assets/cursor/v1/idle-1x.png") 14 14, auto;
    cursor: -webkit-image-set(url("/assets/cursor/v1/idle-1x.png") 1x, url("/assets/cursor/v1/idle-2x.png") 2x, url("/assets/cursor/v1/idle-3x.png") 3x) 14 14, auto;
    cursor: image-set(url("/assets/cursor/v1/idle-1x.png") 1x, url("/assets/cursor/v1/idle-2x.png") 2x, url("/assets/cursor/v1/idle-3x.png") 3x) 14 14, auto;
  }

  /* Links and buttons: lock-on (brackets closed in). :where keeps specificity low, still above single-class rules. */
  html:not([data-cursor="off"]) :where(a[href], button, [role="button"], [role="link"], [role="tab"], [role="switch"], summary, label, select, input[type="button"], input[type="submit"], input[type="reset"], input[type="checkbox"], input[type="radio"], input[type="range"], input[type="file"]) {
    cursor: url("/assets/cursor/v1/lockon-1x.png") 14 14, pointer;
    cursor: -webkit-image-set(url("/assets/cursor/v1/lockon-1x.png") 1x, url("/assets/cursor/v1/lockon-2x.png") 2x, url("/assets/cursor/v1/lockon-3x.png") 3x) 14 14, pointer;
    cursor: image-set(url("/assets/cursor/v1/lockon-1x.png") 1x, url("/assets/cursor/v1/lockon-2x.png") 2x, url("/assets/cursor/v1/lockon-3x.png") 3x) 14 14, pointer;
  }

  /* Text entry: always the system text cursor. */
  html:not([data-cursor="off"]) :is(input:not([type="button"], [type="submit"], [type="reset"], [type="checkbox"], [type="radio"], [type="range"], [type="file"], [type="color"], [type="image"]), textarea, [contenteditable]:not([contenteditable="false"])) {
    cursor: text;
  }

  /* Disabled: system not-allowed. */
  html:not([data-cursor="off"]) :is(button, input, select, textarea):disabled,
  html:not([data-cursor="off"]) [aria-disabled="true"] {
    cursor: not-allowed;
  }
}

/* Click ping: two thin rings that expand and fade at the click point. Created by cursor.js. */
.kx-ping { position: fixed; left: 0; top: 0; width: 0; height: 0; pointer-events: none; z-index: 2147483000; will-change: transform; }
.kx-ping::before,
.kx-ping::after {
  content: ""; position: absolute; border-radius: 50%; pointer-events: none; opacity: 0;
  border: 1.5px solid #00FFA6;
  box-shadow: 0 0 0 1px rgba(5, 8, 7, .6), inset 0 0 0 1px rgba(5, 8, 7, .35);
}
.kx-ping::before { left: -20px; top: -20px; width: 40px; height: 40px; animation: kx-ping-a 420ms cubic-bezier(.2, .7, .2, 1) forwards; }
.kx-ping::after { left: -12px; top: -12px; width: 24px; height: 24px; animation: kx-ping-b 380ms cubic-bezier(.2, .7, .2, 1) 60ms forwards; }
@keyframes kx-ping-a { from { opacity: .9; transform: scale(.2); } to { opacity: 0; transform: scale(1.3); } }
@keyframes kx-ping-b { from { opacity: .8; transform: scale(.3); } to { opacity: 0; transform: scale(1.5); } }

@media (prefers-reduced-motion: reduce) { .kx-ping { display: none; } }
@media (forced-colors: active) { .kx-ping { display: none; } }

/* Footer opt-out. Only shown where the cursor exists (JS on, precise pointer, no forced colors). */
.cursor-pref { display: none; }
@media (hover: hover) and (pointer: fine) and (forced-colors: none) {
  .js .cursor-pref { display: block; }
}
.cursor-toggle {
  appearance: none; background: none; border: 0; padding: 4px 0; margin: 0;
  font: inherit; color: var(--text-2, inherit); cursor: pointer;
  text-decoration: underline; text-decoration-color: var(--line, currentColor); text-underline-offset: 3px;
}
.cursor-toggle:hover { color: var(--text, inherit); text-decoration-color: var(--signal, currentColor); }
.cursor-toggle:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; border-radius: 4px; }
