/* ==========================================================================
   Custom cursor: a small XYZ transform gizmo
   Only switched on (html.has-custom-cursor) for fine pointers that can
   hover. Touch devices keep their normal behaviour and never see it.
   ========================================================================== */

.cursor {
  position: fixed;
  left: 0;
  top: 0;
  z-index: var(--z-cursor);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s var(--ease-out);
  will-change: transform;
}

html.has-custom-cursor .cursor.is-visible {
  opacity: 1;
}

html:not(.has-custom-cursor) .cursor {
  display: none;
}

/* Hide the system cursor only when the gizmo is active */
html.has-custom-cursor,
html.has-custom-cursor * {
  cursor: none !important;
}

.cursor__gizmo {
  position: relative;
  width: 0;
  height: 0;
  transform: scale(1);
  transition: transform 0.45s var(--ease-out);
}

/* Each axis is a short line rotated out from the shared origin */
.cursor__axis {
  position: absolute;
  left: 0;
  top: -0.75px;
  height: 1.5px;
  width: 15px;
  border-radius: 1px;
  transform-origin: 0 50%;
}

/* Tiny cap at the end of each axis */
.cursor__axis::after {
  content: "";
  position: absolute;
  right: -2px;
  top: -1.5px;
  width: 4.5px;
  height: 4.5px;
  border-radius: 50%;
  background: inherit;
}

.cursor__axis--x { background: var(--axis-x); transform: rotate(-8deg); }
.cursor__axis--y { background: var(--axis-y); transform: rotate(-90deg); }
/* Z points toward the viewer, so it is drawn shorter (foreshortened) */
.cursor__axis--z { background: var(--axis-z); width: 10px; transform: rotate(142deg); }

.cursor__origin {
  position: absolute;
  left: -2.5px;
  top: -2.5px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--fg);
  transition: transform 0.45s var(--ease-out), background-color 0.3s, box-shadow 0.3s;
}

/* Over something clickable: the gizmo grows and the origin opens into a ring */
.cursor.is-hover .cursor__gizmo,
.cursor.is-target .cursor__gizmo {
  transform: scale(1.75);
}

.cursor.is-hover .cursor__origin,
.cursor.is-target .cursor__origin {
  background: transparent;
  box-shadow: 0 0 0 1px var(--fg);
  transform: scale(1.6);
}

/* Pressed */
.cursor.is-down .cursor__gizmo {
  transform: scale(0.85);
}

.cursor.is-hover.is-down .cursor__gizmo,
.cursor.is-target.is-down .cursor__gizmo {
  transform: scale(1.45);
}
