/* ==========================================================================
   The brush cursor
   ==========================================================================

   One decorative layer for the whole site: the blush brush, its soft aura, the
   spark canvas and the VIEW cue. Nothing here is content, so nothing here may
   take part in the page's layout or its interaction model —
   pointer-events is none on every element, the layer is aria-hidden, and the
   rules are all transform/opacity so the browser only ever composites them.

   The layer is only useful with assets/js/cursor.js, which is what puts the
   elements on the page; without it these rules match nothing at all. It is also
   removed outright on a coarse pointer and for a visitor who has asked for
   reduced motion, so a phone never pays for the file and a motion-sensitive
   visitor never sees a brush appear.

   Sizes come from the settings as custom properties on the layer, written by
   the script: --kp-cursor-size, --kp-cursor-opacity and --kp-cursor-glow.
   ========================================================================== */

.kp-cursor {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  pointer-events: none;
}

/* The spark canvas covers the viewport and holds nothing else: the small aura
   around the bristles and the short click burst. It is cleared on every frame,
   so it never carries a picture of where the brush used to be. Bigger than the
   visible layer on high-DPI screens, capped at 2x by the script. */
.kp-cursor__sparks {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  /* Only visible while a frame has something on it. A frame that never ran
     cannot leave its last picture on the page if the surface is already
     transparent, and the frame that clears the canvas switches this off. */
  opacity: 0;
  transition: opacity 90ms linear;
}

.kp-cursor__sparks.is-live {
  opacity: 1;
}

/* The brush. Its transform origin is the bristle tip at the bottom centre of its
   own box, which is the hotspot the script anchors to the pointer: tilting the
   brush can never move the point that is being clicked.

   The box is what the script writes too, `--kp-cursor-size` being the width of
   the brush *head* and nothing else: the head is the widest part of the object
   by a factor of three, so the whole drawing is 1.32x that wide and about 3.9x
   that tall. These two rules only ever apply for the instant before the script
   puts its own numbers on the layer, which is why they have to agree with it. */
.kp-cursor__brush {
  position: fixed;
  top: 0;
  left: 0;
  width: calc(var(--kp-cursor-size, 32px) * 1.32);
  height: calc(var(--kp-cursor-size, 32px) * 3.92);
  opacity: 0;
  transform-origin: 50% 100%;
  will-change: transform;
  pointer-events: none;
}

.kp-cursor__brush svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* The soft glow that sits under the brush. A radial gradient rather than a blur
   filter: a blurred element repaints its whole area every frame the pointer
   moves, and this is one translucent disc that only changes opacity. */
.kp-cursor__aura {
  position: fixed;
  top: 0;
  left: 0;
  width: calc(var(--kp-cursor-size, 32px) * 3.4);
  height: calc(var(--kp-cursor-size, 32px) * 3.4);
  border-radius: 50%;
  opacity: 0;
  background: radial-gradient(
    closest-side,
    rgba(236, 160, 185, 0.42),
    rgba(217, 183, 122, 0.16) 55%,
    rgba(236, 160, 185, 0)
  );
  transition: opacity 220ms ease;
  will-change: transform, opacity;
  pointer-events: none;
}

.kp-cursor__aura.is-on {
  opacity: calc(var(--kp-cursor-glow, 0.2) * 0.9);
}

/* The VIEW cue over photography. Small and quiet on purpose: it says the image
   opens, without becoming the thing the visitor is looking at. */
.kp-cursor__view {
  position: fixed;
  top: 0;
  left: 0;
  padding: 0.22rem 0.5rem;
  border-radius: 999px;
  background: rgba(36, 24, 20, 0.74);
  color: var(--kp-ivory);
  font-family: var(--kp-font-display);
  font-size: 0.5625rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  line-height: 1;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 180ms ease;
  pointer-events: none;
}

.kp-cursor__view.is-on {
  opacity: 1;
}

/* ==========================================================================
   The touch half
   ==========================================================================

   What a finger gets instead of a brush. The canvas only ever exists on a touch
   device — the script does not create it anywhere else — so there is no media
   query guarding it beyond reduced motion. Both rules here are the same shape as
   the brush's: nothing takes pointer events, nothing takes part in layout, and
   nothing is announced to a screen reader.
   ========================================================================== */

.kp-touch-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2147483000;
  pointer-events: none;
}

/* The glow on the control that was tapped. A box-shadow ring rather than a
   transform: the finger is still on the control, and a ring cannot move it out
   from under that finger. The length is the studio's `touchGlowDuration`, written
   onto the element by the script; the fallback is the documented default, so a
   page whose script has not run yet still glows for the right amount of time. */
.kp-tap-glow {
  animation: kp-tap-glow var(--kp-tap-glow-ms, 650ms) ease-out;
}

@keyframes kp-tap-glow {
  0% { box-shadow: 0 0 0 0 rgba(236, 160, 185, 0.45); }
  60% { box-shadow: 0 0 0 14px rgba(217, 183, 122, 0.12); }
  100% { box-shadow: 0 0 0 22px rgba(217, 183, 122, 0); }
}

/* No decoration for a visitor who has asked for none, and none at all on touch
   hardware. The script does not install itself in either case; this is the
   belt to that pair of braces, for the moment between the page painting and the
   deferred script running. */
@media (prefers-reduced-motion: reduce) {
  .kp-cursor,
  .kp-touch-canvas {
    display: none;
  }

  .kp-tap-glow {
    animation: none;
  }
}

@media (hover: none), (pointer: coarse) {
  .kp-cursor {
    display: none;
  }
}
