/* ==========================================================================
   Glass cursor. Only on devices with a mouse or trackpad (cursor.js adds
   html.has-cursor). Touch screens keep the native cursor.
   ========================================================================== */

html.has-cursor,
html.has-cursor * { cursor: none !important; }

/* Text fields keep the real I-beam so people can see where they are typing. */
html.has-cursor input,
html.has-cursor textarea,
html.has-cursor select { cursor: text !important; }

.cursor {
  --k: 1;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 2147483000;
  width: 0;
  height: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity .25s var(--ease, ease);
  will-change: transform;
  contain: layout style;
}
.cursor.is-on { opacity: 1; }
.cursor.is-text { opacity: 0; }

/* The lens: centred on the pointer, scales for hover and press */
.cursor__lens {
  position: absolute;
  left: -19px;
  top: -19px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  isolation: isolate;
  transform: scale(var(--k));
  transition: transform .35s cubic-bezier(.2, .8, .2, 1), background-color .3s ease;
  background:
    radial-gradient(120% 120% at 25% 15%, rgb(255 255 255 / .22), transparent 55%),
    radial-gradient(closest-side, transparent 60%, rgb(255 255 255 / .1) 100%),
    rgb(255 255 255 / .06);
  -webkit-backdrop-filter: blur(2px) saturate(1.7) brightness(1.18);
          backdrop-filter: blur(2px) saturate(1.7) brightness(1.18);
  box-shadow:
    inset 0 0 0 .5px rgb(255 255 255 / .14),
    inset 1.5px 1.5px 2px rgb(255 255 255 / .28),
    inset -1.5px -1.5px 2px rgb(255 255 255 / .12),
    0 6px 18px rgb(0 0 0 / .28);
}

/* Edge light: bright at top left and bottom right, like the buttons */
.cursor__lens::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.2px;
  background: linear-gradient(135deg,
    rgb(255 255 255 / .85),
    rgb(255 255 255 / .1) 36%,
    rgb(255 255 255 / .1) 64%,
    rgb(255 255 255 / .6));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  mask-composite: exclude;
}
/* Specular glint */
.cursor__lens::after {
  content: "";
  position: absolute;
  left: 20%;
  top: 13%;
  width: 34%;
  height: 20%;
  border-radius: 50%;
  background: linear-gradient(180deg, rgb(255 255 255 / .75), rgb(255 255 255 / 0));
  transform: rotate(-32deg);
  filter: blur(.6px);
}

/* Precise point so aiming stays easy */
.cursor__dot {
  position: absolute;
  left: -2px;
  top: -2px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgb(255 255 255 / .95);
  box-shadow: 0 0 6px rgb(255 255 255 / .6);
  transition: opacity .25s ease;
}

.cursor.is-link  { --k: 1.55; }
.cursor.is-link .cursor__lens {
  background:
    radial-gradient(120% 120% at 25% 15%, rgb(255 255 255 / .22), transparent 55%),
    rgb(0 153 255 / .22);
}
.cursor.is-link .cursor__dot { opacity: .8; }
.cursor.is-down  { --k: .8; }
.cursor.is-down.is-link { --k: 1.3; }

@media (prefers-reduced-motion: reduce) {
  .cursor__lens { transition: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .cursor__lens { -webkit-backdrop-filter: none; backdrop-filter: none; }
}
