/* Loaded after styles.css. Without the enhancement class, primary media stays visible. */
[data-cover-effect] {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

[data-cover-effect] > .cover-image {
  position: relative;
  display: block;
  width: 100%;
  overflow: hidden;
}

/* Listing cards own the frame for the hover effect. */
.work-visual[data-cover-effect] > .cover-image { height: 100%; }

[data-cover-effect] .cover-image > :is(img, video),
[data-cover-effect]:hover .cover-image > :is(img, video) {
  display: block;
  width: 100%;
  transform: translate3d(var(--cover-shift-x, 0px), var(--cover-shift-y, 0px), 0) scale(var(--cover-scale, 1));
  transform-origin: 50% 50%;
  /* Cancel the older CSS hover scale: one animation system owns this transform. */
  transition: none;
}

.cover-fx[data-cover-effect] > .cover-image {
  clip-path: inset(0 var(--cover-wipe, 0%) 0 0);
}

.cover-fx-moving[data-cover-effect] .cover-image > :is(img, video) {
  will-change: transform;
}

[data-cover-effect] > .cover-peek {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: block;
  overflow: hidden;
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  clip-path: circle(0 at 50% 50%);
}

[data-cover-effect] > .cover-peek > img,
[data-cover-effect]:hover > .cover-peek > img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  transform: scale(1.02);
  transition: none;
}

.cover-fx-fine[data-cover-effect] > .cover-peek {
  visibility: visible;
  opacity: var(--cover-lens-opacity, 0);
  clip-path: circle(var(--cover-lens-radius, 0px) at var(--cover-lens-x, 50%) var(--cover-lens-y, 50%));
}

.cover-lens-ring {
  position: absolute;
  left: var(--cover-lens-x, 50%);
  top: var(--cover-lens-y, 50%);
  z-index: 3;
  width: calc(var(--cover-lens-radius, 0px) * 2);
  height: calc(var(--cover-lens-radius, 0px) * 2);
  border: 1px solid rgb(255 255 255 / 55%);
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 10%);
  transform: translate(-50%, -50%);
  opacity: var(--cover-lens-opacity, 0);
  pointer-events: none;
  visibility: hidden;
}

.cover-fx-fine[data-cover-effect] > .cover-lens-ring { visibility: visible; }
[data-cover-effect] > .open-project { z-index: 4; pointer-events: none; }

@media (hover: none), (pointer: coarse) {
  [data-cover-effect] > .cover-peek,
  [data-cover-effect] > .cover-lens-ring { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  [data-cover-effect] > .cover-image { clip-path: none !important; }
  [data-cover-effect] .cover-image > :is(img, video),
  [data-cover-effect]:hover .cover-image > :is(img, video) {
    transform: none !important;
    transition: none !important;
    will-change: auto;
  }
  [data-cover-effect] > .cover-peek,
  [data-cover-effect] > .cover-lens-ring { display: none !important; }
}
