/* Precision cursor and guide overlay */
body.cursor-active,
body.cursor-active a,
body.cursor-active button {
  cursor: none;
}

body.cursor-active .work-gallery,
body.cursor-active .work-gallery * {
  cursor: none !important;
}

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

body.has-entered .precision-guides {
  opacity: 0 !important;
}

body.is-unfolding .precision-cursor,
body.is-unfolding .precision-guides,
body.is-entering .precision-cursor,
body.is-entering .precision-guides {
  opacity: 0 !important;
  transition: opacity 120ms ease;
}

.precision-cursor {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 260;
  width: 36px;
  height: 36px;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%);
  transition: opacity 180ms ease, width 220ms ease, height 220ms ease;
  will-change: transform;
}

.precision-guides {
  position: fixed;
  inset: 0;
  z-index: 250;
  pointer-events: none;
  opacity: 0;
  transition: opacity 180ms ease;
}

.precision-guides::before,
.precision-guides::after {
  content: "";
  position: absolute;
}

.precision-guides::before {
  left: 0;
  right: 0;
  top: var(--cursor-y);
  height: 1px;
  transform: translateY(-0.5px);
  background: rgba(242, 240, 236, 0.28);
}

.precision-guides::after {
  top: 0;
  bottom: 0;
  left: var(--cursor-x);
  width: 1px;
  transform: translateX(-0.5px);
  background: rgba(242, 240, 236, 0.18);
}

.precision-guides.is-visible {
  opacity: 1;
}

/* viewfinder: four corner L-brackets */
.precision-cursor::before {
  content: "";
  position: absolute;
  inset: 0;
  /* top-left H, top-left V, top-right H, top-right V,
     bottom-left H, bottom-left V, bottom-right H, bottom-right V */
  background:
    linear-gradient(90deg, rgba(242,240,236,0.9), rgba(242,240,236,0.9))
      0 0 / 10px 1px no-repeat,
    linear-gradient(rgba(242,240,236,0.9), rgba(242,240,236,0.9))
      0 0 / 1px 10px no-repeat,
    linear-gradient(90deg, rgba(242,240,236,0.9), rgba(242,240,236,0.9))
      100% 0 / 10px 1px no-repeat,
    linear-gradient(rgba(242,240,236,0.9), rgba(242,240,236,0.9))
      100% 0 / 1px 10px no-repeat,
    linear-gradient(90deg, rgba(242,240,236,0.9), rgba(242,240,236,0.9))
      0 100% / 10px 1px no-repeat,
    linear-gradient(rgba(242,240,236,0.9), rgba(242,240,236,0.9))
      0 100% / 1px 10px no-repeat,
    linear-gradient(90deg, rgba(242,240,236,0.9), rgba(242,240,236,0.9))
      100% 100% / 10px 1px no-repeat,
    linear-gradient(rgba(242,240,236,0.9), rgba(242,240,236,0.9))
      100% 100% / 1px 10px no-repeat;
}

/* center dot */
.precision-cursor::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 3px;
  height: 3px;
  background: rgba(242,240,236,0.6);
  border-radius: 50%;
}

.precision-cursor.is-visible {
  opacity: 1;
}

body.has-entered .precision-cursor {
  z-index: 740;
  width: 16px;
  height: 16px;
  opacity: 0;
  transform: translate(-50%, -50%);
  mix-blend-mode: difference;
  transition: opacity 120ms ease, scale 180ms ease, width 160ms ease, height 160ms ease;
}

body.has-entered .precision-cursor::before {
  display: block;
  inset: 0;
  border: 1.2px solid var(--cursor-frame-color, #f4f2ed);
  background: transparent;
  box-shadow: none;
}

body.has-entered .precision-cursor::after {
  display: block;
  width: 3px;
  height: 3px;
  background: var(--cursor-frame-color, #f4f2ed);
  opacity: 0.92;
}

body.has-entered .precision-cursor.is-visible {
  opacity: 1;
}

.target-cursor-shell {
  display: none;
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  pointer-events: none;
  transform-origin: 0 0;
}

body.has-entered .target-cursor-shell {
  display: none;
}

.target-cursor-dot {
  position: absolute;
  left: 0;
  top: 0;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #fff;
  transform: translate(-50%, -50%);
  will-change: transform;
}

.target-cursor-corner {
  position: absolute;
  left: 0;
  top: 0;
  width: 10px;
  height: 10px;
  border: 2px solid #fff;
  will-change: transform;
}

.target-cursor-corner.corner-tl {
  border-right: none;
  border-bottom: none;
}

.target-cursor-corner.corner-tr {
  border-left: none;
  border-bottom: none;
}

.target-cursor-corner.corner-br {
  border-left: none;
  border-top: none;
}

.target-cursor-corner.corner-bl {
  border-right: none;
  border-top: none;
}

body.has-entered .precision-cursor.is-pressing {
  scale: 0.9;
}

body.has-entered .precision-cursor.is-pressing .target-cursor-dot {
  transform: translate(-50%, -50%) scale(0.7);
}

body.work-gallery-open,
body.work-gallery-open a,
body.work-gallery-open button,
body.work-gallery-open .work-gallery,
body.work-gallery-open .work-gallery * {
  cursor: auto !important;
}

body.work-gallery-open .precision-cursor {
  opacity: 0 !important;
}

@media (pointer: coarse), (max-width: 768px), (prefers-reduced-motion: reduce) {
  body.has-entered,
  body.has-entered a,
  body.has-entered button,
  body.has-entered input,
  body.has-entered textarea,
  body.has-entered select {
    cursor: auto !important;
  }

  body.has-entered .precision-cursor {
    display: none;
  }
}
