/* Individual translate and scale leave the authored transform of each control intact. */
[data-hmi-surface] {
  position: relative;
}

[data-hmi-surface]:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
}

.hmi-optic {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: block;
  width: auto;
  height: auto;
  overflow: hidden;
  overflow: clip;
  border-radius: inherit;
  background: none;
  color: inherit;
  pointer-events: none;
  user-select: none;
}

.hmi-optic > i {
  position: absolute;
  display: block;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.hmi-optic > .hmi-reflection {
  width: 130px;
  height: 92px;
  left: var(--hmi-contact-x, 50%);
  top: var(--hmi-contact-y, 50%);
  border-radius: 50%;
  background: radial-gradient(ellipse, currentColor 0%, transparent 68%);
}

.hmi-optic > .hmi-caustic {
  left: var(--hmi-contact-x, 50%);
  bottom: 0;
  width: 88px;
  height: 1px;
  border-radius: 0;
  background: linear-gradient(90deg, transparent, currentColor 46%, currentColor 54%, transparent);
}

[data-hmi-surface="tile"] > .hmi-optic > .hmi-reflection {
  width: 240px;
  height: 185px;
}

[data-hmi-surface="tile"] > .hmi-optic > .hmi-caustic {
  width: 165px;
}

/* An explicit opt-out in the stylesheet also covers a live preference change. */
@media (prefers-reduced-motion: reduce), (forced-colors: active), print {
  .hmi-optic { display: none; }
}

@media (prefers-reduced-motion: no-preference) {
  /* Supersede the older instant :active scale and large hover translations
     only after our progressive enhancement attached to these targets. */
  button[data-hmi-surface]:active,
  a.action[data-hmi-surface]:active,
  .aether-home-action[data-hmi-surface]:hover,
  .motion-study-card[data-hmi-surface]:is(:hover, :focus-visible) {
    transform: none;
  }

  /* Keep the panel edge still. The title and etched baseline follow the hand. */
  .portfolio-route[data-hmi-surface]:is(:hover, :focus-visible) {
    padding-left: 0;
  }
  .portfolio-route[data-hmi-surface] > strong {
    transition: translate 360ms cubic-bezier(.18,.78,.22,1);
  }
  .portfolio-route[data-hmi-surface]:is(:hover, :focus-visible) > strong {
    translate: 4px 0;
  }

  html.hmi-physics header nav a[aria-current="page"]::after {
    animation: hmi-route-acquire 440ms cubic-bezier(.2,.75,.2,1) both;
  }
  @keyframes hmi-route-acquire {
    from { opacity: .4; transform: scaleX(.25); }
    to { opacity: 1; transform: scaleX(1); }
  }
}
