.aim-target {
  position: relative;
}

.aim-frame {
  position: absolute;
  inset: -.08em -.035em;
  z-index: 1;
  display: block;
  min-height: 1em;
  pointer-events: none;
  opacity: 0;
  color: var(--red, #ff382b);
  background:
    linear-gradient(currentColor, currentColor) left top / 12px 1px,
    linear-gradient(currentColor, currentColor) left top / 1px 12px,
    linear-gradient(currentColor, currentColor) right top / 12px 1px,
    linear-gradient(currentColor, currentColor) right top / 1px 12px,
    linear-gradient(currentColor, currentColor) left bottom / 12px 1px,
    linear-gradient(currentColor, currentColor) left bottom / 1px 12px,
    linear-gradient(currentColor, currentColor) right bottom / 12px 1px,
    linear-gradient(currentColor, currentColor) right bottom / 1px 12px;
  background-repeat: no-repeat;
}

.aim-frame::before {
  content: "";
  position: absolute;
  right: -7px;
  top: calc(50% - 7px);
  width: 14px;
  height: 14px;
  background: url("aim-crosshair.svg") center / contain no-repeat;
}

.aim-frame::after {
  content: "";
  position: absolute;
  inset: auto 0 -4px;
  height: 2px;
  background: currentColor;
  transform-origin: left;
}

.aim-scan {
  position: absolute;
  inset: 0 auto 0 0;
  width: 100%;
  border-right: 1px solid #ff7054;
  background: transparent;
  transform-origin: left;
}

.aim-visible .aim-frame {
  animation: aim-acquire 1.8s ease-out var(--aim-delay) both;
}

.aim-visible .aim-frame::before {
  animation: aim-reticle 1.8s ease-out var(--aim-delay) both;
}

.aim-visible .aim-frame::after {
  animation: aim-underline 1.8s ease-out var(--aim-delay) both;
}

.aim-visible .aim-scan {
  animation: aim-scan 1.8s cubic-bezier(.2, .6, .3, 1) var(--aim-delay) both;
}

@keyframes aim-acquire {
  0% { opacity: 0; transform: scale(1.09); }
  18% { opacity: .75; transform: scale(1); }
  100% { opacity: .6; transform: scale(1); }
}

@keyframes aim-reticle {
  0% { transform: translateX(-12px); }
  40%, 100% { transform: translateX(0); }
}

@keyframes aim-underline {
  0%, 15% { transform: scaleX(0); }
  45%, 100% { transform: scaleX(1); }
}

@keyframes aim-scan {
  0%, 12% { transform: scaleX(0); opacity: 0; }
  18% { opacity: 1; }
  52% { transform: scaleX(1); opacity: 1; }
  60%, 100% { transform: scaleX(1); opacity: .4; }
}

@media (prefers-reduced-motion: reduce) {
  .aim-visible .aim-frame,
  .aim-visible .aim-frame::before,
  .aim-visible .aim-frame::after,
  .aim-visible .aim-scan {
    animation: none;
  }

  .aim-visible .aim-frame { opacity: .6; }
  .aim-visible .aim-scan { transform: scaleX(1); opacity: .4; }
}

.aim-scan::after {
  content: "";
  position: absolute;
  right: -2px;
  top: -2px;
  width: 4px;
  height: 4px;
  background: var(--red, #ff382b);
}
