/* Cross-page zoom: work card -> case-study hero.
   Both pages must load this file. Browsers without View Transitions
   support (and reduced-motion users) just navigate normally. */

@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
}

/* Card thumbnails get their view-transition-name from main.js, and only
   on the card that was clicked, so the other cards don't linger as ghosts. */
:is(.index-card-thumb, .work-thumb, .vt-hero) { view-transition-class: vt-hero; }

/* Nav stays put instead of cross-fading with the page. */
#mainNav { view-transition-name: site-nav; }

/* The morph: keep the image cropped (not stretched) while the box resizes. */
::view-transition-group(*.vt-hero) {
  animation-duration: 900ms;
  animation-timing-function: cubic-bezier(0.65, 0, 0.25, 1);
  overflow: clip;
}
::view-transition-old(*.vt-hero),
::view-transition-new(*.vt-hero) {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Everything else fades quickly so the image leads. */
::view-transition-old(root),
::view-transition-new(root) { animation-duration: 350ms; }

/* Scroll-reveal must not hide a transition target (set by main.js). */
.vt-nav .reveal {
  opacity: 1 !important;
  transform: none !important;
  transition: none !important;
}

/* Hover zoom is driven by main.js (continuous push-in), so switch off the
   old fixed hover scale and its CSS transition where JS takes over. */
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  html .index-card-thumb img,
  html .work-thumb img { transition: none; will-change: transform; }
  html .index-card:hover .index-card-thumb img,
  html .work-item:hover .work-thumb img,
  html .work-item:hover .work-thumb { transform: none; }
}
